From 5addf9ed1cd364d94ae96e88866d90d00fa49328 Mon Sep 17 00:00:00 2001 From: picodes Date: Fri, 3 May 2024 11:06:07 +0200 Subject: [PATCH] fix: setFeeRebate --- hardhat.config.ts | 3 +++ package.json | 4 ++-- scripts/setFeeRebate.ts | 40 ++++++++++++++++++++++++++++++++++++++++ yarn.lock | 26 +++++++++++++------------- 4 files changed, 58 insertions(+), 15 deletions(-) create mode 100644 scripts/setFeeRebate.ts diff --git a/hardhat.config.ts b/hardhat.config.ts index a749cd7..03c0edc 100644 --- a/hardhat.config.ts +++ b/hardhat.config.ts @@ -323,11 +323,14 @@ const config: HardhatUserConfig = { gas: 'auto', gasMultiplier: 1.3, chainId: 324, + ethNetwork: nodeUrl('mainnet'), + verifyURL: 'https://zksync2-mainnet-explorer.zksync.io/contract_verification', verify: { etherscan: { apiKey: etherscanKey('zksync'), }, }, + zksync: true, }, mantle: { live: true, diff --git a/package.json b/package.json index 63ec0c3..4d9e0bb 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,7 @@ "deploy:fork": "FORK=true hardhat node --tags distributionCreator", "deploy:agla": "hardhat deploy --tags aglaMerkl --network", "deploy": "hardhat deploy --tags mtw --network", - "hardhat etherscan-verify --network", + "etherscan": "hardhat etherscan-verify --network", "foundry:compile": "forge build --optimize --optimizer-runs 1000", "foundry:coverage": "forge coverage --ir-minimum --report lcov && yarn lcov:clean && yarn lcov:generate-html", "foundry:deploy": "forge script --broadcast --verify -vvvv", @@ -45,7 +45,7 @@ "url": "https://github.com/AngleProtocol/merkl-contracts/issues" }, "devDependencies": { - "@angleprotocol/sdk": "0.34.4", + "@angleprotocol/sdk": "2.0.0", "@ethersproject/abi": "^5.7.0", "@ethersproject/providers": "^5.7.1", "@nomicfoundation/hardhat-chai-matchers": "^1.0.3", diff --git a/scripts/setFeeRebate.ts b/scripts/setFeeRebate.ts new file mode 100644 index 0000000..b83c054 --- /dev/null +++ b/scripts/setFeeRebate.ts @@ -0,0 +1,40 @@ +import { deployments, ethers } from 'hardhat'; + +import { DistributionCreator, DistributionCreator__factory } from '../typechain'; +import { parseEther,parseUnits, getAddress } from 'ethers/lib/utils'; +import { registry } from '@angleprotocol/sdk'; +import { BigNumber } from 'ethers'; +import { BASE_PARAMS } from '../test/hardhat/utils/helpers'; + +const USER = '0xa535f2C53f530eB953299702A8851a07674fbe46'; + +async function main() { + let manager: DistributionCreator; + const { deployer } = await ethers.getNamedSigners(); + const chainId = (await deployer.provider?.getNetwork())?.chainId; + console.log('chainId', chainId) + const distributionCreator = registry(chainId as unknown as number)?.Merkl?.DistributionCreator // (await deployments.get('DistributionCreator')).address; + + if (!distributionCreator) { + throw new Error('Distribution Creator address not found'); + } + + manager = new ethers.Contract( + distributionCreator, + DistributionCreator__factory.createInterface(), + deployer, + ) as DistributionCreator; + + const res = await ( + await manager + .connect(deployer) + .setUserFeeRebate(getAddress(USER), BigNumber.from(BASE_PARAMS).div(3)) + ).wait(); + + console.log(res); +} + +main().catch(error => { + console.error(error); + process.exit(1); +}); diff --git a/yarn.lock b/yarn.lock index 6ec200a..a5da9e1 100644 --- a/yarn.lock +++ b/yarn.lock @@ -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.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== +"@angleprotocol/sdk@2.0.0": + version "2.0.0" + resolved "https://npm.pkg.github.com/download/@angleprotocol/sdk/2.0.0/ad9abe640e359f4411575f0e8ca4e20f52b1d51c#ad9abe640e359f4411575f0e8ca4e20f52b1d51c" + integrity sha512-RTDYV2EyoWFBgTPdFd6mMdrFT7PuC9gyMKkOXgnutCBdrW+S4h2kLsTQzxcjli8eIw9LqYO9HVNFPQNfJbmd4Q== dependencies: "@apollo/client" "^3.7.17" "@typechain/ethers-v5" "^10.0.0" @@ -23,7 +23,7 @@ lodash "^4.17.21" merkletreejs "^0.3.10" tiny-invariant "^1.1.0" - typechain "^8.0.0" + typechain "^8.3.2" "@apollo/client@^3.7.17": version "3.9.0" @@ -10007,10 +10007,10 @@ type@^2.5.0: resolved "https://registry.npmjs.org/type/-/type-2.6.0.tgz" integrity sha512-eiDBDOmkih5pMbo9OqsqPRGMljLodLcwd5XD5JbtNB0o89xZAwynY9EdCDsJU7LtcVCClu9DvM7/0Ep1hYX3EQ== -typechain@^8.0.0: - version "8.0.0" - resolved "https://registry.npmjs.org/typechain/-/typechain-8.0.0.tgz" - integrity sha512-rqDfDYc9voVAhmfVfAwzg3VYFvhvs5ck1X9T/iWkX745Cul4t+V/smjnyqrbDzWDbzD93xfld1epg7Y/uFAesQ== +typechain@^8.1.0: + version "8.1.0" + resolved "https://registry.npmjs.org/typechain/-/typechain-8.1.0.tgz" + integrity sha512-5jToLgKTjHdI1VKqs/K8BLYy42Sr3o8bV5ojh4MnR9ExHO83cyyUdw+7+vMJCpKXUiVUvARM4qmHTFuyaCMAZQ== dependencies: "@types/prettier" "^2.1.1" debug "^4.3.1" @@ -10023,10 +10023,10 @@ typechain@^8.0.0: ts-command-line-args "^2.2.0" ts-essentials "^7.0.1" -typechain@^8.1.0: - version "8.1.0" - resolved "https://registry.npmjs.org/typechain/-/typechain-8.1.0.tgz" - integrity sha512-5jToLgKTjHdI1VKqs/K8BLYy42Sr3o8bV5ojh4MnR9ExHO83cyyUdw+7+vMJCpKXUiVUvARM4qmHTFuyaCMAZQ== +typechain@^8.3.2: + version "8.3.2" + resolved "https://registry.yarnpkg.com/typechain/-/typechain-8.3.2.tgz#1090dd8d9c57b6ef2aed3640a516bdbf01b00d73" + integrity sha512-x/sQYr5w9K7yv3es7jo4KTX05CLxOf7TRWwoHlrjRh8H82G64g+k7VuWPJlgMo6qrjfCulOdfBjiaDtmhFYD/Q== dependencies: "@types/prettier" "^2.1.1" debug "^4.3.1"