Skip to content

Commit

Permalink
Merge pull request #123 from astraly-labs/feat/kakarot_evm
Browse files Browse the repository at this point in the history
feat: Kakarot EVM deployments
  • Loading branch information
akhercha authored Oct 14, 2024
2 parents 75c3205 + 0475cf8 commit b0383eb
Show file tree
Hide file tree
Showing 131 changed files with 54,651 additions and 0 deletions.
10 changes: 10 additions & 0 deletions kakarot/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
RPC_URL=https://sepolia-rpc.kakarot.org
ETHERSCAN_VERIFY_URL=https://api.routescan.io/v2/network/testnet/evm/920637907288165/etherscan

DEPLOYER_PRIVATE_KEY=0x0

PRAGMA_ORACLE_DEPLOYED_CAIRO_ADDRESS=0x0

PRAGMA_CALLER_DEPLOYED_ADDRESS=0x0

EXAMPLE_ADDRESS=0x0
15 changes: 15 additions & 0 deletions kakarot/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Compiler files
cache/
out/

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

# Docs
docs/

# Dotenv file
.env
broadcast/
6 changes: 6 additions & 0 deletions kakarot/.gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[submodule "lib/forge-std"]
path = lib/forge-std
url = https://github.com/foundry-rs/forge-std
[submodule "lib/kakarot-lib"]
path = lib/kakarot-lib
url = https://github.com/kkrt-labs/kakarot-lib
97 changes: 97 additions & 0 deletions kakarot/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
# PragmaCaller deployer

Sample scripts to be able to deploy the PragmaCaller contract to Kakarot and verify it.

## Set up env variables

You'll need to set up the variables before doing anything:

```sh
# RPC Url - default is Sepolia
RPC_URL=https://sepolia-rpc.kakarot.org

# Etherscan URL used to verify the contract - default is Sepolia
ETHERSCAN_VERIFY_URL=https://api.routescan.io/v2/network/testnet/evm/1802203764_2/etherscan

# Deployer that will be used to deploy PragmaCaller to Kakarot
DEPLOYER_PRIVATE_KEY=0x0

# Address of the pre-deployed PragmaOracle cairo contract
PRAGMA_ORACLE_DEPLOYED_CAIRO_ADDRESS=0x3a99b4b9f711002f1976b3973f4b2031fe6056518615ff0f4e6dd829f972764

# Once PragmaCaller has been deployed, write the address here and call `verify.sh`
PRAGMA_CALLER_DEPLOYED_ADDRESS=0x7491cA3699701a187C1a17308338Ad0bA258B082
```

## Deploy

First, activate the .env variables:

```bash
source .env
```

#### PragmaCaller

```shell
forge script script/PragmaCaller.s.sol \
--broadcast --rpc-url $RPC_URL \
--verifier-url '$ETHERSCAN_VERIFY_URL' \
--etherscan-api-key "verifyContract"
```

#### CallerExample

```shell
forge script script/CallerExample.s.sol \
--broadcast --rpc-url $RPC_URL \
--verifier-url '$ETHERSCAN_VERIFY_URL' \
--etherscan-api-key "verifyContract"
```

#### Feeds

```shell
PAIR_ID="24011449254105924" forge script script/PragmaAggregatorV3.s.sol \
--broadcast --rpc-url $RPC_URL \
--verifier-url '$ETHERSCAN_VERIFY_URL' \
--etherscan-api-key "verifyContract"
```

## Documentation

https://book.getfoundry.sh/

## Usage

### Build

```shell
$ forge build
```

### Format

```shell
$ forge fmt
```

### Gas Snapshots

```shell
$ forge snapshot
```

### Anvil

```shell
$ anvil
```

### Help

