class EIP712LegacySafeTx(EIP712Struct): to = Address() value = Uint(256) data = Bytes() operation = Uint(8) safeTxGas = Uint(256) dataGas = Uint(256) gasPrice = Uint(256) gasToken = Address() refundReceiver = Address() nonce = Uint(256)
class EIP712SafeTx(EIP712Struct): to = Address() value = Uint(256) data = Bytes() operation = Uint(8) safeTxGas = Uint(256) baseGas = Uint(256) # `dataGas` was renamed to `baseGas` in 1.0.0 gasPrice = Uint(256) gasToken = Address() refundReceiver = Address() nonce = Uint(256)
class Order(EIP712Struct): sellToken = Address() buyToken = Address() receiver = Address() sellAmount = Uint(256) buyAmount = Uint(256) validTo = Uint(32) appData = Bytes(32) feeAmount = Uint(256) kind = String() # `sell` or `buy` partiallyFillable = Boolean() sellTokenBalance = String() # `erc20`, `external` or `internal` buyTokenBalance = String() # `erc20` or `internal`
def test_from_solidity_type(): assert from_solidity_type('address') == Address() assert from_solidity_type('bool') == Boolean() assert from_solidity_type('bytes') == Bytes() assert from_solidity_type('bytes32') == Bytes(32) assert from_solidity_type('int128') == Int(128) assert from_solidity_type('string') == String() assert from_solidity_type('uint256') == Uint(256) assert from_solidity_type('address[]') == Array(Address()) assert from_solidity_type('address[10]') == Array(Address(), 10) assert from_solidity_type('bytes16[32]') == Array(Bytes(16), 32) # Sanity check that equivalency is working as expected assert from_solidity_type('bytes32') != Bytes(31) assert from_solidity_type('bytes16[32]') != Array(Bytes(16), 31) assert from_solidity_type('bytes16[32]') != Array(Bytes(), 32) assert from_solidity_type('bytes16[32]') != Array(Bytes(8), 32)
class Foo(EIP712Struct): s = String() u_i = Uint(256) s_i = Int(8) a = Address() b = Boolean() bytes_30 = Bytes(30) dyn_bytes = Bytes() bar = Bar arr = Array(Bytes(1))
class TestStruct(EIP712Struct): address = Address() boolean = Boolean() dyn_bytes = Bytes() bytes_1 = Bytes(1) bytes_32 = Bytes(32) int_32 = Int(32) int_256 = Int(256) string = String() uint_32 = Uint(32) uint_256 = Uint(256)
class Person(EIP712Struct): name = String() addr = Address()
class Person(EIP712Struct): name = String() addr = Address() numbers = Array(Int(256)) moreNumbers = Array(Uint(256), 8)
class Output(EIP712Struct): outputType = Uint(256) outputGuard = Bytes(20) currency = Address() amount = Uint(256)
class Identity(EIP712Struct): userId = Uint(256) wallet = Address()
class EIP712Domain(EIP712Struct): name = String() version = String() chainId = Uint(256) verifyingContract = Address()
class Output(EIP712Struct): owner = Address() currency = Address() amount = Uint(256)