def _saveBalanceMap(balanceMap): balanceMapInfo = Serialize(balanceMap) Put(GetContext(), BALANCEMAPKEY, balanceMapInfo)
def payOutToBalanceOf(addr): key = concatKey(PAYOUTSTO_PREFIX, addr) return Get(GetContext(), key)
def deploy(): if not noneAdmin_: key = concatKey(ADMIN_PREFIX, initial_admin_) Put(GetContext(), key, True) return True return False
def addAdmin(fromAdmin, newAdmin): Require(onlyAdmin(fromAdmin)) key = concatKey(ADMIN_PREFIX, newAdmin) Put(GetContext(), key, True) Notify(["addAdmin", fromAdmin, newAdmin]) return True
def tokenBalanceOf(addr): key = concatKey(TOKENBALANCE_PREFIX, addr) return Get(GetContext(), key)
def _closeRound(roundNumber): Put(GetContext(), concatKey(concatKey(ROUND_PREFIX, roundNumber), ROUND_STATUS_KEY), STATUS_OFF) return True
def symbol(tokenId): """ :param tokenId: helps to format symbol key = tokenId + SYMBOL :return: symbol of token with tokenId """ return Get(GetContext(), concatkey(tokenId, SYMBOL))
def getOdds(escapePoint): return Get(GetContext(), concatKey(TABLE_KEY, escapePoint))
def getTotalOngForAdmin(): return Get(GetContext(), TOTAL_ONG_FOR_ADMIN)
def setOddsTable(keyValueList): RequireWitness(Admin) for keyValue in keyValueList: Put(GetContext(), concatKey(TABLE_KEY, keyValue[0]), keyValue[1]) Notify(["set OddsTable Successfully!"]) return True
def addReferral(referral, toBeReferred): RequireScriptHash(referral) RequireScriptHash(toBeReferred) Put(GetContext(), concatKey(PLAYER_REFERRAL_KEY, referral), toBeReferred) Notify(["addReferral", referral, toBeReferred]) return True
def _fetchCharaSetMap(): charaSetMap = Get(GetContext(), CHARASETMAPKEY) return Deserialize(charaSetMap)
def _saveMessageMap(messageMap): messageMapInfo = Serialize(messageMap) Put(GetContext(), MESSAGEMAPKEY, messageMapInfo)
def _fetchMessageMap(): messageMap = Get(GetContext(), MESSAGEMAPKEY) return Deserialize(messageMap)
def getLuckyBalanceOf(account): return Get(GetContext(), concatKey(LUCKY_BALANCE_KEY, account))
def getLuckySupply(): return Get(GetContext(), LUCKY_TOTAL_SUPPLY_KEY)
def getPlayerBetBalance(roundNumber, account): return Get( GetContext(), concatKey(concatKey(ROUND_PREFIX, roundNumber), concatKey(ROUND_PLAYER_BET_BALANCE_KEY, account)))
def getCurrentRound(): return Get(GetContext(), CURRET_ROUND_NUM_KEY)
def name(tokenId): """ :param tokenId: helps to format name key = tokenId + NAME :return: name of the token with tokenId """ return Get(GetContext(), concatkey(tokenId, NAME))
def getReferred(referral): return Get(GetContext(), concatKey(PLAYER_REFERRAL_KEY, referral))
def totalSupply(tokenId): """ :param tokenId: helps to format totalSupply key = tokenId + TOTAL_SUPPLY :return: total supply of token with tokenId """ return Get(GetContext(), concatkey(tokenId, TOTAL_SUPPLY))
def getRoundStatus(roundNumber): return Get( GetContext(), concatKey(concatKey(ROUND_PREFIX, roundNumber), ROUND_STATUS_KEY))
def deleteAdmin(fromAdmin, deletedAdmin): Require(onlyAdmin(fromAdmin, deletedAdmin)) key = concatKey(ADMIN_PREFIX, deletedAdmin) Delete(GetContext(), key) Notify(["deleteAdmin", fromAdmin, deletedAdmin])
def getRoundBetsEndTime(roundNumber): return Get( GetContext(), concatKey(concatKey(ROUND_PREFIX, roundNumber), ROUND_END_BET_TIME_KEY))
def ReferralBalanceOf(addr): key = concatKey(REFERRALBALANCE_PREFIX, addr) return Get(GetContext(), key)
def getRoundExplodePoint(roundNumber): return Get( GetContext(), concatKey(concatKey(ROUND_PREFIX, roundNumber), ROUND_EXPLODE_NUM_KEY))
def dividendsOf(addr): return Get(GetContext(), concat(DIVIDENDS_PREFIX, addr))
def getOngBalanceOf(account): return Get(GetContext(), concatKey(ONG_BALANCE_KEY, account))
from boa.interop.System.Runtime import Notify from boa.interop.System.Storage import Put, GetContext, Get, Delete from template_contract_test.libs.SafeMath import * ctx = GetContext() def Main(operation, args): if operation == "testStorage": return testStorage() return False def testStorage(): Put(ctx, "key", 100) v = Get(ctx, "key") Notify(v) Delete(ctx, "key") Notify(Get(ctx, "key")) return True
def _fetchBalanceMap(): balanceMapInfo = Get(GetContext(), BALANCEMAPKEY) return Deserialize(balanceMapInfo)