Skip to content
Merged
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
11 changes: 6 additions & 5 deletions .env.sample
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
# RPCs
EVMX_RPC="https://rpc-socket-composer-testnet.t.conduit.xyz"
EVMX_RPC="https://rpc.evmx.socket.tech"
SEPOLIA_RPC="https://rpc.ankr.com/eth_sepolia/"
ARBITRUM_SEPOLIA_RPC="https://rpc.ankr.com/arbitrum_sepolia"
OPTIMISM_SEPOLIA_RPC="https://rpc.ankr.com/optimism_sepolia"
BASE_SEPOLIA_RPC="https://rpc.ankr.com/base_sepolia"

# EVMx key addresses
# Find the most up to date addresses in deployments/dev_addresses.json
ADDRESS_RESOLVER="0x1307b0cDCA91e969D5885D0332bD34688E9f6E39"
AUCTION_MANAGER="0xA8016fad20367D9De8B21d4c16BB677bc7a265cE"
ARBITRUM_FEES_PLUG="0xFDd8beaDb07cB224971fD311F9218addC14443fb"
ADDRESS_RESOLVER="0x7480D8D4B1929e751984b01eE877A9D65e1F3737"
AUCTION_MANAGER="0x50E5140d3601812Dc11f49a39CF9520567731c82"
ARBITRUM_FEES_PLUG="0xa08Dac27E27c49A2535b36064c370e6e8B3A0B9a"
FEES_MANAGER="0x80bEc58A00993dc874Ab2fAe56621af24eF06bA5"

# Add your deployer private key here
# or remove it from this file if it is already an env var
Expand All @@ -21,4 +22,4 @@ APP_GATEWAY="0x"

# FOR INFRASTRUCTURE DEPLOYMENT ONLY
# Removes hardhat issues related to linting and syntax checking
SOCKET_SIGNER_KEY="0000dead0000dead0000dead0000dead0000dead0000dead0000dead0000dead"
SOCKET_SIGNER_KEY="0000dead0000dead0000dead0000dead0000dead0000dead0000dead0000dead"
4 changes: 2 additions & 2 deletions foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ libs = ["node_modules", "lib"]
ffi = true
optimizer = true
optimizer_runs = 200
evm_version = 'shanghai'
evm_version = 'paris'

