Created
May 13, 2020 15:29
-
-
Save KardanovIR/df7e9082de98821a919ee7b3dcf12f45 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Callable(i) | |
func request(id: String, question: String, minResponsesCount: Int, maxResponsesCount: Int, oraclesWhiteList: String, tillHeight: Int) = { | |
let whiteList = checkOraclesWhiteListLengthLt1000(oraclesWhiteList) | |
let checkedRequestIdLt64 = checkRequestIdLt32(id) | |
let requestId = checkIdIsNotUsed(checkedRequestIdLt64) | |
let paymentAmount = checkPaymentInWavesGt0(i.payments[0].extract()) | |
let minCount = checkOraclesCountGt3Lt6(minResponsesCount, maxResponsesCount) | |
let maxCount = checkOraclesWhiteListCountGtMinCount(oraclesWhiteList, minCount, maxResponsesCount) | |
let callerPubKey = toBase58String(i.callerPublicKey) | |
[ | |
StringEntry(keyQuestion(requestId), question), | |
StringEntry(keyOraclesWhiteList(requestId), whiteList), | |
StringEntry(keyRequesterPk(requestId), callerPubKey), | |
StringEntry(keyResponders(requestId), ""), | |
StringEntry(requestId, question), | |
IntegerEntry(keyMinResponsesCount(requestId), minCount), | |
IntegerEntry(keyMaxResponsesCount(requestId), maxCount), | |
IntegerEntry(keyResponsesCount(requestId), 0), | |
IntegerEntry(keyTillHeight(requestId), tillHeight), | |
IntegerEntry(keyRequestHeight(requestId), height), | |
IntegerEntry(keyPayment(requestId), paymentAmount), | |
BooleanEntry(keyRequestIsDone(id), false) | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment