Oracle ABI (Minimal)
Use this minimal ABI with ethers v6 for all JS examples in this documentation.
- Network: BNB Chain (BSC) Mainnet
- Oracle address:
0xFA4595F636887CA28FCA3260486e44fdcc8c8A71 - Token address:
0x948d7a6f18511df422184360d1cd5d56f5be4444
If you prefer the full ABI, import it from the repository build artifacts at:
- artifacts/contracts/FarmTruth.sol/DecentralizedOracle.json
Import options
- From artifacts:
import OracleArtifact from '../../../artifacts/contracts/FarmTruth.sol/DecentralizedOracle.json' const oracle = new Contract('0xFA4595F636887CA28FCA3260486e44fdcc8c8A71', (OracleArtifact as any).abi, providerOrSigner) - From this page (copy-paste):
import { Contract } from 'ethers' import { ORACLE_ABI } from './oracle-abi' // if you copy this array into your project const oracle = new Contract('0xFA4595F636887CA28FCA3260486e44fdcc8c8A71', ORACLE_ABI, providerOrSigner)
Minimal ABI
export const ORACLE_ABI = [
// create
{
"type": "function",
"name": "createQuery",
"stateMutability": "nonpayable",
"inputs": [
{ "name": "startBlock", "type": "uint256" },
{ "name": "question", "type": "string" },
{ "name": "metadata", "type": "string" },
{ "name": "totalOptions", "type": "uint8" }
],
"outputs": [{ "name": "", "type": "uint256" }]
},
// vote
{
"type": "function",
"name": "voteOnQuery",
"stateMutability": "nonpayable",
"inputs": [
{ "name": "queryId", "type": "uint256" },
{ "name": "selectedOptions", "type": "uint8[]" },
{ "name": "collateral", "type": "uint256" }
],
"outputs": []
},
// resolve
{
"type": "function",
"name": "resolveQuery",
"stateMutability": "nonpayable",
"inputs": [{ "name": "queryId", "type": "uint256" }],
"outputs": []
},
// claim
{
"type": "function",
"name": "claimRewards",
"stateMutability": "nonpayable",
"inputs": [{ "name": "queryId", "type": "uint256" }],
"outputs": []
},
// read: details
{
"type": "function",
"name": "getQueryDetails",
"stateMutability": "view",
"inputs": [{ "name": "queryId", "type": "uint256" }],
"outputs": [
{ "name": "creator", "type": "address" },
{ "name": "startBlock", "type": "uint256" },
{ "name": "originalEndBlock", "type": "uint256" },
{ "name": "currentEndBlock", "type": "uint256" },
{ "name": "question", "type": "string" },
{ "name": "metadata", "type": "string" },
{ "name": "totalOptions", "type": "uint8" },
{ "name": "resolved", "type": "bool" },
{ "name": "winningOptions", "type": "uint8[]" },
{ "name": "totalCollateral", "type": "uint256" },
{ "name": "totalWinningCollateral", "type": "uint256" },
{ "name": "totalPot", "type": "uint256" },
{ "name": "createdAt", "type": "uint256" },
{ "name": "lastVoteBlock", "type": "uint256" },
{ "name": "inTieExtension", "type": "bool" },
{ "name": "canBeResolved", "type": "bool" }
]
},
// read: answers distribution
{
"type": "function",
"name": "getQueryAnswers",
"stateMutability": "view",
"inputs": [
{ "name": "queryId", "type": "uint256" },
{ "name": "offset", "type": "uint256" },
{ "name": "limit", "type": "uint256" }
],
"outputs": [
{ "name": "answerHashes", "type": "bytes32[]" },
{ "name": "decodedAnswers", "type": "uint8[][]" },
{ "name": "weights", "type": "uint256[]" }
]
},
// read: lists
{
"type": "function",
"name": "getActiveQueriesCount",
"stateMutability": "view",
"inputs": [],
"outputs": [{ "name": "", "type": "uint256" }]
},
{
"type": "function",
"name": "getActiveQueries",
"stateMutability": "view",
"inputs": [
{ "name": "offset", "type": "uint256" },
{ "name": "limit", "type": "uint256" }
],
"outputs": [{ "name": "", "type": "uint256[]" }]
},
// read: claim checks and expected reward
{
"type": "function",
"name": "canClaimRewards",
"stateMutability": "view",
"inputs": [
{ "name": "queryId", "type": "uint256" },
{ "name": "user", "type": "address" }
],
"outputs": [{ "name": "", "type": "bool" }]
},
{
"type": "function",
"name": "getUserVote",
"stateMutability": "view",
"inputs": [
{ "name": "queryId", "type": "uint256" },
{ "name": "user", "type": "address" }
],
"outputs": [
{ "name": "selectedOptions", "type": "uint8[]" },
{ "name": "collateral", "type": "uint256" },
{ "name": "claimed", "type": "bool" }
]
},
{
"type": "function",
"name": "getExpectedReward",
"stateMutability": "view",
"inputs": [
{ "name": "queryId", "type": "uint256" },
{ "name": "user", "type": "address" }
],
"outputs": [{ "name": "", "type": "uint256" }]
}
] as const
Back to: