Blockchain Protocol

Intro

PredIQt is powered by a set of smart contracts which allow users to perform actions on PredIQt markets in a completely permission-less, trust-less manner.. They are developed in a way that allow modularity and extensibility. We are going to explain the different APIs across the contracts.

prediqtpedia

This contract is the hearth of predIQt, it handles the order-book matching and connect creators with resolvers. It also takes care of the transfers and shares issuance.

prediqt::setfee(uint64_t fee_id, uint64_t fee_amount)

  • Set fees for the prediction markets. Only contract can run this action. There are 4 types of fees, 1 - market creation fee in IQ, 2 - creator fee %, 3 - resolver fee %, 4 - referral fee %. 2,3,4 have a precion of 10000.

  • fee_id -

  • fee_amount

prediqt::setresolver(name resolver, uint64_t market_id)

  • Set resolver for the prediction markets. Contract can run this action, or resolver after expiration.

  • resolver account that will be the new resolver

  • market_id market identifier

prediqt::propmarket(name creator, name resolver, string ipfs, uint32_t time_in, symbol symbol)

  • Creates a prediction market. Everybody can run this action.

  • creator account that will create the market

  • resolver account that will resolve the market

  • ipfs IPFS hash with content of the market

  • time_in when the market will allow resolver to act

  • symbol denominated symbol for the current market

prediqt::lmtorderyes(name user, uint64_t market_id, uint64_t shares, uint64_t limit, name referral, bool buy)

  • Open an order for YES. Everybody can run this action.

  • user account that will be opening the order

  • market_id market identifier

  • shares amount of shares willing to buy

  • limit limit price per share

  • referral referral account

  • buy buying or selling a share

prediqt::lmtorderno(name user, uint64_t market_id, uint64_t shares, uint64_t limit, name referral, bool buy)

  • Open an order for NO. Everybody can run this action.

  • user account that will be opening the order

  • market_id market identifier

  • shares amount of shares willing to buy

  • limit limit price per share

  • referral referral account

  • buy buying or selling a share

prediqt::cnclorderyes(name user, uint64_t market_id, uint64_t id)

  • Cancel a YES order. If market is resolved, everybody can run this action. If market is active, only order owner.

  • user account that will be closing an order

  • market_id market identifier

  • id order id

prediqt::cnclorderno(name user, uint64_t market_id, uint64_t id)

  • Cancel a NO order. If market is resolved, everybody can run this action. If market is active, only order owner.

  • user account that will be closing an order

  • market_id market identifier

  • id order id

prediqt::mktresolve(name resolver, uint64_t market_id, bool sharetype, string memo)

  • Resolve a market. Only resolver can run this action.

  • resolver account that will be resolving the market

  • market_id market identifier

  • sharetype YES or NO

  • memo message related to the resolution

prediqt::trnsfrshares(name from, name to, uint64_t shares, bool sharetype, uint64_t market_id)

  • Transfer shares between accounts. Only from account can perform this action.

  • from account that will be transfering his shares

  • to account destination

  • shares amount of shares to transfer

  • sharetype YES or NO

  • market_id market identifier

prediqt::withdraw(name user, uint64_t quantity)

  • Withdraw balance that its in user balance. Everybody can run this action.

  • user account that will be withdrawing his balance

  • quantity amount of tokens to withdraw

prediqt::mktinvalid(uint64_t market_id, string memo)

  • Mark a market as invalid. If market has not expired yet, only contract can execute, if it has expired, market resolver can execute it.

  • market_id market identifier

  • memo message related to invalidation

prediqt::delmarket(uint64_t market_id)

  • Delete a market if nobody has place an order. Market creator can execute this action.

  • market_id market identifier

  • memo message related to invalidation

prediqt::claimshares(name user, uint64_t market_id)

  • Burn shares and get EOS. Only owner of shares can perform this action.

  • user account that will receive earned shares

  • market_id market identifier

prediqt::payrefshares(name to, uint64_t quantity, uint64_t market_id)

  • Pay referral shares to users. Only contract can execute this action.

  • to account that will receive earned shares

  • quantity amount of shares to pay

  • market_id market identifier

prediqt::addasset(symbol symbol, name contract)

  • Add allowed assets to the contract. Only contract can execute this action.

  • symbol symbol that will be allowed

  • contract contract owner of the symbol

prediqt::removeasset(symbol symbol, name contract)

  • Remove allowed assets to the contract. Only contract can execute this action.

  • symbol symbol that will be allowed

  • contract contract owner of the symbol

prediqtbank

👍

This contract stores tokens on behalve of main contract. Its purpose its to stake tokens and send them back to the main contract at the time that its needed. That reduces the amount of stored tokens in the main contract for security reasons.

prediqtbank::sync()

  • Sync and unstake / transfer back tokens. Everybody can execute this action.

prediqtiqresolution

👍

This contract is one of the possible resolvers. It allows to vote using IQ for the outcome of a prediction market.

prediqtiqresolution::changeresolv(uint64_t market_id)

  • Change resolver to oracle. Everyone can execute this action once 3 days expiration time happens.

  • market_id market identifier

prediqtiqresolution::sendpayouts(uint64_t market_id)

  • Send payouts once market has been resolved by this resolver. Everyone can execute this action once market has been resolved.

  • market_id market identifier

Last updated