Skip to content

Commit 4f569b7

Browse files
committed
chore: update for new devnet
1 parent 4fc8161 commit 4f569b7

5 files changed

Lines changed: 33 additions & 33 deletions

File tree

.env.sample

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,22 @@
11
# RPCs
22
EVMX_RPC="https://rpc-evmx-devnet.socket.tech/"
3+
34
SEPOLIA_RPC="https://ethereum-sepolia-rpc.publicnode.com"
45
ARBITRUM_SEPOLIA_RPC="https://sepolia-rollup.arbitrum.io/rpc"
56
OPTIMISM_SEPOLIA_RPC="https://sepolia.optimism.io"
67
BASE_SEPOLIA_RPC="https://sepolia.base.org"
78

9+
ARBITRUM_RPC="https://arbitrum.drpc.org"
10+
OPTIMISM_RPC="https://optimism.drpc.org"
11+
BASE_RPC="https://base.drpc.org"
12+
813
# EVMx key addresses
914
# Find the most up to date addresses at:
1015
# https://github.com/SocketDotTech/socket-protocol/blob/master/deployments/stage_addresses.json
11-
ADDRESS_RESOLVER="0x21a9AFDfbEb0399D4a12f3AA1324042Be2B57F8e"
12-
FEES_MANAGER="0x30e07016eB24570629Bc8765CA307394Af90B27C"
13-
ARBITRUM_FEES_PLUG="0xDfE94B9b14de382Ed13C8A7F387884808D0f7E0b"
14-
ARBITRUM_TEST_USDC="0xa03Cbf13f331aF7c0fD7F2E28E6Cbc13F879E3F3"
16+
ADDRESS_RESOLVER="0x935b06902cA5C8bb4C76e18738561c294D377A93"
17+
FEES_MANAGER="0xA07208F9e7aE243F922317ab6604DC9F86822406"
18+
ARBITRUM_FEES_PLUG="0xee1Aef0b06f63Aa1c881838794Dd0876462c2B0d"
19+
ARBITRUM_USDC="0xaf88d065e77c8cC2239327C5EDb3A432268e5831"
1520

1621
# Add your deployer private key here
1722
# or remove it from this file if it is already an env var

script/counter/WithdrawFeesArbitrumFeesPlug.s.sol

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@ pragma solidity ^0.8.0;
33

44
import {Script} from "forge-std/Script.sol";
55
import {console} from "forge-std/console.sol";
6-
import {FeesManager} from "socket-protocol/contracts/evmx/payload-delivery/FeesManager.sol";
7-
import {TestUSDC} from "socket-protocol/contracts/evmx/helpers/TestUSDC.sol";
6+
import {FeesManager} from "socket-protocol/contracts/evmx/fees/FeesManager.sol";
87

98
import {CounterAppGateway} from "../../src/counter/CounterAppGateway.sol";
109

