Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
@Callable(i)
func getResult(id: String) = {
if (keyIsDefined(id) == false) then throwIdError(id) else {
let responsesCount = getResponsesCount(id)
let minResponsesCount = getMinResponsesCount(id)
if (responsesCount < minResponsesCount) then throw("Minimum oracles count not reached yet") else {
let result = calculateResult(id)
let ratingsDiff = getOracleRatingsDiff(id, result)
let resultKey = keyResult(id)
let resultDataEntry = StringEntry(resultKey, result)
let dataToWrite = cons(resultDataEntry, ratingsDiff)
dataToWrite
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment