Solidity Tutorial

πŸš€ Want a shortcut? πŸš€

Start with our boilerplate Solidity smart contract on GitHubarrow-up-right.

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 resultsarrow-up-right:

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

6. Still having issues?

  1. Tweet to @dawsonbotsfordarrow-up-right and @everipediaarrow-up-right any engineering questions (or send a DM on Twitter to @dawsonbotsfordarrow-up-right)

Last updated

Was this helpful?