Solidity Tutorial

🚀 Want a shortcut? 🚀

Start with our boilerplate Solidity smart contract on GitHub.

Walkthrough

  1. Install the contract via npm

npm install oraqle-contracts
# OR
yarn add oraqle-contracts

2. Set pragma and import the senate contract at the top of your smart contract

pragma solidity 0.6.11;
import "oraqle-contracts/contracts/associated-press/Jan2021SenateRunoffs.sol";

3. Paste in this example code and change the parts your need! Don't forget to change the deployed contract address for production.

contract IsPerdueWinner {
Jan2021SenateRunoffs internal senateRunoffContract;
constructor() public {
senateRunoffContract = Jan2021SenateRunoffs(
0x0792724900B551d200D954a5Ed709d9514d73A9F
);
}
function isPerdueWinner() public view returns (bool) {
return
keccak256(
bytes(senateRunoffContract.winners("U.S. Senate Class II"))
) == keccak256(bytes("Perdue"));
}
}

4. Validate on kovan that you are getting the following results:

5. Replace the smart contract address on line 6 above with the production contract address and get ready for January 5th!

6. Still having issues?

  1. Tweet to @dawsonbotsford and @everipedia any engineering questions (or send a DM on Twitter to @dawsonbotsford)