feat: this should cover all pools over >10mil TVL:

I have not tested everything thoroughly yet. Ignore `test.json` that'll likely go away if we use the `Transfer` method for pool deltas
This commit is contained in:
0xMochan
2024-05-16 23:29:52 -07:00
parent 78fffc02d9
commit 379baebfb7
16 changed files with 18711 additions and 295 deletions

View File

@@ -0,0 +1,222 @@
[
{
"constant": true,
"inputs": [],
"name": "name",
"outputs": [
{
"name": "",
"type": "string"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"name": "_spender",
"type": "address"
},
{
"name": "_value",
"type": "uint256"
}
],
"name": "approve",
"outputs": [
{
"name": "",
"type": "bool"
}
],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "totalSupply",
"outputs": [
{
"name": "",
"type": "uint256"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"name": "_from",
"type": "address"
},
{
"name": "_to",
"type": "address"
},
{
"name": "_value",
"type": "uint256"
}
],
"name": "transferFrom",
"outputs": [
{
"name": "",
"type": "bool"
}
],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "decimals",
"outputs": [
{
"name": "",
"type": "uint8"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [
{
"name": "_owner",
"type": "address"
}
],
"name": "balanceOf",
"outputs": [
{
"name": "balance",
"type": "uint256"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "symbol",
"outputs": [
{
"name": "",
"type": "string"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"name": "_to",
"type": "address"
},
{
"name": "_value",
"type": "uint256"
}
],
"name": "transfer",
"outputs": [
{
"name": "",
"type": "bool"
}
],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": true,
"inputs": [
{
"name": "_owner",
"type": "address"
},
{
"name": "_spender",
"type": "address"
}
],
"name": "allowance",
"outputs": [
{
"name": "",
"type": "uint256"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"payable": true,
"stateMutability": "payable",
"type": "fallback"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"name": "owner",
"type": "address"
},
{
"indexed": true,
"name": "spender",
"type": "address"
},
{
"indexed": false,
"name": "value",
"type": "uint256"
}
],
"name": "Approval",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"name": "from",
"type": "address"
},
{
"indexed": true,
"name": "to",
"type": "address"
},
{
"indexed": false,
"name": "value",
"type": "uint256"
}
],
"name": "Transfer",
"type": "event"
}
]

View File

@@ -658,7 +658,7 @@
"type": "address"
},
{
"name": "_A",
"name": "`_A`",
"type": "uint256"
},
{

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,760 @@
[
{
"name": "TokenExchange",
"inputs": [
{
"type": "address",
"name": "buyer",
"indexed": true
},
{
"type": "int128",
"name": "sold_id",
"indexed": false
},
{
"type": "uint256",
"name": "tokens_sold",
"indexed": false
},
{
"type": "int128",
"name": "bought_id",
"indexed": false
},
{
"type": "uint256",
"name": "tokens_bought",
"indexed": false
}
],
"anonymous": false,
"type": "event"
},
{
"name": "TokenExchangeUnderlying",
"inputs": [
{
"type": "address",
"name": "buyer",
"indexed": true
},
{
"type": "int128",
"name": "sold_id",
"indexed": false
},
{
"type": "uint256",
"name": "tokens_sold",
"indexed": false
},
{
"type": "int128",
"name": "bought_id",
"indexed": false
},
{
"type": "uint256",
"name": "tokens_bought",
"indexed": false
}
],
"anonymous": false,
"type": "event"
},
{
"name": "AddLiquidity",
"inputs": [
{
"type": "address",
"name": "provider",
"indexed": true
},
{
"type": "uint256[4]",
"name": "token_amounts",
"indexed": false
},
{
"type": "uint256[4]",
"name": "fees",
"indexed": false
},
{
"type": "uint256",
"name": "invariant",
"indexed": false
},
{
"type": "uint256",
"name": "token_supply",
"indexed": false
}
],
"anonymous": false,
"type": "event"
},
{
"name": "RemoveLiquidity",
"inputs": [
{
"type": "address",
"name": "provider",
"indexed": true
},
{
"type": "uint256[4]",
"name": "token_amounts",
"indexed": false
},
{
"type": "uint256[4]",
"name": "fees",
"indexed": false
},
{
"type": "uint256",
"name": "token_supply",
"indexed": false
}
],
"anonymous": false,
"type": "event"
},
{
"name": "RemoveLiquidityImbalance",
"inputs": [
{
"type": "address",
"name": "provider",
"indexed": true
},
{
"type": "uint256[4]",
"name": "token_amounts",
"indexed": false
},
{
"type": "uint256[4]",
"name": "fees",
"indexed": false
},
{
"type": "uint256",
"name": "invariant",
"indexed": false
},
{
"type": "uint256",
"name": "token_supply",
"indexed": false
}
],
"anonymous": false,
"type": "event"
},
{
"name": "CommitNewAdmin",
"inputs": [
{
"type": "uint256",
"name": "deadline",
"indexed": true,
"unit": "sec"
},
{
"type": "address",
"name": "admin",
"indexed": true
}
],
"anonymous": false,
"type": "event"
},
{
"name": "NewAdmin",
"inputs": [
{
"type": "address",
"name": "admin",
"indexed": true
}
],
"anonymous": false,
"type": "event"
},
{
"name": "CommitNewParameters",
"inputs": [
{
"type": "uint256",
"name": "deadline",
"indexed": true,
"unit": "sec"
},
{
"type": "uint256",
"name": "A",
"indexed": false
},
{
"type": "uint256",
"name": "fee",
"indexed": false
},
{
"type": "uint256",
"name": "admin_fee",
"indexed": false
}
],
"anonymous": false,
"type": "event"
},
{
"name": "NewParameters",
"inputs": [
{
"type": "uint256",
"name": "A",
"indexed": false
},
{
"type": "uint256",
"name": "fee",
"indexed": false
},
{
"type": "uint256",
"name": "admin_fee",
"indexed": false
}
],
"anonymous": false,
"type": "event"
},
{
"outputs": [],
"inputs": [
{
"type": "address[4]",
"name": "_coins"
},
{
"type": "address[4]",
"name": "_underlying_coins"
},
{
"type": "address",
"name": "_pool_token"
},
{
"type": "uint256",
"name": "_A"
},
{
"type": "uint256",
"name": "_fee"
}
],
"constant": false,
"payable": false,
"type": "constructor"
},
{
"name": "get_virtual_price",
"outputs": [
{
"type": "uint256",
"name": ""
}
],
"inputs": [],
"constant": true,
"payable": false,
"type": "function",
"gas": 1570535
},
{
"name": "calc_token_amount",
"outputs": [
{
"type": "uint256",
"name": ""
}
],
"inputs": [
{
"type": "uint256[4]",
"name": "amounts"
},
{
"type": "bool",
"name": "deposit"
}
],
"constant": true,
"payable": false,
"type": "function",
"gas": 6103471
},
{
"name": "add_liquidity",
"outputs": [],
"inputs": [
{
"type": "uint256[4]",
"name": "amounts"
},
{
"type": "uint256",
"name": "min_mint_amount"
}
],
"constant": false,
"payable": false,
"type": "function",
"gas": 9331701
},
{
"name": "get_dy",
"outputs": [
{
"type": "uint256",
"name": ""
}
],
"inputs": [
{
"type": "int128",
"name": "i"
},
{
"type": "int128",
"name": "j"
},
{
"type": "uint256",
"name": "dx"
}
],
"constant": true,
"payable": false,
"type": "function",
"gas": 3489637
},
{
"name": "get_dy_underlying",
"outputs": [
{
"type": "uint256",
"name": ""
}
],
"inputs": [
{
"type": "int128",
"name": "i"
},
{
"type": "int128",
"name": "j"
},
{
"type": "uint256",
"name": "dx"
}
],
"constant": true,
"payable": false,
"type": "function",
"gas": 3489467
},
{
"name": "exchange",
"outputs": [],
"inputs": [
{
"type": "int128",
"name": "i"
},
{
"type": "int128",
"name": "j"
},
{
"type": "uint256",
"name": "dx"
},
{
"type": "uint256",
"name": "min_dy"
}
],
"constant": false,
"payable": false,
"type": "function",
"gas": 7034253
},
{
"name": "exchange_underlying",
"outputs": [],
"inputs": [
{
"type": "int128",
"name": "i"
},
{
"type": "int128",
"name": "j"
},
{
"type": "uint256",
"name": "dx"
},
{
"type": "uint256",
"name": "min_dy"
}
],
"constant": false,
"payable": false,
"type": "function",
"gas": 7050488
},
{
"name": "remove_liquidity",
"outputs": [],
"inputs": [
{
"type": "uint256",
"name": "_amount"
},
{
"type": "uint256[4]",
"name": "min_amounts"
}
],
"constant": false,
"payable": false,
"type": "function",
"gas": 241191
},
{
"name": "remove_liquidity_imbalance",
"outputs": [],
"inputs": [
{
"type": "uint256[4]",
"name": "amounts"
},
{
"type": "uint256",
"name": "max_burn_amount"
}
],
"constant": false,
"payable": false,
"type": "function",
"gas": 9330864
},
{
"name": "commit_new_parameters",
"outputs": [],
"inputs": [
{
"type": "uint256",
"name": "amplification"
},
{
"type": "uint256",
"name": "new_fee"
},
{
"type": "uint256",
"name": "new_admin_fee"
}
],
"constant": false,
"payable": false,
"type": "function",
"gas": 146045
},
{
"name": "apply_new_parameters",
"outputs": [],
"inputs": [],
"constant": false,
"payable": false,
"type": "function",
"gas": 133452
},
{
"name": "revert_new_parameters",
"outputs": [],
"inputs": [],
"constant": false,
"payable": false,
"type": "function",
"gas": 21775
},
{
"name": "commit_transfer_ownership",
"outputs": [],
"inputs": [
{
"type": "address",
"name": "_owner"
}
],
"constant": false,
"payable": false,
"type": "function",
"gas": 74452
},
{
"name": "apply_transfer_ownership",
"outputs": [],
"inputs": [],
"constant": false,
"payable": false,
"type": "function",
"gas": 60508
},
{
"name": "revert_transfer_ownership",
"outputs": [],
"inputs": [],
"constant": false,
"payable": false,
"type": "function",
"gas": 21865
},
{
"name": "withdraw_admin_fees",
"outputs": [],
"inputs": [],
"constant": false,
"payable": false,
"type": "function",
"gas": 23448
},
{
"name": "kill_me",
"outputs": [],
"inputs": [],
"constant": false,
"payable": false,
"type": "function",
"gas": 37818
},
{
"name": "unkill_me",
"outputs": [],
"inputs": [],
"constant": false,
"payable": false,
"type": "function",
"gas": 21955
},
{
"name": "coins",
"outputs": [
{
"type": "address",
"name": ""
}
],
"inputs": [
{
"type": "int128",
"name": "arg0"
}
],
"constant": true,
"payable": false,
"type": "function",
"gas": 2130
},
{
"name": "underlying_coins",
"outputs": [
{
"type": "address",
"name": ""
}
],
"inputs": [
{
"type": "int128",
"name": "arg0"
}
],
"constant": true,
"payable": false,
"type": "function",
"gas": 2160
},
{
"name": "balances",
"outputs": [
{
"type": "uint256",
"name": ""
}
],
"inputs": [
{
"type": "int128",
"name": "arg0"
}
],
"constant": true,
"payable": false,
"type": "function",
"gas": 2190
},
{
"name": "A",
"outputs": [
{
"type": "uint256",
"name": ""
}
],
"inputs": [],
"constant": true,
"payable": false,
"type": "function",
"gas": 2021
},
{
"name": "fee",
"outputs": [
{
"type": "uint256",
"name": ""
}
],
"inputs": [],
"constant": true,
"payable": false,
"type": "function",
"gas": 2051
},
{
"name": "admin_fee",
"outputs": [
{
"type": "uint256",
"name": ""
}
],
"inputs": [],
"constant": true,
"payable": false,
"type": "function",
"gas": 2081
},
{
"name": "owner",
"outputs": [
{
"type": "address",
"name": ""
}
],
"inputs": [],
"constant": true,
"payable": false,
"type": "function",
"gas": 2111
},
{
"name": "admin_actions_deadline",
"outputs": [
{
"type": "uint256",
"unit": "sec",
"name": ""
}
],
"inputs": [],
"constant": true,
"payable": false,
"type": "function",
"gas": 2141
},
{
"name": "transfer_ownership_deadline",
"outputs": [
{
"type": "uint256",
"unit": "sec",
"name": ""
}
],
"inputs": [],
"constant": true,
"payable": false,
"type": "function",
"gas": 2171
},
{
"name": "future_A",
"outputs": [
{
"type": "uint256",
"name": ""
}
],
"inputs": [],
"constant": true,
"payable": false,
"type": "function",
"gas": 2201
},
{
"name": "future_fee",
"outputs": [
{
"type": "uint256",
"name": ""
}
],
"inputs": [],
"constant": true,
"payable": false,
"type": "function",
"gas": 2231
},
{
"name": "future_admin_fee",
"outputs": [
{
"type": "uint256",
"name": ""
}
],
"inputs": [],
"constant": true,
"payable": false,
"type": "function",
"gas": 2261
},
{
"name": "future_owner",
"outputs": [
{
"type": "address",
"name": ""
}
],
"inputs": [],
"constant": true,
"payable": false,
"type": "function",
"gas": 2291
}
]

View File

@@ -0,0 +1,559 @@
[
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"name": "base_pool",
"type": "address"
},
{
"indexed": false,
"name": "implementat",
"type": "address"
}
],
"name": "BasePoolAdded",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"name": "coin",
"type": "address"
},
{
"indexed": false,
"name": "base_pool",
"type": "address"
},
{
"indexed": false,
"name": "A",
"type": "uint256"
},
{
"indexed": false,
"name": "fee",
"type": "uint256"
},
{
"indexed": false,
"name": "deployer",
"type": "address"
}
],
"name": "MetaPoolDeployed",
"type": "event"
},
{
"inputs": [],
"outputs": [],
"stateMutability": "nonpayable",
"type": "constructor"
},
{
"inputs": [
{
"name": "_from",
"type": "address"
},
{
"name": "_to",
"type": "address"
}
],
"name": "find_pool_for_coins",
"outputs": [
{
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"name": "_from",
"type": "address"
},
{
"name": "_to",
"type": "address"
},
{
"name": "i",
"type": "uint256"
}
],
"name": "find_pool_for_coins",
"outputs": [
{
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"gas": 2795,
"inputs": [
{
"name": "_pool",
"type": "address"
}
],
"name": "get_n_coins",
"outputs": [
{
"name": "",
"type": "uint256"
},
{
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"gas": 2427,
"inputs": [
{
"name": "_pool",
"type": "address"
}
],
"name": "get_coins",
"outputs": [
{
"name": "",
"type": "address[2]"
}
],
"stateMutability": "view",
"type": "function"
},
{
"gas": 12195,
"inputs": [
{
"name": "_pool",
"type": "address"
}
],
"name": "get_underlying_coins",
"outputs": [
{
"name": "",
"type": "address[8]"
}
],
"stateMutability": "view",
"type": "function"
},
{
"gas": 1501,
"inputs": [
{
"name": "_pool",
"type": "address"
}
],
"name": "get_decimals",
"outputs": [
{
"name": "",
"type": "uint256[2]"
}
],
"stateMutability": "view",
"type": "function"
},
{
"gas": 10155,
"inputs": [
{
"name": "_pool",
"type": "address"
}
],
"name": "get_underlying_decimals",
"outputs": [
{
"name": "",
"type": "uint256[8]"
}
],
"stateMutability": "view",
"type": "function"
},
{
"gas": 1876,
"inputs": [
{
"name": "_pool",
"type": "address"
}
],
"name": "get_rates",
"outputs": [
{
"name": "",
"type": "uint256[2]"
}
],
"stateMutability": "view",
"type": "function"
},
{
"gas": 1268,
"inputs": [
{
"name": "_pool",
"type": "address"
}
],
"name": "get_balances",
"outputs": [
{
"name": "",
"type": "uint256[2]"
}
],
"stateMutability": "view",
"type": "function"
},
{
"gas": 13247,
"inputs": [
{
"name": "_pool",
"type": "address"
}
],
"name": "get_underlying_balances",
"outputs": [
{
"name": "",
"type": "uint256[8]"
}
],
"stateMutability": "view",
"type": "function"
},
{
"gas": 958,
"inputs": [
{
"name": "_pool",
"type": "address"
}
],
"name": "get_A",
"outputs": [
{
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"gas": 1584,
"inputs": [
{
"name": "_pool",
"type": "address"
}
],
"name": "get_fees",
"outputs": [
{
"name": "",
"type": "uint256"
},
{
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"gas": 1388,
"inputs": [
{
"name": "_pool",
"type": "address"
}
],
"name": "get_admin_balances",
"outputs": [
{
"name": "",
"type": "uint256[2]"
}
],
"stateMutability": "view",
"type": "function"
},
{
"gas": 20309,
"inputs": [
{
"name": "_pool",
"type": "address"
},
{
"name": "_from",
"type": "address"
},
{
"name": "_to",
"type": "address"
}
],
"name": "get_coin_indices",
"outputs": [
{
"name": "",
"type": "int128"
},
{
"name": "",
"type": "int128"
},
{
"name": "",
"type": "bool"
}
],
"stateMutability": "view",
"type": "function"
},
{
"gas": 544334,
"inputs": [
{
"name": "_base_pool",
"type": "address"
},
{
"name": "_metapool_implementation",
"type": "address"
},
{
"name": "_fee_receiver",
"type": "address"
}
],
"name": "add_base_pool",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"gas": 851955,
"inputs": [
{
"name": "_base_pool",
"type": "address"
},
{
"name": "_name",
"type": "string"
},
{
"name": "_symbol",
"type": "string"
},
{
"name": "_coin",
"type": "address"
},
{
"name": "_A",
"type": "uint256"
},
{
"name": "_fee",
"type": "uint256"
}
],
"name": "deploy_metapool",
"outputs": [
{
"name": "",
"type": "address"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"gas": 36668,
"inputs": [
{
"name": "addr",
"type": "address"
}
],
"name": "commit_transfer_ownership",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"gas": 56619,
"inputs": [],
"name": "accept_transfer_ownership",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"gas": 36943,
"inputs": [
{
"name": "_base_pool",
"type": "address"
},
{
"name": "_fee_receiver",
"type": "address"
}
],
"name": "set_fee_receiver",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"gas": 5237,
"inputs": [],
"name": "convert_fees",
"outputs": [
{
"name": "",
"type": "bool"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"gas": 1631,
"inputs": [],
"name": "admin",
"outputs": [
{
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"gas": 1661,
"inputs": [],
"name": "future_admin",
"outputs": [
{
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"gas": 1800,
"inputs": [
{
"name": "arg0",
"type": "uint256"
}
],
"name": "pool_list",
"outputs": [
{
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"gas": 1721,
"inputs": [],
"name": "pool_count",
"outputs": [
{
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"gas": 1860,
"inputs": [
{
"name": "arg0",
"type": "uint256"
}
],
"name": "base_pool_list",
"outputs": [
{
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"gas": 1781,
"inputs": [],
"name": "base_pool_count",
"outputs": [
{
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"gas": 2026,
"inputs": [
{
"name": "arg0",
"type": "address"
}
],
"name": "fee_receiver",
"outputs": [
{
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
}
]

View File

@@ -7,8 +7,7 @@
"6b175474e89094c44da98b954eedeac495271d0f",
"a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
"dac17f958d2ee523a2206206994597c13d831ec7"
],
"attributes": {}
]
},
{
"name": "steth",
@@ -17,8 +16,7 @@
"tokens": [
"EeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",
"ae7ab96520DE3A18E5e111B5EaAb095312D7fE84"
],
"attributes": {}
]
},
{
"name": "tricrypto2",
@@ -28,7 +26,35 @@
"dAC17F958D2ee523a2206206994597C13D831ec7",
"2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599",
"C02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2"
],
"attributes": {}
]
},
{
"name": "crvUSD/USDC",
"address": "4dece678ceceb27446b35c672dc7d61f30bad69e",
"tx_hash": "4b288a16fe2f1c556752478989d88ef6e7a2c9a0cd258a12b11b232a112dc279",
"tokens": [
"a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
"f939e0a03fb07f59a73314e73794be0e57ac1b4e"
]
},
{
"name": "susd",
"address": "A5407eAE9Ba41422680e2e00537571bcC53efBfD",
"tx_hash": "51aca4a03a395de8855fa2ca59b7febe520c2a223e69c502066162f7c1a95ec2",
"tokens": [
"6B175474E89094C44Da98b954EedeAC495271d0F",
"A0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
"dAC17F958D2ee523a2206206994597C13D831ec7",
"57Ab1ec28D129707052df4dF418D58a2D46d5f51"
]
},
{
"name": "fraxusdc",
"address": "DcEF968d416a41Cdac0ED8702fAC8128A64241A2",
"tx_hash": "1f4254004ce9e19d4eb742ee5a69d30f29085902d976f73e97c44150225ef775",
"tokens": [
"853d955aCEf822Db058eb8505911ED77F175b99e",
"A0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"
]
}
]

View File

@@ -2,7 +2,7 @@ import json
from typing import Any
PARAMETERS = "params.json"
EMPTY = "0x0000000000000000000000000000000000000000"
def encode_json_to_query_params(params: list[dict[str, Any]]):
encoded_params = []
@@ -12,6 +12,8 @@ def encode_json_to_query_params(params: list[dict[str, Any]]):
tx_hash: str = param["tx_hash"]
tokens: list[str] = param["tokens"]
attributes: dict[str, str] = param["attributes"]
attributes["name"] = param["name"]
attributes["factory"] = EMPTY
encoded_address = f"address={address}"
encoded_tx_hash = f"tx_hash={tx_hash}"

File diff suppressed because it is too large Load Diff

View File

@@ -1,12 +1,16 @@
pub mod crypto_pool_factory;
pub mod stableswap_factory;
pub mod susd;
pub mod pool_tricrypto;
pub mod pool_crypto_swap_ng;
pub mod pool_tricrypto2;
pub mod crypto_swap_ng_factory;
pub mod test;
pub mod pool_steth;
pub mod pool;
pub mod tricrypto_factory;
pub mod main_registry;
pub mod pool_3pool;
pub mod ERC20;
pub mod meta_pool_factory;
pub mod crypto_swap_registry;

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -81,21 +81,7 @@ pub fn map_components(
})
}
/// Simply stores the `ProtocolComponent`s with the pool id as the key
#[substreams::handlers::store]
pub fn store_components(map: BlockTransactionProtocolComponents, store: StoreAddInt64) {
store.add_many(
0,
&map.tx_components
.iter()
.flat_map(|tx_components| &tx_components.components)
.map(|component| format!("pool:{0}", component.id))
.collect::<Vec<_>>(),
1,
);
}
/// Simply stores the `ProtocolComponent`s with the pool id as the key
/// Simply stores the `ProtocolComponent`s with the pool id as the key and tokens as the value
#[substreams::handlers::store]
pub fn store_component_tokens(map: BlockTransactionProtocolComponents, store: StoreSetString) {
map.tx_components
@@ -119,14 +105,13 @@ pub fn store_component_tokens(map: BlockTransactionProtocolComponents, store: St
#[substreams::handlers::map]
pub fn map_relative_balances(
block: eth::v2::Block,
pools_store: StoreGetInt64,
tokens_store: StoreGetString,
) -> Result<BlockBalanceDeltas, anyhow::Error> {
Ok(BlockBalanceDeltas {
balance_deltas: {
block
.logs()
.filter_map(|log| emit_deltas(log, &pools_store, &tokens_store))
.filter_map(|log| emit_deltas(log, &tokens_store))
.flat_map(|deltas| deltas.into_iter())
.collect::<Vec<_>>()
},
@@ -151,7 +136,7 @@ pub fn map_protocol_changes(
block: eth::v2::Block,
grouped_components: BlockTransactionProtocolComponents,
deltas: BlockBalanceDeltas,
components_store: StoreGetInt64,
components_store: StoreGetString,
balance_store: StoreDeltas, // Note, this map module is using the `deltas` mode for the store.
) -> Result<BlockContractChanges> {
// We merge contract changes by transaction (identified by transaction index) making it easy to

View File

@@ -1,5 +1,4 @@
use substreams::{
hex,
scalar::BigInt,
store::{StoreGet, StoreGetInt64, StoreGetString},
};
@@ -21,18 +20,10 @@ fn tx_from_log(log: &LogView) -> Transaction {
/// pools contain differing ABIs, we load in several examples of abis in order to best match the
/// topic ID to the correct event. The repetition in this function is dervived from the fact that
/// most of these events have similar structures, but the specific topic id differs.
pub fn emit_deltas(
log: LogView,
pools_store: &StoreGetInt64,
tokens_store: &StoreGetString,
) -> Option<Vec<BalanceDelta>> {
pub fn emit_deltas(log: LogView, tokens_store: &StoreGetString) -> Option<Vec<BalanceDelta>> {
let pool_key = format!("pool:{}", hex::encode(&log.address()));
if pools_store.get_last(pool_key).is_none() {
return None;
}
let tokens = tokens_store
.get_last(format!("pool:{}", hex::encode(log.address())))?
.get_last(pool_key)?
.split(":")
.map(|token| token.to_owned())
.collect::<Vec<_>>();

View File

@@ -12,12 +12,12 @@ use substreams::scalar::BigInt;
const EMPTY_BYTES32: [u8; 32] = [0; 32];
const EMPTY_ADDRESS: [u8; 20] = hex!("0000000000000000000000000000000000000000");
const CRYPTO_SWAP_REGISTRY: [u8; 20] = hex!("9a32aF1A11D9c937aEa61A3790C2983257eA8Bc0");
const MAIN_REGISTRY: [u8; 20] = hex!("90E00ACe148ca3b23Ac1bC8C240C2a7Dd9c2d7f5");
const CRYPTO_POOL_FACTORY: [u8; 20] = hex!("F18056Bbd320E96A48e3Fbf8bC061322531aac99");
const META_POOL_FACTORY: [u8; 20] = hex!("B9fC157394Af804a3578134A6585C0dc9cc990d4");
const META_POOL_FACTORY_OLD: [u8; 20] = hex!("0959158b6040D32d04c301A72CBFD6b39E21c9AE");
const CRYPTO_SWAP_NG_FACTORY: [u8; 20] = hex!("6A8cbed756804B16E05E741eDaBd5cB544AE21bf");
const TRICRYPTO_FACTORY: [u8; 20] = hex!("0c0e5f2fF0ff18a3be9b835635039256dC4B4963");
const STABLESWAP_FACTORY: [u8; 20] = hex!("4F8846Ae9380B90d2E71D5e3D042dff3E7ebb40d");
/// This trait defines some helpers for serializing and deserializing `Vec<BigInt>` which is needed
/// to be able to encode some of the `Attribute`s. This should also be handled by any downstream
@@ -42,6 +42,10 @@ impl SerializableVecBigInt for Vec<BigInt> {
}
}
fn address_to_bytes_with_0x(address: &[u8; 20]) -> Vec<u8> {
format!("0x{}", hex::encode(address)).into_bytes()
}
pub fn address_map(
call_address: &[u8; 20],
log: &Log,
@@ -49,181 +53,9 @@ pub fn address_map(
tx: &TransactionTrace,
) -> Option<ProtocolComponent> {
match *call_address {
CRYPTO_SWAP_REGISTRY => {
let pool_added = abi::crypto_swap_registry::events::PoolAdded::match_and_decode(log)?;
let add_pool = abi::crypto_swap_registry::functions::AddPool1::match_and_decode(call)
.map(|add_pool| abi::crypto_swap_registry::functions::AddPool3 {
pool: add_pool.pool,
lp_token: add_pool.lp_token,
gauge: add_pool.gauge,
zap: add_pool.zap,
n_coins: add_pool.n_coins,
name: add_pool.name,
base_pool: EMPTY_ADDRESS.clone().into(),
has_positive_rebasing_tokens: false,
})
.or_else(|| {
abi::crypto_swap_registry::functions::AddPool2::match_and_decode(call).map(
|add_pool| abi::crypto_swap_registry::functions::AddPool3 {
pool: add_pool.pool,
lp_token: add_pool.lp_token,
gauge: add_pool.gauge,
zap: add_pool.zap,
n_coins: add_pool.n_coins,
name: add_pool.name,
base_pool: add_pool.base_pool,
has_positive_rebasing_tokens: false,
},
)
})
.or_else(|| {
abi::crypto_swap_registry::functions::AddPool3::match_and_decode(call)
})?;
// We need to perform an eth_call in order to actually get the pool's tokens
let coins_function =
abi::crypto_swap_registry::functions::GetCoins { pool: add_pool.pool };
let coins = coins_function.call(CRYPTO_SWAP_REGISTRY.to_vec())?;
let trimmed_coins: Vec<_> = coins
.get(0..add_pool.n_coins.to_i32() as usize)
.unwrap()
.to_vec();
Some(ProtocolComponent {
id: hex::encode(&pool_added.pool),
tx: Some(Transaction {
to: tx.to.clone(),
from: tx.from.clone(),
hash: tx.hash.clone(),
index: tx.index.into(),
}),
tokens: trimmed_coins,
contracts: vec![pool_added.pool],
static_att: vec![
Attribute {
name: "pool_type".into(),
value: "CryptoSwap".into(),
change: ChangeType::Creation.into(),
},
Attribute {
name: "name".into(),
value: add_pool.name.into(),
change: ChangeType::Creation.into(),
},
Attribute {
name: "lp_token".into(),
value: add_pool.lp_token.into(),
change: ChangeType::Creation.into(),
},
],
change: ChangeType::Creation.into(),
protocol_type: Some(ProtocolType {
name: "curve_pool".into(),
financial_type: FinancialType::Swap.into(),
attribute_schema: Vec::new(),
implementation_type: ImplementationType::Vm.into(),
}),
})
}
MAIN_REGISTRY => {
let pool_created = abi::main_registry::events::PoolAdded::match_and_decode(log)?;
let add_pool =
abi::main_registry::functions::AddPoolWithoutUnderlying::match_and_decode(call)
.map(|add_pool| abi::main_registry::functions::AddPool {
pool: add_pool.pool,
lp_token: add_pool.lp_token,
rate_info: add_pool.rate_info,
decimals: add_pool.decimals,
n_coins: add_pool.n_coins,
underlying_decimals: BigInt::from(0), // not needed
has_initial_a: add_pool.has_initial_a,
is_v1: add_pool.is_v1,
name: add_pool.name,
})
.or_else(|| {
abi::main_registry::functions::AddMetapool1::match_and_decode(call).map(
|add_pool| abi::main_registry::functions::AddPool {
pool: add_pool.pool,
lp_token: add_pool.lp_token,
rate_info: EMPTY_BYTES32.clone(),
decimals: add_pool.decimals,
n_coins: add_pool.n_coins,
underlying_decimals: BigInt::from(0), // not needed
has_initial_a: true,
is_v1: false,
name: add_pool.name,
},
)
})
.or_else(|| {
abi::main_registry::functions::AddMetapool2::match_and_decode(call).map(
|add_pool| abi::main_registry::functions::AddPool {
pool: add_pool.pool,
lp_token: add_pool.lp_token,
rate_info: EMPTY_BYTES32.clone(),
decimals: add_pool.decimals,
n_coins: add_pool.n_coins,
underlying_decimals: BigInt::from(0), // not needed
has_initial_a: true,
is_v1: false,
name: add_pool.name,
},
)
})
.or_else(|| abi::main_registry::functions::AddPool::match_and_decode(call))?;
// We need to perform an eth_call in order to actually get the pool's tokens
let coins_function = abi::main_registry::functions::GetCoins { pool: add_pool.pool };
let coins = coins_function.call(MAIN_REGISTRY.to_vec())?;
let trimmed_coins: Vec<_> = coins
.get(0..add_pool.n_coins.to_i32() as usize)
.unwrap_or(&[])
.to_vec();
Some(ProtocolComponent {
id: hex::encode(&pool_created.pool),
tx: Some(Transaction {
to: tx.to.clone(),
from: tx.from.clone(),
hash: tx.hash.clone(),
index: tx.index.into(),
}),
tokens: trimmed_coins,
contracts: vec![pool_created.pool],
static_att: vec![
Attribute {
name: "pool_type".into(),
value: "MainRegistry".into(),
change: ChangeType::Creation.into(),
},
Attribute {
name: "name".into(),
value: add_pool.name.into(),
change: ChangeType::Creation.into(),
},
Attribute {
name: "lp_token".into(),
value: add_pool.lp_token.into(),
change: ChangeType::Creation.into(),
},
],
change: ChangeType::Creation.into(),
protocol_type: Some(ProtocolType {
name: "curve_pool".into(),
financial_type: FinancialType::Swap.into(),
attribute_schema: Vec::new(),
implementation_type: ImplementationType::Vm.into(),
}),
})
}
CRYPTO_POOL_FACTORY => {
let pool_added =
abi::crypto_pool_factory::events::CryptoPoolDeployed::match_and_decode(log)?;
let deploy_call =
abi::crypto_pool_factory::functions::DeployPool::match_and_decode(call)?;
let component_id = &call.return_data[12..];
@@ -240,7 +72,7 @@ pub fn address_map(
static_att: vec![
Attribute {
name: "pool_type".into(),
value: "CryptoPool".into(),
value: "crypto_pool".into(),
change: ChangeType::Creation.into(),
},
Attribute {
@@ -249,60 +81,13 @@ pub fn address_map(
change: ChangeType::Creation.into(),
},
Attribute {
name: "lp_token".into(),
value: pool_added.gamma.to_string().into(),
name: "factory_name".into(),
value: "crypto_pool".into(),
change: ChangeType::Creation.into(),
},
Attribute {
name: "mid_fee".into(),
value: deploy_call.mid_fee.to_string().into(),
change: ChangeType::Creation.into(),
},
Attribute {
name: "out_fee".into(),
value: deploy_call.out_fee.to_string().into(),
change: ChangeType::Creation.into(),
},
Attribute {
name: "allowed_extra_profit".into(),
value: deploy_call
.allowed_extra_profit
.to_string()
.into(),
change: ChangeType::Creation.into(),
},
Attribute {
name: "fee_gamma".into(),
value: deploy_call.fee_gamma.to_string().into(),
change: ChangeType::Creation.into(),
},
Attribute {
name: "adjustment_step".into(),
value: deploy_call
.adjustment_step
.to_string()
.into(),
change: ChangeType::Creation.into(),
},
Attribute {
name: "admin_fee".into(),
value: deploy_call.admin_fee.to_string().into(),
change: ChangeType::Creation.into(),
},
Attribute {
name: "ma_half_time".into(),
value: deploy_call
.ma_half_time
.to_string()
.into(),
change: ChangeType::Creation.into(),
},
Attribute {
name: "initial_price".into(),
value: deploy_call
.initial_price
.to_string()
.into(),
name: "factory".into(),
value: address_to_bytes_with_0x(&CRYPTO_POOL_FACTORY),
change: ChangeType::Creation.into(),
},
],
@@ -376,13 +161,13 @@ pub fn address_map(
change: ChangeType::Creation.into(),
},
Attribute {
name: "fee".into(),
value: add_pool.fee.to_string().into(),
name: "factory_name".into(),
value: "meta_pool".into(),
change: ChangeType::Creation.into(),
},
Attribute {
name: "a".into(),
value: add_pool.a.to_string().into(),
name: "factory".into(),
value: address_to_bytes_with_0x(&META_POOL_FACTORY),
change: ChangeType::Creation.into(),
},
],
@@ -426,11 +211,95 @@ pub fn address_map(
}),
tokens: vec![pool_added.coin, add_pool.base_pool.clone()],
contracts: vec![component_id.into(), add_pool.base_pool.clone()],
static_att: vec![Attribute {
name: "pool_type".into(),
value: "MetaPool".into(),
change: ChangeType::Creation.into(),
}],
static_att: vec![
Attribute {
name: "pool_type".into(),
value: "metapool".into(),
change: ChangeType::Creation.into(),
},
Attribute {
name: "name".into(),
value: add_pool.name.into(),
change: ChangeType::Creation.into(),
},
Attribute {
name: "factory_name".into(),
value: "meta_pool".into(),
change: ChangeType::Creation.into(),
},
Attribute {
name: "factory".into(),
value: address_to_bytes_with_0x(&META_POOL_FACTORY),
change: ChangeType::Creation.into(),
},
],
change: ChangeType::Creation.into(),
protocol_type: Some(ProtocolType {
name: "curve_pool".into(),
financial_type: FinancialType::Swap.into(),
attribute_schema: Vec::new(),
implementation_type: ImplementationType::Vm.into(),
}),
})
} else {
None
}
}
META_POOL_FACTORY_OLD => {
if let Some(pool_added) =
abi::meta_pool_factory::events::MetaPoolDeployed::match_and_decode(log)
{
let add_pool =
abi::meta_pool_factory::functions::DeployMetapool1::match_and_decode(call)
.map(|add_pool| abi::meta_pool_factory::functions::DeployMetapool2 {
base_pool: add_pool.base_pool,
name: add_pool.name,
symbol: add_pool.symbol,
coin: add_pool.coin,
a: add_pool.a,
fee: add_pool.fee,
implementation_idx: BigInt::from(0),
})
.or_else(|| {
abi::meta_pool_factory::functions::DeployMetapool2::match_and_decode(
call,
)
})?;
let component_id = &call.return_data[12..];
Some(ProtocolComponent {
id: hex::encode(component_id),
tx: Some(Transaction {
to: tx.to.clone(),
from: tx.from.clone(),
hash: tx.hash.clone(),
index: tx.index.into(),
}),
tokens: vec![pool_added.coin, add_pool.base_pool.clone()],
contracts: vec![component_id.into(), add_pool.base_pool.clone()],
static_att: vec![
Attribute {
name: "pool_type".into(),
value: "metapool".into(),
change: ChangeType::Creation.into(),
},
Attribute {
name: "name".into(),
value: add_pool.name.into(),
change: ChangeType::Creation.into(),
},
Attribute {
name: "factory_name".into(),
value: "meta_pool".into(),
change: ChangeType::Creation.into(),
},
Attribute {
name: "factory".into(),
value: address_to_bytes_with_0x(&META_POOL_FACTORY),
change: ChangeType::Creation.into(),
},
],
change: ChangeType::Creation.into(),
protocol_type: Some(ProtocolType {
name: "curve_pool".into(),
@@ -465,7 +334,7 @@ pub fn address_map(
static_att: vec![
Attribute {
name: "pool_type".into(),
value: "Pool".into(),
value: "plain_pool".into(),
change: ChangeType::Creation.into(),
},
Attribute {
@@ -474,19 +343,19 @@ pub fn address_map(
change: ChangeType::Creation.into(),
},
Attribute {
name: "fee".into(),
value: pool_added.fee.to_string().into(),
name: "factory_name".into(),
value: "crypto_swap_ng".into(),
change: ChangeType::Creation.into(),
},
Attribute {
name: "a".into(),
value: pool_added.a.to_string().into(),
name: "factory".into(),
value: address_to_bytes_with_0x(&CRYPTO_SWAP_NG_FACTORY),
change: ChangeType::Creation.into(),
},
],
change: ChangeType::Creation.into(),
protocol_type: Some(ProtocolType {
name: "crypto_swap_ng".into(),
name: "curve_pool".into(),
financial_type: FinancialType::Swap.into(),
attribute_schema: Vec::new(),
implementation_type: ImplementationType::Vm.into(),
@@ -511,7 +380,7 @@ pub fn address_map(
static_att: vec![
Attribute {
name: "pool_type".into(),
value: "Pool".into(),
value: "metapool".into(),
change: ChangeType::Creation.into(),
},
Attribute {
@@ -520,19 +389,19 @@ pub fn address_map(
change: ChangeType::Creation.into(),
},
Attribute {
name: "fee".into(),
value: pool_added.fee.to_string().into(),
name: "factory_name".into(),
value: "crypto_swap_ng".into(),
change: ChangeType::Creation.into(),
},
Attribute {
name: "a".into(),
value: pool_added.a.to_string().into(),
name: "factory".into(),
value: address_to_bytes_with_0x(&CRYPTO_SWAP_NG_FACTORY),
change: ChangeType::Creation.into(),
},
],
change: ChangeType::Creation.into(),
protocol_type: Some(ProtocolType {
name: "crypto_swap_ng".into(),
name: "curve_pool".into(),
financial_type: FinancialType::Swap.into(),
attribute_schema: Vec::new(),
implementation_type: ImplementationType::Vm.into(),
@@ -559,7 +428,7 @@ pub fn address_map(
static_att: vec![
Attribute {
name: "pool_type".into(),
value: "Pool".into(),
value: "trycrypto".into(),
change: ChangeType::Creation.into(),
},
Attribute {
@@ -567,10 +436,163 @@ pub fn address_map(
value: pool_added.name.into(),
change: ChangeType::Creation.into(),
},
Attribute {
name: "factory_name".into(),
value: "tricrypto".into(),
change: ChangeType::Creation.into(),
},
Attribute {
name: "factory".into(),
value: address_to_bytes_with_0x(&TRICRYPTO_FACTORY),
change: ChangeType::Creation.into(),
},
],
change: ChangeType::Creation.into(),
protocol_type: Some(ProtocolType {
name: "tricrypto".into(),
name: "curve_pool".into(),
financial_type: FinancialType::Swap.into(),
attribute_schema: Vec::new(),
implementation_type: ImplementationType::Vm.into(),
}),
})
} else {
None
}
}
STABLESWAP_FACTORY => {
if let Some(pool_added) =
abi::stableswap_factory::events::PlainPoolDeployed::match_and_decode(log)
{
let add_pool = if let Some(pool) =
abi::stableswap_factory::functions::DeployPlainPool1::match_and_decode(call)
{
abi::stableswap_factory::functions::DeployPlainPool3 {
name: pool.name,
symbol: pool.symbol,
coins: pool.coins,
a: pool.a,
fee: pool.fee,
asset_type: BigInt::from(0),
implementation_idx: BigInt::from(0),
}
} else if let Some(pool) =
abi::stableswap_factory::functions::DeployPlainPool2::match_and_decode(call)
{
abi::stableswap_factory::functions::DeployPlainPool3 {
name: pool.name,
symbol: pool.symbol,
coins: pool.coins,
a: pool.a,
fee: pool.fee,
asset_type: BigInt::from(0),
implementation_idx: BigInt::from(0),
}
} else if let Some(pool) =
abi::stableswap_factory::functions::DeployPlainPool3::match_and_decode(call)
{
pool
} else {
return None;
};
let component_id = &call.return_data[12..];
Some(ProtocolComponent {
id: hex::encode(component_id),
tx: Some(Transaction {
to: tx.to.clone(),
from: tx.from.clone(),
hash: tx.hash.clone(),
index: tx.index.into(),
}),
tokens: pool_added.coins.into(),
contracts: vec![component_id.into()],
static_att: vec![
Attribute {
name: "pool_type".into(),
value: "plain".into(),
change: ChangeType::Creation.into(),
},
Attribute {
name: "name".into(),
value: add_pool.name.into(),
change: ChangeType::Creation.into(),
},
Attribute {
name: "factory_name".into(),
value: "stable_swap".into(),
change: ChangeType::Creation.into(),
},
Attribute {
name: "factory".into(),
value: address_to_bytes_with_0x(&CRYPTO_SWAP_NG_FACTORY),
change: ChangeType::Creation.into(),
},
],
change: ChangeType::Creation.into(),
protocol_type: Some(ProtocolType {
name: "curve".into(),
financial_type: FinancialType::Swap.into(),
attribute_schema: Vec::new(),
implementation_type: ImplementationType::Vm.into(),
}),
})
} else if let Some(pool_added) =
abi::stableswap_factory::events::MetaPoolDeployed::match_and_decode(log)
{
let add_pool = if let Some(pool) =
abi::stableswap_factory::functions::DeployMetapool1::match_and_decode(call)
{
abi::stableswap_factory::functions::DeployMetapool2 {
base_pool: pool.base_pool,
name: pool.name,
symbol: pool.symbol,
coin: pool.coin,
a: pool.a,
fee: pool.fee,
implementation_idx: BigInt::from(0),
}
} else if let Some(pool) =
abi::stableswap_factory::functions::DeployMetapool2::match_and_decode(call)
{
pool
} else {
return None;
};
let component_id = &call.return_data[12..];
Some(ProtocolComponent {
id: hex::encode(component_id),
tx: Some(Transaction {
to: tx.to.clone(),
from: tx.from.clone(),
hash: tx.hash.clone(),
index: tx.index.into(),
}),
tokens: vec![pool_added.coin, pool_added.base_pool],
contracts: vec![component_id.into()],
static_att: vec![
Attribute {
name: "pool_type".into(),
value: "metapool".into(),
change: ChangeType::Creation.into(),
},
Attribute {
name: "name".into(),
value: add_pool.name.into(),
change: ChangeType::Creation.into(),
},
Attribute {
name: "factory_name".into(),
value: "stable_swap".into(),
change: ChangeType::Creation.into(),
},
Attribute {
name: "factory".into(),
value: address_to_bytes_with_0x(&STABLESWAP_FACTORY),
change: ChangeType::Creation.into(),
},
],
change: ChangeType::Creation.into(),
protocol_type: Some(ProtocolType {
name: "curve".into(),
financial_type: FinancialType::Swap.into(),
attribute_schema: Vec::new(),
implementation_type: ImplementationType::Vm.into(),

View File

@@ -27,14 +27,6 @@ modules:
output:
type: proto:tycho.evm.v1.BlockTransactionProtocolComponents
- name: store_components
kind: store
initialBlock: 18830232
updatePolicy: add
valueType: int64
inputs:
- map: map_components
- name: store_component_tokens
kind: store
initialBlock: 18830232
@@ -68,7 +60,7 @@ modules:
- source: sf.ethereum.type.v2.Block
- map: map_components
- map: map_relative_balances
- store: store_components
- store: store_component_tokens
- store: store_balances
mode: deltas # This is the key property that simplifies `BalanceChange` handling
output: