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

Add transfer surcharge recipient script #466

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@

"deploy-fl-online-amoy": "source .env && forge script script/deploy-fl-online-control.s.sol:DeployFLOnlineControlScript --rpc-url ${AMOY_RPC_URL} --broadcast --etherscan-api-key ${POLYGONSCAN_API_KEY} --verify",
"deploy-fl-online-polygon": "source .env && forge script script/deploy-fl-online-control.s.sol:DeployFLOnlineControlScript --rpc-url ${POLYGON_RPC_URL} --broadcast --etherscan-api-key ${POLYGONSCAN_API_KEY} --verify",

"deploy-atlas-bsc": "source .env && forge script script/deploy-atlas.s.sol:DeployAtlasScript --rpc-url ${BSC_RPC_URL} --legacy --broadcast --etherscan-api-key ${BSCSCAN_API_KEY} --verify --delay 30",
"deploy-atlas-bsc-testnet": "source .env && forge script script/deploy-atlas.s.sol:DeployAtlasScript --rpc-url ${BSC_TESTNET_RPC_URL} --legacy --broadcast --etherscan-api-key ${BSCSCAN_API_KEY} --verify --delay 30",

"deploy-atlas-sepolia": "source .env && forge script script/deploy-atlas.s.sol:DeployAtlasScript --rpc-url ${SEPOLIA_RPC_URL} --legacy --gas-estimate-multiplier 150 --broadcast --etherscan-api-key ${ETHERSCAN_API_KEY} --verify --delay 30",
"deploy-atlas-local": "source .env && forge script script/deploy-atlas.s.sol:DeployAtlasScript --fork-url http://localhost:8545 --broadcast",

Expand Down Expand Up @@ -60,6 +60,8 @@
"solver-deposit": "source .env && forge script script/solver-deposit.s.sol:SolverAtlasDepositScript --fork-url http://localhost:8545 --broadcast --non-interactive",
"setup-demo": "npm run deploy-atlas-swap-intent-tx-builder && npm run deploy-solver && npm run solver-deposit",

"transfer-surcharge-recipient:sepolia": ". ./.env && forge script script/transfer-surcharge-recipient.s.sol:TransferSurchargeRecipientScript --rpc-url ${SEPOLIA_RPC_URL} --sig 'run(string)' --broadcast --non-interactive",

"atlas-addr": "echo 'ATLAS:' && jq -r '.ATLAS' deployments.json",
"swap-intent-addr": "echo 'SWAP INTENT DAPP CONTROL:' && jq -r '.SWAP_INTENT_DAPP_CONTROL' deployments.json",
"tx-builder-addr": "echo 'TX BUILDER:' && jq -r '.TX_BUILDER' deployments.json",
Expand All @@ -78,4 +80,3 @@
"solc": "solc-select install 0.8.18 && solc-select use 0.8.18"
}
}

37 changes: 37 additions & 0 deletions script/transfer-surcharge-recipient.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.25;

import "forge-std/Script.sol";

import { DeployBaseScript } from "script/base/deploy-base.s.sol";

import { Atlas } from "src/contracts/atlas/Atlas.sol";

/// @dev npm run transfer-surcharge-recipient:sepolia -- <address>
contract TransferSurchargeRecipientScript is DeployBaseScript {
function run(string calldata _newRecipient) external {
console.log("\n=== Transferring Atlas Surcharge Recipient ===\n");

// Hex string to address.
address newRecipient = vm.parseAddress(_newRecipient);

// Get the deployer's private key from environment.
uint256 deployerPrivateKey = vm.envUint("GOV_PRIVATE_KEY");
address deployer = vm.addr(deployerPrivateKey);

// Get Atlas contract address from deployments.
address atlasAddress = _getAddressFromDeploymentsJson(".ATLAS");
Atlas atlas = Atlas(payable(atlasAddress));

console.log("Deployer address: \t\t\t", deployer);
console.log("Atlas address: \t\t\t\t", atlasAddress);
console.log("New surcharge recipient: \t\t\t", newRecipient);

// Transfer the surcharge recipient role to the new address.
vm.startBroadcast(deployerPrivateKey);
atlas.transferSurchargeRecipient(newRecipient);
vm.stopBroadcast();

console.log("\nSurcharge recipient successfully transferred to:", newRecipient);
}
}
Loading