Skip to content

Commit 800ba44

Browse files
authored
Merge pull request #1 from gemwalletcom/feat/stargate-receiver
feat: stargate receiver
2 parents 6b36f90 + 2a642f1 commit 800ba44

33 files changed

+617
-303
lines changed

.env.example

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Stargate V2 Endpoints
2+
STARGATE_ENDPOINT_ETHEREUM=0x1a44076050125825900e736c501f859c50fE728c
3+
STARGATE_ENDPOINT_BASE=0x1a44076050125825900e736c501f859c50fE728c
4+
STARGATE_ENDPOINT_BSC=0x1a44076050125825900e736c501f859c50fE728c
5+
STARGATE_ENDPOINT_AVALANCHE=0x1a44076050125825900e736c501f859c50fE728c
6+
STARGATE_ENDPOINT_POLYGON=0x1a44076050125825900e736c501f859c50fE728c
7+
STARGATE_ENDPOINT_ARBITRUM=0x1a44076050125825900e736c501f859c50fE728c
8+
STARGATE_ENDPOINT_OPTIMISM=0x1a44076050125825900e736c501f859c50fE728c
9+
10+
# RPC Endpoints
11+
ETHEREUM_RPC_URL=
12+
OPTIMISM_RPC_URL=
13+
BASE_RPC_URL=
14+
BSC_RPC_URL=
15+
AVALANCHE_RPC_URL=
16+
POLYGON_RPC_URL=
17+
ARBITRUM_RPC_URL=
18+
19+
# Etherscan API Keys
20+
ETHEREUM_SCAN_API_KEY=
21+
OPTIMISM_SCAN_API_KEY=
22+
BASE_SCAN_API_KEY=
23+
BSC_SCAN_API_KEY=
24+
# AVALANCHE_SCAN_API_KEY=
25+
POLYGON_SCAN_API_KEY=
26+
ARBITRUM_SCAN_API_KEY=
27+
28+
# Private Key for Deployment
29+
PRIVATE_KEY=

.github/workflows/test.yml renamed to .github/workflows/ci.yml

+11-7
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
1-
name: test
1+
name: Build
22

3-
on: workflow_dispatch
3+
on:
4+
push:
5+
branches: ["main"]
6+
pull_request:
7+
branches: ["main"]
48

59
env:
610
FOUNDRY_PROFILE: ci
@@ -19,13 +23,13 @@ jobs:
1923
with:
2024
version: nightly
2125

22-
- name: Run Forge build
26+
- name: Forge build
2327
run: |
2428
forge --version
2529
forge build --sizes
2630
id: build
2731

28-
- name: Run Forge tests
29-
run: |
30-
forge test -vvv --rpc-url ${{ secrets.BSC_RPC_URL }}
31-
id: test
32+
# - name: Forge tests
33+
# run: |
34+
# forge test -vvv --rpc-url ${{ secrets.BSC_RPC_URL }}
35+
# id: test

.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
# Compiler files
22
cache/
33
out/
4+
zkout/
45

56
# Ignores development broadcast logs
6-
!/broadcast
7+
broadcast/
78
/broadcast/*/31337/
89
/broadcast/**/dry-run/
910

.gitmodules

+14-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1-
[submodule "bsc/hub_reader/lib/forge-std"]
2-
path = bsc/hub_reader/lib/forge-std
1+
[submodule "lib/forge-std"]
2+
path = lib/forge-std
33
url = https://github.com/foundry-rs/forge-std
4+
[submodule "lib/openzeppelin-contracts"]
5+
path = lib/openzeppelin-contracts
6+
url = https://github.com/OpenZeppelin/openzeppelin-contracts
7+
[submodule "lib/layerzero-v2"]
8+
path = lib/layerzero-v2
9+
url = https://github.com/LayerZero-Labs/layerzero-v2
10+
[submodule "lib/stargate-v2"]
11+
path = lib/stargate-v2
12+
url = https://github.com/stargate-protocol/stargate-v2
13+
[submodule "lib/solidity-bytes-utils"]
14+
path = lib/solidity-bytes-utils
15+
url = https://github.com/GNSPS/solidity-bytes-utils

.vscode/settings.json

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"editor.formatOnSave": true,
3+
"solidity.formatter": "forge",
4+
}

README.md

+19-4
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@
22

33
A collection of smart contracts for Gem Wallet.
44

5-
- [bsc/hub_reader](bsc/hub_reader): A contract that simplify interacting with BSC Staking Hub
5+
- [src/hub_reader](src/hub_reader): A contract that simplify interacting with BSC Staking Hub
6+
- [src/stargate](src/stargate): A contract that allow to do onchain calls on destination chain after Stargate Bridge
67

78
## Development
89

910
1. Install [Foundry](https://book.getfoundry.sh/) and you're good to go.
10-
2. Configure `.env` file with your `BSC_RPC_URL` and `BSCSCAN_API_KEY`, if you need to deploy the contract, you need to set `PRIVATE_KEY` as well.
11+
2. Configure `.env` using `.env.example` rpcs (if needed) and etherscan values, if you need to deploy the contract, you need to set `PRIVATE_KEY` as well.
1112

1213
## Usage
1314

@@ -27,6 +28,20 @@ forge test --rpc-url <your_rpc_url>
2728

2829
```shell
2930
# deploy hub_reader
30-
cd bsc/hub_reader
31-
forge script script/HubReader.s.sol:HubReaderScript --rpc-url "$BSC_RPC_URL" --broadcast --verify -vvvv
31+
just deploy-hub-reader
3232
```
33+
34+
```shell
35+
# deploy stargate to all supported chains
36+
just deploy-stargate
37+
```
38+
39+
```shell
40+
# deploy stargate to specific chain
41+
just deploy-stargate optimism
42+
```
43+
44+
45+
46+
47+

bsc/hub_reader/broadcast/HubReader.s.sol/56/run-1715346908.json

-46
This file was deleted.

0 commit comments

Comments
 (0)