Skip to content

Commit b899050

Browse files
davesquekclowes
authored andcommitted
Add test for data in issue ticket
1 parent 009f5b7 commit b899050

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

tests/core/contracts/test_contract_method_abi_decoding.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
ABI_BYTES = json.loads('[{"constant":false,"inputs":[{"name":"bytesarg","type":"bytes"}],"name":"bytesfunc","outputs":[],"type":"function"}]') # noqa: E501
1212
ABI_STRING = json.loads('[{"constant":false,"inputs":[{"name":"stringarg","type":"string"}],"name":"stringfunc","outputs":[],"type":"function"}]') # noqa: E501
1313
ABI_ADDRESS = json.loads('[{"constant":false,"inputs":[{"name":"addressarg","type":"address"}],"name":"addressfunc","outputs":[],"type":"function"}]') # noqa: E501
14+
ABI_TUPLE = json.loads('[{"constant":false,"inputs":[{"components":[{"name":"owner","type":"address"},{"name":"number","type":"uint256"}],"name":"fromAccount","type":"tuple"},{"components":[{"name":"owner","type":"address"},{"name":"number","type":"uint256"}],"name":"liquidAccount","type":"tuple"},{"components":[{"name":"value","type":"uint256"}],"name":"minLiquidatorRatio","type":"tuple"},{"name":"minValueLiquidated","type":"uint256"},{"name":"owedPreferences","type":"uint256[]"},{"name":"heldPreferences","type":"uint256[]"}],"name":"liquidate","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"}]') # noqa: E501
1415
a32bytes = b'a'.ljust(32, b'\x00')
1516

1617

@@ -65,6 +66,19 @@
6566
'addressfunc',
6667
{'addressarg': '0xFFfFfFffFFfffFFfFFfFFFFFffFFFffffFfFFFfF'},
6768
),
69+
(
70+
ABI_TUPLE,
71+
'0xc29a4b71000000000000000000000000bfae42a79ff045659dd0f84e65534f5c4c8100230000000000000000000000000000000000000000000000000000000000000000000000000000000000000000db3d3af153cb02f0bc44621db82289280e93500f94a7d1598c397f6b49ecd5ccbc2b464259b96870063493b0dc7409d0fd9fb9860000000000000000000000000000000000000000000000000429d069189e00000000000000000000000000000000000178287f49c4a1d6622fb2ab40000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000018000000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001', # noqa: E501
72+
'liquidate',
73+
{
74+
'fromAccount': ('0xBfae42A79FF045659DD0F84e65534f5c4c810023', 0),
75+
'liquidAccount': ('0xdb3d3AF153cB02f0Bc44621Db82289280e93500F', 67238809929330522294664880975001390268660278453875034113630810005818923006342), # noqa: E501
76+
'minLiquidatorRatio': (300000000000000000,),
77+
'minValueLiquidated': 500000000000000000000000000000000000000,
78+
'owedPreferences': [0, 1, 2],
79+
'heldPreferences': [2, 0, 1],
80+
},
81+
),
6882
),
6983
)
7084
def test_contract_abi_decoding(web3, abi, data, method, expected):

0 commit comments

Comments
 (0)