当前位置: 首页>>代码示例>>Python>>正文


Python Runtime.CheckWitness方法代码示例

本文整理汇总了Python中boa.interop.Neo.Runtime.CheckWitness方法的典型用法代码示例。如果您正苦于以下问题:Python Runtime.CheckWitness方法的具体用法?Python Runtime.CheckWitness怎么用?Python Runtime.CheckWitness使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在boa.interop.Neo.Runtime的用法示例。


在下文中一共展示了Runtime.CheckWitness方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: kyc_register

# 需要导入模块: from boa.interop.Neo import Runtime [as 别名]
# 或者: from boa.interop.Neo.Runtime import CheckWitness [as 别名]
def kyc_register(ctx, args):
    """

    :param args:list a list of addresses to register
    :param token:Token A token object with your ICO settings
    :return:
        int: The number of addresses to register for KYC
    """
    ok_count = 0

    if CheckWitness(TOKEN_OWNER):

        for address in args:

            if len(address) == 20:

                kyc_storage_key = concat(KYC_KEY, address)
                Put(ctx, kyc_storage_key, True)

                OnKYCRegister(address)
                ok_count += 1

    return ok_count 
开发者ID:CityOfZion,项目名称:neo-boa,代码行数:25,代码来源:crowdsale.py

示例2: Main

# 需要导入模块: from boa.interop.Neo import Runtime [as 别名]
# 或者: from boa.interop.Neo.Runtime import CheckWitness [as 别名]
def Main(operation):

    verify = CheckWitness(OWNER_HASH)

    if verify:
        print("ok!!")
    else:
        print("not ok!")

    Notify(operation)

    # not sure of how this works
    verify2 = verify_signature(operation, OWNER_PUBKEY)

    Notify(verify2)  # it returs false for now

    return True 
开发者ID:CityOfZion,项目名称:neo-boa,代码行数:19,代码来源:SignatureTest.py

示例3: RegisterDomain

# 需要导入模块: from boa.interop.Neo import Runtime [as 别名]
# 或者: from boa.interop.Neo.Runtime import CheckWitness [as 别名]
def RegisterDomain(domain_name, owner):
    msg = concat("RegisterDomain: ", domain_name)
    Notify(msg)

    if not CheckWitness(owner):
        Notify("Owner argument is not the same as the sender")
        return False

    context = GetContext()
    exists = Get(context, domain_name)
    if exists:
        Notify("Domain is already registered")
        return False

    Put(context, domain_name, owner)
    return True 
开发者ID:CityOfZion,项目名称:python-smart-contract-workshop,代码行数:18,代码来源:4-domain.py

示例4: TransferDomain

# 需要导入模块: from boa.interop.Neo import Runtime [as 别名]
# 或者: from boa.interop.Neo.Runtime import CheckWitness [as 别名]
def TransferDomain(domain_name, to_address):
    msg = concat("TransferDomain: ", domain_name)
    Notify(msg)

    context = GetContext()
    owner = Get(context, domain_name)
    if not owner:
        Notify("Domain is not yet registered")
        return False

    if not CheckWitness(owner):
        Notify("Sender is not the owner, cannot transfer")
        return False

    if not len(to_address) != 34:
        Notify("Invalid new owner address. Must be exactly 34 characters")
        return False

    Put(context, domain_name, to_address)
    return True 
开发者ID:CityOfZion,项目名称:python-smart-contract-workshop,代码行数:22,代码来源:4-domain.py

示例5: DeleteDomain

# 需要导入模块: from boa.interop.Neo import Runtime [as 别名]
# 或者: from boa.interop.Neo.Runtime import CheckWitness [as 别名]
def DeleteDomain(domain_name):
    msg = concat("DeleteDomain: ", domain_name)
    Notify(msg)

    context = GetContext()
    owner = Get(context, domain_name)
    if not owner:
        Notify("Domain is not yet registered")
        return False

    if not CheckWitness(owner):
        Notify("Sender is not the owner, cannot transfer")
        return False

    Delete(context, domain_name)
    return True 
开发者ID:CityOfZion,项目名称:python-smart-contract-workshop,代码行数:18,代码来源:4-domain.py

示例6: deploy

