generated from AngleProtocol/boilerplate
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add fund disputer whitelist script
- Loading branch information
Showing
2 changed files
with
42 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters