Skip to content

Commit

Permalink
chore: add deployment test
Browse files Browse the repository at this point in the history
  • Loading branch information
0xApotheosis committed Sep 16, 2024
1 parent 3b892e8 commit aadad7a
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
4 changes: 4 additions & 0 deletions ignition/modules/StakingRewards.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,19 @@ const OWNER = '0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266';
const REWARDS_DISTRIBUTION = '0x70997970C51812dc3A010C7d01b50e0d17dc79C8';
const REWARDS_TOKEN = '0xc770eefad204b5180df6a14ee197d99d808ee52d'; // FOX
const STAKING_TOKEN = '0x470e8de2ebaef52014a47cb5e6af86884947f08c'; // ETH/FOX Pool
export const REWARDS_DURATION = 14n * 24n * 60n * 60n; // 14 days in seconds

const StakingRewardsModule = buildModule('StakingRewardsModule', (m) => {
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]);

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

return { stakingRewards };
});

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

describe('Deployment', function () {
it('Should set the rewards duration', async function () {
const { stakingRewards } = await hre.ignition.deploy(StakingRewardsModule);
const rewardsDuration: bigint = await stakingRewards.read.rewardsDuration();
expect(rewardsDuration).to.equal(REWARDS_DURATION);
});
});
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"resolveJsonModule": true,
"types": ["node", "@nomicfoundation/hardhat-viem", "@types/chai-as-promised"]
},
"include": ["test/**/*"],
"include": ["test/**/*", "ignition/**/*"],
"exclude": ["node_modules"],
"files": ["hardhat.config.ts"]
}

0 comments on commit aadad7a

Please sign in to comment.