# See more config options https://github.com/foundry-rs/foundry/blob/master/crates/config/README.md#all-options
[etherscan]
3605 = { key = "none", url = "https://explorer-cloud-broken-leg-7uu20euqoj.t.conduit.xyz/api" }
7625382 = { key = "empty", url = "https://evms.cloud.blockscout.com/api?" }
421614 = { key = "${ARBISCAN_API_KEY}", url = "https://api-sepolia.arbiscan.io/api?" }
11155420 = { key = "${OPTIMISM_API_KEY}", url = "https://optimism-sepolia.blockscout.com/api?" }
File renamed without changes.
2 changes: 1 addition & 1 deletion script/PayFeesInArbitrumETH.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ contract DepositFees is Script {
uint256 balance = sender.balance;
console.log("Sender balance in wei:", balance);

uint feesAmount = 0.01 ether;
uint feesAmount = 0.001 ether;
feesPlug.deposit{value: feesAmount}(ETH_ADDRESS, appGateway, feesAmount);
}
}
16 changes: 4 additions & 12 deletions script/counter/IncrementCountersFromApp.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ contract IncrementCounters is Script {

vm.createSelectFork(socketRPC);

CounterDeployer deployer = CounterDeployer(vm.envAddress("COUNTER_DEPLOYER"));
CounterAppGateway gateway = CounterAppGateway(vm.envAddress("COUNTER_APP_GATEWAY"));
CounterDeployer deployer = CounterDeployer(vm.envAddress("DEPLOYER"));
CounterAppGateway gateway = CounterAppGateway(vm.envAddress("APP_GATEWAY"));

address counterForwarderArbitrumSepolia = deployer.forwarderAddresses(
deployer.counter(),
Expand Down Expand Up @@ -67,15 +67,7 @@ contract IncrementCounters is Script {
// console.log("Ethereum Sepolia forwarder not yet deployed");
//}

// vm.startBroadcast(deployerPrivateKey);
bytes memory data = abi.encodeWithSelector(
CounterAppGateway.incrementCounters.selector,
instances
);
console.log("to");
console.log(address(gateway));
console.log("data");
console.logBytes(data);
// gateway.incrementCounters(instances);
vm.startBroadcast(deployerPrivateKey);
gateway.incrementCounters(instances);
}
}
59 changes: 44 additions & 15 deletions script/counter/WithdrawFeesArbitrumFeesPlug.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,30 +3,59 @@ pragma solidity ^0.8.0;

import {Script} from "forge-std/Script.sol";
import {console} from "forge-std/console.sol";
import {FeesPlug} from "../../contracts/protocol/payload-delivery/FeesPlug.sol";
import {FeesManager} from "../../contracts/protocol/payload-delivery/app-gateway/FeesManager.sol";
import {ETH_ADDRESS} from "../../contracts/protocol/utils/common/Constants.sol";
import {CounterAppGateway} from "../../contracts/apps/counter/CounterAppGateway.sol";

contract WithdrawFees is Script {
function run() external {
vm.createSelectFork(vm.envString("ARBITRUM_SEPOLIA_RPC"));

uint256 privateKey = vm.envUint("PRIVATE_KEY");
vm.startBroadcast(privateKey);
FeesPlug feesPlug = FeesPlug(payable(vm.envAddress("ARBITRUM_FEES_PLUG")));
// EVMX Check available fees
vm.createSelectFork(vm.envString("EVMX_RPC"));
FeesManager feesManager = FeesManager(payable(vm.envAddress("FEES_MANAGER")));
address appGatewayAddress = vm.envAddress("APP_GATEWAY");
CounterAppGateway appGateway = CounterAppGateway(appGatewayAddress);

address sender = vm.addr(privateKey);
console.log("Sender address:", sender);
uint256 balance = sender.balance;
console.log("Sender balance:", balance);
uint256 availableFees = feesManager.getAvailableFees(
421614,
appGatewayAddress,
ETH_ADDRESS
);
console.log("Available fees:", availableFees);

if (availableFees > 0) {
// Switch to Arbitrum Sepolia to get gas price
vm.createSelectFork(vm.envString("ARBITRUM_SEPOLIA_RPC"));
uint256 privateKey = vm.envUint("PRIVATE_KEY");
address sender = vm.addr(privateKey);

// Gas price from Arbitrum
uint256 arbitrumGasPrice = block.basefee + 0.1 gwei; // With buffer
uint256 gasLimit = 5_000_000; // Estimate
uint256 estimatedGasCost = gasLimit * arbitrumGasPrice;

console.log("Arbitrum gas price (wei):", arbitrumGasPrice);
console.log("Gas limit:", gasLimit);
console.log("Estimated gas cost:", estimatedGasCost);

// Calculate amount to withdraw
uint256 amountToWithdraw = availableFees > estimatedGasCost
? availableFees - estimatedGasCost
: 0;

if (amountToWithdraw > 0) {
// Switch back to EVMX to perform withdrawal
vm.createSelectFork(vm.envString("EVMX_RPC"));
vm.startBroadcast(privateKey);
console.log("Withdrawing amount:", amountToWithdraw);
appGateway.withdrawFeeTokens(421614, ETH_ADDRESS, amountToWithdraw, sender);
vm.stopBroadcast();

uint256 appBalance = feesPlug.balanceOf(appGatewayAddress);
console.log("AppBalance:", appBalance);
if (appBalance > 0) {
appGateway.withdrawFeeTokens(421614, ETH_ADDRESS, appBalance, sender);
console.log("Withdrew:", appBalance);
// Switch back to Arbitrum Sepolia to check final balance
vm.createSelectFork(vm.envString("ARBITRUM_SEPOLIA_RPC"));
console.log("Final sender balance:", sender.balance);
} else {
console.log("Available fees less than estimated gas cost");
}
}
}
}
4 changes: 2 additions & 2 deletions script/counter/deployOnchainCounters.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ contract CounterDeployOnchain is Script {
// deployer.deployContracts(11155420);
// console.log("Deploying contracts on Base Sepolia...");
// deployer.deployContracts(84532);
//console.log("Deploying contracts on Ethereum Sepolia...");
//deployer.deployContracts(11155111);
// console.log("Deploying contracts on Ethereum Sepolia...");
// deployer.deployContracts(11155111);
}
}
Loading