Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: 💫 New Kakarot Interfaces #131

Closed
wants to merge 12 commits into from
Closed
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@ jobs:
steps:
- uses: actions/checkout@v3
- uses: software-mansion/setup-scarb@v1

- run: scarb fmt --check
- run: scarb test
2 changes: 1 addition & 1 deletion .github/workflows/gas_snapshot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
run: python pragma-deployer/pragma_deployer/gas_usage/gen_snapshot.py

- name: Upload gas snapshot to GitHub Artifacts
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: gas-snapshot
path: gas_snapshot.json
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "kakarot-evm-interface/lib/kakarot-lib"]
path = kakarot-evm-interface/lib/kakarot-lib
url = https://github.com/kkrt-labs/kakarot-lib
10 changes: 5 additions & 5 deletions kakarot-evm-interface/.env.example
Original file line number Diff line number Diff line change
@@ -1,10 +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
CAIRO_PRAGMA_ORACLE_ADDRESS=0x36031daa264c24520b11d93af622c848b2499b66b41d611bac95e13cfca131a
CAIRO_PRAGMA_SUMMARY_STATS_ADDRESS=0x379afb83d2f8e38ab08252750233665a812a24278aacdde52475618edbf879c

PRAGMA_ORACLE_DEPLOYED_CAIRO_ADDRESS=0x0
EVM_PRIVATE_KEY=0x0
EVM_PRAGMA_CALLER_ADDRESS=0x0

PRAGMA_CALLER_DEPLOYED_ADDRESS=0x0

EXAMPLE_ADDRESS=0x0
PAIR_ID=0
45 changes: 38 additions & 7 deletions kakarot-evm-interface/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,18 @@ 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

# Cairo address of the Pragma Oracle - see deployments
CAIRO_PRAGMA_ORACLE_ADDRESS=0x0
CAIRO_PRAGMA_SUMMARY_STATS_ADDRESS=0x0

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

# Address of the pre-deployed PragmaOracle cairo contract
PRAGMA_ORACLE_DEPLOYED_CAIRO_ADDRESS=0x3a99b4b9f711002f1976b3973f4b2031fe6056518615ff0f4e6dd829f972764
# Set this to the PragmaCaller deployed address on Kakarot once deployed
EVM_PRAGMA_CALLER_ADDRESS=0x0

# Once PragmaCaller has been deployed, write the address here and call `verify.sh`
PRAGMA_CALLER_DEPLOYED_ADDRESS=0x7491cA3699701a187C1a17308338Ad0bA258B082
# Set this to the pair you want to use for the PragmaAggregatorV3 interface
PAIR_ID=0
```

## Deploy
Expand All @@ -36,8 +40,17 @@ source .env
```shell
forge script script/PragmaCaller.s.sol \
--broadcast --rpc-url $RPC_URL \
--verifier-url '$ETHERSCAN_VERIFY_URL' \
--verifier-url $ETHERSCAN_VERIFY_URL \
--etherscan-api-key "verifyContract"

# or just verify

forge verify-contract $EVM_PRAGMA_CALLER_ADDRESS src/PragmaCaller.sol:PragmaCaller \
--verifier-url 'https://api.routescan.io/v2/network/testnet/evm/920637907288165/etherscan' \
--etherscan-api-key "verifyContract" \
--num-of-optimizations 200 \
--compiler-version 0.8.28 \
--constructor-args $(cast abi-encode "constructor(uint256 pragmaOracleAddress, uint256 pragmaSummaryStatsAddress)" $CAIRO_PRAGMA_ORACLE_ADDRESS $CAIRO_PRAGMA_SUMMARY_STATS_ADDRESS)
```

#### CallerExample
Expand All @@ -47,15 +60,33 @@ forge script script/CallerExample.s.sol \
--broadcast --rpc-url $RPC_URL \
--verifier-url '$ETHERSCAN_VERIFY_URL' \
--etherscan-api-key "verifyContract"

# or just verify

forge verify-contract $EVM_PRAGMA_CALLER_EXAMPLE_ADDRESS src/CallerExample.sol:CallerExample \
--verifier-url 'https://api.routescan.io/v2/network/testnet/evm/920637907288165/etherscan' \
--etherscan-api-key "verifyContract" \
--num-of-optimizations 200 \
--compiler-version 0.8.28 \
--constructor-args $(cast abi-encode "constructor(address pragmaCallerAddress)" $EVM_PRAGMA_CALLER_ADDRESS)
```

#### Feeds

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

# or just verify

