Skip to content

Commit

Permalink
feat: script to test reward token
Browse files Browse the repository at this point in the history
  • Loading branch information
sogipec committed Feb 14, 2024
1 parent 9f3e045 commit 1661f8f
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 4 deletions.
8 changes: 5 additions & 3 deletions hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,14 @@ import '@nomiclabs/hardhat-truffle5';
import '@nomiclabs/hardhat-solhint';
import '@tenderly/hardhat-tenderly';
import '@typechain/hardhat';
import { HardhatNetworkAccountsUserConfig } from 'hardhat/types';
import { parseEther } from 'ethers/lib/utils';

import { TASK_COMPILE_SOLIDITY_GET_SOURCE_PATHS } from 'hardhat/builtin-tasks/task-names';
import { HardhatUserConfig, subtask } from 'hardhat/config';
import yargs from 'yargs';

import { accounts, etherscanKey, nodeUrl } from './utils/network';
import { accounts, etherscanKey, nodeUrl, getPkey } from './utils/network';

// Otherwise, ".sol" files from "test" are picked up during compilation and throw an error
subtask(TASK_COMPILE_SOLIDITY_GET_SOURCE_PATHS).setAction(async (_, __, runSuper) => {
Expand All @@ -28,7 +30,7 @@ subtask(TASK_COMPILE_SOLIDITY_GET_SOURCE_PATHS).setAction(async (_, __, runSuper
});

const accountsPkey: HardhatNetworkAccountsUserConfig = [
{ privateKey: process.env.DEPLOYER_PRIVATE_KEY!, balance: parseEther('1000').toString() },
{ privateKey: getPkey(), balance: parseEther('1000').toString() },
];

const accountsOldDeployer: HardhatNetworkAccountsUserConfig = accounts('old_deployer');
Expand Down Expand Up @@ -167,7 +169,7 @@ const config: HardhatUserConfig = {
mainnet: {
live: true,
url: nodeUrl('mainnet'),
accounts: accounts('mainnet'),
accounts: [getPkey()],
gas: 'auto',
gasMultiplier: 1.3,
chainId: 1,
Expand Down
5 changes: 4 additions & 1 deletion scripts/setRewardTokenMinAmount.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { deployments, ethers } from 'hardhat';

import { DistributionCreator, DistributionCreator__factory } from '../typechain';
import { parseEther,parseUnits } from 'ethers/lib/utils';

async function main() {
let manager: DistributionCreator;
Expand All @@ -17,8 +18,10 @@ async function main() {
await (
await manager
.connect(deployer)
.setRewardTokenMinAmounts(['0x0D1E753a25eBda689453309112904807625bEFBe'], [200000000000000000000000])
.setRewardTokenMinAmounts(['0xa709aaD0691Fc67279577566640ae1D6515c1b81'], [parseEther('0.04')])
).wait();
// 18 decimals
// 000000000000000000
}

main().catch(error => {
Expand Down
9 changes: 9 additions & 0 deletions utils/network.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,12 @@ export function getMnemonic(networkName: string): string {
export function accounts(networkName: string): { mnemonic: string; count: number } {
return { mnemonic: getMnemonic(networkName), count: 20 };
}

export function getPkey(): string {
try {
return process.env.DEPLOYER_PRIVATE_KEY!
} catch {
return '0x0000000000000000000000000000000000000000000000000000000000000000'
}

}

0 comments on commit 1661f8f

Please sign in to comment.