Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
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
29 changes: 29 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Stargate V2 Endpoints
STARGATE_ENDPOINT_ETHEREUM=0x1a44076050125825900e736c501f859c50fE728c
STARGATE_ENDPOINT_BASE=0x1a44076050125825900e736c501f859c50fE728c
STARGATE_ENDPOINT_BSC=0x1a44076050125825900e736c501f859c50fE728c
STARGATE_ENDPOINT_AVALANCHE=0x1a44076050125825900e736c501f859c50fE728c
STARGATE_ENDPOINT_POLYGON=0x1a44076050125825900e736c501f859c50fE728c
STARGATE_ENDPOINT_ARBITRUM=0x1a44076050125825900e736c501f859c50fE728c
STARGATE_ENDPOINT_OPTIMISM=0x1a44076050125825900e736c501f859c50fE728c

# RPC Endpoints
ETHEREUM_RPC_URL=
OPTIMISM_RPC_URL=
BASE_RPC_URL=
BSC_RPC_URL=
AVALANCHE_RPC_URL=
POLYGON_RPC_URL=
ARBITRUM_RPC_URL=

# Etherscan API Keys
ETHEREUM_SCAN_API_KEY=
OPTIMISM_SCAN_API_KEY=
BASE_SCAN_API_KEY=
BSC_SCAN_API_KEY=
# AVALANCHE_SCAN_API_KEY=
POLYGON_SCAN_API_KEY=
ARBITRUM_SCAN_API_KEY=

# Private Key for Deployment
PRIVATE_KEY=
18 changes: 11 additions & 7 deletions .github/workflows/test.yml → .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
name: test
name: Build

on: workflow_dispatch
on:
push:
branches: ["main"]
pull_request:
branches: ["main"]

env:
FOUNDRY_PROFILE: ci
Expand All @@ -19,13 +23,13 @@ jobs:
with:
version: nightly

- name: Run Forge build
- name: Forge build
run: |
forge --version
forge build --sizes
id: build

- name: Run Forge tests
run: |
forge test -vvv --rpc-url ${{ secrets.BSC_RPC_URL }}
id: test
# - name: Forge tests
# run: |
# forge test -vvv --rpc-url ${{ secrets.BSC_RPC_URL }}
# id: test
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
# Compiler files
cache/
out/
zkout/

# Ignores development broadcast logs
!/broadcast
broadcast/
/broadcast/*/31337/
/broadcast/**/dry-run/

Expand Down
16 changes: 14 additions & 2 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
[submodule "bsc/hub_reader/lib/forge-std"]
path = bsc/hub_reader/lib/forge-std
[submodule "lib/forge-std"]
path = lib/forge-std
url = https://github.com/foundry-rs/forge-std
[submodule "lib/openzeppelin-contracts"]
path = lib/openzeppelin-contracts
url = https://github.com/OpenZeppelin/openzeppelin-contracts
[submodule "lib/layerzero-v2"]
path = lib/layerzero-v2
url = https://github.com/LayerZero-Labs/layerzero-v2
[submodule "lib/stargate-v2"]
path = lib/stargate-v2
url = https://github.com/stargate-protocol/stargate-v2
[submodule "lib/solidity-bytes-utils"]
path = lib/solidity-bytes-utils
url = https://github.com/GNSPS/solidity-bytes-utils
4 changes: 4 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"editor.formatOnSave": true,
"solidity.formatter": "forge",
}
23 changes: 19 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@

A collection of smart contracts for Gem Wallet.

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

## Development

1. Install [Foundry](https://book.getfoundry.sh/) and you're good to go.
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.
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.

## Usage

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

```shell
# deploy hub_reader
cd bsc/hub_reader
forge script script/HubReader.s.sol:HubReaderScript --rpc-url "$BSC_RPC_URL" --broadcast --verify -vvvv
just deploy-hub-reader
```

```shell
# deploy stargate to all supported chains
just deploy-stargate
```

```shell
# deploy stargate to specific chain
just deploy-stargate optimism
```





46 changes: 0 additions & 46 deletions bsc/hub_reader/broadcast/HubReader.s.sol/56/run-1715346908.json

This file was deleted.

Loading