from boa.interop.System.Action import RegisterAction

Transfer = RegisterAction('transfer_test', 'a', 'b', 'c')
Refund = RegisterAction('refund_test', 'to', 'amount')


def Main(operation, args):
    if operation == "test1":
        return test()
    if operation == "test2":
        return test1()
    return False


def test():
    a = 2
    b = 5
    c = a + b
    Transfer(a, b, c)
    return True


def test1():
    to = 'somebody'
    amount = 52
    Refund(to, amount)
    return True
Example #2
0
from boa.interop.System.Storage import GetContext, Get, Put, Delete
from boa.interop.System.Runtime import Notify, CheckWitness
from boa.interop.System.Action import RegisterAction
from boa.builtins import concat, ToScriptHash
# from boa.interop.Ontology.Runtime import AddressToBase58, Base58ToAddress

TransferEvent = RegisterAction("transfer", "from", "to", "amount")
ApprovalEvent = RegisterAction("approval", "owner", "spender", "amount")

ctx = GetContext()

NAME = 'Aesop'
SYMBOL = 'AES'
DECIMALS = 8
FACTOR = 100000000
OWNER = ToScriptHash("AabYzjuPMm42KTcWtZQ9qMZ3bc2Mxp2EQW")
# OWNER = bytearray(b'\x61\x6f\x2a\x4a\x38\x39\x6f\xf2\x03\xea\x01\xe6\xc0\x70\xae\x42\x1b\xb8\xce\x2d')
TOTAL_AMOUNT = 1000000000
BALANCE_PREFIX = bytearray(b'\x01')
APPROVE_PREFIX = b'\x02'
SUPPLY_KEY = 'TotalSupply'


def Main(operation, args):
    """
    :param operation:
    :param args:
    :return:
    """
    # 'init' has to be invokded first after deploying the contract to store the necessary and important info in the blockchain
    if operation == 'init':
Example #3
0
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

from boa.builtins import concat
from boa.interop.System.Runtime import CheckWitness, Serialize, Deserialize
from boa.interop.System.Storage import Put, GetContext, Get
from boa.interop.System.Action import RegisterAction

ctx = GetContext()

ITEM_PREFIX = "ITEM"

itemPut = RegisterAction('Put', 'ipfs_hash')
itemPutFail = RegisterAction('PutFail', 'ipfs_hash')
itemRemove = RegisterAction('Remove', 'ipfs_hash')
itemRemoveFail = RegisterAction('RemoveFail', 'ipfs_hash')


def main(operation, args):
    if operation == 'put_one_item':
        return put_one_item(args[0], args[1], args[2])
    elif operation == 'get_item_list':
        return get_item_list(args[0])
    elif operation == 'del_ont_item':
        return del_ont_item(args[0], args[1])
    else:
        return False


def concat_key(str1, str2):
    return concat(concat(str1, '_'), str2)
def RequireWitness(witness):
    """
	Checks the transaction sender is equal to the witness. If not
	satisfying, revert the transaction.
	:param witness: required transaction sender
	:return: True if transaction sender or revert the transaction.
	"""
    Require(CheckWitness(witness))
    return True


"""
collect pumpkin smart contract
"""

TransferEvent = RegisterAction("transfer", "fromAcct", "toAcct", "tokenId", "amount")
ApprovalEvent = RegisterAction("approval", "owner", "spender", "tokenId", "amount")

# modify to the admin address
admin = ToScriptHash('AQf4Mzu1YJrhz9f3aRkkwSm9n3qhXGSh4p')

# TOKEN_ID1 is used to identify different tokens, to help store the token name, token symbol and balance
# TOKEN_ID1 = bytearray('b\x01')
# TOKEN_ID2 = bytearray('b\x02')
# TOKEN_ID3 = bytearray('b\x03')
# TOKEN_ID4 = bytearray('b\x04')
# TOKEN_ID5 = bytearray('b\x05')
# TOKEN_ID6 = bytearray('b\x06')
# TOKEN_ID7 = bytearray('b\x07')
# TOKEN_ID8 = bytearray('b\x08')
Example #5
0
"""
NBA Guess Contract
"""

from boa.interop.System.Storage import GetContext, Get, Put, Delete
from boa.interop.System.Runtime import CheckWitness, GetTime, Notify, Serialize, Deserialize, Log
from boa.interop.System.Action import RegisterAction
from boa.builtins import concat, ToScriptHash, range, state
from boa.interop.System.App import RegisterAppCall
from boa.interop.Ontology.Native import Invoke
from boa.interop.System.ExecutionEngine import GetExecutingScriptHash, GetScriptContainer
from boa.interop.System.Transaction import GetTransactionHash

BetEvent = RegisterAction("placebet", "address", "gameid", "horv", "amount")

oracleContract = RegisterAppCall('ca5744eadc5234b8d712560641ffa08d0ec63bf8',
                                 'operation', 'args')
ctx = GetContext()
selfAddr = GetExecutingScriptHash()
adminAddress = ToScriptHash("Ad4pjz2bqep4RhQrUAzMuZJkBC3qJ1tZuT")
operaterAddress = ToScriptHash("AS3SCXw8GKTEeXpdwVw7EcC4rqSebFYpfb")

# 5% fee cost
FeeRate = 5
Name = "NBA Guess"
#keys
GameCountPrefix = 'GameCount'
GamePrefix = 'Game'
BetPrefix = 'Bet'
OraclePrefix = 'Oracle'
OracleResPrefix = 'OracleRes'