-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add deploy script for FixedRewardPoolV3WithStaking
- Loading branch information
Showing
2 changed files
with
314 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
import { ethers, upgrades } from 'hardhat'; | ||
require('dotenv').config(); | ||
|
||
async function main() { | ||
if (!process.env.DEVICE_NFT) { | ||
console.log(`Please provide DEVICE_NFT address`); | ||
return; | ||
} | ||
if (!process.env.START_TIME) { | ||
console.log(`Please provide START_TIME`); | ||
return; | ||
} | ||
if (!process.env.TOTAL_SECONDS) { | ||
console.log(`Please provide TOTAL_SECONDS`); | ||
return; | ||
} | ||
if (!process.env.REWARD_PER_SECOND) { | ||
console.log(`Please provide REWARD_PER_SECOND (unit: IOTX)`); | ||
return; | ||
} | ||
if (!process.env.SYSTEM_STAKING) { | ||
console.log(`Please provide SYSTEM_STAKING`); | ||
return; | ||
} | ||
|
||
let owner = (await ethers.getSigners())[0].address; | ||
if (process.env.OWNER) { | ||
owner = process.env.OWNER; | ||
} | ||
|
||
const ownedWeightedNFT = await ethers.deployContract('OwnedWeightedNFT', [process.env.DEVICE_NFT, owner]); | ||
await ownedWeightedNFT.waitForDeployment(); | ||
|
||
const pool = await upgrades.deployProxy( | ||
await ethers.getContractFactory('FixedRewardPoolV3WithStaking'), | ||
[ | ||
ownedWeightedNFT.target, | ||
process.env.START_TIME, | ||
ethers.parseEther(process.env.REWARD_PER_SECOND), | ||
process.env.TOTAL_SECONDS, | ||
process.env.SYSTEM_STAKING, | ||
91 * 86400, | ||
ethers.parseEther("0.0001") | ||
], | ||
{ | ||
initializer: 'initialize', | ||
}, | ||
); | ||
await pool.waitForDeployment(); | ||
|
||
console.log(`OwnedWeightedNFT for ${process.env.DEVICE_NFT} deployed to ${ownedWeightedNFT.target}`); | ||
console.log(`FixedRewardPool for ${process.env.DEVICE_NFT} deployed to ${pool.target}`); | ||
} | ||
|
||
main().catch(err => { | ||
console.error(err); | ||
process.exitCode = 1; | ||
}); |