From 682b1019af9ca3cdbbcbaf2b599abce6d93a7680 Mon Sep 17 00:00:00 2001 From: Apotheosis <97164662+0xApotheosis@users.noreply.github.com> Date: Mon, 16 Sep 2024 20:01:08 +1000 Subject: [PATCH] fix: contract deployed by account 0 --- hardhat.config.ts | 2 ++ ignition/modules/StakingRewards.ts | 10 ++++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/hardhat.config.ts b/hardhat.config.ts index 8bb105d..4e0d163 100644 --- a/hardhat.config.ts +++ b/hardhat.config.ts @@ -8,6 +8,8 @@ const config: HardhatUserConfig = { networks: { localhost: { url: 'http://127.0.0.1:8545', + // Account 0 of the default Hardhat node, funded with ETH so we can test deployment locally + accounts: ['0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80'], }, // Mainnet configuration (only used if INFURA_API_KEY and PRIVATE_KEY are set) // Let's us still test locally without setting up mainnet diff --git a/ignition/modules/StakingRewards.ts b/ignition/modules/StakingRewards.ts index ad091fe..0e2a33b 100644 --- a/ignition/modules/StakingRewards.ts +++ b/ignition/modules/StakingRewards.ts @@ -1,20 +1,22 @@ import { buildModule } from '@nomicfoundation/hardhat-ignition/modules'; -const OWNER = '0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266'; // FIXME: this is a dummy Hardhat address -const REWARDS_DISTRIBUTION = '0x70997970C51812dc3A010C7d01b50e0d17dc79C8'; // FIXME: this is a dummy Hardhat address +const REWARDS_DISTRIBUTION = '0x5337027a4873210E1A4a0F2558F05C9792E2C9E6'; // 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 const StakingRewardsModule = buildModule('StakingRewardsModule', (m) => { - const owner = m.getParameter('owner', OWNER); + const owner = m.getAccount(0); 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]); + const stakingRewards = m.contract('StakingRewards', [owner, rewardsDistribution, rewardsToken, stakingToken], { + from: owner, + }); m.call(stakingRewards, 'setRewardsDuration', [rewardsDuration]);