예제 #1
0
def return_op(computation: ComputationAPI) -> None:
    start_position, size = computation.stack_pop_ints(2)

    computation.extend_memory(start_position, size)

    computation.output = computation.memory_read_bytes(start_position, size)
    raise Halt('RETURN')
예제 #2
0
def return_op(computation: BaseComputation) -> None:
    start_position, size = computation.stack_pop(num_items=2,
                                                 type_hint=constants.UINT256)

    computation.extend_memory(start_position, size)

    computation.output = computation.memory_read_bytes(start_position, size)
    raise Halt('RETURN')
예제 #3
0
def _selfdestruct(computation: ComputationAPI, beneficiary: Address) -> None:
    local_balance = computation.state.get_balance(computation.msg.storage_address)
    beneficiary_balance = computation.state.get_balance(beneficiary)

    # 1st: Transfer to beneficiary
    computation.state.set_balance(beneficiary, local_balance + beneficiary_balance)
    # 2nd: Zero the balance of the address being deleted (must come after
    # sending to beneficiary in case the contract named itself as the
    # beneficiary.
    computation.state.set_balance(computation.msg.storage_address, 0)

    computation.logger.debug2(
        "SELFDESTRUCT: %s (%s) -> %s",
        encode_hex(computation.msg.storage_address),
        local_balance,
        encode_hex(beneficiary),
    )

    # 3rd: Register the account to be deleted
    computation.register_account_for_deletion(beneficiary)
    raise Halt('SELFDESTRUCT')
예제 #4
0
def stop(computation: BaseComputation) -> None:
    raise Halt('STOP')
예제 #5
0
파일: system.py 프로젝트: jacqueswww/py-evm
def selfdestruct(computation: BaseComputation) -> None:
    beneficiary = force_bytes_to_address(
        computation.stack_pop(type_hint=constants.BYTES))
    _selfdestruct(computation, beneficiary)
    raise Halt('SELFDESTRUCT')
예제 #6
0
파일: flow.py 프로젝트: divyanks/py-evm-1
def stop(computation):
    raise Halt('STOP')