ONGAddress = bytearray( b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02' ) # the original company Dev1 = ToScriptHash("AYqCVffRcbPkf1BVCYPJqqoiFTFmvwYKhG") # the cooperator Dev2 = ToScriptHash("ANTPeXCffDZCaCXxY9u2UdssB2EYpP4BMh") Operater = ToScriptHash("AQf4Mzu1YJrhz9f3aRkkwSm9n3qhXGSh4p") INIT_KEY = "Inited" ContractAddress = GetExecutingScriptHash() ONGMagnitude = 1000000000 Magnitude = 1000000000000000000000000000000 OracleContract = RegisterAppCall('e0d635c7eb2c5eaa7d2207756a4c03a89790934a', 'operation', 'args') SelfContractAddress = GetExecutingScriptHash() DEV_PROFIT_PREFIX = "DEV" FEE_PERCENTAGE_KEY = "FEE" SENTREQHASH_FORMGAME_PREFIX = "G1" GAME_STATUS_PREFIX = 'G2' GAME_RES_PREFIX = "G3" GAME_DISKID_LIST_PREFIX = "G4" GAME_BET_ENDTIME_PREFIX = "G5" DISK_ONG_AMOUNT_PREFIX = "G6" DISK_PLAYERS_LIST_PREFIX = "G7" DISK_STATUS_PERFIX = "G8" PLAYER_BET_PREFIX = "G9"
from boa.interop.System.Runtime import CheckWitness, Deserialize, Notify from ontology.builtins import state, concat from boa.interop.System.App import RegisterAppCall from ontology.interop.Ontology.Native import Invoke from boa.interop.System.ExecutionEngine import GetExecutingScriptHash from ontology.interop.Ontology.Contract import Migrate from ontology.libont import AddressFromVmCode headContract = RegisterAppCall("6a7636598311a4b9c939d60fe58d3018379bfd87", "operation", "args") def GetCoinContractAddress(assetId): if assetId is 'ONYX': return bytearray( b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01' ) elif assetId is 'OXG': return bytearray( b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02' ) else: Revert() def Require(condition): if not condition: Revert() def WitnessRequire(witness):
""" def uSub(a, b): """ Operates a minus b with condition that a - b can never be below 0. :param a: operand a :param b: operand b :return: a - b if a - b > 0 or revert the transaction. """ Require(a >= b) return a - b from boa.interop.System.ExecutionEngine import GetExecutingScriptHash from boa.interop.System.App import RegisterAppCall, DynamicAppCall SpokkzOEP4Contract = RegisterAppCall('cf6460564d3f6884fb6b98f02ff24e22cb2f0c90', 'operation', 'args') DEPLOYER = ToScriptHash('Ac725LuR7wo481zvNmc9jerqCzoCArQjtw') OWNER_KEY = '___OWNER_SPUUL01' PAYMENT_PREFIX = '_____pay_spuul01' DEPLOYED_KEY = 'DEPLOYED_SPUUL01' ctx = GetContext() def main(operation, args): if operation == 'deploy': return deploy() if operation == 'confirmPayment':
from boa.interop.System.App import RegisterAppCall from boa.interop.System.ExecutionEngine import GetExecutingScriptHash, GetCallingScriptHash, GetEntryScriptHash from boa.interop.System.Runtime import CheckWitness, GetTime, Notify, Serialize, Deserialize # Here "4d99d1dad2caf811c3452fc1ef9cc1a3a8b59b9a" should your contract hash, pls note it's not reversed hash ContractB = RegisterAppCall('4d99d1dad2caf811c3452fc1ef9cc1a3a8b59b9a', 'operation', 'args') ContractAddress = GetExecutingScriptHash() def Main(opration, args): if opration == "invokeA": opt = args[0] params = args[1] return invokeA(opt, params) if opration == "checkHash": return checkHash() return False def invokeA(operation, params): callerHash = GetCallingScriptHash() entryHash = GetEntryScriptHash() Notify(["111_invokeA", callerHash, entryHash, ContractAddress]) return ContractB(operation, params) def checkHash(): Notify(["111_checkHash"]) # to prevent hack from other contract
from boa.interop.System.App import RegisterAppCall from boa.interop.System.ExecutionEngine import GetExecutingScriptHash, GetCallingScriptHash, GetEntryScriptHash from boa.interop.System.Runtime import CheckWitness, GetTime, Notify, Serialize, Deserialize # Here "749a701ae89c0dbdab9b4b660ba84ee478004219" should your OPE4 contract hash, pls note it's not reversed hash ContractB = RegisterAppCall('91396642e3ec943bf749eb858ec7edd118ee54be', 'operation', 'args') ContractAddress = GetExecutingScriptHash() def Main(opration, args): if opration == "invokeA": opt = args[0] params = args[1] return invokeA(opt, params) if opration == "checkHash": return checkHash() return False def invokeA(operation, params): callerHash = GetCallingScriptHash() entryHash = GetEntryScriptHash() Notify(["111_invokeA",callerHash, entryHash, ContractAddress]) return ContractB(operation, params) def checkHash(): Notify(["111_checkHash"]) # to prevent hack from other contract callerHash = GetCallingScriptHash()
def uSub(a, b): """ Operates a minus b with condition that a - b can never be below 0. :param a: operand a :param b: operand b :return: a - b if a - b > 0 or revert the transaction. """ Require(a >= b) return a - b from boa.interop.System.ExecutionEngine import GetExecutingScriptHash from boa.interop.System.App import RegisterAppCall, DynamicAppCall SpokkzOEP4Contract = RegisterAppCall( 'b52b63902ed5d6455cd7929a13613fc1b88a056f', 'operation', 'args') DEPLOYER = ToScriptHash('AZgDDvShZpuW3Ved3Ku7dY5TkWJvfdSyih') OWNER_KEY = '___OWNER_SPUUL03' PAYMENT_PREFIX = '_____pay_spuul03' DEPLOYED_KEY = 'DEPLOYED_SPUUL03' ctx = GetContext() def Main(operation, args): if operation == 'deploy': return deploy()
from boa.interop.System.App import RegisterAppCall from boa.interop.System.Runtime import Log from boa.interop.System.ExecutionEngine import GetExecutingScriptHash # Here "8ef4b22b006b49a85f5a9a4fe4cd42ce1ab809f4" should your OPE4 contract hash, pls note it's not reversed hash OEP4Contract = RegisterAppCall('8ef4b22b006b49a85f5a9a4fe4cd42ce1ab809f4', 'operation', 'args') selfContractAddress = GetExecutingScriptHash() def Main(operation, args): # Here you can define the method name "checkName" to anything you want if operation == "checkName": return checkName() # Here you can define the method name "checkBalanceOf" to anything you want if operation == "checkBalanceOf": if len(args) == 1: account = args[0] return checkBalanceOf(account) else: return False if operation == "checkSelfBalance": return checkSelfBalance() if operation == "checkTransfer": if len(args) != 3: Log("len(args)!=3 ") return False else: fromAcct = args[0]
# FR, AR, FS, AS, FC, AC, UD, MA, TP, SE # FR_PREFIX = 'FR' # for rep # AR_PREFIX = 'AR' # against rep # FS_PREFIX = 'FS' # for staked # AS_PREFIX = 'AS' # against staked # FC_PREFIX = 'FC' # for count # AC_PREFIX = 'AC' # against count # UD_PREFIX = 'UD' # sign/up_down # MA_PREFIX = 'MA' # margin # SE_PREFIX = 'SE' # seconds # TP_PREFIX = 'TP' # target price ctx = GetContext() # call OEP4 contract for transfer of tokens RepContract = RegisterAppCall('210fdf37cf13fdbf2bf7590223f41bd0bb3d8039', 'operation', 'args') token_owner = 'ANXE3XovCwBH1ckQnPc6vKYiTwRXyrVToD' def Main(operation, args): if operation == 'init': return init() if operation == 'add_bank': if len(args) != 2: return False address = args[0] amount = args[1] return add_bank(address, amount) if operation == 'subtract_bank':
ONGAddress = bytearray( b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02' ) # the original company Dev1 = ToScriptHash("AYqCVffRcbPkf1BVCYPJqqoiFTFmvwYKhG") # the cooperator Dev2 = ToScriptHash("ANTPeXCffDZCaCXxY9u2UdssB2EYpP4BMh") Operater = ToScriptHash("AQf4Mzu1YJrhz9f3aRkkwSm9n3qhXGSh4p") INIT_KEY = "Inited" ContractAddress = GetExecutingScriptHash() ONGMagnitude = 1000000000 Magnitude = 1000000000000000000000000000000 OracleContract = RegisterAppCall('ff4d2c2765346c9229201687604af4f59a0a334f', 'operation', 'args') SelfContractAddress = GetExecutingScriptHash() DEV_PROFIT_PREFIX = "DEV" FEE_PERCENTAGE_KEY = "FEE" SENTREQHASH_FORMGAME_PREFIX = "G1" GAME_STATUS_PREFIX = 'G2' GAME_RES_PREFIX = "G3" GAME_DISKID_PREFIX = "G4" GAME_BET_ENDTIME_PREFIX = "G5" DISK_ONG_AMOUNT_PREFIX = "G6" DISK_PLAYERS_LIST_PREFIX = "G7" DISK_STATUS_KEY = "G8" PLAYER_BET_PREFIX = "G9"
from boa.interop.System.App import RegisterAppCall from boa.interop.System.Runtime import Log # Here "749a701ae89c0dbdab9b4b660ba84ee478004219" should your OPE4 contract hash, pls note it's not reversed version OEP4Contract = RegisterAppCall('749a701ae89c0dbdab9b4b660ba84ee478004219', 'operation', 'args') def Main(operation, args): if operation == "transfer": if len(args) != 3: Log("len(args)!=3 ") return False return CallNep5Contract("transfer", args) # Here you can define the method name "Name" to anything you want if operation == "Name": # This "name" below should be consistent with your OEP4Contract methods return OEP4Contract("name", 0) # Here you can define the method name "BalanceOf" to anything you want if operation == "BalanceOf": # This "balanceOf" below should be consistent with your OEP4Contract methods return OEP4Contract("balanceOf", args) def CallNep5Contract(operation, params): return OEP4Contract(operation, params)
from boa.interop.System.App import RegisterAppCall from boa.interop.Ontology.Runtime import GetRandomHash ContractToBeAttacked = RegisterAppCall( '3bc5276e6b59444035e577a07f9991011ba38bf7', 'operation', 'args') def Main(opration, args): if opration == "attack": methodToBeAttack = args[0] return attack(methodToBeAttack) return False def attack(methodToBeAttack): randomNumber = getRandomNumber() return ContractToBeAttacked(methodToBeAttack, [randomNumber]) def getRandomNumber(): randomHash = GetRandomHash() randomNumber = abs(randomHash) % 100000000 return randomNumber
""" 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' AccountPrefix = 'Account'
from boa.interop.System.App import RegisterAppCall, DynamicAppCall from boa.interop.System.Runtime import Log, Notify CallContract = RegisterAppCall('b16e976491982ddccd195dd73bd952a423a5e833', 'operation', 'args') # input = b'\x33...\xb1'' # b16e976491982ddccd195dd73bd952a423a5e833 NAME = "Dynamic" def Main(operation, args): if operation == "DynamicCallContract": if len(args) != 3: return False revesedContractAddress = args[0] opt = args[1] params = args[2] return DynamicCallContract(revesedContractAddress, opt, params) if operation == "StaticCallContract": opt = args[0] params = args[1] return StaticCallContract(opt, params) if operation == "name": return getName() return False def DynamicCallContract(revesedContractAddress, operation, params):
TONT_MIN = 100000000 #error code定义 ERROR_AMONT = 1 #错误的下注额,小于最小下注额 ERROR_NUMBER = 2 #错误的下注数字,范围不在最小到最大数字之间 ERROR_ADDRESS = 3 #账户地址出错 ERROR_BANLANCE = 4 #账户余额不足 ERROR_TONT_WITHDRAW = 5 #提取TONT出错,提取数量必须为整数 ERROR_AUTH = 6#认证失败 SUCCESS_RECHARGE = 10 # SUCCESS_Withdraw = 11 # OEP4Contract = RegisterAppCall('49f0908f08b3ebce1e71dc5083cb9a8a54cc4a24', 'operation', 'args') def Main(opration, args): if IsFromContract(): return False if opration == "Guess": if len(args[0]) != 20: ErrorNotify(ERROR_ADDRESS) return False if CheckWitness(args[0]): if len(args) == 5: if len(args[4]) != 20: return Guess(args[0], args[1], args[2], args[3], teamaddress) return Guess(args[0], args[1], args[2], args[3], args[4])