```shell
$ forge --help
$ anvil --help
$ cast --help
```
44 changes: 44 additions & 0 deletions kakarot/deployments/sepolia.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
"PragmaCaller": "0x5a3d161e5c63511F97F51fbF366B8238Cd0bBeAc",
"CallerExample": "0x3899D87a02eFaB864C9306DCd2EDe06B90f28B14",
"BTC/USD": {
"pair_id": "18669995996566340",
"contract": "0x330ec0B08B74a4F34Fd76B0917A55169885624Be"
},
"ETH/USD": {
"pair_id": "19514442401534788",
"contract": "0xcD025F607AdB9542B77C69A29B7b9Aa32Bf06811"
},
"WBTC/USD": {
"pair_id": "6287680677296296772",
"contract": "0x4604A5b10818638F751829A580362eD5a42b9E5E"
},
"USDC/USD": {
"pair_id": "6148332971638477636",
"contract": "0xa3C78F0fd24523d1D5A70e47086343A445976911"
},
"USDT/USD": {
"pair_id": "6148333044652921668",
"contract": "0x52880cAe955C88546134e7394B4305c2fA79faB8"
},
"WSTETH/USD": {
"pair_id": "412383036120118613857092",
"contract": "0x5Ad588FDF6a8851c4098fC3aec535f0A66316C0F"
},
"STRK/USD": {
"pair_id": "6004514686061859652",
"contract": "0x7225f3743668B2751075cd53D25B449ca9967718"
},
"UNI/USD": {
"pair_id": "24011449254105924",
"contract": "0x858FA2FacF63A3e529cAb4F5a02ceaFb590db2c1"
},
"EKUBO/USD": {
"pair_id": "1278253658919688033092",
"contract": "0xa07CC3ff0557fD0F01FFb004469103353D6126F4"
},
"LORDS/USD": {
"pair_id": "1407668255603079598916",
"contract": "0xac0e304dA34912C9eD1d29a212feC74B36Eea4d6"
}
}
6 changes: 6 additions & 0 deletions kakarot/foundry.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[profile.default]
src = "src"
out = "out"
libs = ["lib"]

# See more config options https://github.com/foundry-rs/foundry/blob/master/crates/config/README.md#all-options
1 change: 1 addition & 0 deletions kakarot/lib/forge-std/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
src/Vm.sol linguist-generated
128 changes: 128 additions & 0 deletions kakarot/lib/forge-std/.github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
name: CI

on:
workflow_dispatch:
pull_request:
push:
branches:
- master

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly

- name: Print forge version
run: forge --version

# Backwards compatibility checks:
# - the oldest and newest version of each supported minor version
# - versions with specific issues
- name: Check compatibility with latest
if: always()
run: |
output=$(forge build --skip test)
if echo "$output" | grep -q "Warning"; then
echo "$output"
exit 1
fi
- name: Check compatibility with 0.8.0
if: always()
run: |
output=$(forge build --skip test --use solc:0.8.0)
if echo "$output" | grep -q "Warning"; then
echo "$output"
exit 1
fi
- name: Check compatibility with 0.7.6
if: always()
run: |
output=$(forge build --skip test --use solc:0.7.6)
if echo "$output" | grep -q "Warning"; then
echo "$output"
exit 1
fi
- name: Check compatibility with 0.7.0
if: always()
run: |
output=$(forge build --skip test --use solc:0.7.0)
if echo "$output" | grep -q "Warning"; then
echo "$output"
exit 1
fi
- name: Check compatibility with 0.6.12
if: always()
run: |
output=$(forge build --skip test --use solc:0.6.12)
if echo "$output" | grep -q "Warning"; then
echo "$output"
exit 1
fi
- name: Check compatibility with 0.6.2
if: always()
run: |
output=$(forge build --skip test --use solc:0.6.2)
if echo "$output" | grep -q "Warning"; then
echo "$output"
exit 1
fi
# via-ir compilation time checks.
- name: Measure compilation time of Test with 0.8.17 --via-ir
if: always()
run: forge build --skip test --contracts test/compilation/CompilationTest.sol --use solc:0.8.17 --via-ir

- name: Measure compilation time of TestBase with 0.8.17 --via-ir
if: always()
run: forge build --skip test --contracts test/compilation/CompilationTestBase.sol --use solc:0.8.17 --via-ir

- name: Measure compilation time of Script with 0.8.17 --via-ir
if: always()
run: forge build --skip test --contracts test/compilation/CompilationScript.sol --use solc:0.8.17 --via-ir

- name: Measure compilation time of ScriptBase with 0.8.17 --via-ir
if: always()
run: forge build --skip test --contracts test/compilation/CompilationScriptBase.sol --use solc:0.8.17 --via-ir

test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly

- name: Print forge version
run: forge --version

- name: Run tests
run: forge test -vvv

fmt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly

- name: Print forge version
run: forge --version

- name: Check formatting
run: forge fmt --check
31 changes: 31 additions & 0 deletions kakarot/lib/forge-std/.github/workflows/sync.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Sync Release Branch

on:
release:
types:
- created

jobs:
sync-release-branch:
runs-on: ubuntu-latest
if: startsWith(github.event.release.tag_name, 'v1')
steps:
- name: Check out the repo
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: v1

# The email is derived from the bots user id,
# found here: https://api.github.com/users/github-actions%5Bbot%5D
- name: Configure Git
run: |
git config user.name github-actions[bot]
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
- name: Sync Release Branch
run: |
git fetch --tags
git checkout v1
git reset --hard ${GITHUB_REF}
git push --force
4 changes: 4 additions & 0 deletions kakarot/lib/forge-std/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
cache/
out/
.vscode
.idea
Loading

0 comments on commit b0383eb

Please sign in to comment.