Exemplo n.º 1
0
 def test_forced_exit_bytes(self):
     tr = ForcedExit(target="0x19aa2ed8712072e918632259780e587698ef58df",
                     token=Token.eth(),
                     fee=1000000,
                     nonce=12,
                     valid_from=0,
                     valid_until=4294967295,
                     initiator_account_id=44)
     res = "080000002c19aa2ed8712072e918632259780e587698ef58df00007d030000000c000000000000000000000000ffffffff"
     assert tr.encoded_message().hex() == res
Exemplo n.º 2
0
 def test_mint_nft_bytes(self):
     tr = MintNFT(
         creator_id=44,
         creator_address="0xedE35562d3555e61120a151B3c8e8e91d83a378a",
         content_hash=
         "0000000000000000000000000000000000000000000000000000000000000123",
         recipient="0x19aa2ed8712072e918632259780e587698ef58df",
         fee=1000000,
         fee_token=Token.eth(),
         nonce=12)
     res = "f6010000002cede35562d3555e61120a151b3c8e8e91d83a378a000000000000000000000000000000000000000000000000000000000000012319aa2ed8712072e918632259780e587698ef58df000000007d030000000c"
     assert tr.encoded_message().hex() == res
Exemplo n.º 3
0
 def test_transfer_bytes(self):
     tr = Transfer(
         from_address="0xedE35562d3555e61120a151B3c8e8e91d83a378a",
         to_address="0x19aa2ed8712072e918632259780e587698ef58df",
         token=Token.eth(),
         amount=1000000000000,
         fee=1000000,
         nonce=12,
         valid_from=0,
         valid_until=4294967295,
         account_id=44)
     res = "050000002cede35562d3555e61120a151b3c8e8e91d83a378a19aa2ed8712072e918632259780e587698ef58df00004a817c80027d030000000c000000000000000000000000ffffffff"
     assert tr.encoded_message().hex() == res
Exemplo n.º 4
0
 def test_withdraw_nft_bytes(self):
     tr = WithdrawNFT(
         account_id=44,
         from_address="0xedE35562d3555e61120a151B3c8e8e91d83a378a",
         to_address="0x19aa2ed8712072e918632259780e587698ef58df",
         fee_token=Token.eth(),
         fee=1000000,
         nonce=12,
         valid_from=0,
         valid_until=4294967295,
         token_id=100000)
     res = "f5010000002cede35562d3555e61120a151b3c8e8e91d83a378a19aa2ed8712072e918632259780e587698ef58df000186a0000000007d030000000c000000000000000000000000ffffffff"
     assert tr.encoded_message().hex() == res
Exemplo n.º 5
0
 def test_order_bytes(self):
     token1 = Token.eth()
     token2 = Token(id=2, symbol='', address='',
                    decimals=0)  # only id matters
     order = Order(account_id=6,
                   nonce=18,
                   token_sell=token1,
                   token_buy=token2,
                   ratio=Fraction(1, 2),
                   amount=1000000,
                   recipient='0x823b6a996cea19e0c41e250b20e2e804ea72ccdf',
                   valid_from=0,
                   valid_until=4294967295)
     res = '6f0100000006823b6a996cea19e0c41e250b20e2e804ea72ccdf0000001200000000000000020000000000000000000000000000010000000000000000000000000000020001e84800000000000000000000000000ffffffff'
     assert order.encoded_message().hex() == res
Exemplo n.º 6
0
 def test_signature(self):
     account = Account.from_key(PRIVATE_KEY)
     signer = ZkSyncSigner.from_account(account, self.library,
                                        ChainId.MAINNET)
     tr = Transfer(
         from_address="0xedE35562d3555e61120a151B3c8e8e91d83a378a",
         to_address="0x19aa2ed8712072e918632259780e587698ef58df",
         token=Token.eth(),
         amount=1000000000000,
         fee=1000000,
         nonce=12,
         valid_from=0,
         valid_until=4294967295,
         account_id=44)
     res = signer.sign_tx(tr)
     assert res.signature == '849281ea1b3a97b3fe30fbd25184db3e7860db96e3be9d53cf643bd5cf7805a30dbf685c1e63fd75968a61bd83d3a1fb3a0b1c68c71fe87d96f1c1cb7de45b05'
Exemplo n.º 7
0
 def test_signature(self):
     account = Account.from_key(PRIVATE_KEY)
     signer = ZkSyncSigner.from_account(account, self.library,
                                        ChainId.MAINNET)
     tr = Transfer(
         from_address="0xedE35562d3555e61120a151B3c8e8e91d83a378a",
         to_address="0x19aa2ed8712072e918632259780e587698ef58df",
         token=Token.eth(),
         amount=1000000000000,
         fee=1000000,
         nonce=12,
         valid_from=0,
         valid_until=4294967295,
         account_id=44)
     res = signer.sign_tx(tr)
     assert res.signature == 'b3211c7e15d31d64619e0c7f65fce8c6e45637b5cfc8711478c5a151e6568d875ec7f48e040225fe3cc7f1e7294625cad6d98b4595d007d36ef62122de16ae01'