@@ -3,8 +3,8 @@ pragma solidity ^0.8.0;
33
44import {Script} from "forge-std/Script.sol " ;
55import {console} from "forge-std/console.sol " ;
6- import {FeesManager} from "socket-protocol/contracts/protocol /payload-delivery/FeesManager.sol " ;
7- import {ETH_ADDRESS } from "socket-protocol/contracts/protocol/utils/common/Constants .sol " ;
6+ import {FeesManager} from "socket-protocol/contracts/evmx /payload-delivery/FeesManager.sol " ;
7+ import {TestUSDC } from "socket-protocol/contracts/evmx/helpers/TestUSDC .sol " ;
88
99import {CounterAppGateway} from "../../src/counter/CounterAppGateway.sol " ;
1010
@@ -35,9 +35,10 @@ contract WithdrawFees is Script {
3535 vm.createSelectFork (vm.envString ("EVMX_RPC " ));
3636 FeesManager feesManager = FeesManager (payable (vm.envAddress ("FEES_MANAGER " )));
3737 address appGatewayAddress = vm.envAddress ("APP_GATEWAY " );
38+ TestUSDC testUSDCContract = TestUSDC (vm.envAddress ("ARBITRUM_TEST_USDC " ));
3839
3940 CounterAppGateway appGateway = CounterAppGateway (appGatewayAddress);
40- uint256 availableFees = feesManager.getAvailableFees ( 421614 , appGatewayAddress, ETH_ADDRESS );
41+ uint256 availableFees = feesManager.getMaxCreditsAvailableForWithdraw ( appGatewayAddress);
4142 console.log ("Available fees: " , availableFees);
4243
4344 if (availableFees > 0 ) {
@@ -48,7 +49,7 @@ contract WithdrawFees is Script {
4849
4950 // Gas price from Arbitrum
5051 uint256 arbitrumGasPrice = block .basefee + 0.1 gwei ; // With buffer
51- uint256 gasLimit = 3_000_000 ; // Estimate
52+ uint256 gasLimit = 50_000_000_000 ; // Estimate
5253 uint256 estimatedGasCost = gasLimit * arbitrumGasPrice;
5354
5455 console.log ("Arbitrum gas price (wei): " , arbitrumGasPrice);
@@ -63,12 +64,8 @@ contract WithdrawFees is Script {
6364 vm.createSelectFork (vm.envString ("EVMX_RPC " ));
6465 vm.startBroadcast (privateKey);
6566 console.log ("Withdrawing amount: " , amountToWithdraw);
66- appGateway.withdrawFeeTokens (421614 , ETH_ADDRESS , amountToWithdraw, sender);
67+ appGateway.withdrawFeeTokens (421614 , address (testUSDCContract) , amountToWithdraw, sender);
6768 vm.stopBroadcast ();
68-
69- // Switch back to Arbitrum Sepolia to check final balance
70- vm.createSelectFork (vm.envString ("ARBITRUM_SEPOLIA_RPC " ));
71- console.log ("Final sender balance: " , sender.balance);
7269 } else {
7370 console.log ("Available fees less than estimated gas cost " );
7471 }
0 commit comments