Esempio n. 1
0
def _saveBalanceMap(balanceMap):
    balanceMapInfo = Serialize(balanceMap)
    Put(GetContext(), BALANCEMAPKEY, balanceMapInfo)
Esempio n. 2
0
def payOutToBalanceOf(addr):
    key = concatKey(PAYOUTSTO_PREFIX, addr)
    return Get(GetContext(), key)
Esempio n. 3
0
def deploy():
    if not noneAdmin_:
        key = concatKey(ADMIN_PREFIX, initial_admin_)
        Put(GetContext(), key, True)
        return True
    return False
Esempio n. 4
0
def addAdmin(fromAdmin, newAdmin):
    Require(onlyAdmin(fromAdmin))
    key = concatKey(ADMIN_PREFIX, newAdmin)
    Put(GetContext(), key, True)
    Notify(["addAdmin", fromAdmin, newAdmin])
    return True
Esempio n. 5
0
def tokenBalanceOf(addr):
    key = concatKey(TOKENBALANCE_PREFIX, addr)
    return Get(GetContext(), key)
Esempio n. 6
0
def _closeRound(roundNumber):
    Put(GetContext(),
        concatKey(concatKey(ROUND_PREFIX, roundNumber), ROUND_STATUS_KEY),
        STATUS_OFF)
    return True
Esempio n. 7
0
def symbol(tokenId):
    """
    :param tokenId: helps to format symbol key = tokenId + SYMBOL
    :return: symbol of token with tokenId
    """
    return Get(GetContext(), concatkey(tokenId, SYMBOL))
Esempio n. 8
0
def getOdds(escapePoint):
    return Get(GetContext(), concatKey(TABLE_KEY, escapePoint))
Esempio n. 9
0
def getTotalOngForAdmin():
    return Get(GetContext(), TOTAL_ONG_FOR_ADMIN)
Esempio n. 10
0
def setOddsTable(keyValueList):
    RequireWitness(Admin)
    for keyValue in keyValueList:
        Put(GetContext(), concatKey(TABLE_KEY, keyValue[0]), keyValue[1])
    Notify(["set OddsTable Successfully!"])
    return True
Esempio n. 11
0
def addReferral(referral, toBeReferred):
    RequireScriptHash(referral)
    RequireScriptHash(toBeReferred)
    Put(GetContext(), concatKey(PLAYER_REFERRAL_KEY, referral), toBeReferred)
    Notify(["addReferral", referral, toBeReferred])
    return True
Esempio n. 12
0
def _fetchCharaSetMap():
    charaSetMap = Get(GetContext(), CHARASETMAPKEY)
    return Deserialize(charaSetMap)
Esempio n. 13
0
def _saveMessageMap(messageMap):
    messageMapInfo = Serialize(messageMap)
    Put(GetContext(), MESSAGEMAPKEY, messageMapInfo)
Esempio n. 14
0
def _fetchMessageMap():
    messageMap = Get(GetContext(), MESSAGEMAPKEY)
    return Deserialize(messageMap)
Esempio n. 15
0
def getLuckyBalanceOf(account):
    return Get(GetContext(), concatKey(LUCKY_BALANCE_KEY, account))
Esempio n. 16
0
def getLuckySupply():
    return Get(GetContext(), LUCKY_TOTAL_SUPPLY_KEY)
Esempio n. 17
0
def getPlayerBetBalance(roundNumber, account):
    return Get(
        GetContext(),
        concatKey(concatKey(ROUND_PREFIX, roundNumber),
                  concatKey(ROUND_PLAYER_BET_BALANCE_KEY, account)))
Esempio n. 18
0
def getCurrentRound():
    return Get(GetContext(), CURRET_ROUND_NUM_KEY)
Esempio n. 19
0
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))
Esempio n. 20
0
def getReferred(referral):
    return Get(GetContext(), concatKey(PLAYER_REFERRAL_KEY, referral))
Esempio n. 21
0
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))
Esempio n. 22
0
def getRoundStatus(roundNumber):
    return Get(
        GetContext(),
        concatKey(concatKey(ROUND_PREFIX, roundNumber), ROUND_STATUS_KEY))
Esempio n. 23
0
def deleteAdmin(fromAdmin, deletedAdmin):
    Require(onlyAdmin(fromAdmin, deletedAdmin))
    key = concatKey(ADMIN_PREFIX, deletedAdmin)
    Delete(GetContext(), key)
    Notify(["deleteAdmin", fromAdmin, deletedAdmin])
Esempio n. 24
0
def getRoundBetsEndTime(roundNumber):
    return Get(
        GetContext(),
        concatKey(concatKey(ROUND_PREFIX, roundNumber),
                  ROUND_END_BET_TIME_KEY))
Esempio n. 25
0
def ReferralBalanceOf(addr):
    key = concatKey(REFERRALBALANCE_PREFIX, addr)
    return Get(GetContext(), key)
Esempio n. 26
0
def getRoundExplodePoint(roundNumber):
    return Get(
        GetContext(),
        concatKey(concatKey(ROUND_PREFIX, roundNumber), ROUND_EXPLODE_NUM_KEY))
Esempio n. 27
0
def dividendsOf(addr):
    return Get(GetContext(), concat(DIVIDENDS_PREFIX, addr))
Esempio n. 28
0
def getOngBalanceOf(account):
    return Get(GetContext(), concatKey(ONG_BALANCE_KEY, account))
Esempio n. 29
0
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
Esempio n. 30
0
def _fetchBalanceMap():
    balanceMapInfo = Get(GetContext(), BALANCEMAPKEY)
    return Deserialize(balanceMapInfo)