Uma is a decentralized oracle designed to report any sort of knowledge on the blockchain, besides these that may’t be verified. It’s known as an optimistic oracle as a result of it operates on the idea that if nobody disputes the information, then it’s thought of correct.
Uma additionally has a built-in arbitration system to deal with disputes. This oracle supplies information for tasks like cross-chain bridges, insurance coverage protocols, prediction markets, and derivatives. The kinds of information can range extensively — from cryptocurrency costs to sports activities or political occasions.
Nevertheless, all the information pertains to real-world occasions that may be verified sooner or later.
Listed here are a number of examples of such information:
Elon Musk will tweet about cryptocurrencies earlier than August thirty first.Trump will say the phrase “tampon” in an interview.There shall be a monkeypox outbreak in 2024.The worth of Solana shall be over $140 on August twenty third.Satoshi’s id shall be revealed in 2024.
Let’s break down the fundamental strategy of how the oracle gathers dependable information. Once we speak about information right here, we’re referring to the examples talked about above. All through this text, you’ll see phrases like “assertion,” “assertion,” “occasion,” or “prediction” — all of those describe the information the oracle offers with at totally different phases of its lifecycle.
Right here’s a simplified have a look at how information flows into the oracle:
Assertion. An announcement is submitted to the oracle together with a reward. The thought is that whoever can efficiently problem the assertion will get the reward.Problem interval. Throughout this time, anybody can problem the assertion. If nobody does, the assertion is taken into account prepared for finalization, which means it’s accepted as true and dependable.Dispute. Even after the problem interval, any participant can nonetheless dispute the assertion to assert the reward or simply to maintain issues sincere. That final bit is sort of a joke — disputes don’t occur all that always. Sport principle suggests most individuals play honest within the protocol’s ecosystem.Voting. If a dispute is raised, UMA token holders vote to resolve it. UMA is the protocol’s token, and it offers holders the best to vote on disputes and earn rewards for doing so.Settle. The ultimate step is settling, the place the assertion is formally confirmed as true.
Let’s stroll by an instance.
Vasily — fortunately not Terkhin — believes that Spain received the 2024 Euro Cup. It is a well-known reality, so Vasily decides to show the Uma oracle about it. He submits the occasion to the oracle — that is the assertion stage. The problem interval passes with no disputes — it’s fairly apparent. Then, the ultimate step, settle, confirms within the oracle that Spain was the champion. Any more, the oracle can all the time reply who received.
Vasily is pumped up by his success and plans to submit the whole 2024 Euro Cup outcomes desk.
However Vasily was truly rooting for France, who got here in third. He decides to cheat by transferring them as much as second place. A disputer catches this and raises a dispute. It’s value noting that each Vasily and the disputer have pores and skin within the sport — they’ve staked some tokens. The voting occurs, and Vasily’s try to cheat fails as a result of the oracle’s arbitration system works because it ought to, and the occasion is flagged as false. On the last settle stage, the oracle awards a few of Vasily’s tokens to the disputer as a reward. Vasily loses his tokens, and the disputer comes out forward.
That’s a fast overview of how Uma’s oracle works to validate new information from the true world.
The Uma oracle permits sensible contracts to shortly request and obtain data. Nevertheless, there’s a course of that should occur earlier than that data is confirmed, which includes a sure period of time and a full verification course of.
The next system parts are concerned within the oracle’s operation:
Asserter — The participant who submits a press release from the true world into the system. For instance, “The trade price of the yuan at this time is the same as one greenback.”Disputer — The participant who can problem the assertion revealed by the asserter.DVM — A software program module for resolving disputes between the asserter and disputer. Nevertheless, utilizing this module is optionally available and will be changed with a customized dispute decision system.Voter — The participant who votes to determine whether or not the asserter or the disputer is right.
Let’s check out the diagram from the official documentation that reveals how all these system parts work together.
Based on the diagram, the Uma oracle works as follows:
The asserter publishes a press release and places up a collateral in a token permitted by the protocol.Through the problem interval, the disputer can open a dispute in the event that they disagree with the asserter’s assertion. To provoke the dispute, the disputer additionally stakes collateral. If the assertion isn’t challenged throughout the allowed time, it’s thought of true.After that, the DVM initiates an unbiased voting course of amongst all UMA token holders. This course of consists of commit and reveal phases, the place initially, nobody is aware of how others have voted, after which every participant reveals their vote.After voting concludes, if the asserter was right, they obtain half of the disputer’s collateral, with the opposite half remaining within the protocol. If the disputer wins, the reverse occurs — they take half of the asserter’s collateral.
To take part in voting, a voter must have their UMA tokens staked within the protocol. It is a key distinction between DVM v1.0 and v2.0. The motivation for staking is the chance to earn rewards. Total, this can be a widespread characteristic utilized by many protocols, and Uma doesn’t supply something new on this regard.
Voters take part within the voting course of in two phases: submitting their vote in secret after which revealing it. This is named the “commit/reveal” scheme. Within the first stage, the vote is hashed and submitted to the sensible contract, and within the second stage, the vote is revealed. This ensures that nobody can see how others have voted, which ensures a really unbiased voting course of.
There’s additionally an attention-grabbing mechanism known as slashing. Based on this mechanism, staked balances are redistributed from individuals who both don’t take part in voting or vote incorrectly, to those that vote accurately.
It’s essential to outline what “right” and “incorrect” individuals are. An incorrect participant is one who leads to the minority after the vote.
For instance, the system proposes an occasion: “Zimbabwe will win precisely 10 gold medals on the Olympics.” It’s unlikely, however let’s say the celebrities align, and Zimbabwe wins precisely 10 gold medals. It appears simple, so we vote that the occasion is true. Nevertheless, for some cause, nearly all of individuals, possibly on account of a mistaken supply, voted that the occasion didn’t occur, pondering Zimbabwe didn’t win any medals. On this case, despite the fact that we voted actually, we might be labeled as “incorrect” voters and topic to slashing.
It’s value noting once more that an incorrect participant is somebody who voted with the minority. Nevertheless, this state of affairs is unlikely as a result of individuals don’t understand how others have voted till the reveal stage. Since voting is secret, nobody needs to finish up within the minority, in order that they’ll attempt to vote accurately.
This mechanism eliminates the financial incentive to behave dishonestly or sabotage the voting course of. The documentation refers to this as a penalty for not taking part in voting.
OOV3 is the code identify for the Optimistic Oracle V3 sensible contract. If you might want to combine with the Uma protocol, that is the sensible contract you’ll be working with.
Throughout deployment, the constructor of the sensible contract takes three parameters:
finder: A wise contract that shops the addresses of all energetic protocol sensible contracts. This enables for environment friendly use of it in any third-party sensible contract.defaultCurrency: The handle of the token by which the protocol will settle for collateral.defaultLiveness: The time-frame throughout which a dispute will be initiated over a press release.constructor(FinderInterface _finder,IERC20 _defaultCurrency,uint64 _defaultLiveness) {finder = _finder;// Set _defaultCurrency и _defaultLiveness on the sensible contractsetAdminProperties(_defaultCurrency, _defaultLiveness, 0.5e18);}
The core logic of the sensible contract is simple and mirrors the protocol’s workflow in three steps:
Assert reality: Proposes an occasion/assertion from the true world for validation.Dispute assertion: Permits for the occasion to be challenged.Settle assertion: Confirms the occasion as truthful, correct, or right.
There are two public capabilities for asserting an occasion: assertTruthWithDefaults() and assertTruth(). Primarily, the primary perform calls the second with default parameters, so let’s take a more in-depth have a look at the second perform in a simplified type.
perform assertTruth(bytes reminiscence declare, // A set of bytes representing the encoded assertion.handle asserter, // The handle of the assertion initiator, wanted to retrieve their collateral.handle callbackRecipient, // The callback handle.handle escalationManager, // Another dispute decision supervisor.uint64 liveness, // The time interval throughout which the assertion will be disputedIERC20 foreign money, // The handle of the token by which collateral shall be helduint256 bond, // The quantity of collateral, which should not be lower than the minimal required by the protocolbytes32 identifier, // The identifier for the DVMbytes32 domainId // An optionally available parameter that enables grouping assertions
) public nonReentrant returns (bytes32 assertionId) {uint64 time = uint64(getCurrentTime());// An identifier is created for the assertion. it is a hash of its parameters.assertionId = _getId(declare, bond, time, liveness, foreign money, callbackRecipient, escalationManager, identifier);
// Checks for the power so as to add the assertion.require(asserter != handle(0), “Asserter cant be 0”);require(assertions[assertionId].asserter == handle(0), “Assertion already exists”);require(_validateAndCacheIdentifier(identifier), “Unsupported identifier”);require(_validateAndCacheCurrency(handle(foreign money)), “Unsupported foreign money”);require(bond >= getMinimumBond(handle(foreign money)), “Bond quantity too low”);
// Saves the assertion on the sensible contract.assertions[assertionId] = Assertion({// all assertion parameters…});
// This half determines how the dispute shall be resolved. By default, // if escalationManager is ready to deal with(0), the dispute shall be resolved by the DVM protocol. // In any other case, it will likely be dealt with by the escalationManager, which should implement a selected interface.
{EscalationManagerInterface.AssertionPolicy reminiscence assertionPolicy = _getAssertionPolicy(assertionId);// The dispute decision system should be energetic (both DVM or escalationManager).require(!assertionPolicy.blockAssertion, “Assertion not allowed”);EscalationManagerSettings storage emSettings = assertions[assertionId].escalationManagerSettings;// Reassignment is critical to make use of the settings instantly from the escalationManager.(emSettings.arbitrateViaEscalationManager, emSettings.discardOracle,emSettings.validateDisputers) = (assertionPolicy.arbitrateViaEscalationManager,assertionPolicy.discardOracle,assertionPolicy.validateDisputers);}
// Transfers the collateral from the caller to the sensible contractcurrency.safeTransferFrom(msg.sender, handle(this), bond);…}
After the assertion is created, the countdown begins for the interval throughout which a dispute will be initiated. To do that, any celebration that disagrees should name the disputeAssertion() perform. It’s a small perform, so let’s take a more in-depth have a look at it.
perform disputeAssertion(bytes32 assertionId, handle disputer) exterior nonReentrant {// Verify if it is potential to create a disputerequire(disputer != handle(0), “Disputer cannot be 0”);Assertion storage assertion = assertions[assertionId];require(assertion.asserter != handle(0), “Assertion doesn’t exist”);require(assertion.disputer == handle(0), “Assertion already disputed”);// Confirm that the dispute interval hasn’t expiredrequire(assertion.expirationTime > getCurrentTime(), “Assertion is expired”);// Verify that there is a system obtainable to resolve the dispute (DVM or escalation supervisor)require(_isDisputeAllowed(assertionId), “Dispute not allowed”);
// Set the disputer’s handle for the assertionassertion.disputer = disputer;
// Acquire collateral from the disputerassertion.foreign money.safeTransferFrom(msg.sender, handle(this), assertion.bond);
// Notify the DVM that it is time to provoke the voting course of to resolve the dispute_oracleRequestPrice(assertionId, assertion.identifier, assertion.assertionTime);
// Make a callback to the callbackRecipient handle that was set with the assertion
_callbackOnAssertionDispute(assertionId);…emit AssertionDisputed(assertionId, msg.sender, disputer);}
As soon as the dispute interval has handed, the assertion will be finalized for public use. To do that, you might want to name the settleAssertion() perform. Let’s take a more in-depth have a look at it.
perform settleAssertion(bytes32 assertionId) public nonReentrant {Assertion storage assertion = assertions[assertionId];
// Checks for the power to name settleAssertion()require(assertion.asserter != handle(0), “Assertion doesn’t exist”);require(!assertion.settled, “Assertion already settled”);
// Units the flag indicating the assertion is settledassertion.settled = true;
// If no dispute was initiatedif (assertion.disputer == handle(0)) {// Wait till the dispute interval has expiredrequire(assertion.expirationTime <= getCurrentTime(), “Assertion not expired”);
assertion.settlementResolution = true;// Return the collateral to the account that created the assertionassertion.foreign money.safeTransfer(assertion.asserter, assertion.bond);
// Make a callback to the callbackRecipient handle that was set when the assertion was created_callbackOnAssertionResolve(assertionId, true);
emit AssertionSettled(assertionId, assertion.asserter, false, true, msg.sender);} else {// If a dispute was initiated, retrieve its resultint256 resolvedPrice = _oracleGetPrice(assertionId, assertion.identifier, assertion.assertionTime);
// File the dispute resultif (assertion.escalationManagerSettings.discardOracle) assertion.settlementResolution = false;else assertion.settlementResolution = resolvedPrice == numericalTrue;
// Decide who will obtain the collateral backaddress bondRecipient = resolvedPrice == numericalTrue ? assertion.asserter : assertion.disputer;
// Calculate the oracle feeuint256 oracleFee = (burnedBondPercentage * assertion.bond) / 1e18;// Calculate the quantity to be returned to the collateral recipientuint256 bondRecipientAmount = assertion.bond * 2 – oracleFee;
// ship feeassertion.foreign money.safeTransfer(handle(_getStore()), oracleFee);// ship a collateral to the recipientassertion.foreign money.safeTransfer(bondRecipient, bondRecipientAmount);
// Make a callback to the callbackRecipient handle that was set when the assertion was created.if (!assertion.escalationManagerSettings.discardOracle)_callbackOnAssertionResolve(assertionId, assertion.settlementResolution);
emit AssertionSettled(assertionId, bondRecipient, true, assertion.settlementResolution, msg.sender);}}
It’s time to get extra acquainted with the DVM dispute decision system. Within the repository, this a part of the code is positioned in a separate folder known as data-verification-mechanism.
The primary contract that’s start line for understanding the system is Voting.sol. Under, we’ll be taking a look at its second model: the VotingV2.sol sensible contract.
This technique is bigger than OOV3, however we’ll intention to cowl an important facets. On the heart of the diagram is the VotingV2.sol sensible contract itself, together with the interfaces it inherits: OracleInterface, OracleAncillaryInterface, OracleGovernanceInterface, and VotingV2Interface.
To take part in voting on disputes, UMA token holders must stake their tokens. That is dealt with by a separate sensible contract, Staker.sol, which VotingV2.sol inherits from. Within the diagram, that is highlighted in inexperienced.
The yellow/orange highlighted sensible contracts are these used inside the primary VotingV2.sol. They add extra logic, and for a few of them, their addresses should be offered to the VotingV2.sol constructor throughout deployment, implying they should be deployed individually beforehand. Let’s listing them and clarify their roles:
VoteTiming.sol: Defines the timing intervals for UMA token holders’ voting, particularly the order of commit/reveal operations. Keep in mind, voting happens in two phases. First, voters submit a hash of their vote, after which they reveal this hash.Finder.sol: Chargeable for storing the addresses of different sensible contracts used all through the protocol and past.FixedSlashSlashingLibrary.sol: Manages the redistribution of UMA tokens between sincere and dishonest individuals, favoring the previous.VotingToken.sol: That is the UMA protocol’s token. Its handle is offered to VotingV2.sol throughout deployment. Customers should stake this token to achieve entry to voting.ResultComputationV2: A vital library accountable for tallying votes.Earlier voting contract: The handle of the earlier model of the Voting.sol sensible contract. It’s solely used for retrieving rewards or data saved within the previous model.
The purple-highlighted sections within the diagram characterize teams of capabilities applied by the VotingV2.sol sensible contract:
Voting functionsVoting getter functionsPrice request and entry functionsOwner admin functionsStaking functionsMigrating help functionsPrivate and inside capabilities
There’s no want to enter element about what every perform group does — the names are fairly self-explanatory.
With all this in thoughts, you possibly can discover the VotingV2.sol sensible contract by yourself.
Now, let’s speak in regards to the slashing mechanism. We’ve already recognized it as the first mechanism for incentivizing UMA token holders to take part in dispute decision.
To grasp how this mechanism works, we have to hint it again to its start line within the code. place to begin is the interior _updateTrackers() perform within the VotingV2.sol sensible contract. Let’s take a more in-depth have a look at it.
// voter – the handle of the voting participantfunction _updateTrackers(handle voter) inside override {// Prepares the listing of voting requests, updates the listing of these the place voting has concluded, so we are able to verify if the voter participated in themprocessResolvablePriceRequests();
// Applies slashing to the precise voter’s address_updateAccountSlashingTrackers(voter, UINT64_MAX);
// Calls the overridden perform, which is bodily positioned within the Staker.sol sensible contractsuper._updateTrackers(voter);}
This perform is utilized in many locations all through the code. However if you happen to look carefully, a lot of the situations are tied to consumer actions: stake(), unstake(), withdrawRewards(). There are a pair extra situations — go discover them your self, as they are saying.
So, it seems that any motion a voter takes will set off slashing for them. They received’t be capable to keep away from it. Meaning you possibly can’t simply stake tokens, accumulate staking rewards with out taking part within the voting, after which withdraw the rewards later. When the consumer tries to withdraw, they may set off slashing on themselves with their very own transaction and get penalized. The one solution to keep away from the penalty is to take part in voting and achieve this actually.
Moreover, the protocol permits anybody to set off slashing for anybody else at any time. So, even simply ready it out till the protocol doubtlessly cancels slashing by a DAO received’t work. Somebody will certainly set off slashing for such a consumer. All it takes is looking the general public updateTrackers() perform. This perform will, underneath the hood, name the interior perform of the identical identify.
perform updateTrackers(handle voter) exterior {_updateTrackers(voter);}
In case you don’t need to make the consumer undergo the whole voting historical past, you need to use a perform that means that you can outline the utmost depth of occasions for slashing. That is dealt with by the updateTrackersRange() perform.
Let’s summarize when a consumer encounters slashing. Check out the diagram.
The one factor we haven’t coated is how the slashing code is written. I’ll go away that as a homework project. Trace: try the _updateAccountSlashingTrackers() perform.
Essential! Earlier, we talked about the FixedSlashSlashingLibrary.sol library. On nearer inspection, you’ll see that it merely handles the quantity of tokens that shall be deducted from a consumer as a penalty for not taking part in voting or for voting incorrectly.
Uma presents a number of instance tasks that reveal methods to use the protocol:
Prediction market. Implements a prediction market the place the outcomes are verified utilizing the Optimistic Oracle V3.Insurance coverage contract. Implements an insurance coverage contract that means that you can acquire a coverage with the potential of receiving a payout in case of an insured occasion.A generic information assertion framework. Permits making assertions on arbitrary information, verified by the Optimistic Oracle V3.
Let’s dive into probably the most attention-grabbing instance, the “Prediction market.” I selected this instance as a result of I do know of a well-liked service within the prediction markets area, Polymarket, which makes use of the Uma protocol.
How does a prediction market work? The service is populated with predictions that customers can vote on, selecting one of many potential outcomes. For instance: “Bitcoin shall be value $100,000 tomorrow.” A consumer can agree with this assertion or disagree and forged their vote for both the optimistic or destructive end result.
You’ll be able to consider it as a betting service. We’re betting on a selected end result of an occasion. When the occasion occurs, the wager both pays off, and we earn cash, or we lose every part. Normally, a prediction has two or three outcomes, however typically there are extra. A fungible token is created for every end result. To position a wager, you might want to purchase this token. The acquired token will be exchanged on different platforms for a extra well-known token, if it’s listed there. Typically, the power to trade is applied instantly throughout the prediction service itself.
Let’s bounce proper in. Let’s check out the constructor:
constructor(handle _finder,handle _currency,handle _optimisticOracleV3) {// Set the addresses:// finder – for accessing the required UMA contracts// foreign money – the token for use for collateral// optimisticOracleV3 – the oracle’s addressfinder = FinderInterface(_finder);// Verify if UMA permits using this token as collateralrequire(_getCollateralWhitelist().isOnWhitelist(_currency), “Unsupported foreign money”);foreign money = IERC20(_currency);oo = OptimisticOracleV3Interface(_optimisticOracleV3);defaultIdentifier = oo.defaultIdentifier();}
The primary process of the prediction market is to create varied binary assertions the place customers can specific their opinions by indicating whether or not they “agree” or “disagree” with the assertion. These are known as potential outcomes of an assertion or prediction within the sensible contract. There’s a particular mapping known as markets for storing these assertions.
struct Market {bool resolved; // True if the assertion has been verified and will be settledbytes32 assertedOutcomeId; // Hash of the potential outcomes (outcome1, outcome2, or unresolvable)ExpandedIERC20 outcome1Token;ExpandedIERC20 outcome2Token;uint256 reward; // Reward for asserting the right outcomeuint256 requiredBond; // Required collateral for submitting the assertion to the UMA oraclebytes outcome1; // Quick identify of the primary outcomebytes outcome2; // Quick identify of the second outcomebytes description; // Description of the prediction
}
mapping(bytes32 => Market) public markets;
Now that we all know the information constructions that describe the prediction market, we are able to check out the initializeMarket() perform, which creates markets on the sensible contract.
perform initializeMarket(sstring reminiscence outcome1, // Identify of the primary outcomestring reminiscence outcome2, // Identify of the second outcomestring reminiscence description, // Market descriptionuint256 reward, // Reward for the asserteruint256 requiredBond // Collateral for the UMA oracle
) public returns (bytes32 marketId) {…
// Creating an identifier for the prediction marketmarketId = keccak256(abi.encode(block.quantity, description));
…
// Create a report for the marketmarkets[marketId] = Market({resolved: false,assertedOutcomeId: bytes32(0),outcome1Token: outcome1Token,outcome2Token: outcome2Token,reward: reward,requiredBond: requiredBond,outcome1: bytes(outcome1),outcome2: bytes(outcome2),description: bytes(description)});
// Fund the contract with the reward amountif (reward > 0) foreign money.safeTransferFrom(msg.sender, handle(this), reward);
emit MarketInitialized(marketId,outcome1,outcome2,description,handle(outcome1Token),handle(outcome2Token),reward,requiredBond);}
The following step, after the prediction market is created and customers have positioned their bets “for” or “in opposition to” and the expected occasion has occurred, is to submit the proposed end result to the UMA protocol to validate the consequence. Our sensible contract implements the assertMarket() perform for this objective.
// assertedOutcome – this is among the prediction outcomes that the perform caller believes is correctfunction assertMarket(bytes32 marketId, string reminiscence assertedOutcome) public returns (bytes32 assertionId) {Market storage market = markets[marketId];require(market.outcome1Token != ExpandedIERC20(handle(0)), “Market doesn’t exist”);
// The hash of the result will function the identifierbytes32 assertedOutcomeId = keccak256(bytes(assertedOutcome));require(market.assertedOutcomeId == bytes32(0), “Assertion energetic or resolved”);// The ensuing hash should match the hash of one of many market’s outcomesrequire(assertedOutcomeId == keccak256(market.outcome1) ||assertedOutcomeId == keccak256(market.outcome2) ||assertedOutcomeId == keccak256(unresolvable),”Invalid asserted end result”);
market.assertedOutcomeId = assertedOutcomeId;// Get the collateral quantity required by the Uma oracleuint256 minimumBond = oo.getMinimumBond(handle(foreign money));uint256 bond = market.requiredBond > minimumBond ? market.requiredBond : minimumBond;// Generate the assertion that shall be despatched to Uma for verificationbytes reminiscence declare = _composeClaim(assertedOutcome, market.description);
// Switch the collateral from the transaction caller to the sensible contractcurrency.safeTransferFrom(msg.sender, handle(this), bond);foreign money.safeApprove(handle(oo), bond);// Submit the assertion to the Uma oracleassertionId = _assertTruthWithDefaults(declare, bond);
// Retailer the assertion identifier and the corresponding market identifierassertedMarkets[assertionId] = AssertedMarket({ asserter: msg.sender, marketId: marketId });
emit MarketAsserted(marketId, assertedOutcome, assertionId);}
At this level, an inexpensive query may come up: how does the PredictionMarket.sol sensible contract know when the oracle has settled the occasion and is able to inform us that our assertion is right? It is time to keep in mind the callbacks that the oracle can carry out. We simply must implement certainly one of these callbacks, known as assertionResolvedCallback(). When the assertion is verified by the oracle, it’ll set off this callback.
perform assertionResolvedCallback(bytes32 assertionId, bool assertedTruthfully) public {// Verify that the caller is the oraclerequire(msg.sender == handle(oo), “Not licensed”);Market storage market = markets[assertedMarkets[assertionId].marketId];
if (assertedTruthfully) {// If the result is confirmed, mark the market as resolvedmarket.resolved = true;// If a reward was designated for this market, ship it to the suitable partyif (market.reward > 0) foreign money.safeTransfer(assertedMarkets[assertionId].asserter, market.reward);emit MarketResolved(assertedMarkets[assertionId].marketId);} else {market.assertedOutcomeId = bytes32(0); // In any other case, do nothing and restart the assertion course of}// Take away the report that the market is being asserted by the oracledelete assertedMarkets[assertionId];
}
Your complete sequence of calls we described above will be summarized in a diagram for readability.
With this, the primary logic of how the PredictionMarket.sol sensible contract interacts with the Uma oracle involves an finish. We deliberately passed over the main points associated to the interior workings of the prediction market itself. Typically, for every end result available in the market, a fungible token is created. When customers select an end result, they’re basically shopping for these tokens underneath the hood and, furthermore, can commerce them (this performance is past the scope of this instance). The beginnings of this logic are additionally current in our instance contract. The capabilities accountable for this are: createOutcomeTokens(), redeemOutcomeTokens(), settleOutcomeTokens().
Beforehand, to take part in voting, it was sufficient to carry UMA tokens in your pockets. The protocol used a snapshot mechanism to report customers’ balances, which acted as an “entry ticket.” Within the new model, you need to stake UMA tokens on the protocol’s sensible contract to achieve entry to voting.
On the time of writing, customers are provided an APR of 30.1%. Nevertheless, this doesn’t imply you possibly can stake and passively earn rewards. Do not forget that the system has a slashing mechanism, which may redistribute stakers’ balances.
Based on the documentation, every voting interval lasts 48 hours:
The primary 24 hours are for encrypting your vote. That is the commit stage.The following 24 hours are for revealing your vote. That is the reveal stage.
Staking rewards accumulate constantly and will be claimed at any time.
Nevertheless, there’s a catch when you might want to unstake your tokens. You’ll must first make a request, anticipate a sure interval throughout which your tokens received’t earn rewards, and solely after that may you withdraw your staked tokens with a separate transaction.
Essential! On the time of writing, the penalty for lacking a vote is 0.05% of the staked stability.
Along with getting used for voting on real-world occasion assertions, the UMA protocol token can also be used for protocol governance.
The voting course of is split into two phases — commit and reveal — and lasts 48 hours, which we’ve already coated.
The protocol has its personal proposal normal, much like Ethereum’s EIP. These proposals are known as UMIPs (UMA Enchancment Proposals).
It’s value noting that the protocol makes use of a progressive method to voting. What does this imply? It signifies that voting doesn’t instantly happen on-chain however begins with a particular service known as snapshot.org. Ultimately, the voting course of appears like this:
Submit to Discourse. First, you might want to publish your proposal on “https://discourse.uma.xyz/”. The proposal outlines the important thing thought. At this stage, the neighborhood has the chance to debate the proposal.Snapshot Vote. As soon as the proposal is prepared, the creator creates a five-day vote on Snapshot.On-chain Vote. If the Snapshot vote passes, the vote is performed on-chain.
On the time of writing, the protocol on Snapshot has solely 71 individuals.
The Optimistic Oracle from UMA stands other than different oracles. Within the conventional mannequin, oracles attempt to reduce human involvement by decentralizing information aggregation, deciding on a pacesetter to ship the information, and utilizing total blockchains, extra consensus mechanisms, and a number of unbiased information sources. UMA does none of this; as an alternative, the protocol takes a very totally different method, relying totally on its neighborhood to find out the accuracy of the information.
This method opens up totally new use circumstances, significantly for prediction markets, insurance coverage, and plenty of different areas the place information supply pace will not be the highest precedence, and so they can afford to attend for the complete cycle of knowledge verification throughout the UMA protocol. Nevertheless, this enables the oracle to supply an nearly limitless vary of knowledge sorts, basically with semi-automated verification of their integrity and accuracy.
As regular, my private opinion is that this: it’s an attention-grabbing protocol that has thought rigorously about its incentive and restraint system for individuals. It clearly understands its area of interest the place it may be helpful and tailors its service accordingly. The protocol undoubtedly deserves consideration as a result of the answer is technically easy and stylish, but utterly totally different from the standard oracle mannequin. Nevertheless, its sensible success is dependent upon the exercise of the neighborhood, which must stake, vote, and resolve disputed assertions. However that’s a complete different story.
Try our web site and Telegram channel to know extra about web3 growth!
Official DocumentationOfficial RepositoryUMA Token Staking is Stay — Right here is How You ParticipateUMA Constructing with the Optimistic Oracle