PAIR_ID="1407668255603079598916" forge verify-contract [CONTRACT_DEPLOYED_ABOVE] src/PragmaAggregatorV3.sol:PragmaAggregatorV3 \
--verifier-url 'https://api.routescan.io/v2/network/testnet/evm/920637907288165/etherscan' \
--etherscan-api-key "verifyContract" \
--num-of-optimizations 200 \
--compiler-version 0.8.28 \
--constructor-args $(cast abi-encode "constructor(address _pragmaCaller, uint256 _pairId)" $EVM_PRAGMA_CALLER_ADDRESS $PAIR_ID)
```

## Documentation
Expand Down
24 changes: 12 additions & 12 deletions kakarot-evm-interface/deployments/sepolia.json
Original file line number Diff line number Diff line change
@@ -1,44 +1,44 @@
{
"PragmaCaller": "0x5a3d161e5c63511F97F51fbF366B8238Cd0bBeAc",
"CallerExample": "0x3899D87a02eFaB864C9306DCd2EDe06B90f28B14",
"PragmaCaller": "0x874C3C6299E2166DE37838a8F15f52952b25f186",
"CallerExample": "0xF3FA7Cf1A77133e7734800cEb84D1aBBA214576D",
"BTC/USD": {
"pair_id": "18669995996566340",
"contract": "0x330ec0B08B74a4F34Fd76B0917A55169885624Be"
"contract": "0x9999bcA6284AD4A0503E93ae418566786d52C0f8"
},
"ETH/USD": {
"pair_id": "19514442401534788",
"contract": "0xcD025F607AdB9542B77C69A29B7b9Aa32Bf06811"
"contract": "0xbDF3294C51ADD204ef06F1d2C2d11d4aa94725f8"
},
"WBTC/USD": {
"pair_id": "6287680677296296772",
"contract": "0x4604A5b10818638F751829A580362eD5a42b9E5E"
"contract": "0x8Ca18fAB3D3e6e12236599a5604ef0D918f468D7"
},
"USDC/USD": {
"pair_id": "6148332971638477636",
"contract": "0xa3C78F0fd24523d1D5A70e47086343A445976911"
"contract": "0x3DE32d3Be34315b1De89C2108bCebf2771B1aC61"
},
"USDT/USD": {
"pair_id": "6148333044652921668",
"contract": "0x52880cAe955C88546134e7394B4305c2fA79faB8"
"contract": "0x98629B2B14E21248e99906A04B923eA5ae8B3Cc5"
},
"WSTETH/USD": {
"pair_id": "412383036120118613857092",
"contract": "0x5Ad588FDF6a8851c4098fC3aec535f0A66316C0F"
"contract": "0x5E412799a9B3ABa0f098768bDbbC70AdA94195e5"
},
"STRK/USD": {
"pair_id": "6004514686061859652",
"contract": "0x7225f3743668B2751075cd53D25B449ca9967718"
"contract": "0x3634ae539bFA68c055C8A714438542766f14D192"
},
"UNI/USD": {
"pair_id": "24011449254105924",
"contract": "0x858FA2FacF63A3e529cAb4F5a02ceaFb590db2c1"
"contract": "0x31C73089f62c6Fc41ea59feA34E927DDB9Ee93fb"
},
"EKUBO/USD": {
"pair_id": "1278253658919688033092",
"contract": "0xa07CC3ff0557fD0F01FFb004469103353D6126F4"
"contract": "0x9fC4779897AEDe45B8Bf74669EDCD4038163565b"
},
"LORDS/USD": {
"pair_id": "1407668255603079598916",
"contract": "0xac0e304dA34912C9eD1d29a212feC74B36Eea4d6"
"contract": "0x27ae6f192E8d97Cd37922FFB83789e000A5A18Ce"
}
}
1 change: 1 addition & 0 deletions kakarot-evm-interface/lib/kakarot-lib
Submodule kakarot-lib added at a3714b
34 changes: 0 additions & 34 deletions kakarot-evm-interface/lib/kakarot-lib/.github/workflows/test.yml

This file was deleted.

14 changes: 0 additions & 14 deletions kakarot-evm-interface/lib/kakarot-lib/.gitignore

This file was deleted.

3 changes: 0 additions & 3 deletions kakarot-evm-interface/lib/kakarot-lib/.gitmodules

This file was deleted.

11 changes: 0 additions & 11 deletions kakarot-evm-interface/lib/kakarot-lib/README.md

This file was deleted.

6 changes: 0 additions & 6 deletions kakarot-evm-interface/lib/kakarot-lib/foundry.toml

This file was deleted.

This file was deleted.

This file was deleted.

Loading
Loading