Skip to content

Commit

Permalink
add deplot reward pool script
Browse files Browse the repository at this point in the history
  • Loading branch information
ququzone committed Oct 22, 2024
1 parent 36c28f2 commit 70937ec
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions script/12_deploy_fixed_reward_pool.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
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_BLOCK) {
console.log(`Please provide START_BLOCK`);
return;
}
if (!process.env.REWARD_PER_BLOCK) {
console.log(`Please provide REWARD_PER_BLOCK (unit: IOTX)`);
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('FixedRewardPool'),
[ownedWeightedNFT.target, process.env.START_BLOCK, ethers.parseEther(process.env.REWARD_PER_BLOCK)],
{
initializer: 'initialize',
},
);
await pool.waitForDeployment();

console.log(`FixedRewardPool for ${process.env.DEVICE_NFT} deployed to ${pool.target}`);
}

main().catch(err => {
console.error(err);
process.exitCode = 1;
});

0 comments on commit 70937ec

Please sign in to comment.