Skip to content

Commit

Permalink
feat: add fund disputer whitelist script
Browse files Browse the repository at this point in the history
  • Loading branch information
nlecoufl committed Nov 18, 2024
1 parent ce8b427 commit aa2c067
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 0 deletions.
41 changes: 41 additions & 0 deletions deploy/foundry/fundDisputerWhitelist.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.17;

import { Script } from "forge-std/Script.sol";
import { BaseScript } from "../utils/Base.s.sol";
import { console } from "forge-std/console.sol";

// NOTE: This script is used to fund the whitelist of disputers for a given chain.
// Can be executed with (0.1 ether = 100000000000000000 wei):
// forge script deploy/foundry/fundDisputerWhitelist.s.sol:FundDisputerWhitelistScript \
// -vvvv \
// --rpc-url localhost \
// --sig "run(uint256,address[])" \
// 100000000000000000 "[0xeA05F9001FbDeA6d4280879f283Ff9D0b282060e,0x0dd2Ea40A3561C309C03B96108e78d06E8A1a99B,0xF4c94b2FdC2efA4ad4b831f312E7eF74890705DA]"
contract FundDisputerWhitelistScript is Script, BaseScript {
function run(uint256 fundAmount, address[] calldata whitelist) external {
uint256 deployerPrivateKey = vm.envUint("DEPLOYER_PRIVATE_KEY");
console.log("Chain ID:", block.chainid);

vm.startBroadcast(deployerPrivateKey);

// Fund each whitelisted address
for (uint256 i = 0; i < whitelist.length; i++) {
address recipient = whitelist[i];
console.log("Funding whitelist address:", recipient);

// Transfer native token
(bool success, ) = recipient.call{ value: fundAmount }("");
require(success, "Transfer failed");

console.log("Funded with amount:", fundAmount);
}

vm.stopBroadcast();

// Print summary
console.log("\n=== Funding Summary ===");
console.log("Amount per address:", fundAmount);
console.log("Number of addresses funded:", whitelist.length);
}
}
1 change: 1 addition & 0 deletions deploy/foundry/merklDeploy.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import { ICore } from "../../contracts/interfaces/ICore.sol";
import { BaseScript } from "../utils/Base.s.sol";
import { MockToken } from "../../contracts/mock/MockToken.sol";

// NOTE: Before running this script on a new chain, make sure to create the AngleLabs multisig and update the sdk with the new address
contract MainDeployScript is Script, BaseScript, JsonReader {
uint256 private DEPLOYER_PRIVATE_KEY;
uint256 private MERKL_DEPLOYER_PRIVATE_KEY;
Expand Down

0 comments on commit aa2c067

Please sign in to comment.