Skip to content

Commit

Permalink
fix: reward script
Browse files Browse the repository at this point in the history
  • Loading branch information
BaptistG committed Mar 1, 2024
1 parent 6f80a48 commit 2f75db6
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 26 deletions.
2 changes: 1 addition & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@
#MNEMONIC_ARBITRUM=""
#ARBITRUM_ETHERSCAN_API_KEY=""


# DEPLOYER_PRIVATE_KEY=""
36 changes: 18 additions & 18 deletions hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ const config: HardhatUserConfig = {
// For the lists of Chain ID: https://chainlist.org
networks: {
hardhat: {
accounts: accounts('coredao'),
accounts: accountsPkey,
live: false,
blockGasLimit: 125e5,
initialBaseFeePerGas: 0,
Expand Down Expand Up @@ -138,12 +138,12 @@ const config: HardhatUserConfig = {
interval: 1000,
}
: { auto: true },
chainId: 1337,
chainId: 100,
},
polygon: {
live: true,
url: nodeUrl('polygon'),
accounts: accounts('polygon'),
accounts: [getPkey()],
gas: 'auto',
chainId: 137,
// gasPrice: 400e9,
Expand All @@ -157,7 +157,7 @@ const config: HardhatUserConfig = {
fantom: {
live: true,
url: nodeUrl('fantom'),
accounts: accounts('fantom'),
accounts: [getPkey()],
gas: 'auto',
chainId: 250,
verify: {
Expand Down Expand Up @@ -195,7 +195,7 @@ const config: HardhatUserConfig = {
optimism: {
live: true,
url: nodeUrl('optimism'),
accounts: accounts('optimism'),
accounts: [getPkey()],
gas: 'auto',
chainId: 10,
verify: {
Expand All @@ -207,7 +207,7 @@ const config: HardhatUserConfig = {
arbitrum: {
live: true,
url: nodeUrl('arbitrum'),
accounts: accounts('arbitrum'),
accounts: [getPkey()],
gas: 'auto',
chainId: 42161,
verify: {
Expand All @@ -219,7 +219,7 @@ const config: HardhatUserConfig = {
avalanche: {
live: true,
url: nodeUrl('avalanche'),
accounts: accounts('avalanche'),
accounts: [getPkey()],
gas: 'auto',
chainId: 43114,
verify: {
Expand All @@ -231,7 +231,7 @@ const config: HardhatUserConfig = {
aurora: {
live: true,
url: nodeUrl('aurora'),
accounts: accounts('aurora'),
accounts: [getPkey()],
gas: 'auto',
chainId: 1313161554,
verify: {
Expand All @@ -243,7 +243,7 @@ const config: HardhatUserConfig = {
bsc: {
live: true,
url: nodeUrl('bsc'),
accounts: accounts('bsc'),
accounts: [getPkey()],
gas: 'auto',
chainId: 56,
verify: {
Expand All @@ -255,7 +255,7 @@ const config: HardhatUserConfig = {
gnosis: {
live: true,
url: nodeUrl('gnosis'),
accounts: accounts('gnosis'),
accounts: [getPkey()],
gas: 'auto',
gasMultiplier: 2,
chainId: 100,
Expand All @@ -269,7 +269,7 @@ const config: HardhatUserConfig = {
polygonzkevm: {
live: true,
url: nodeUrl('polygonzkevm'),
accounts: accounts('polygonzkevm'),
accounts: [getPkey()],
gas: 'auto',
gasMultiplier: 1.3,
chainId: 1101,
Expand All @@ -282,7 +282,7 @@ const config: HardhatUserConfig = {
base: {
live: true,
url: nodeUrl('base'),
accounts: accounts('base'),
accounts: [getPkey()],
gas: 'auto',
gasMultiplier: 1.3,
chainId: 8453,
Expand All @@ -295,7 +295,7 @@ const config: HardhatUserConfig = {
linea: {
live: true,
url: nodeUrl('linea'),
accounts: accounts('linea'),
accounts: [getPkey()],
gas: 'auto',
gasMultiplier: 1.3,
chainId: 59144,
Expand All @@ -308,7 +308,7 @@ const config: HardhatUserConfig = {
zksync: {
live: true,
url: nodeUrl('zksync'),
accounts: accounts('zksync'),
accounts: [getPkey()],
gas: 'auto',
gasMultiplier: 1.3,
chainId: 324,
Expand All @@ -321,7 +321,7 @@ const config: HardhatUserConfig = {
mantle: {
live: true,
url: nodeUrl('mantle'),
accounts: accounts('mantle'),
accounts: [getPkey()],
gas: 'auto',
gasMultiplier: 1.3,
chainId: 5000,
Expand All @@ -334,7 +334,7 @@ const config: HardhatUserConfig = {
filecoin: {
live: true,
url: nodeUrl('filecoin'),
accounts: accounts('filecoin'),
accounts: [getPkey()],
gas: 'auto',
gasMultiplier: 1.3,
chainId: 314,
Expand All @@ -347,7 +347,7 @@ const config: HardhatUserConfig = {
thundercore: {
live: true,
url: nodeUrl('thundercore'),
accounts: accounts('thundercore'),
accounts: [getPkey()],
gas: 'auto',
gasMultiplier: 1.3,
chainId: 108,
Expand All @@ -360,7 +360,7 @@ const config: HardhatUserConfig = {
coredao: {
live: true,
url: nodeUrl('coredao'),
accounts: accounts('coredao'),
accounts: [getPkey()],
gas: 'auto',
gasMultiplier: 1.3,
chainId: 1116,
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"hardhat:test": "hardhat test",
"check-upgradeability": "hardhat run scripts/checkUpgradeability.ts",
"license": "hardhat prepend-spdx-license",
"node:fork": "FORK=true hardhat node --tags",
"node:fork": "FORK=true hardhat node",
"size": "yarn hardhat:compile && hardhat size-contracts",
"lint": "yarn lint:sol && yarn lint:js",
"lint:check": "yarn lint:sol:check && yarn lint:js:check",
Expand Down
26 changes: 20 additions & 6 deletions scripts/setRewardTokenMinAmount.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@
import { deployments, ethers } from 'hardhat';

import { DistributionCreator, DistributionCreator__factory } from '../typechain';
import { parseEther,parseUnits } from 'ethers/lib/utils';
import { parseEther,parseUnits, getAddress } from 'ethers/lib/utils';
import { registry } from '@angleprotocol/sdk';

async function main() {
let manager: DistributionCreator;
const { deployer } = await ethers.getNamedSigners();
const managerAddress = (await deployments.get('DistributionCreator')).address;
const chainId = (await deployer.provider?.getNetwork())?.chainId;
console.log('chainId', chainId)
const managerAddress = registry(chainId as unknown as number)?.Merkl?.DistributionCreator // (await deployments.get('DistributionCreator')).address;

if (!managerAddress) {
throw new Error('Manager address not found');
}

manager = new ethers.Contract(
managerAddress,
Expand All @@ -15,13 +22,20 @@ async function main() {
) as DistributionCreator;

console.log('Setting reward token min amount');
await (

const token = {
address: '',
decimals: 0,
minAmount: '0',
}

const res = await (
await manager
.connect(deployer)
.setRewardTokenMinAmounts(['0xa709aaD0691Fc67279577566640ae1D6515c1b81'], [parseEther('0.04')])
.setRewardTokenMinAmounts([getAddress(token.address)], [parseUnits(token.minAmount, token.decimals)])
).wait();
// 18 decimals
// 000000000000000000

console.log(res);
}

main().catch(error => {
Expand Down

0 comments on commit 2f75db6

Please sign in to comment.