Skip to content

Commit 5f3aa38

Browse files
committed
Add initial Schedule script
1 parent a9f6423 commit 5f3aa38

3 files changed

Lines changed: 128 additions & 1 deletion

File tree

README.md

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ forge verify-contract --rpc-url https://rpc.ankr.com/arbitrum_sepolia --verifier
187187
```
188188

189189
### 5. **Run EVMx Deploy Script**
190-
Finally, run the EVMx Write script:
190+
Finally, run the EVMx Deploy script:
191191
```bash
192192
forge script script/deploy/RunEVMxDeploy.s.sol --broadcast --skip-simulation --with-gas-price 0 --legacy --sig "runTests()"
193193
```
@@ -196,3 +196,39 @@ forge script script/deploy/RunEVMxDeploy.s.sol --broadcast --skip-simulation --w
196196
```bash
197197
forge script script/deploy/RunEVMxDeploy.s.sol --broadcast --sig "withdrawAppFees()" --legacy --with-gas-price 0
198198
```
199+
200+
# Deployment Steps for EVMx Schedule Tests
201+
202+
Follow these steps to deploy and run the EVMx Write tests.
203+
204+
### 1. **Deploy the EVMx Schedule Tests Script**
205+
Run the following command to deploy the EVMx Schedule tests script:
206+
```bash
207+
forge script script/schedule/RunEVMxSchedule.s.sol --broadcast --skip-simulation --with-gas-price 0 --legacy --sig "deployAppGateway()"
208+
```
209+
210+
### 1a. **Verify the Contract**
211+
Verify the `ScheduleAppGateway` contract on Blockscout:
212+
```bash
213+
forge verify-contract --rpc-url https://rpc-evmx-devnet.socket.tech/ --verifier blockscout --verifier-url https://evmx.cloud.blockscout.com/api <APP_GATEWAY_ADDRESS> src/schedule/ScheduleAppGateway.sol:ScheduleAppGateway
214+
```
215+
216+
### 2. **Update the `APP_GATEWAY` in `.env`**
217+
Make sure to update the `APP_GATEWAY` address in your `.env` file.
218+
219+
### 3. **Pay Fees in Arbitrum ETH**
220+
Run the script to pay fees in Arbitrum ETH:
221+
```bash
222+
forge script lib/socket-protocol/script/helpers/PayFeesInArbitrumETH.s.sol --broadcast --skip-simulation
223+
```
224+
225+
### 4. **Run EVMx Schedule Script**
226+
Finally, run the EVMx Schedule script:
227+
```bash
228+
forge script script/schedule/RunEVMxSchedule.s.sol --broadcast --skip-simulation --with-gas-price 0 --legacy --sig "runTimers()"
229+
```
230+
231+
### 5. Withdraw funds
232+
```bash
233+
forge script script/schedule/RunEVMxSchedule.s.sol --broadcast --sig "withdrawAppFees()" --legacy --with-gas-price 0
234+
```
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
// SPDX-License-Identifier: MIT
2+
pragma solidity ^0.8.0;
3+
4+
import {console} from "forge-std/console.sol";
5+
import {SetupScript} from "../SetupScript.sol";
6+
import {ScheduleAppGateway} from "../../src/schedule/ScheduleAppGateway.sol";
7+
8+
contract RunEVMxSchedule is SetupScript {
9+
ScheduleAppGateway scheduleAppGateway;
10+
address opSepForwarder;
11+
address arbSepForwarder;
12+
13+
function appGateway() internal view override returns (address) {
14+
return address(scheduleAppGateway);
15+
}
16+
17+
function deployAppGatewayContract() internal override returns (address) {
18+
// Deploy ScheduleAppGateway
19+
ScheduleAppGateway newGateway = new ScheduleAppGateway(addressResolver, deployFees);
20+
return address(newGateway);
21+
}
22+
23+
// Initialize contract references
24+
function init() internal {
25+
scheduleAppGateway = ScheduleAppGateway(appGatewayAddress);
26+
}
27+
28+
function executeScriptSpecificLogic() internal override {
29+
init();
30+
scheduleAppGateway.triggerTimeouts();
31+
}
32+
33+
function run() external pure {
34+
console.log("Please call one of these external functions: deployAppGateway() or runTimers()");
35+
}
36+
37+
function deployAppGateway() external {
38+
_deployAppGateway();
39+
}
40+
41+
function withdrawAppFees() external {
42+
init();
43+
_withdrawAppFees(arbSepChainId);
44+
}
45+
46+
function runTimers() external {
47+
_run(arbSepChainId);
48+
}
49+
}
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
// SPDX-License-Identifier: GPL-3.0
2+
pragma solidity >=0.7.0 <0.9.0;
3+
4+
import "socket-protocol/contracts/base/AppGatewayBase.sol";
5+
6+
contract ScheduleAppGateway is AppGatewayBase {
7+
uint256[] public resolveTimes = new uint256[](10);
8+
9+
uint256[] public timeoutDurations = [1, 10, 20, 30, 40, 50, 100, 500, 1000, 10000];
10+
11+
constructor(address addressResolver_, Fees memory fees_) AppGatewayBase(addressResolver_) {
12+
_setOverrides(fees_);
13+
}
14+
15+
function deployContracts(uint32) external async {
16+
return;
17+
}
18+
19+
function initialize(uint32) public pure override {
20+
return;
21+
}
22+
23+
function triggerTimeouts() public {
24+
for (uint256 i = 0; i < timeoutDurations.length; i++) {
25+
watcherPrecompile__().setTimeout(
26+
address(this), abi.encodeWithSelector(this.resolveTimeout.selector, i), timeoutDurations[i]
27+
);
28+
}
29+
}
30+
31+
function resolveTimeout(uint256 index_) public {
32+
resolveTimes[index_] = block.timestamp;
33+
}
34+
35+
function setFees(Fees memory fees_) public {
36+
fees = fees_;
37+
}
38+
39+
function withdrawFeeTokens(uint32 chainSlug_, address token_, uint256 amount_, address receiver_) external {
40+
_withdrawFeeTokens(chainSlug_, token_, amount_, receiver_);
41+
}
42+
}

0 commit comments

Comments
 (0)