# 需要导入模块: from boa.interop.Neo import Runtime [as 别名]
# 或者: from boa.interop.Neo.Runtime import CheckWitness [as 别名]
def deploy():
    """

    :param token: Token The token to deploy
    :return:
        bool: Whether the operation was successful
    """
    if not CheckWitness(TOKEN_OWNER):
        print("Must be owner to deploy")
        return False

    if not Get(ctx, 'initialized'):
        # do deploy logic
        Put(ctx, 'initialized', 1)
        Put(ctx, TOKEN_OWNER, TOKEN_INITIAL_AMOUNT)
        return add_to_circulation(ctx, TOKEN_INITIAL_AMOUNT)

    return False 
开发者ID:nash-io,项目名称:neo-ico-template,代码行数:20,代码来源:ico_template.py

示例7: RegisterFarmer

# 需要导入模块: from boa.interop.Neo import Runtime [as 别名]
# 或者: from boa.interop.Neo.Runtime import CheckWitness [as 别名]
def RegisterFarmer(Farmer_name, owner):
    msg = concat("RegisterFarmer: ", Farmer_name)
    Notify(msg)

    if not CheckWitness(owner):
        Notify("Owner argument is not the same as the person who registered the farmer")
        return False

    context = GetContext()
    exists = Get(context, Farmer_name)
    if exists:
        Notify("Farmer is already registered")
        return False

    Put(context, Farmer_name, owner)
    return True 
开发者ID:BitMari,项目名称:varimi,代码行数:18,代码来源:smartFarmContracts.py

示例8: DeleteFarmer

# 需要导入模块: from boa.interop.Neo import Runtime [as 别名]
# 或者: from boa.interop.Neo.Runtime import CheckWitness [as 别名]
def DeleteFarmer(Farmer_name):
    msg = concat("DeleteFarmer: ", Farmer_name)
    Notify(msg)

    context = GetContext()
    owner = Get(context, Farmer_name)
    if not owner:
        Notify("Farmer is not yet registered")
        return False

    if not CheckWitness(owner):
        Notify("This person is not the owner of the farmer registry, the farmer cannot be deleted")
        return False

    Delete(context, Farmer_name)
    return True


## STAGE TWO : FARM REGISTRATION : PYTHON CODE COMPLETE 
## THIS CODE IS TO REGISTER FARM OWNERSHIP ON THE BLOCKCHAIN WITH ABILITY TO ADD/DELETE/QUERY/TRANSFER OWNERSHIP 
开发者ID:BitMari,项目名称:varimi,代码行数:22,代码来源:smartFarmContracts.py

示例9: RegisterFarm

# 需要导入模块: from boa.interop.Neo import Runtime [as 别名]
# 或者: from boa.interop.Neo.Runtime import CheckWitness [as 别名]
def RegisterFarm(Farm_name, owner):
    msg = concat("RegisterFarm: ", Farm_name)
    Notify(msg)

    if not CheckWitness(owner):
        Notify("Owner argument is not the same as the person who registered")
        return False

    context = GetContext()
    exists = Get(context, Farm_name)
    if exists:
        Notify("Farm is already registered")
        return False

    Put(context, Farm_name, owner)
    return True 
开发者ID:BitMari,项目名称:varimi,代码行数:18,代码来源:smartFarmContracts.py

示例10: TransferFarm

# 需要导入模块: from boa.interop.Neo import Runtime [as 别名]
# 或者: from boa.interop.Neo.Runtime import CheckWitness [as 别名]
def TransferFarm(Farm_name, to_address):
    msg = concat("TransferFarm: ", Farm_name)
    Notify(msg)

    context = GetContext()
    owner = Get(context, Farm_name)
    if not owner:
        Notify("Farm is not yet registered")
        return False

    if not CheckWitness(owner):
        Notify("This person is not the owner, farm ownership cannot transfer")
        return False

    if not len(to_address) != 34:
        Notify("Invalid new owner neo address. Must be exactly 34 characters")
        return False

    Put(context, Farm_name, to_address)
    return True 
开发者ID:BitMari,项目名称:varimi,代码行数:22,代码来源:smartFarmContracts.py

示例11: DeleteFarm

# 需要导入模块: from boa.interop.Neo import Runtime [as 别名]
# 或者: from boa.interop.Neo.Runtime import CheckWitness [as 别名]
def DeleteFarm(Farm_name):
    msg = concat("DeleteFarm: ", Farm_name)
    Notify(msg)

    context = GetContext()
    owner = Get(context, Farm_name)
    if not owner:
        Notify("Farm is not yet registered")
        return False

    if not CheckWitness(owner):
        Notify("This person is not the owner of the farm, the farm cannot be deleted")
        return False

    Delete(context, Farm_name)
    return True

