Beispiel #1
0
def update_sc(nef_file: bytes, manifest: bytes, data: Any = None):
    """
    Updates the smart contract. In this example there is a bugged method, so, the smart contract will be updated to fix
    the bug.
    """
    if check_witness(OWNER):
        ContractManagement.update(nef_file, manifest, data)
Beispiel #2
0
def post_transfer(from_address: Union[UInt160, None],
                  to_address: Union[UInt160, None], amount: int, data: Any):
    """
    Checks if the one receiving NEP17 tokens is a smart contract and if it's one the onPayment method will be called

    :param from_address: the address of the sender
    :type from_address: UInt160
    :param to_address: the address of the receiver
    :type to_address: UInt160
    :param amount: the amount of cryptocurrency that is being sent
    :type amount: int
    :param data: any pertinent data that might validate the transaction
    :type data: Any
    """
    if to_address is not None:
        contract = ContractManagement.get_contract(to_address)
        if contract is not None:
            call_contract(to_address, 'onNEP17Payment',
                          [from_address, amount, data])
def post_transfer(from_address: Union[UInt160,
                                      None], to_address: Union[UInt160, None],
                  token_id: ByteString, data: Any):
    """
    Checks if the one receiving NEP11 tokens is a smart contract and if it's one the onPayment method will be called.

    :param from_address: the address of the sender
    :type from_address: UInt160
    :param to_address: the address of the receiver
    :type to_address: UInt160
    :param token_id: the id of the token that is being sent
    :type token_id: ByteString
    :param data: any pertinent data that might validate the transaction
    :type data: Any
    """
    # the transfer event will be fired
    on_transfer(from_address, to_address, 1, token_id)

    if not isinstance(to_address, None):
        contract = ContractManagement.get_contract(to_address)
        if not isinstance(contract, None):
            call_contract(to_address, 'onNEP11Payment',
                          [from_address, 1, token_id, data])
def main() -> int:
    return ContractManagement.get_minimum_deployment_fee()
def Main(script: bytes, manifest: str, data: Any, arg0: Any):
    ContractManagement.update(script, manifest, data, arg0)
def Main(arg0: Any):
    ContractManagement.destroy(arg0)
Beispiel #7
0
def update(script: bytes, manifest: bytes, data: Any):
    ContractManagement.update(script, manifest, data)
Beispiel #8
0
def Main(script: bytes):
    ContractManagement.update(script)
Beispiel #9
0
def main(hash: UInt160) -> Contract:
    return ContractManagement.get_contract(hash)
def Main(script: bytes, manifest: bytes, data: Any, arg0: Any):
    ContractManagement.deploy(script, manifest, data, arg0)
def Main(scripthash: bytes):
    ContractManagement.deploy(scripthash)
Beispiel #12
0
def Main(script: bytes, manifest: bytes, data: Any) -> Contract:
    return ContractManagement.deploy(script, manifest, data)