Skip to content

Commit

Permalink
fix: reward script (#59)
Browse files Browse the repository at this point in the history
* fix: reward script

* chore: update sdk

* feat: add immutable

* feat: set campaign fee script

---------

Co-authored-by: Picodes <[email protected]>
  • Loading branch information
BaptistG and Picodes authored Mar 12, 2024
1 parent f7bca72 commit 6f6e535
Show file tree
Hide file tree
Showing 6 changed files with 138 additions and 21 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=""
74 changes: 67 additions & 7 deletions hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ const config: HardhatUserConfig = {
// For the lists of Chain ID: https://chainlist.org
networks: {
hardhat: {
accounts: accountsMerklDeployer,
accounts: accountsPkey,
live: false,
blockGasLimit: 125e5,
initialBaseFeePerGas: 0,
Expand Down Expand Up @@ -159,7 +159,7 @@ const config: HardhatUserConfig = {
interval: 1000,
}
: { auto: true },
chainId: 1337,
chainId: 100,
},
polygon: {
live: true,
Expand All @@ -175,6 +175,18 @@ const config: HardhatUserConfig = {
},
},
},
fantom: {
live: true,
url: nodeUrl('fantom'),
accounts: [getPkey()],
gas: 'auto',
chainId: 250,
verify: {
etherscan: {
apiKey: etherscanKey('fantom'),
},
},
},
mainnet: {
live: true,
url: nodeUrl('mainnet'),
Expand Down Expand Up @@ -203,7 +215,7 @@ const config: HardhatUserConfig = {
arbitrum: {
live: true,
url: nodeUrl('arbitrum'),
accounts: accountsOldDeployer,
accounts: [getPkey()],
gas: 'auto',
chainId: 42161,
verify: {
Expand All @@ -224,6 +236,18 @@ const config: HardhatUserConfig = {
},
},
},
aurora: {
live: true,
url: nodeUrl('aurora'),
accounts: [getPkey()],
gas: 'auto',
chainId: 1313161554,
verify: {
etherscan: {
apiKey: etherscanKey('aurora'),
},
},
},
bsc: {
live: true,
url: nodeUrl('bsc'),
Expand All @@ -239,7 +263,7 @@ const config: HardhatUserConfig = {
gnosis: {
live: true,
url: nodeUrl('gnosis'),
accounts: accountsOldDeployer,
accounts: [getPkey()],
gas: 'auto',
gasMultiplier: 3,
chainId: 100,
Expand Down Expand Up @@ -289,6 +313,19 @@ const config: HardhatUserConfig = {
},
},
},
zksync: {
live: true,
url: nodeUrl('zksync'),
accounts: [getPkey()],
gas: 'auto',
gasMultiplier: 1.3,
chainId: 324,
verify: {
etherscan: {
apiKey: etherscanKey('zksync'),
},
},
},
mantle: {
live: true,
url: nodeUrl('mantle'),
Expand All @@ -305,7 +342,7 @@ const config: HardhatUserConfig = {
filecoin: {
live: true,
url: nodeUrl('filecoin'),
accounts: accountsOldDeployer,
accounts: [getPkey()],
gas: 'auto',
gasMultiplier: 1.3,
chainId: 314,
Expand All @@ -331,7 +368,7 @@ const config: HardhatUserConfig = {
thundercore: {
live: true,
url: nodeUrl('thundercore'),
accounts: accountsOldDeployer,
accounts: [getPkey()],
gas: 'auto',
gasMultiplier: 1.3,
chainId: 108,
Expand All @@ -344,7 +381,7 @@ const config: HardhatUserConfig = {
coredao: {
live: true,
url: nodeUrl('coredao'),
accounts: accountsOldDeployer,
accounts: [getPkey()],
gas: 'auto',
gasMultiplier: 1.3,
chainId: 1116,
Expand All @@ -354,6 +391,29 @@ const config: HardhatUserConfig = {
},
},
},
blast: {
live: true,
url: nodeUrl('blast'),
accounts: [getPkey()],
gas: 'auto',
gasMultiplier: 1.3,
chainId: 81457,
verify: {
etherscan: {
apiKey: etherscanKey('blast'),
},
},
},
immutablezkevm: {
live: true,
url: nodeUrl('immutablezkevm'),
accounts: [getPkey()],
gas: 'auto',
gasMultiplier: 1.3,
chainId: 13371,
verify: {
etherscan: {
apiKey: etherscanKey('immutablezkevm'),
immutable: {
live: true,
url: nodeUrl('immutable'),
Expand Down
4 changes: 2 additions & 2 deletions 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 All @@ -39,7 +39,7 @@
"url": "https://github.com/AngleProtocol/merkl-contracts/issues"
},
"devDependencies": {
"@angleprotocol/sdk": "0.21.1",
"@angleprotocol/sdk": "0.34.4",
"@ethersproject/abi": "^5.7.0",
"@ethersproject/providers": "^5.7.1",
"@nomicfoundation/hardhat-chai-matchers": "^1.0.3",
Expand Down
44 changes: 44 additions & 0 deletions scripts/setCampaignFee.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import { deployments, ethers } from 'hardhat';

import { DistributionCreator, DistributionCreator__factory } from '../typechain';
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 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,
DistributionCreator__factory.createInterface(),
deployer,
) as DistributionCreator;

console.log('Setting campaign Fees');

const campaignFee = {
fee: '0.5',
campaignType: '4',
}

console.log(campaignFee.campaignType, parseUnits(campaignFee.fee, 7).toString())
const res = await (
await manager
.connect(deployer)
.setCampaignFees(campaignFee.campaignType, parseUnits(campaignFee.fee, 7))
).wait();

console.log(res);
}

main().catch(error => {
console.error(error);
process.exit(1);
});
27 changes: 20 additions & 7 deletions scripts/setRewardTokenMinAmount.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
import { deployments, ethers } from 'hardhat';

import { DistributionCreator, DistributionCreator__factory } from '../typechain';
import { parseEther,parseUnits } from 'ethers/lib/utils';
import { parseAmount } from '../utils/bignumber';
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 @@ -16,13 +22,20 @@ async function main() {
) as DistributionCreator;

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

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

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

console.log(res);
}

main().catch(error => {
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
resolved "https://registry.yarnpkg.com/@aashutoshrathi/word-wrap/-/word-wrap-1.2.6.tgz#bd9154aec9983f77b3a034ecaa015c2e4201f6cf"
integrity sha512-1Yjs2SvM8TflER/OD3cOjhWWOZb58A2t7wpE2S9XfBYTiIl+XFhQG2bjy4Pu1I+EAlCNUzRDYDdFwFYUKvXcIA==

"@angleprotocol/sdk@0.21.1":
version "0.21.1"
resolved "https://npm.pkg.github.com/download/@angleprotocol/sdk/0.21.1/2f785e40f44da487d3af00dd4234e1aa5222fc46#2f785e40f44da487d3af00dd4234e1aa5222fc46"
integrity sha512-/4G2AL+ccDgL4DOUzSGp7c3yKLoWBy7+hav4/Tpkdo283MB9RSW4k84jJQov+OH3p5to3j5SBRfwrhND5zwu6Q==
"@angleprotocol/sdk@0.34.4":
version "0.34.4"
resolved "https://npm.pkg.github.com/download/@angleprotocol/sdk/0.34.4/423d2a54e1cd7c6116cd2b95825f4d1572f4a497#423d2a54e1cd7c6116cd2b95825f4d1572f4a497"
integrity sha512-iHsOQtdqj15qVbGJ8RtkHy6qAqLM6Bsm9FaPvf+msBSENaHcoIpQnzxl1pt+pUyF1YKyj0gxsev4NHF5lO0pcA==
dependencies:
"@apollo/client" "^3.7.17"
"@typechain/ethers-v5" "^10.0.0"
Expand Down

0 comments on commit 6f6e535

Please sign in to comment.