## STAGE THREE : FARM PROJECT REGISTRATION : PYTHON CODE COMPLETE 
## THIS CODE IS TO REGISTER FARM PROJECT GIVEN THE FARMER IS ALSO ON THE BLOCKCHAIN AND THEIR FARM IS ALSO REGISTERED 
## ON THE BLOCKCHAIN WITH ABILITY TO ADD/DELETE/QUERY/TRANSFER OF PROJECT OWNERSHIP 
开发者ID:BitMari,项目名称:varimi,代码行数:22,代码来源:smartFarmContracts.py

示例12: TransferFarmProject

# 需要导入模块: from boa.interop.Neo import Runtime [as 别名]
# 或者: from boa.interop.Neo.Runtime import CheckWitness [as 别名]
def TransferFarmProject(FarmProject_name, to_address):
    msg = concat("TransferFarmProject: ", FarmProject_name)
    Notify(msg)

    context = GetContext()
    owner = Get(context, FarmProject_name)
    if not owner:
        Notify("Farm Project is not yet registered")
        return False

    if not CheckWitness(owner):
        Notify("This person is not the owner, farm project ownership cannot transfer")
        return False

    if not len(to_address) != 34:
        Notify("Invalid new owner neo address. Must be exactly 34 characters")
        return False

    Put(context, FarmProject_name, to_address)
    return True 
开发者ID:BitMari,项目名称:varimi,代码行数:22,代码来源:smartFarmContracts.py

示例13: DeleteFarmProject

# 需要导入模块: from boa.interop.Neo import Runtime [as 别名]
# 或者: from boa.interop.Neo.Runtime import CheckWitness [as 别名]
def DeleteFarmProject(FarmProject_name):
    msg = concat("DeleteFarmProject: ", FarmProject_name)
    Notify(msg)

    context = GetContext()
    owner = Get(context, FarmProject_name)
    if not owner:
        Notify("Farm Project is not yet registered")
        return False

    if not CheckWitness(owner):
        Notify("This person is not the owner of the farm project, the farm project cannot be deleted")
        return False

    Delete(context, FarmProject_name)
    return True

## STAGE FOUR : Buyer REGISTRATION : PYTHON CODE COMPLETE 
## THIS CODE IS TO REGISTER A DIRECT Buyer ON THE BLOCKCHAIN WITH ABILITY TO ADD/DELETE/QUERY 
开发者ID:BitMari,项目名称:varimi,代码行数:21,代码来源:smartFarmContracts.py

示例14: RegisterBuyer

# 需要导入模块: from boa.interop.Neo import Runtime [as 别名]
# 或者: from boa.interop.Neo.Runtime import CheckWitness [as 别名]
def RegisterBuyer(Buyer_name, owner):
    msg = concat("RegisterBuyer: ", Buyer_name)
    Notify(msg)

    if not CheckWitness(owner):
        Notify("Owner argument is not the same as the person who registered")
        return False

    context = GetContext()
    exists = Get(context, Buyer_name)
    if exists:
        Notify("Buyer is already registered")
        return False

    Put(context, Buyer_name, owner)
    return True 
开发者ID:BitMari,项目名称:varimi,代码行数:18,代码来源:smartFarmContracts.py

示例15: DeleteBuyer

# 需要导入模块: from boa.interop.Neo import Runtime [as 别名]
# 或者: from boa.interop.Neo.Runtime import CheckWitness [as 别名]
def DeleteBuyer(Buyer_name):
    msg = concat("DeleteBuyer: ", Buyer_name)
    Notify(msg)

    context = GetContext()
    owner = Get(context, Buyer_name)
    if not owner:
        Notify("Buyer is not yet registered")
        return False

    if not CheckWitness(owner):
        Notify("This person is not the owner of the name, the Buyer cannot be deleted")
        return False

    Delete(context, Buyer_name)
    return True

## STAGE FIVE : THE BITMARI SMART FARM CONTRACT : PYTHON CODE COMPLETE 
## THIS CODE IS TO CREATE A RECORD BETWEEN The Buyer AND With Terms of the contract 
## ON THE BLOCKCHAIN WITH ABILITY TO ADD/DELETE/QUERY/TRANSFER/ (STAGE SEVEN) OF  CONTRACT OWNERSHIP
## THE ORACLE WILL BE THE SUPPLIER POS 
开发者ID:BitMari,项目名称:varimi,代码行数:23,代码来源:smartFarmContracts.py


注:本文中的boa.interop.Neo.Runtime.CheckWitness方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。