Пример #1
0
    def test_transfer_from_manager_to_entrypoint_with_args(
            self, client: Client):
        arg = 'Pair "hello" 42'
        # using 'transfer'
        client.transfer(
            0,
            'manager',
            'target',
            ['--entrypoint', 'add_left', '--arg', arg, '--burn-cap', '0.067'],
        )
        client.bake('bootstrap5', BAKE_ARGS)
        client.transfer(
            0,
            'manager',
            'target',
            ['--entrypoint', 'mem_left', '--arg', '"hello"'],
        )
        client.bake('bootstrap5', BAKE_ARGS)

        # using 'call'
        client.call(
            'manager',
            'target',
            ['--entrypoint', 'add_left', '--arg', arg, '--burn-cap', '0.067'],
        )
        client.bake('bootstrap5', BAKE_ARGS)
        client.call(
            'manager',
            'target',
            ['--entrypoint', 'mem_left', '--arg', '"hello"'],
        )
        client.bake('bootstrap5', BAKE_ARGS)
Пример #2
0
    def test_transfer_from_manager_to_no_default_with_args(
            self, client: Client):
        arg = 'Left Unit'
        client.transfer(0, 'manager', 'target_no_default', ['--arg', arg])
        client.bake('bootstrap5', BAKE_ARGS)

        client.call('manager', 'target_no_default', ['--arg', arg])
        client.bake('bootstrap5', BAKE_ARGS)
Пример #3
0
    def test_transfer_from_manager_to_rooted_target_with_args(
            self, client: Client):
        arg = 'Left Unit'
        client.transfer(0, 'manager', 'rooted_target',
                        ['--arg', arg, '--entrypoint', 'root'])
        client.bake('bootstrap5', BAKE_ARGS)

        client.call('manager', 'rooted_target',
                    ['--arg', arg, '--entrypoint', 'root'])
        client.bake('bootstrap5', BAKE_ARGS)
Пример #4
0
 def test_call(self, client: Client, session: dict):
     contract = session['contract']
     bootstrap3 = '"tz1faswCTDciRzE4oJ9jn2Vm2dvjeyA9fUzU"'
     transfer = client.call('bootstrap2', contract, ['--arg', bootstrap3])
     utils.bake(client, 'bootstrap5')
     assert utils.check_block_contains_operations(client,
                                                  [transfer.operation_hash])
Пример #5
0
 def test_chain_id_authentication_first_run(self, client: Client,
                                            session: dict):
     destination = IDENTITIES['bootstrap2']['identity']
     operation = '{DROP; NIL operation; ' + \
         f'PUSH address "{destination}"; ' + \
         'CONTRACT unit; ASSERT_SOME; PUSH mutez 1000; UNIT; ' + \
         'TRANSFER_TOKENS; CONS}'
     chain_id = client.rpc('get', 'chains/main/chain_id')
     contract_address = session['contract']
     packed = client.pack(
         f'Pair (Pair "{chain_id}" "{contract_address}") ' +
         f'(Pair {operation} 0)', 'pair (pair chain_id address)' +
         '(pair (lambda unit (list operation)) nat)')
     signature = client.sign(packed, "bootstrap1")
     client.call('bootstrap2', 'authentication',
                 ['--arg', f'Pair {operation} \"{signature}\"'])
     client.bake('bootstrap5', BAKE_ARGS)
Пример #6
0
    def test_big_map_to_self_transfer(self, client: Client):
        client.call('bootstrap2', "big_map_to_self", [])
        client.bake('bootstrap5', BAKE_ARGS)

        client.transfer(0, 'bootstrap2', "big_map_to_self", [])
        client.bake('bootstrap5', BAKE_ARGS)
Пример #7
0
 def test_chain_id_opcode(self, client: Client, session: dict):
     path = os.path.join(CONTRACT_PATH, 'opcodes', 'chain_id.tz')
     originate(client, session, path, 'Unit', 0)
     client.call('bootstrap2', "chain_id", [])
     client.bake('bootstrap5', BAKE_ARGS)