Skip to content

Commit

Permalink
chore: deployment tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
0xApotheosis committed Sep 17, 2024
1 parent c0095da commit 699931a
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 15 deletions.
18 changes: 7 additions & 11 deletions ignition/modules/StakingRewards.ts
Original file line number Diff line number Diff line change
@@ -1,25 +1,21 @@
import { buildModule } from '@nomicfoundation/hardhat-ignition/modules';

const REWARDS_DISTRIBUTION = '0x32DBc9Cf9E8FbCebE1e0a2ecF05Ed86Ca3096Cb6'; // FIXME: this is a dummy address - it needs to be set

const REWARDS_TOKEN = '0xc770eefad204b5180df6a14ee197d99d808ee52d'; // FOX
const STAKING_TOKEN = '0x470e8de2ebaef52014a47cb5e6af86884947f08c'; // ETH/FOX Pool

export const REWARDS_DURATION = 14n * 24n * 60n * 60n; // 14 days in seconds - FIXME: use the correct value
export const REWARDS_DISTRIBUTION = '0xEc84524385ffD1eA423Ec4682caa5AB56071FbC7';
export const REWARDS_TOKEN = '0xc770EEfAd204B5180dF6a14Ee197D99d808ee52d'; // FOX
export const STAKING_TOKEN = '0x470e8de2eBaef52014A47Cb5E6aF86884947F08c'; // ETH/FOX Pool
export const OWNER = '0x90A48D5CF7343B08dA12E067680B4C6dbfE551Be'; // DAO multi-sig

const StakingRewardsModule = buildModule('StakingRewardsModule', (m) => {
const owner = m.getAccount(0);
const deployer = m.getAccount(0);
const owner = m.getParameter('owner', OWNER);
const rewardsDistribution = m.getParameter('rewardsDistribution', REWARDS_DISTRIBUTION);
const rewardsToken = m.getParameter('rewardsToken', REWARDS_TOKEN);
const stakingToken = m.getParameter('stakingToken', STAKING_TOKEN);
const rewardsDuration = m.getParameter('newRewardsDuration', REWARDS_DURATION);

const stakingRewards = m.contract('StakingRewards', [owner, rewardsDistribution, rewardsToken, stakingToken], {
from: owner,
from: deployer,
});

m.call(stakingRewards, 'setRewardsDuration', [rewardsDuration]);

return { stakingRewards };
});

Expand Down
14 changes: 10 additions & 4 deletions test/Deployment.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
import StakingRewardsModule, { REWARDS_DURATION } from '../ignition/modules/StakingRewards';
import StakingRewardsModule, { OWNER, REWARDS_DISTRIBUTION, REWARDS_TOKEN, STAKING_TOKEN } from '../ignition/modules/StakingRewards';
import hre from 'hardhat';
import { expect } from 'chai';

describe('Deployment', function () {
it('Should set the rewards duration', async function () {
it('Should deploy with constructor params', async function () {
const { stakingRewards } = await hre.ignition.deploy(StakingRewardsModule);
const rewardsDuration: bigint = await stakingRewards.read.rewardsDuration();
expect(rewardsDuration).to.equal(REWARDS_DURATION);
const owner = await stakingRewards.read.owner();
const rewardsDistribution = await stakingRewards.read.rewardsDistribution();
const rewardsToken = await stakingRewards.read.rewardsToken();
const stakingToken = await stakingRewards.read.stakingToken();
expect(owner).to.equal(OWNER);
expect(rewardsDistribution).to.equal(REWARDS_DISTRIBUTION);
expect(rewardsToken).to.equal(REWARDS_TOKEN);
expect(stakingToken).to.equal(STAKING_TOKEN);
});
});

0 comments on commit 699931a

Please sign in to comment.