Skip to content

Commit

Permalink
chore: new scripts (#73)
Browse files Browse the repository at this point in the history
  • Loading branch information
Picodes authored Jun 20, 2024
1 parent 3c05295 commit ea7ba31
Show file tree
Hide file tree
Showing 4 changed files with 92 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

# DEPLOYER_PRIVATE_KEY=""

# ETH_NODE_URI_MODE=https://mainnet.mode.network/
# ETH_NODE_URI_MODE=
# ETHERSCAN_API_KEY_MODE=""
# MODE_ETHERSCAN_API_KEY=""

Expand Down
2 changes: 1 addition & 1 deletion contracts/tokenWrappers/RadiantTokenWrapper.sol
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { BaseMerklTokenWrapper } from "./BaseTokenWrapper.sol";

interface IVesting {
function rdntToken() external view returns (address);
function vestTokens(address, uint256, bool) external returns (address);
function vestTokens(address, uint256, bool) external;

Check failure on line 13 in contracts/tokenWrappers/RadiantTokenWrapper.sol

View workflow job for this annotation

GitHub Actions / lint

Insert ⏎
}

/// @title Radiant MTW
Expand Down
50 changes: 50 additions & 0 deletions scripts/buildDisputeResolution.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import { deployments, ethers } from 'hardhat';

import { DistributionCreator, DistributionCreator__factory, Distributor, Distributor__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';
import fs from 'fs';

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

if (!distributionCreatorAddress) {
throw new Error('Distribution Creator address not found');
}
if (!distributorAddress) {
throw new Error('Distributor address not found');
}

distributionCreator = new ethers.Contract(
distributionCreatorAddress,
DistributionCreator__factory.createInterface(),
deployer,
) as DistributionCreator;

distributor = new ethers.Contract(
distributorAddress,
Distributor__factory.createInterface(),
deployer,
) as Distributor;

const disputeToken = await distributor.disputeToken()
const disputer = await distributor.disputer()

fs.writeFileSync(
`${(await deployer?.provider?.getNetwork())?.name}_dispute.json`,
`{"version":"1.0","chainId":"${chainId}","createdAt":1693483753967,"meta":{"name":"Transactions Batch","description":"","txBuilderVersion":"1.16.2","createdFromSafeAddress":"0xe4BB74804edf5280c9203f034036f7CB15196078","createdFromOwnerAddress":"","checksum":"0xb9377def98483d3d19bd3e1f34d7e2ca1055a92ed09d35bd90bb4892f60c2d2e"},"transactions":[{"to":"0x3Ef3D8bA38EBe18DB133cEc108f4D14CE00Dd9Ae","value":"0","data":null,"contractMethod":{"inputs":[{"internalType":"bool","name":"valid","type":"bool"}],"name":"resolveDispute","payable":false},"contractInputsValues":{"valid":"false"}},{"to":"${disputeToken}","value":"0","data":null,"contractMethod":{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transfer","payable":false},"contractInputsValues":{"to":"${disputer}","amount":"100000000000000000000"}}]}`,
);
}

main().catch(error => {
console.error(error);
process.exit(1);
});
40 changes: 40 additions & 0 deletions scripts/set0Fee.ts
Original file line number Diff line number Diff line change
@@ -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 = '0xFC85C07C3e0D497d97F287a70C6b2fA5CD5fdBE0';

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))
).wait();

console.log(res);
}

main().catch(error => {
console.error(error);
process.exit(1);
});

0 comments on commit ea7ba31

Please sign in to comment.