Skip to content

Commit

Permalink
feat: set campaign fee script
Browse files Browse the repository at this point in the history
  • Loading branch information
BaptistG committed Mar 8, 2024
1 parent af8c447 commit a1c8d98
Showing 1 changed file with 44 additions and 0 deletions.
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);
});

0 comments on commit a1c8d98

Please sign in to comment.