Oracle Staking Guide

John Derbyshire
hubii
Published in
6 min readOct 1, 2019

--

Welcome to the first version of hubii’s Oracle staking guide, which is designed to help you take part in our ongoing Oracle game. Following the deployment of the Oracle to mainnet last week, we have been asked by our community to produce a simple guide to how you can participate. If you haven’t already, please start with our original announcement here — this non-technical introduction includes links to the Oracle smart contracts and the first version of the Oracle game White Paper.

We currently have one ‘resolution engine’ live on mainnet, which began with a bounty fund worth 500,000 NII (5,000 USD at our IEO price). Over the next 12 months, we’ll be adding more complex ‘resolution engines’, with increasingly large bounty funds. Ultimately, 100 million NII tokens (worth 1 million USD at our IEO price) will be allocated to the Oracle. Read on to find out how you can take part.

WARNING: The Oracle operates using staking rounds, known as verification phases. If you stake your tokens on the losing outcome for a given round (i.e. you stake on ‘true’ and the outcome is false), you will lose your tokens. This is an intended feature of the Oracle’s design.

Mainnet — Using Etherscan/MetaMask

Step 1 — Approve

First, we need to approve the Oracle contract to be allowed to ‘pull’ a predefined amount of tokens from your wallet. This is a standard functionality within ERC20 token contracts. Navigate to the NII token contract on Etherscan and choose ‘Write Contract’:

https://etherscan.io/token/0xac4f2f204b38390b92d0540908447d5ed352799a#writeContract

Next, select ‘Connect to Web3’.

Enter the Oracle contract address address under spender (address), this is currently: 0xE5D6bc2457B23A8E18216BC5b57F2b67B008D0B9

Finally, specify the amount of base units of NII that you want the Oracle to be able to pull from your wallet. This uint256 value must be an integer and is measured in the base unit of NII, so 1 NII = 1000000000000000 base units.

Now click ‘Write’ in Etherscan and confirm the transaction on MetaMask.

Note: at the time of writing the Ethereum mainnet has a high ‘safe low gas price’. You may want to check https://ethgasstation.info/ to ensure that you set an appropriate gas price for your transaction. Bear in mind that a larger gas limit transaction often requires a larger gas price.

Step 2 — Check the Test Statement, Verification Phase Number and Current Staking Metrics

Although not strictly necessary, it is sensible to check whether you are staking your tokens into the correct resolution engine and verification phase. Similarly, the test statement may change; you should therefore also ensure that you know what the current test statement is.

To check the test statement, go to: https://github.com/hubiinetwork/lottery-oracle-contracts/blob/master/TEST_STATEMENTS.md

To check the current verification phase number, navigate to the resolution engine you wish to stake into (such as ‘NaiveTotalResolutionEngine’) and look under ‘Read Contract’:

https://etherscan.io/address/0xc303cacbc16f41baf140d588f264245eb23da8f4#readContract

Here you can see that the current ‘verificationPhaseNumber’ is 1.

To check the current staking metrics for a given verification phase number, go to the resolution engine contract (e.g. https://etherscan.io/address/0xc303cacbc16f41baf140d588f264245eb23da8f4#readContract for ‘NaiveResolutionEngine’) and call ‘2. metricsByVerificationPhaseNumber’. An example readout from the contract is included below:

Please note that the amounts for ‘trueStakeAmount’, ‘falseStakeAmount’ and ‘bountyAmount’ are in base units, so 1 NII = 1000000000000000 base units.

Step 3 — Stake Your Tokens into the Oracle Contract

With the Oracle contract approved to pull an amount of tokens from Step 1, you can now stake your tokens into the Oracle.

Navigate to the ‘Write Contract’ section of the Oracle contract on Etherscan:

https://etherscan.io/address/0xe5d6bc2457b23a8e18216bc5b57f2b67b008d0b9#writeContract

As with Step 1, make sure you have selected ‘Connect to Web3’

Now you can enter the staking information under ‘2. stake’:

  • _resolutionEngine (address)

This is the address of the resolution engine that you want to stake into, for NaiveTotalResolutionEngine use: 0xc303cacbc16f41baf140d588f264245eb23da8f4

  • _verificationPhaseNumber (uint256)

This is the verification phase number that you want to stake tokens into, using the example from Step 2 you would enter ‘1’ here.

  • _status (bool)

Do you want to stake your tokens on true or false? Enter ‘true’ or ‘false’ here to indicate your staking direction. Importantly, any input other than ‘false’ here will default to staking on true.

  • _amount (uint256)

How many tokens do you want to stake into the Oracle? Enter a unit256 value in base units (as per Step 1). As an example, 1 NII = 1000000000000000 base units.

Now click ‘Write’ in Etherscan and confirm the transaction on MetaMask.

Note: at the time of writing the Ethereum mainnet has a high ‘safe low gas price’. You may want to check https://ethgasstation.info/ to ensure that you set an appropriate gas price for your transaction.

Step 4 — Stage Your Payout Ahead of Withdrawal

If you have staked your tokens on the ‘correct’ outcome for a verification phase (i.e. you staked tokens on ‘true’ and the market resolved as true, or you staked your tokens on ‘false’ and the market resolved as false), you can now stage your payout ahead of making a withdrawal.

Note: you can check whether an address is due a payout by querying the Oracle contract under ‘Read Contract — 4. calculatePayout’.

To stage a payout prior to withdrawal, navigate to the ‘Write Contract’ section of the Oracle contract on Etherscan:

https://etherscan.io/address/0xe5d6bc2457b23a8e18216bc5b57f2b67b008d0b9#writeContract

As with Step 1, make sure you have selected ‘Connect to Web3’

Now you can enter the staking information under ‘1. stagePayout’:

Using the Oracle contract, fill in the following information:

  • _resolutionEngine (address)

For which resolution engine do you wish to stage a payout? Enter the address here (e.g. NaiveResolutionEngine, use: 0xc303cacbc16f41baf140d588f264245eb23da8f4).

  • _firstVerificationPhaseNumber (uint256)

You can stage payouts from more than one verification phase. Enter the first (i.e. starting from) verification phase number here.

  • _lastVerificationPhaseNumber (uint256)

As with the previous field, you can choose to stage payouts from multiple verification phases. Enter the final (i.e. ending on) verification phase number here.

Now click ‘Write’ in Etherscan and confirm the transaction on MetaMask.

Step 5 — Request a Withdrawal of Your Staged Tokens

If you have staged a payout in Step 4, you can now request a withdrawal of your staged tokens. To do so, navigate to the ‘Write Contract’ section of the Oracle contract on Etherscan:

https://etherscan.io/address/0xe5d6bc2457b23a8e18216bc5b57f2b67b008d0b9#writeContract

As with Step 1, make sure you have selected ‘Connect to Web3’

Now you can enter the staking information under ‘9. withdraw’:

This contract call requires the following information:

  • _resolutionEngine (address)

From which resolution engine do you wish to make a withdrawal? Enter the address here (e.g. NaiveResolutionEngine, use: 0xc303cacbc16f41baf140d588f264245eb23da8f4).

  • _amount (uint256)

How many of your staged tokens do you wish to withdraw? Enter the number here in base units; so for 1 NII, you should enter ‘1000000000000’.

--

--