Being an Oracle - mevu-bet/mevu GitHub Wiki
Being Verified
In order to become an Oracle a user must first have their ethereum address added to the mapping of verified Oracles in OracleVerifier.sol. Currently only an address authorized by the owner can verify a new address.
MVU Allowance
The process of oraclizing an event involves staking some amount of MVU tokens, which entails sending these tokens to the Mevu platform of smart-contracts. By establishing an allowance of your tokens that the Mevu platform can spend (with a one-time transaction), this allows users to become an oracle for an event with one transaction instead of two every time. This allowance is automatically depleted as users become Oracles and stake MVU and so must be periodically reset if it is not set high enough initially. The allowance can be set on the front end by clicking the button indicating so or directly in the smart-contract by calling approve
on the MVU token contract and specifying the address where OraclesController.sol sits as the spender.
Registering as an Oracle for an Event
Once verified and with a MVU allowance, a user can actually become an Oracle for an event. After the event has happened the user decides their stake (must be less than their MVU allowance) and inputs the event winner (1
for team one, 2
for team two and 3
for a tie). This is accomplished through the registerOracle
function in OraclesController.sol
function registerOracle (
bytes32 eventId,
uint mvuStake,
uint winnerVote
)
eventUnlocked(eventId)
onlyVerified
mustBeVoteReady(eventId)
Claiming Reward
After what is known as the 'oracle reporting period' or 'oracle period' (the period of time after an event is over when Oracles submit the outcome) is over a registered Oracle can claim their reward for performing the Oracle service. The length of the oracle period is held by oraclePeriod
in Admin.sol. The term reward may be a bit of a misnomer since if an Oracle is found to be against consensus they will recieve 0 ETH in earnings and will also lose half of the MVU they staked. Oracles claim their reward by calling claimReward
in OraclesController.sol.
function claimReward (bytes32 eventId )
onlyOracle(eventId)
notClaimed(eventId)
eventLocked(eventId)
Claiming Refund
In the event that a user has registered as an Oracle for an event but there are not enough registered Oracles to meet the minimum required number for that event then that user is entitled to a refund of their MVU tokens staked. After the Oracle period has passed (oraclePeriod
in Admin.sol) the user may call claimRefund
in OraclesController.sol
function claimRefund (bytes32 eventId)
refundNotClaimed(eventId)
onlyOracle(eventId)
eventLocked(eventId)
noWinner(eventId)
Withdrawing
Currently, the claimReward
function detailed above only calculates an Oracles reward (ETH and MVU) and unlocks it for withdrawal but does not actually transfer to the Oracle. To obtain earnings, Oracles must call withdraw
in OraclesController.sol for MVU and withdraw
in Mevu.sol for ETH.