Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scripts #56

Merged
merged 2 commits into from
Feb 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// - ENABLE_GAS_REPORT
// - CI
// - RUNS
import 'dotenv/config';

Check failure on line 5 in hardhat.config.ts

View workflow job for this annotation

GitHub Actions / lint

Run autofix to sort these imports!
import 'hardhat-contract-sizer';
import 'hardhat-spdx-license-identifier';
import 'hardhat-deploy';
Expand All @@ -14,19 +14,29 @@
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) => {
const paths = await runSuper();
return paths.filter((p: string) => !p.includes('/test/foundry/'));
});

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

const accountsOldDeployer: HardhatNetworkAccountsUserConfig = accounts('old_deployer');
const accountsMerklDeployer: HardhatNetworkAccountsUserConfig = accounts('merkl_deployer');
const accountsGovernorSidechain: HardhatNetworkAccountsUserConfig = accounts('governor_sidechain');

const argv = yargs
.env('')
.boolean('enableGasReport')
Expand Down Expand Up @@ -159,7 +169,7 @@
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
5 changes: 4 additions & 1 deletion scripts/upgradeContracts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ async function main() {

const distributionAddress = registry(ChainId.MAINNET)?.Merkl?.DistributionCreator!;
const distributorAddress = registry(ChainId.MAINNET)?.Merkl?.Distributor!;
console.log(deployer.address);

manager = new ethers.Contract(
distributionAddress,
Expand All @@ -27,16 +28,18 @@ async function main() {
) as Distributor;

const newImplementation = await deployments.get('DistributionCreator_Implementation_V2_0');
console.log('1st upgrade');
await manager.connect(deployer).upgradeTo(newImplementation.address);
const newDistribImplementation = await deployments.get('Distributor_Implementation_V2_0');
console.log('2nd upgrade');
await distributor.connect(deployer).upgradeTo(newDistribImplementation.address);

console.log(await manager.core());
console.log(await manager.distributor());
console.log(await manager.feeRecipient());
console.log((await manager.defaultFees()).toString());
console.log(await manager.message());
console.log(await manager.distributionList(10));
console.log(await manager.distributionList(1));
console.log((await manager.feeRebate(deployer.address)).toString());
console.log((await manager.isWhitelistedToken(registry(ChainId.MAINNET)?.agEUR?.AgToken!)).toString());
console.log((await manager._nonces('0xfda462548ce04282f4b6d6619823a7c64fdc0185')).toString());
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'
}

}
Loading