-
Notifications
You must be signed in to change notification settings - Fork 37
Etherfi integration #97
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
Open
mp-web3
wants to merge
22
commits into
main
Choose a base branch
from
etherfi-adapter-and-substream
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
439c98e
feat: Initial Setup
a68d604
feat: Moved folder initial map_components() development
4ff3475
feat: added LiquidityPool contract events
ca01dc4
feat: Implemented map_relative_balances with all events
7cdd34f
feat: Implemented testPoolBehaviour
e13aba6
running integration test
mp-web3 cc8a1f8
added readme file
mp-web3 7ed963e
updated readme with tests
mp-web3 b4c0f69
updated integration_test
mp-web3 fe06b71
formatted
mp-web3 c09ab83
build etherfi substream
mp-web3 d2ed638
fix: fixed blocks to fetch and formatted
mp-web3 f555020
fix: fixed start and ending blocks
mp-web3 a07aadc
lint
mp-web3 52d7caf
fix: update cargo, build with nightly and format using cargo +nightly…
mp-web3 cda78ac
fix: fixed stop blocks
mp-web3 29acedd
shadowy script for setting up sdk testing environment
mp-web3 3d751ec
refactor: cleanup PR
zizou0x 749ec7b
WIP: fixing store_modules
mp-web3 7925cd6
fix: protocol component store key
dobertRowneySr e3fe53a
fix: component id into utf-8 bytes
dobertRowneySr d499436
test: better block start / end combination
dobertRowneySr File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| [package] | ||
| name = "ethereum-etherfi" | ||
| version = "0.0.1" | ||
| edition = "2021" | ||
|
|
||
| [lib] | ||
| name = "ethereum_etherfi" | ||
| crate-type = ["cdylib"] | ||
|
|
||
| [dependencies] | ||
| ethabi = "18.0.0" | ||
| hex-literal = "0.4.1" | ||
| num-bigint = "0.4.4" | ||
| num-traits = "0.2.15" | ||
| prost = "0.12.3" | ||
| prost-types = "0.12.3" | ||
| substreams = "0.5.22" | ||
| substreams-ethereum = "0.9.9" | ||
| substreams-database-change = "1" | ||
| substreams-entity-change = "1.3" | ||
| anyhow = "1.0.75" | ||
| tycho-substreams = { git = "https://github.com/propeller-heads/tycho-protocol-sdk.git", rev = "3c08359" } | ||
| hex = "0.4.3" | ||
| itertools = "0.13.0" | ||
|
|
||
| # Required so that ethabi > ethereum-types build correctly under wasm32-unknown-unknown | ||
| [target.wasm32-unknown-unknown.dependencies] | ||
| getrandom = { version = "0.2", features = ["custom"] } | ||
|
|
||
| [build-dependencies] | ||
| anyhow = "1.0.75" | ||
| substreams-ethereum = "0.9.9" | ||
| regex = "1.8" | ||
|
|
||
| [profile.release] | ||
| lto = true | ||
| opt-level = 's' | ||
| strip = "debuginfo" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| CARGO_VERSION := $(shell cargo version 2>/dev/null) | ||
|
|
||
| .PHONY: build | ||
| build: | ||
| ifdef CARGO_VERSION | ||
| cargo build --target wasm32-unknown-unknown --release | ||
| else | ||
| @echo "Building substreams target using Docker. To speed up this step, install a Rust development environment." | ||
| docker run --rm -ti --init -v ${PWD}:/usr/src --workdir /usr/src/ rust:bullseye cargo build --target wasm32-unknown-unknown --release | ||
| endif | ||
|
|
||
| .PHONY: run | ||
| run: build | ||
| substreams run substreams.yaml $(if $(MODULE),$(MODULE),map_events) $(if $(START_BLOCK),-s $(START_BLOCK)) $(if $(STOP_BLOCK),-t $(STOP_BLOCK)) | ||
|
|
||
| .PHONY: gui | ||
| gui: build | ||
| substreams gui substreams.yaml $(if $(MODULE),$(MODULE),map_events) $(if $(START_BLOCK),-s $(START_BLOCK)) $(if $(STOP_BLOCK),-t $(STOP_BLOCK)) | ||
|
|
||
| .PHONY: protogen | ||
| protogen: | ||
| substreams protogen ./substreams.yaml --exclude-paths="sf/substreams,google" | ||
|
|
||
| .PHONY: pack | ||
| pack: build | ||
| substreams pack substreams.yaml |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,188 @@ | ||
| # ethereum-etherfi substream tests | ||
|
|
||
| **Liquidity Pool Proxy** | ||
|
|
||
| - Address: 0x308861A430be4cce5502d0A12724771Fc6DaF216 | ||
| - Deployment tx hash: 0x491b823bc15ced4c54f0ed5a235d39e478f8aae3ad02eb553924b40ad9859e10 | ||
| - Deployment block: 17664317 | ||
| - Standard: EIP-1967 Transparent Proxy | ||
| - First Deposit tx hash: 0x2e92d04a5da978f13e55c73fe95cfecb4e4124f95c88ce82972665a4145ff769 | ||
| - First Deposit block: 19891386 | ||
| - Difference Deposit block - Deployment block: 2227069 | ||
|
|
||
| **Liquidity Pool Implementation** | ||
|
|
||
| - Address: 0xa8A8Be862BA6301E5949ABDE93b1D892C14FfB1F | ||
| - Deployment tx hash: 0x95c2e5081af5a591d4899689fa385b550a49775cc705cf1eb0b40bd14974568b | ||
| - Deployment block: 20832727 | ||
|
|
||
| **weETH Proxy** | ||
|
|
||
| - Address: 0xCd5fE23C85820F7B72D0926FC9b05b43E359b7ee | ||
| - Deployment tx hash: 0xa034bdf7ec3b407125fcfbb786d908b0bcfd9976f2fbaf489776ba58b9db61ac | ||
| - Deployment block: 17664336 | ||
| - Standard: EIP-1967 Transparent Proxy | ||
| - First Wrap tx hash: 0x8ea192ac34be87bc004f83db69f62e2b92bc41937799b43feeac9a148bc66f62 | ||
| - First Wrap block: 20287009 | ||
|
|
||
| **weETH Implementation** | ||
|
|
||
| - Address: 0xe629ee84C1Bd9Ea9c677d2D5391919fCf5E7d5D9 | ||
| - Deployment tx hash: 0x455235ddb3d8c00f4cb805ae76f6c11d017bf71f32940459fce6269530b0c011 | ||
| - Deployment block: 18517517 | ||
|
|
||
| **eETH Proxy** | ||
|
|
||
| - Address: 0x35fA164735182de50811E8e2E824cFb9B6118ac2 | ||
| - Deployment tx hash: 0xf6763c707b90b260bba114fce9a141aa4a923327539ded9d4d4ae4395b2200ff | ||
| - Deployment block: 17664324 | ||
| - Standard: EIP-1967 Transparent Proxy | ||
|
|
||
| **eETH Implementation** | ||
|
|
||
| - Address: 0x1B47A665364bC15C28B05f449B53354d0CefF72f | ||
| - Deployment tx hash: 0x13b30c3b456189b04b2049d2c94285443f881497f3221a509a7d98facc06a5f7 | ||
| - Deployment block: 18549702 | ||
|
|
||
| ## Integration_test.tycho.yaml using constructor() | ||
|
|
||
| Since in `ethereum-sfraxeth` we had issues when casting addresses into interface, I'll try to rerun the integration test by first modifying the adapter so that the weeth address is hardcoded and does not need to be passaed | ||
|
|
||
| **EtherfiAdapter.sol** changes | ||
|
|
||
| ``` | ||
| constructor() { | ||
| weEth = IWeEth(address(0xCd5fE23C85820F7B72D0926FC9b05b43E359b7ee)); | ||
| eEth = weEth.eETH(); | ||
| liquidityPool = eEth.liquidityPool(); | ||
| } | ||
| ``` | ||
|
|
||
| **Integration_test.tycho.yaml** | ||
|
|
||
| ``` | ||
| # Name of the substreams config file in your substreams module. Usually "./substreams.yaml" | ||
| substreams_yaml_path: ./substreams.yaml | ||
|
|
||
| # Name of the adapter contract, usually: ProtocolSwapAdapter | ||
| adapter_contract: "EtherfiAdapter" | ||
|
|
||
| # Constructor signature of the Adapter contract | ||
| adapter_build_signature: "constructor()" | ||
|
|
||
| # A comma separated list of args to be passed to the constructor of the Adapter contract | ||
| adapter_build_args: | ||
|
|
||
| # Whether or not the testing script should skip checking balances of the protocol components. | ||
| skip_balance_check: false | ||
|
|
||
| # A list of accounts that need to be indexed to run the tests properly. | ||
| # Usually used when there is a global component required by all pools and created before the tested range of blocks. | ||
| initialized_accounts: | ||
| - "0x308861A430be4cce5502d0A12724771Fc6DaF216" # Liquidity pool component for initialization | ||
|
|
||
| # A list of protocol types names created by your Substreams module. | ||
| protocol_type_names: | ||
| - "etherfi_liquidity_pool" | ||
| - "etherfi_weeth_pool" | ||
|
|
||
| # A list of tests. | ||
| tests: | ||
| # Test for Etherfi Liquidity Pool creation | ||
| - name: test_liquidity_pool_creation | ||
| # Indexed block range | ||
| start_block: 17664317 | ||
| stop_block: 17664500 | ||
| expected_components: | ||
| - id: "0x308861A430be4cce5502d0A12724771Fc6DaF216" # Liquidity Pool Address | ||
| tokens: | ||
| - "0x35fA164735182de50811E8e2E824cFb9B6118ac2" # eETH | ||
| - "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE" # ETH | ||
| creation_tx: "0x491b823bc15ced4c54f0ed5a235d39e478f8aae3ad02eb553924b40ad9859e10" | ||
| skip_simulation: false | ||
|
|
||
| # Test for WeETH pool creation | ||
| - name: test_weeth_pool_creation | ||
| start_block: 17664317 | ||
| stop_block: 17664500 | ||
| expected_components: | ||
| - id: "0xCd5fE23C85820F7B72D0926FC9b05b43E359b7ee" # WeETH Address | ||
| tokens: | ||
| - "0x35fA164735182de50811E8e2E824cFb9B6118ac2" # eETH | ||
| - "0xCd5fE23C85820F7B72D0926FC9b05b43E359b7ee" # WeETH | ||
| creation_tx: "0xa034bdf7ec3b407125fcfbb786d908b0bcfd9976f2fbaf489776ba58b9db61ac" | ||
| skip_simulation: false | ||
|
|
||
| ``` | ||
|
|
||
| ### Test results | ||
|
|
||
| `python ./testing/src/runner/cli.py --package "ethereum-etherfi" --vm-traces` | ||
|
|
||
| ❗️ test_liquidity_pool_creation failed: '0x308861a430be4cce5502d0a12724771fc6daf216' not found in protocol components. | ||
|
|
||
| ❗️ test_weeth_pool_creation failed: '0xcd5fe23c85820f7b72d0926fc9b05b43e359b7ee' not found in protocol components. | ||
|
|
||
| ## Integration_test.tycho.yaml using implementation addresses instead of proxyes | ||
|
|
||
| ``` | ||
| # Name of the substreams config file in your substreams module. Usually "./substreams.yaml" | ||
| substreams_yaml_path: ./substreams.yaml | ||
|
|
||
| # Name of the adapter contract, usually: ProtocolSwapAdapter | ||
| adapter_contract: "EtherfiAdapter" | ||
|
|
||
| # Constructor signature of the Adapter contract | ||
| adapter_build_signature: "constructor()" | ||
|
|
||
| # A comma separated list of args to be passed to the constructor of the Adapter contract | ||
| adapter_build_args: | ||
|
|
||
| # Whether or not the testing script should skip checking balances of the protocol components. | ||
| skip_balance_check: false | ||
|
|
||
| # A list of accounts that need to be indexed to run the tests properly. | ||
| # Usually used when there is a global component required by all pools and created before the tested range of blocks. | ||
| initialized_accounts: | ||
| - "0x308861A430be4cce5502d0A12724771Fc6DaF216" # Liquidity pool component for initialization | ||
|
|
||
| # A list of protocol types names created by your Substreams module. | ||
| protocol_type_names: | ||
| - "etherfi_liquidity_pool" | ||
| - "etherfi_weeth_pool" | ||
|
|
||
| # A list of tests. | ||
| tests: | ||
| # Test for Etherfi Liquidity Pool creation | ||
| - name: test_liquidity_pool_creation | ||
| # Indexed block range | ||
| start_block: 20832700 # Actual deployment block: 20832727 | ||
| stop_block: 20832800 | ||
| expected_components: | ||
| - id: "0xa8A8Be862BA6301E5949ABDE93b1D892C14FfB1F" # Liquidity Pool Implementation Address | ||
| tokens: | ||
| - "0x35fA164735182de50811E8e2E824cFb9B6118ac2" # eETH | ||
| - "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE" # ETH | ||
| creation_tx: "0x95c2e5081af5a591d4899689fa385b550a49775cc705cf1eb0b40bd14974568b" | ||
| skip_simulation: false | ||
|
|
||
| # Test for WeETH pool creation | ||
| - name: test_weeth_pool_creation | ||
| start_block: 18517500 # Actual deployment block: 18517517 | ||
| stop_block: 18517600 | ||
| expected_components: | ||
| - id: "0xe629ee84C1Bd9Ea9c677d2D5391919fCf5E7d5D9" # WeETH Implementation Address | ||
| tokens: | ||
| - "0x35fA164735182de50811E8e2E824cFb9B6118ac2" # eETH | ||
| - "0xCd5fE23C85820F7B72D0926FC9b05b43E359b7ee" # WeETH | ||
| creation_tx: "0x455235ddb3d8c00f4cb805ae76f6c11d017bf71f32940459fce6269530b0c011" | ||
| skip_simulation: false | ||
|
|
||
| ``` | ||
| ### Test results | ||
|
|
||
| `python ./testing/src/runner/cli.py --package "ethereum-etherfi" --vm-traces` | ||
|
|
||
| ❗️ test_liquidity_pool_creation failed: '0x308861a430be4cce5502d0a12724771fc6daf216' not found in protocol components. | ||
|
|
||
| ❗️ test_weeth_pool_creation failed: '0xcd5fe23c85820f7b72d0926fc9b05b43e359b7ee' not found in protocol components. |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we fix this please?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
have you updated AdapterTest.sol
runPoolBehaviourTestfunction so that it can manage constant prices?