Skip to content

Commit

Permalink
Inspector bugfixes (#31)
Browse files Browse the repository at this point in the history
* chore: update deps

* fix(compound): do not prune liquidation calls

also do not double count liquidations + delegatecalls

properly classifies https://etherscan.io/tx/0xa14015acb343e670296a43e9d0b7b8b812d76062c957fa026fbf0f957ac4701b now. Previously it would not show as a Liquidation

* test(aave): add simple liquidation test

* test(curve): add simple liquidation test

* test(arb): add arb that reverted

* feat(uniswap): classify addLiquidity actions

* feat(curve): classify addLiquidity

* fix: ignore yearn recycler

* fix: convert protocol vector to hashset

* chore: clippy lints
  • Loading branch information
gakonst committed Jan 1, 2021
1 parent 1d16c1c commit 34c2d2c
Show file tree
Hide file tree
Showing 29 changed files with 21,853 additions and 562 deletions.
740 changes: 365 additions & 375 deletions Cargo.lock

Large diffs are not rendered by default.

30 changes: 16 additions & 14 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,28 @@ edition = "2018"

[dependencies]
ethers = { git = "https://github.com/gakonst/ethers-rs", branch = "master", features = ["abigen"] }
serde_json = "1.0.59"
once_cell = "1.4.1"
itertools = "0.9.0"
anyhow = "1.0.34"
rustc-hex = "2.1.0"
serde_json = "1.0.61"
once_cell = "1.5.2"
itertools = "0.10.0"
anyhow = "1.0.37"

# cached provider
thiserror = "1.0.22"
async-trait = "0.1.41"
serde = "1.0.117"
thiserror = "1.0.23"
async-trait = "0.1.42"
serde = "1.0.118"

# postgres connection
tokio = { version = "0.2.2", features = ["macros", "rt-threaded"] }
tokio-postgres = "0.5.0"
rust_decimal = { version = "1.8.1", features = ["db-postgres", "db-tokio-postgres"] }
tokio = { version = "1.0.1", features = ["macros", "rt-multi-thread"] }
tokio-postgres = "0.7.0"
rust_decimal = { version = "1.9.0", features = ["db-postgres", "db-tokio-postgres"] }
gumdrop = "0.8.0"
futures = "0.3.8"

[dev-dependencies]
rustc-hex = "2.1.0"
hex = "0.4.2"

[features]
postgres-tests = []

[patch.crates-io]
rust_decimal = { git = "https://github.com/paupino/rust-decimal/", branch = "master" }
reqwest = { git = "https://github.com/seanmonstar/reqwest", branch = "master" }
tokio-tungstenite = { git = "https://github.com/dnaka91/tokio-tungstenite", branch = "tokio-1.0" }
2 changes: 1 addition & 1 deletion abi/curveregistry.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
[{"inputs": [{"indexed": true, "type": "uint256", "name": "deadline"}, {"indexed": true, "type": "address", "name": "admin"}], "type": "event", "name": "CommitNewAdmin", "anonymous": false}, {"inputs": [{"indexed": true, "type": "address", "name": "admin"}], "type": "event", "name": "NewAdmin", "anonymous": false}, {"inputs": [{"indexed": true, "type": "address", "name": "buyer"}, {"indexed": true, "type": "address", "name": "pool"}, {"indexed": false, "type": "address", "name": "token_sold"}, {"indexed": false, "type": "address", "name": "token_bought"}, {"indexed": false, "type": "uint256", "name": "amount_sold"}, {"indexed": false, "type": "uint256", "name": "amount_bought"}], "type": "event", "name": "TokenExchange", "anonymous": false}, {"inputs": [{"indexed": true, "type": "address", "name": "pool"}, {"indexed": false, "type": "bytes", "name": "rate_method_id"}], "type": "event", "name": "PoolAdded", "anonymous": false}, {"inputs": [{"indexed": true, "type": "address", "name": "pool"}], "type": "event", "name": "PoolRemoved", "anonymous": false}, {"inputs": [{"type": "address[4]", "name": "_returns_none"}], "constant": false, "name": "constructor", "outputs": [], "stateMutability": "view", "payable": false, "type": "constructor"}, {"stateMutability": "view", "payable": true, "constant": false, "type": "fallback"}, {"inputs": [{"type": "address", "name": "_from"}, {"type": "address", "name": "_to"}], "constant": true, "name": "find_pool_for_coins", "outputs": [{"type": "address", "name": ""}], "stateMutability": "nonpayable", "payable": false, "type": "function"}, {"inputs": [{"type": "address", "name": "_from"}, {"type": "address", "name": "_to"}, {"type": "uint256", "name": "i"}], "constant": true, "name": "find_pool_for_coins", "outputs": [{"type": "address", "name": ""}], "stateMutability": "nonpayable", "payable": false, "type": "function"}, {"inputs": [{"type": "address", "name": "_pool"}], "constant": true, "name": "get_pool_coins", "outputs": [{"type": "tuple", "name": "", "components": [{"type": "address[8]", "name": "coins"}, {"type": "address[8]", "name": "underlying_coins"}, {"type": "uint256[8]", "name": "decimals"}, {"type": "uint256[8]", "name": "underlying_decimals"}]}], "stateMutability": "nonpayable", "payable": false, "type": "function"}, {"inputs": [{"type": "address", "name": "_pool"}], "constant": true, "name": "get_pool_info", "outputs": [{"type": "tuple", "name": "", "components": [{"type": "uint256[8]", "name": "balances"}, {"type": "uint256[8]", "name": "underlying_balances"}, {"type": "uint256[8]", "name": "decimals"}, {"type": "uint256[8]", "name": "underlying_decimals"}, {"type": "address", "name": "lp_token"}, {"type": "uint256", "name": "A"}, {"type": "uint256", "name": "fee"}]}], "stateMutability": "nonpayable", "payable": false, "type": "function"}, {"inputs": [{"type": "address", "name": "_pool"}], "constant": true, "name": "get_pool_rates", "outputs": [{"type": "uint256[8]", "name": ""}], "stateMutability": "nonpayable", "payable": false, "type": "function"}, {"inputs": [{"type": "address", "name": "_pool"}, {"type": "address", "name": "_from"}, {"type": "address", "name": "_to"}], "constant": true, "name": "estimate_gas_used", "outputs": [{"type": "uint256", "name": ""}], "stateMutability": "nonpayable", "payable": false, "type": "function"}, {"inputs": [{"type": "address", "name": "_pool"}, {"type": "address", "name": "_from"}, {"type": "address", "name": "_to"}, {"type": "uint256", "name": "_amount"}], "constant": true, "name": "get_exchange_amount", "outputs": [{"type": "uint256", "name": ""}], "stateMutability": "nonpayable", "payable": false, "type": "function"}, {"inputs": [{"type": "address", "name": "_pool"}, {"type": "address", "name": "_from"}, {"type": "address", "name": "_to"}, {"type": "uint256", "name": "_amount"}, {"type": "uint256", "name": "_expected"}], "constant": false, "name": "exchange", "outputs": [{"type": "bool", "name": ""}], "stateMutability": "view", "payable": true, "type": "function"}, {"inputs": [{"type": "address", "name": "_pool"}, {"type": "address", "name": "_from"}, {"type": "address", "name": "_to"}, {"type": "uint256", "name": "_amount"}], "constant": true, "name": "get_input_amount", "outputs": [{"type": "uint256", "name": ""}], "stateMutability": "nonpayable", "payable": false, "type": "function"}, {"inputs": [{"type": "address", "name": "_pool"}, {"type": "int128", "name": "_n_coins"}, {"type": "address", "name": "_lp_token"}, {"type": "address", "name": "_calculator"}, {"type": "bytes32", "name": "_rate_method_id"}, {"type": "bytes32", "name": "_decimals"}, {"type": "bytes32", "name": "_underlying_decimals"}], "constant": false, "name": "add_pool", "outputs": [], "stateMutability": "view", "payable": false, "type": "function"}, {"inputs": [{"type": "address", "name": "_pool"}, {"type": "int128", "name": "_n_coins"}, {"type": "address", "name": "_lp_token"}, {"type": "address", "name": "_calculator"}, {"type": "bytes32", "name": "_rate_method_id"}, {"type": "bytes32", "name": "_decimals"}, {"type": "bytes32", "name": "_use_rates"}], "constant": false, "name": "add_pool_without_underlying", "outputs": [], "stateMutability": "view", "payable": false, "type": "function"}, {"inputs": [{"type": "address", "name": "_pool"}], "constant": false, "name": "remove_pool", "outputs": [], "stateMutability": "view", "payable": false, "type": "function"}, {"inputs": [{"type": "address", "name": "_addr"}, {"type": "bool", "name": "_is_returns_none"}], "constant": false, "name": "set_returns_none", "outputs": [], "stateMutability": "view", "payable": false, "type": "function"}, {"inputs": [{"type": "address[5]", "name": "_addr"}, {"type": "uint256[2][5]", "name": "_amount"}], "constant": false, "name": "set_pool_gas_estimates", "outputs": [], "stateMutability": "view", "payable": false, "type": "function"}, {"inputs": [{"type": "address[10]", "name": "_addr"}, {"type": "uint256[10]", "name": "_amount"}], "constant": false, "name": "set_coin_gas_estimates", "outputs": [], "stateMutability": "view", "payable": false, "type": "function"}, {"inputs": [{"type": "address", "name": "_pool"}, {"type": "address", "name": "_estimator"}], "constant": false, "name": "set_gas_estimate_contract", "outputs": [], "stateMutability": "view", "payable": false, "type": "function"}, {"inputs": [{"type": "address", "name": "_pool"}, {"type": "address", "name": "_calculator"}], "constant": false, "name": "set_calculator", "outputs": [], "stateMutability": "view", "payable": false, "type": "function"}, {"inputs": [{"type": "address", "name": "_pool"}], "constant": true, "name": "get_calculator", "outputs": [{"type": "address", "name": ""}], "stateMutability": "nonpayable", "payable": false, "type": "function"}, {"inputs": [{"type": "address", "name": "_new_admin"}], "constant": false, "name": "commit_transfer_ownership", "outputs": [], "stateMutability": "view", "payable": false, "type": "function"}, {"inputs": [], "constant": false, "name": "apply_transfer_ownership", "outputs": [], "stateMutability": "view", "payable": false, "type": "function"}, {"inputs": [], "constant": false, "name": "revert_transfer_ownership", "outputs": [], "stateMutability": "view", "payable": false, "type": "function"}, {"inputs": [{"type": "address", "name": "_token"}], "constant": false, "name": "claim_token_balance", "outputs": [], "stateMutability": "view", "payable": false, "type": "function"}, {"inputs": [], "constant": false, "name": "claim_eth_balance", "outputs": [], "stateMutability": "view", "payable": false, "type": "function"}, {"inputs": [], "constant": true, "name": "admin", "outputs": [{"type": "address", "name": ""}], "stateMutability": "nonpayable", "payable": false, "type": "function"}, {"inputs": [{"type": "int128", "name": "arg0"}], "constant": true, "name": "pool_list", "outputs": [{"type": "address", "name": ""}], "stateMutability": "nonpayable", "payable": false, "type": "function"}, {"inputs": [], "constant": true, "name": "pool_count", "outputs": [{"type": "uint256", "name": ""}], "stateMutability": "nonpayable", "payable": false, "type": "function"}]
[{"name":"PoolAdded","inputs":[{"type":"address","name":"pool","indexed":true},{"type":"bytes","name":"rate_method_id","indexed":false}],"anonymous":false,"type":"event"},{"name":"PoolRemoved","inputs":[{"type":"address","name":"pool","indexed":true}],"anonymous":false,"type":"event"},{"outputs":[],"inputs":[{"type":"address","name":"_address_provider"},{"type":"address","name":"_gauge_controller"}],"stateMutability":"nonpayable","type":"constructor"},{"name":"find_pool_for_coins","outputs":[{"type":"address","name":""}],"inputs":[{"type":"address","name":"_from"},{"type":"address","name":"_to"}],"stateMutability":"view","type":"function"},{"name":"find_pool_for_coins","outputs":[{"type":"address","name":""}],"inputs":[{"type":"address","name":"_from"},{"type":"address","name":"_to"},{"type":"uint256","name":"i"}],"stateMutability":"view","type":"function"},{"name":"get_n_coins","outputs":[{"type":"uint256[2]","name":""}],"inputs":[{"type":"address","name":"_pool"}],"stateMutability":"view","type":"function","gas":1704},{"name":"get_coins","outputs":[{"type":"address[8]","name":""}],"inputs":[{"type":"address","name":"_pool"}],"stateMutability":"view","type":"function","gas":12285},{"name":"get_underlying_coins","outputs":[{"type":"address[8]","name":""}],"inputs":[{"type":"address","name":"_pool"}],"stateMutability":"view","type":"function","gas":12347},{"name":"get_decimals","outputs":[{"type":"uint256[8]","name":""}],"inputs":[{"type":"address","name":"_pool"}],"stateMutability":"view","type":"function","gas":8199},{"name":"get_underlying_decimals","outputs":[{"type":"uint256[8]","name":""}],"inputs":[{"type":"address","name":"_pool"}],"stateMutability":"view","type":"function","gas":8261},{"name":"get_rates","outputs":[{"type":"uint256[8]","name":""}],"inputs":[{"type":"address","name":"_pool"}],"stateMutability":"view","type":"function","gas":34780},{"name":"get_gauges","outputs":[{"type":"address[10]","name":""},{"type":"int128[10]","name":""}],"inputs":[{"type":"address","name":"_pool"}],"stateMutability":"view","type":"function","gas":20310},{"name":"get_balances","outputs":[{"type":"uint256[8]","name":""}],"inputs":[{"type":"address","name":"_pool"}],"stateMutability":"view","type":"function","gas":16818},{"name":"get_underlying_balances","outputs":[{"type":"uint256[8]","name":""}],"inputs":[{"type":"address","name":"_pool"}],"stateMutability":"view","type":"function","gas":158953},{"name":"get_virtual_price_from_lp_token","outputs":[{"type":"uint256","name":""}],"inputs":[{"type":"address","name":"_token"}],"stateMutability":"view","type":"function","gas":2080},{"name":"get_A","outputs":[{"type":"uint256","name":""}],"inputs":[{"type":"address","name":"_pool"}],"stateMutability":"view","type":"function","gas":1198},{"name":"get_parameters","outputs":[{"type":"uint256","name":"A"},{"type":"uint256","name":"future_A"},{"type":"uint256","name":"fee"},{"type":"uint256","name":"admin_fee"},{"type":"uint256","name":"future_fee"},{"type":"uint256","name":"future_admin_fee"},{"type":"address","name":"future_owner"},{"type":"uint256","name":"initial_A"},{"type":"uint256","name":"initial_A_time"},{"type":"uint256","name":"future_A_time"}],"inputs":[{"type":"address","name":"_pool"}],"stateMutability":"view","type":"function","gas":6458},{"name":"get_fees","outputs":[{"type":"uint256[2]","name":""}],"inputs":[{"type":"address","name":"_pool"}],"stateMutability":"view","type":"function","gas":1603},{"name":"get_admin_balances","outputs":[{"type":"uint256[8]","name":""}],"inputs":[{"type":"address","name":"_pool"}],"stateMutability":"view","type":"function","gas":36719},{"name":"get_coin_indices","outputs":[{"type":"int128","name":""},{"type":"int128","name":""},{"type":"bool","name":""}],"inputs":[{"type":"address","name":"_pool"},{"type":"address","name":"_from"},{"type":"address","name":"_to"}],"stateMutability":"view","type":"function","gas":27456},{"name":"estimate_gas_used","outputs":[{"type":"uint256","name":""}],"inputs":[{"type":"address","name":"_pool"},{"type":"address","name":"_from"},{"type":"address","name":"_to"}],"stateMutability":"view","type":"function","gas":32329},{"name":"add_pool","outputs":[],"inputs":[{"type":"address","name":"_pool"},{"type":"uint256","name":"_n_coins"},{"type":"address","name":"_lp_token"},{"type":"bytes32","name":"_rate_method_id"},{"type":"uint256","name":"_decimals"},{"type":"uint256","name":"_underlying_decimals"},{"type":"bool","name":"_has_initial_A"},{"type":"bool","name":"_is_v1"}],"stateMutability":"nonpayable","type":"function","gas":10196577},{"name":"add_pool_without_underlying","outputs":[],"inputs":[{"type":"address","name":"_pool"},{"type":"uint256","name":"_n_coins"},{"type":"address","name":"_lp_token"},{"type":"bytes32","name":"_rate_method_id"},{"type":"uint256","name":"_decimals"},{"type":"uint256","name":"_use_rates"},{"type":"bool","name":"_has_initial_A"},{"type":"bool","name":"_is_v1"}],"stateMutability":"nonpayable","type":"function","gas":5590664},{"name":"add_metapool","outputs":[],"inputs":[{"type":"address","name":"_pool"},{"type":"uint256","name":"_n_coins"},{"type":"address","name":"_lp_token"},{"type":"uint256","name":"_decimals"}],"stateMutability":"nonpayable","type":"function","gas":10226976},{"name":"remove_pool","outputs":[],"inputs":[{"type":"address","name":"_pool"}],"stateMutability":"nonpayable","type":"function","gas":779646579509},{"name":"set_pool_gas_estimates","outputs":[],"inputs":[{"type":"address[5]","name":"_addr"},{"type":"uint256[2][5]","name":"_amount"}],"stateMutability":"nonpayable","type":"function","gas":355578},{"name":"set_coin_gas_estimates","outputs":[],"inputs":[{"type":"address[10]","name":"_addr"},{"type":"uint256[10]","name":"_amount"}],"stateMutability":"nonpayable","type":"function","gas":357165},{"name":"set_gas_estimate_contract","outputs":[],"inputs":[{"type":"address","name":"_pool"},{"type":"address","name":"_estimator"}],"stateMutability":"nonpayable","type":"function","gas":37747},{"name":"set_liquidity_gauges","outputs":[],"inputs":[{"type":"address","name":"_pool"},{"type":"address[10]","name":"_liquidity_gauges"}],"stateMutability":"nonpayable","type":"function","gas":365793},{"name":"address_provider","outputs":[{"type":"address","name":""}],"inputs":[],"stateMutability":"view","type":"function","gas":2111},{"name":"gauge_controller","outputs":[{"type":"address","name":""}],"inputs":[],"stateMutability":"view","type":"function","gas":2141},{"name":"pool_list","outputs":[{"type":"address","name":""}],"inputs":[{"type":"uint256","name":"arg0"}],"stateMutability":"view","type":"function","gas":2280},{"name":"pool_count","outputs":[{"type":"uint256","name":""}],"inputs":[],"stateMutability":"view","type":"function","gas":2201},{"name":"get_pool_from_lp_token","outputs":[{"type":"address","name":""}],"inputs":[{"type":"address","name":"arg0"}],"stateMutability":"view","type":"function","gas":2446},{"name":"get_lp_token","outputs":[{"type":"address","name":""}],"inputs":[{"type":"address","name":"arg0"}],"stateMutability":"view","type":"function","gas":2476}]
Loading

0 comments on commit 34c2d2c

Please sign in to comment.