def avoidToBeInvokedByContract():
    callerHash = GetCallingScriptHash()
    entryHash = GetEntryScriptHash()
    if callerHash != entryHash:
        Notify(["You are not allowed to invoke this method through contract"])
        return False
    else:
        Notify(["You can implement what you need to do here!"])
        return True
def cannotAvoidContractCallAttack(guessNumber):

    randomNumber = getRandomNumber()

    callerHash = GetCallingScriptHash()
    #Developers are wrong
    entryHash = GetExecutingScriptHash()
    Notify(["randomNumber:", randomNumber, "guessNumber:", guessNumber])
    #Never equal
    VaasRequire(callerHash == entryHash)
    if guessNumber == randomNumber:
        Notify(["You have won the big prize!"])
        return True
    return False
def avoidContractCallAttack(guessNumber):

    randomNumber = getRandomNumber()

    callerHash = GetCallingScriptHash()
    entryHash = GetEntryScriptHash()
    Notify(["randomNumber:", randomNumber, "guessNumber:", guessNumber])
    if callerHash != entryHash:
        Notify(["You are not allowed to invoke this method through contract!"])
        return False
    else:
        Notify(["You can implement what you need to do here!"])
        if guessNumber == randomNumber:
            Notify(["You have won the big prize!"])
            return True
        return False
def RequireNotContract():
    callerHash = GetCallingScriptHash()
    entryHash = GetEntryScriptHash()
    Require(callerHash == entryHash)
def RequireApproved():
    callerHash = GetCallingScriptHash()
    entryHash = GetEntryScriptHash()
    if entryHash is not callerHash:
        approved = isApproved(callerHash)
        Require(approved)
Ejemplo n.º 6
0
def onlyLINK():
    assert (bytearray_reverse(GetCallingScriptHash()) == getChainLinkToken())
    return True
Ejemplo n.º 7
0
def invokeA(operation, params):
    callerHash = GetCallingScriptHash()
    entryHash = GetEntryScriptHash()
    Notify(["111_invokeA",callerHash, entryHash, ContractAddress])
    return ContractB(operation, params)