@@ -35,10 +34,10 @@ contract WithdrawFees is Script {
3534
vm.createSelectFork(vm.envString("EVMX_RPC"));
3635
FeesManager feesManager = FeesManager(payable(vm.envAddress("FEES_MANAGER")));
3736
address appGatewayAddress = vm.envAddress("APP_GATEWAY");
38-
TestUSDC testUSDCContract = TestUSDC(vm.envAddress("ARBITRUM_TEST_USDC"));
37+
address token = vm.envAddress("USDC");
3938

4039
CounterAppGateway appGateway = CounterAppGateway(appGatewayAddress);
41-
uint256 availableFees = feesManager.getMaxCreditsAvailableForWithdraw(appGatewayAddress);
40+
uint256 availableFees = feesManager.getAvailableCredits(appGatewayAddress);
4241
console.log("Available fees:", availableFees);
4342

4443
if (availableFees > 0) {
@@ -49,7 +48,7 @@ contract WithdrawFees is Script {
4948

5049
// Gas price from Arbitrum
5150
uint256 arbitrumGasPrice = block.basefee + 0.1 gwei; // With buffer
52-
uint256 gasLimit = 50_000_000_000; // Estimate
51+
uint256 gasLimit = 5_000_000; // Estimate
5352
uint256 estimatedGasCost = gasLimit * arbitrumGasPrice;
5453

5554
console.log("Arbitrum gas price (wei):", arbitrumGasPrice);
@@ -64,7 +63,7 @@ contract WithdrawFees is Script {
6463
vm.createSelectFork(vm.envString("EVMX_RPC"));
6564
vm.startBroadcast(privateKey);
6665
console.log("Withdrawing amount:", amountToWithdraw);
67-
appGateway.withdrawFeeTokens(421614, address(testUSDCContract), amountToWithdraw, sender);
66+
appGateway.withdrawCredits(421614, token, amountToWithdraw, sender);
6867
vm.stopBroadcast();
6968
} else {
7069
console.log("Available fees less than estimated gas cost");

script/helpers/AppGatewayFeeBalance.s.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ pragma solidity ^0.8.0;
33

44
import {Script} from "forge-std/Script.sol";
55
import {console} from "forge-std/console.sol";
6-
import {FeesManager} from "socket-protocol/contracts/evmx/payload-delivery/FeesManager.sol";
6+
import {FeesManager} from "socket-protocol/contracts/evmx/fees/FeesManager.sol";
77

88
contract CheckDepositedFees is Script {
99
function run() external {

src/counter/CounterAppGateway.sol

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,11 @@ contract CounterAppGateway is AppGatewayBase, Ownable {
2929
* @param addressResolver_ Address of the SOCKET Protocol's AddressResolver contract
3030
* @param fees_ Fee configuration for multi-chain operations
3131
*/
32-
constructor(address addressResolver_, uint256 fees_) AppGatewayBase(addressResolver_) {
32+
constructor(address addressResolver_, uint256 fees_) {
3333
creationCodeWithArgs[counter] = abi.encodePacked(type(Counter).creationCode);
3434
_setMaxFees(fees_);
3535
_initializeOwner(msg.sender);
36+
_initializeAppGateway(addressResolver_);
3637
}
3738

3839
/**
@@ -42,7 +43,7 @@ contract CounterAppGateway is AppGatewayBase, Ownable {
4243
* https://docs.socket.tech/writing-apps#onchain-contract-deployment-with-the-appgateway-contract
4344
* @param chainSlug_ The identifier of the target chain
4445
*/
45-
function deployContracts(uint32 chainSlug_) external async(bytes("")) {
46+
function deployContracts(uint32 chainSlug_) external async {
4647
_deploy(counter, chainSlug_, IsPlug.YES);
4748
}
4849

@@ -53,7 +54,7 @@ contract CounterAppGateway is AppGatewayBase, Ownable {
5354
* For more information on the initialize function, see:
5455
* https://docs.socket.tech/deploy#initialize
5556
*/
56-
function initialize(uint32 /* chainSlug_ */ ) public pure override {
57+
function initializeOnChain(uint32 /* chainSlug_ */ ) public pure override {
5758
return;
5859
}
5960

@@ -62,7 +63,7 @@ contract CounterAppGateway is AppGatewayBase, Ownable {
6263
* @dev Calls the increase function on each counter instance provided
6364
* @param instances_ Array of counter contract addresses to increment
6465
*/
65-
function incrementCounters(address[] memory instances_) public async(bytes("")) {
66+
function incrementCounters(address[] memory instances_) public async {
6667
for (uint256 i = 0; i < instances_.length; i++) {
6768
ICounter(instances_[i]).increase();
6869
}
@@ -85,7 +86,7 @@ contract CounterAppGateway is AppGatewayBase, Ownable {
8586
* @param amount_ The amount to withdraw
8687
* @param receiver_ The address that will receive the withdrawn fees
8788
*/
88-
function withdrawFeeTokens(uint32 chainSlug_, address token_, uint256 amount_, address receiver_) external {
89-
_withdrawFeeTokens(chainSlug_, token_, amount_, receiver_);
89+
function withdrawCredits(uint32 chainSlug_, address token_, uint256 amount_, address receiver_) external {
90+
_withdrawCredits(chainSlug_, token_, amount_, receiver_);
9091
}
9192
}

test/apps/Counter.t.sol

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,35 +3,32 @@ pragma solidity ^0.8.21;
33

44
import {CounterAppGateway} from "../../src/counter/CounterAppGateway.sol";
55
import {Counter} from "../../src/counter/Counter.sol";
6-
import "socket-protocol/test/DeliveryHelper.t.sol";
6+
import "socket-protocol/test/SetupTest.t.sol";
77

8-
contract CounterTest is DeliveryHelperTest {
8+
contract CounterTest is AppGatewayBaseSetup {
99
uint256 feesAmount = 0.01 ether;
1010

1111
bytes32 counterId;
1212
bytes32[] contractIds = new bytes32[](1);
13-
1413
CounterAppGateway counterGateway;
1514

16-
function deploySetup() internal {
17-
setUpDeliveryHelper();
15+
event CounterScheduleResolved(uint256 creationTimestamp, uint256 executionTimestamp);
1816

19-
counterGateway = new CounterAppGateway(address(addressResolver), feesAmount);
20-
depositUSDCFees(
21-
address(counterGateway),
22-
OnChainFees({chainSlug: arbChainSlug, token: address(arbConfig.feesTokenUSDC), amount: 1 ether})
23-
);
17+
function setUp() public {
18+
deploy();
2419

20+
counterGateway = new CounterAppGateway(address(addressResolver), feesAmount);
21+
depositNativeAndCredits(arbChainSlug, 1 ether, 0, address(counterGateway));
2522
counterId = counterGateway.counter();
2623
contractIds[0] = counterId;
2724
}
2825

2926
function deployCounterApp(uint32 chainSlug) internal returns (uint40 requestCount) {
30-
requestCount = _deploy(chainSlug, counterGateway, contractIds);
27+
counterGateway.deployContracts(chainSlug);
28+
requestCount = executeDeploy(counterGateway, chainSlug, contractIds);
3129
}
3230

3331
function testCounterDeployment() external {
34-
deploySetup();
3532
deployCounterApp(arbChainSlug);
3633

3734
(address onChain, address forwarder) = getOnChainAndForwarderAddresses(arbChainSlug, counterId, counterGateway);
@@ -41,7 +38,6 @@ contract CounterTest is DeliveryHelperTest {
4138
}
4239

4340
function testCounterIncrement() external {
44-
deploySetup();
4541
deployCounterApp(arbChainSlug);
4642

4743
(address arbCounter, address arbCounterForwarder) =
@@ -52,13 +48,12 @@ contract CounterTest is DeliveryHelperTest {
5248
address[] memory instances = new address[](1);
5349
instances[0] = arbCounterForwarder;
5450
counterGateway.incrementCounters(instances);
55-
executeRequest(new bytes[](0));
51+
executeRequest();
5652

5753
assertEq(Counter(arbCounter).counter(), arbCounterBefore + 1);
5854
}
5955

6056
function testCounterIncrementMultipleChains() public {
61-
deploySetup();
6257
deployCounterApp(arbChainSlug);
6358
deployCounterApp(optChainSlug);
6459

@@ -79,7 +74,7 @@ contract CounterTest is DeliveryHelperTest {
7974
chains[0] = arbChainSlug;
8075
chains[1] = optChainSlug;
8176

82-
executeRequest(new bytes[](0));
77+
executeRequest();
8378
assertEq(Counter(arbCounter).counter(), arbCounterBefore + 1);
8479
assertEq(Counter(optCounter).counter(), optCounterBefore + 1);
8580
}

0 commit comments

Comments
 (0)