-
Notifications
You must be signed in to change notification settings - Fork 58
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
Deterministic testing integration #671
base: release-candidate
Are you sure you want to change the base?
Changes from all commits
7f689e4
608e03b
d250e3b
0134d33
ada8b74
9f5df66
c781636
98424b3
c58f5d9
69f5535
578a5f7
e7d869d
c61bef5
46001f3
e19eb48
775e251
290e693
85195f6
cf2bb0d
5380e84
3c95f60
5a6518c
77a9308
9f495a6
8541f60
af5c22f
f68f95b
4b8e5dc
3832f0f
573ef3e
23865a5
26c5e96
66b327a
fc1fe82
dcccf98
d5c6300
ed7a3ea
834d429
5c1c137
c97312f
101550f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -155,6 +155,20 @@ | |
"stateMutability": "view", | ||
"inputs": [], | ||
"outputs": [{"internalType": "uint32", "name": "", "type": "uint32"}] | ||
}, | ||
{ | ||
"type": "function", | ||
"name": "deleteStrategy", | ||
"stateMutability": "nonpayable", | ||
"inputs": [{"internalType": "uint256","name": "strategyId","type": "uint256"}], | ||
"outputs": [] | ||
}, | ||
{ | ||
"type":"function", | ||
"name":"createStrategy", | ||
"stateMutability":"payable", | ||
"inputs":[{"internalType":"Token","name":"token0","type":"address"},{"internalType":"Token","name":"token1","type":"address"},{"components":[{"internalType":"uint128","name":"y","type":"uint128"},{"internalType":"uint128","name":"z","type":"uint128"},{"internalType":"uint64","name":"A","type":"uint64"},{"internalType":"uint64","name":"B","type":"uint64"}],"internalType":"structOrder[2]","name":"orders","type":"tuple[2]"}], | ||
"outputs":[{"internalType":"uint256","name":"","type":"uint256"}] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These two contract functions ( They are not supposed to ever be used by the bot, even though they can technically be executed in read-only mode (aka static call). If this is indeed how you're using them, then there is very likely a better way (i.e., calling an actual read function in the same contract). |
||
} | ||
] | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
cid,last_updated,last_updated_block,descr,pair_name,exchange_name,fee,fee_float,address,anchor,tkn0_address,tkn1_address,tkn0_decimals,tkn1_decimals,exchange_id,tkn0_symbol,tkn1_symbol,timestamp,tkn0_balance,tkn1_balance,liquidity,sqrt_price_q96,tick,tick_spacing,exchange,pool_type,tkn0_weight,tkn1_weight,tkn2_address,tkn2_decimals,tkn2_symbol,tkn2_balance,tkn2_weight,tkn3_address,tkn3_decimals,tkn3_symbol,tkn3_balance,tkn3_weight,tkn4_address,tkn4_decimals,tkn4_symbol,tkn4_balance,tkn4_weight,tkn5_address,tkn5_decimals,tkn5_symbol,tkn5_balance,tkn5_weight,tkn6_address,tkn6_decimals,tkn6_symbol,tkn6_balance,tkn6_weight,tkn7_address,tkn7_decimals,tkn7_symbol,tkn7_balance,tkn7_weight,test,exchange_type,pool_address,tkn0_setBalance,tkn1_setBalance,slots,param_lists,param_blockTimestampLast,param_blockTimestampLast_type,param_reserve0,param_reserve0_type,param_reserve1,param_reserve1_type,param_liquidity,param_liquidity_type,param_sqrtPriceX96,param_sqrtPriceX96_type,param_tick,param_tick_type,param_observationIndex,param_observationIndex_type,param_observationCardinality,param_observationCardinality_type,param_observationCardinalityNext,param_observationCardinalityNext_type,param_feeProtocol,param_feeProtocol_type,param_unlocked,param_unlocked_type | ||
,,0,uniswap_v2 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48/0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2 0.003,0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48/0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2,uniswap_v2,3000,0.003,0xB4e16d0168e52d35CaCD2c6185b44281Ec28C9Dc,,0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48,0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2,6,18,3,USDC,WETH,,,,,,,60,uniswap_v2,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,uniswap_v2,0xB4e16d0168e52d35CaCD2c6185b44281Ec28C9Dc,49204613674917,21734090459912674200000,"[8,]","[['blockTimestampLast','reserve1','reserve0'],]",,uint32,49204613674917,uint112,21734090459912674200000,uint112,,,,,,,,,,,,,,,, | ||
,,0,uniswap_v3 0x514910771AF9Ca656af840dff83E8264EcF986CA/0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2 0.003,0x514910771AF9Ca656af840dff83E8264EcF986CA/0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2,uniswap_v3,3000,0.003,0xa6Cc3C2531FdaA6Ae1A3CA84c2855806728693e8,,0x514910771AF9Ca656af840dff83E8264EcF986CA,0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2,18,18,4,LINK,WETH,,,,,,,60,uniswap_v3,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,2,uniswap_v3,0xa6Cc3C2531FdaA6Ae1A3CA84c2855806728693e8,1312731411619255420525571,7101396323681156262130,"[4,0,]","[['liquidity'],['unlocked', 'feeProtocol', 'observationCardinalityNext', 'observationCardinality', 'observationIndex', 'tick', 'sqrtPriceX96']]",,,,,,,1456862313731161106039763,"uint128",6362445213301469813433370622,"uint160",-50441,"int24",85,"uint16",180,"uint16",180,"uint16",0,"uint8",True,bool | ||
,,0,pancakeswap_v3 0x6B175474E89094C44Da98b954EedeAC495271d0F/0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48 0.0001,0x6B175474E89094C44Da98b954EedeAC495271d0F/0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48,pancakeswap_v3,100,0.0001,0xD9e497BD8f491fE163b42A62c296FB54CaEA74B7,,0x6B175474E89094C44Da98b954EedeAC495271d0F,0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48,18,6,10,DAI,USDC,0,0,0,0,0,0,1,pancakeswap_v3,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,3,pancakeswap_v3,0xD9e497BD8f491fE163b42A62c296FB54CaEA74B7,13653990890660798693042,135975525713,"[4,0,1,]","[['liquidity'],['observationCardinalityNext', 'observationCardinality', 'observationIndex', 'tick', 'sqrtPriceX96'],['unlocked', 'feeProtocol']]",,,,,,,1275240832730323472063,"uint128",79228147574959555694268,"uint160",-276325,"int24",0,"uint16",1,"uint16",1,"uint16",216272100,"uint32",True,bool | ||
,,0,pancakeswap_v2 0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599/0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2 0.0025,0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599/0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2,pancakeswap_v2,2500,0.0025,0x4AB6702B3Ed3877e9b1f203f90cbEF13d663B0e8,,0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599,0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2,8,18,9,WBTC,WETH,0,0,0,,,,,pancakeswap_v2,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,pancakeswap_v2,0x4AB6702B3Ed3877e9b1f203f90cbEF13d663B0e8,421419304,78852853048776778963,"[8,]","[['blockTimestampLast','reserve1','reserve0'],]",,uint32,421419304,uint112,78852853048776778963,uint112,,,,,,,,,,,,,,,, | ||
,,0,uniswap_v3 0x6B175474E89094C44Da98b954EedeAC495271d0F/0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2 0.0005,0x6B175474E89094C44Da98b954EedeAC495271d0F/0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2,uniswap_v3,500,0.0005,0x60594a405d53811d3BC4766596EFD80fd545A270,,0x6B175474E89094C44Da98b954EedeAC495271d0F,0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2,18,18,4,DAI,WETH,,,,,,,10,uniswap_v3,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,3,uniswap_v3,0x60594a405d53811d3BC4766596EFD80fd545A270,2850299295281281234085971,1147049345011454055669,"[4,0,]","[['liquidity'],['unlocked', 'feeProtocol', 'observationCardinalityNext', 'observationCardinality', 'observationIndex', 'tick', 'sqrtPriceX96']]",,,,,,,451613902936689743409876,"uint128",1659826732499374354385938036,"uint160",-77317,"int24",110,"uint16",180,"uint16",180,"uint16",0,"uint8",True,bool |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -62,7 +62,8 @@ def validate_and_submit_transaction( | |
src_address: str, | ||
expected_profit_gastkn: Decimal, | ||
expected_profit_usd: Decimal, | ||
flashloan_struct: List[Dict] | ||
flashloan_struct: List[Dict], | ||
log_dict: Dict | ||
) -> Tuple[Optional[str], Optional[dict]]: | ||
""" | ||
This method validates and submits a transaction to the arb contract. | ||
|
@@ -104,7 +105,7 @@ def validate_and_submit_transaction( | |
self._update_transaction(tx) | ||
except Exception as e: | ||
self.cfg.logger.info(f"Transaction {dumps(tx, indent=4)}\nFailed with {e}") | ||
return None, None | ||
return None, None, None | ||
|
||
tx["gas"] += self.cfg.DEFAULT_GAS_SAFETY_OFFSET | ||
|
||
|
@@ -132,9 +133,9 @@ def validate_and_submit_transaction( | |
self.cfg.logger.info(f"Waiting for transaction {tx_hash} receipt") | ||
tx_receipt = self._wait_for_transaction_receipt(tx_hash) | ||
self.cfg.logger.info(f"Transaction receipt: {dumps(tx_receipt, indent=4)}") | ||
return tx_hash, tx_receipt | ||
return tx_hash, tx_receipt, log_dict | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Passing an additional input parameter just in order to return it seems futile. |
||
|
||
return None, None | ||
return None, None, None | ||
|
||
def check_and_approve_tokens(self, tokens: List): | ||
""" | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
cid,last_updated,last_updated_block,descr,pair_name,exchange_name,fee,fee_float,address,anchor,tkn0_address,tkn1_address,tkn0_decimals,tkn1_decimals,exchange_id,tkn0_symbol,tkn1_symbol,timestamp,tkn0_balance,tkn1_balance,liquidity,sqrt_price_q96,tick,tick_spacing,exchange,pool_type,tkn0_weight,tkn1_weight,tkn2_address,tkn2_decimals,tkn2_symbol,tkn2_balance,tkn2_weight,tkn3_address,tkn3_decimals,tkn3_symbol,tkn3_balance,tkn3_weight,tkn4_address,tkn4_decimals,tkn4_symbol,tkn4_balance,tkn4_weight,tkn5_address,tkn5_decimals,tkn5_symbol,tkn5_balance,tkn5_weight,tkn6_address,tkn6_decimals,tkn6_symbol,tkn6_balance,tkn6_weight,tkn7_address,tkn7_decimals,tkn7_symbol,tkn7_balance,tkn7_weight,test,exchange_type,pool_address,tkn0_setBalance,tkn1_setBalance,slots,param_lists,param_blockTimestampLast,param_blockTimestampLast_type,param_reserve0,param_reserve0_type,param_reserve1,param_reserve1_type,param_liquidity,param_liquidity_type,param_sqrtPriceX96,param_sqrtPriceX96_type,param_tick,param_tick_type,param_observationIndex,param_observationIndex_type,param_observationCardinality,param_observationCardinality_type,param_observationCardinalityNext,param_observationCardinalityNext_type,param_feeProtocol,param_feeProtocol_type,param_unlocked,param_unlocked_type | ||
,,0,uniswap_v2 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48/0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2 0.003,0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48/0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2,uniswap_v2,3000,0.003,0xB4e16d0168e52d35CaCD2c6185b44281Ec28C9Dc,,0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48,0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2,6,18,3,USDC,WETH,,,,,,,60,uniswap_v2,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,uniswap_v2,0xB4e16d0168e52d35CaCD2c6185b44281Ec28C9Dc,49204613674917,21734090459912674200000,"[8,]","[['blockTimestampLast','reserve1','reserve0'],]",,uint32,49204613674917,uint112,21734090459912674200000,uint112,,,,,,,,,,,,,,,, | ||
,,0,uniswap_v3 0x514910771AF9Ca656af840dff83E8264EcF986CA/0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2 0.003,0x514910771AF9Ca656af840dff83E8264EcF986CA/0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2,uniswap_v3,3000,0.003,0xa6Cc3C2531FdaA6Ae1A3CA84c2855806728693e8,,0x514910771AF9Ca656af840dff83E8264EcF986CA,0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2,18,18,4,LINK,WETH,,,,,,,60,uniswap_v3,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,2,uniswap_v3,0xa6Cc3C2531FdaA6Ae1A3CA84c2855806728693e8,1312731411619255420525571,7101396323681156262130,"[4,0,]","[['liquidity'],['unlocked', 'feeProtocol', 'observationCardinalityNext', 'observationCardinality', 'observationIndex', 'tick', 'sqrtPriceX96']]",,,,,,,1456862313731161106039763,"uint128",6362445213301469813433370622,"uint160",-50441,"int24",85,"uint16",180,"uint16",180,"uint16",0,"uint8",True,bool | ||
,,0,pancakeswap_v3 0x6B175474E89094C44Da98b954EedeAC495271d0F/0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48 0.0001,0x6B175474E89094C44Da98b954EedeAC495271d0F/0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48,pancakeswap_v3,100,0.0001,0xD9e497BD8f491fE163b42A62c296FB54CaEA74B7,,0x6B175474E89094C44Da98b954EedeAC495271d0F,0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48,18,6,10,DAI,USDC,0,0,0,0,0,0,1,pancakeswap_v3,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,3,pancakeswap_v3,0xD9e497BD8f491fE163b42A62c296FB54CaEA74B7,13653990890660798693042,135975525713,"[4,0,1,]","[['liquidity'],['observationCardinalityNext', 'observationCardinality', 'observationIndex', 'tick', 'sqrtPriceX96'],['unlocked', 'feeProtocol']]",,,,,,,1275240832730323472063,"uint128",79228147574959555694268,"uint160",-276325,"int24",0,"uint16",1,"uint16",1,"uint16",216272100,"uint32",True,bool | ||
,,0,pancakeswap_v2 0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599/0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2 0.0025,0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599/0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2,pancakeswap_v2,2500,0.0025,0x4AB6702B3Ed3877e9b1f203f90cbEF13d663B0e8,,0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599,0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2,8,18,9,WBTC,WETH,0,0,0,,,,,pancakeswap_v2,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,pancakeswap_v2,0x4AB6702B3Ed3877e9b1f203f90cbEF13d663B0e8,421419304,78852853048776778963,"[8,]","[['blockTimestampLast','reserve1','reserve0'],]",,uint32,421419304,uint112,78852853048776778963,uint112,,,,,,,,,,,,,,,, | ||
,,0,uniswap_v3 0x6B175474E89094C44Da98b954EedeAC495271d0F/0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2 0.0005,0x6B175474E89094C44Da98b954EedeAC495271d0F/0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2,uniswap_v3,500,0.0005,0x60594a405d53811d3BC4766596EFD80fd545A270,,0x6B175474E89094C44Da98b954EedeAC495271d0F,0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2,18,18,4,DAI,WETH,,,,,,,10,uniswap_v3,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,3,uniswap_v3,0x60594a405d53811d3BC4766596EFD80fd545A270,2850299295281281234085971,1147049345011454055669,"[4,0,]","[['liquidity'],['unlocked', 'feeProtocol', 'observationCardinalityNext', 'observationCardinality', 'observationIndex', 'tick', 'sqrtPriceX96']]",,,,,,,451613902936689743409876,"uint128",1659826732499374354385938036,"uint160",-77317,"int24",110,"uint16",180,"uint16",180,"uint16",0,"uint8",True,bool |
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.
No changes in this file until PR #651 is merged