Skip to main content

Predictions contract

Methods​

approve​

function approve(address to, uint256 tokenId) external nonpayable

See {IERC721-approve}.

Parameters​

NameTypeDescription
toaddressundefined
tokenIduint256undefined

approveOracle​

function approveOracle(address oracle, bool isTrusted) external nonpayable

Parameters​

NameTypeDescription
oracleaddressundefined
isTrustedboolundefined

balanceOf​

function balanceOf(address owner) external view returns (uint256)

See {IERC721-balanceOf}.

Parameters​

NameTypeDescription
owneraddressundefined

Returns​

NameTypeDescription
_0uint256undefined

burnPredictionToIncreaseOpenPredictionsCount​

function burnPredictionToIncreaseOpenPredictionsCount(uint256 predictionID) external nonpayable

Parameters​

NameTypeDescription
predictionIDuint256undefined

cancelPrediction​

function cancelPrediction(uint256 predictionID) external nonpayable

Parameters​

NameTypeDescription
predictionIDuint256undefined

cancelPredictions​

function cancelPredictions(uint256[] predictionIDs) external nonpayable

Parameters​

NameTypeDescription
predictionIDsuint256[]undefined

changeCompetitionsAddress​

function changeCompetitionsAddress(address newCompetitionsAddress) external nonpayable

Parameters​

NameTypeDescription
newCompetitionsAddressaddressundefined

changeDurationToClosePredictions​

function changeDurationToClosePredictions(uint256 newDurationToClosePredictions) external nonpayable

Parameters​

NameTypeDescription
newDurationToClosePredictionsuint256undefined

changeMaxLeverage​

function changeMaxLeverage(uint256 newMaxLeverage) external nonpayable

Parameters​

NameTypeDescription
newMaxLeverageuint256undefined

changeMaxOpenPredictionsCount​

function changeMaxOpenPredictionsCount(uint256 newMaxOpenPredictionsCount) external nonpayable

Parameters​

NameTypeDescription
newMaxOpenPredictionsCountuint256undefined

changePrediction​

function changePrediction(uint256 predictionID, uint256 stopLossPrice, uint256 takeProfitPrice) external nonpayable

Parameters​

NameTypeDescription
predictionIDuint256undefined
stopLossPriceuint256undefined
takeProfitPriceuint256undefined

changePredictions​

function changePredictions(uint256[] predictionIDs, uint256[] stopLossPrice, uint256[] takeProfitPrice) external nonpayable

Parameters​

NameTypeDescription
predictionIDsuint256[]undefined
stopLossPriceuint256[]undefined
takeProfitPriceuint256[]undefined

changePredictionsLifetime​

function changePredictionsLifetime(uint256 newPredictionsLifetime) external nonpayable

Parameters​

NameTypeDescription
newPredictionsLifetimeuint256undefined

changePricesAddress​

function changePricesAddress(address newPricesAddress) external nonpayable

Parameters​

NameTypeDescription
newPricesAddressaddressundefined

closePrediction​

function closePrediction(uint256 predictionID, uint256 expectedPrice, bytes32 salt, bool isDirectionUp) external nonpayable

Parameters​

NameTypeDescription
predictionIDuint256undefined
expectedPriceuint256undefined
saltbytes32undefined
isDirectionUpboolundefined

closePredictionByPriceIndex​

function closePredictionByPriceIndex(uint256 predictionID, bytes32 salt, bool isDirectionUp, uint256 priceIndex) external nonpayable

Parameters​

NameTypeDescription
predictionIDuint256undefined
saltbytes32undefined
isDirectionUpboolundefined
priceIndexuint256undefined

closePredictions​

function closePredictions(uint256[] predictionIDs, uint256[] expectedPrices, bytes32[] salt, bool[] isDirectionUp) external nonpayable

Parameters​

NameTypeDescription
predictionIDsuint256[]undefined
expectedPricesuint256[]undefined
saltbytes32[]undefined
isDirectionUpbool[]undefined

closePredictionsByPriceIndex​

function closePredictionsByPriceIndex(uint256[] predictionIDs, bytes32[] salt, bool[] isDirectionUp, uint256[] priceIndexes) external nonpayable

Parameters​

NameTypeDescription
predictionIDsuint256[]undefined
saltbytes32[]undefined
isDirectionUpbool[]undefined
priceIndexesuint256[]undefined

closeTimeEndedPrediction​

function closeTimeEndedPrediction(uint256 predictionID, bytes32 salt, bool isDirectionUp) external nonpayable

Parameters​

NameTypeDescription
predictionIDuint256undefined
saltbytes32undefined
isDirectionUpboolundefined

closeTimeEndedPredictions​

function closeTimeEndedPredictions(uint256[] predictionIDs, bytes32[] salt, bool[] isDirectionUp) external nonpayable

Parameters​

NameTypeDescription
predictionIDsuint256[]undefined
saltbytes32[]undefined
isDirectionUpbool[]undefined

competitionsAddress​

function competitionsAddress() external view returns (address)

Returns​

NameTypeDescription
_0addressundefined

disapproveDefaultOracle​

function disapproveDefaultOracle(bool isUntrusted) external nonpayable

Parameters​

NameTypeDescription
isUntrustedboolundefined

durationToClosePredictions​

function durationToClosePredictions() external view returns (uint256)

Returns​

NameTypeDescription
_0uint256undefined

getApproved​

function getApproved(uint256 tokenId) external view returns (address)

See {IERC721-getApproved}.

Parameters​

NameTypeDescription
tokenIduint256undefined

Returns​

NameTypeDescription
_0addressundefined

getInfoHash​

function getInfoHash(bytes32 salt, bool isDirectionUp) external pure returns (bytes32 infoHash)

Parameters​

NameTypeDescription
saltbytes32undefined
isDirectionUpboolundefined

Returns​

NameTypeDescription
infoHashbytes32undefined

getPredictionPerformance​

function getPredictionPerformance(uint256 predictionID) external view returns (int256)

Parameters​

NameTypeDescription
predictionIDuint256undefined

Returns​

NameTypeDescription
_0int256undefined

getPredictions​

function getPredictions(uint256[] ids) external view returns (struct Predictions.Prediction[] predictionsArray)

Parameters​

NameTypeDescription
idsuint256[]undefined

Returns​

NameTypeDescription
predictionsArrayPredictions.Prediction[]undefined

getRealStopLossTakeProfit​

function getRealStopLossTakeProfit(uint256 predictionID, bool isDirectionUp) external view returns (uint256 stopLossPrice, uint256 takeProfitPrice)

Parameters​

NameTypeDescription
predictionIDuint256undefined
isDirectionUpboolundefined

Returns​

NameTypeDescription
stopLossPriceuint256undefined
takeProfitPriceuint256undefined

getTrustedForwarder​

function getTrustedForwarder() external view returns (address)

⚠️ Warning ⚠️ The Forwarder can have a full control over your Recipient. Only trust verified Forwarder.Method is not a required method to allow Recipients to trust multiple Forwarders. Not recommended yet.

Returns​

NameTypeDescription
_0addressThe address of the Forwarder contract that is being used.

isApprovedForAll​

function isApprovedForAll(address owner, address operator) external view returns (bool)

See {IERC721-isApprovedForAll}.

Parameters​

NameTypeDescription
owneraddressundefined
operatoraddressundefined

Returns​

NameTypeDescription
_0boolundefined

isDefaultOracleUntrusted​

function isDefaultOracleUntrusted(address) external view returns (bool)

Parameters​

NameTypeDescription
_0addressundefined

Returns​

NameTypeDescription
_0boolundefined

isOracleTrusted​

function isOracleTrusted(address, address) external view returns (bool)

Parameters​

NameTypeDescription
_0addressundefined
_1addressundefined

Returns​

NameTypeDescription
_0boolundefined

isOracleTrustedByIssuerOrOwner​

function isOracleTrustedByIssuerOrOwner(address issuer, address oracle) external view returns (bool)

Parameters​

NameTypeDescription
issueraddressundefined
oracleaddressundefined

Returns​

NameTypeDescription
_0boolundefined

isTrustedForwarder​

function isTrustedForwarder(address forwarder) external view returns (bool)

⚠️ Warning ⚠️ The Forwarder can have a full control over your Recipient. Only trust verified Forwarder.

Parameters​

NameTypeDescription
forwarderaddressThe address of the Forwarder contract that is being used.

Returns​

NameTypeDescription
_0boolisTrustedForwarder true if the Forwarder is trusted to forward relayed transactions by this Recipient.

maxLeverage​

function maxLeverage() external view returns (uint256)

Returns​

NameTypeDescription
_0uint256undefined

maxOpenPredictionsCount​

function maxOpenPredictionsCount() external view returns (uint256)

Returns​

NameTypeDescription
_0uint256undefined

name​

function name() external view returns (string)

See {IERC721Metadata-name}.

Returns​

NameTypeDescription
_0stringundefined

newPrediction​

function newPrediction(address issuer, bytes32 symbol, bytes32 entropy, bytes32 infoHash, uint256 stopLossPrice, uint256 takeProfitPrice, uint256 expectedTopPrice, uint256 expectedBottomPrice, uint256 expectedTime, uint256 openPrice, uint256 leverage, bool openWhenPriceMoreThen) external nonpayable

Parameters​

NameTypeDescription
issueraddressundefined
symbolbytes32undefined
entropybytes32undefined
infoHashbytes32undefined
stopLossPriceuint256undefined
takeProfitPriceuint256undefined
expectedTopPriceuint256undefined
expectedBottomPriceuint256undefined
expectedTimeuint256undefined
openPriceuint256undefined
leverageuint256undefined
openWhenPriceMoreThenboolundefined

newPredictions​

function newPredictions(Predictions.NewPredictionParams[] params) external nonpayable

Parameters​

NameTypeDescription
paramsPredictions.NewPredictionParams[]undefined

openPrediction​

function openPrediction(uint256 predictionID, uint256 priceIndex) external nonpayable

Parameters​

NameTypeDescription
predictionIDuint256undefined
priceIndexuint256undefined

openPredictions​

function openPredictions(uint256[] predictionIDs, uint256[] priceIndexes) external nonpayable

Parameters​

NameTypeDescription
predictionIDsuint256[]undefined
priceIndexesuint256[]undefined

openPredictionsCount​

function openPredictionsCount(address) external view returns (uint256)

Parameters​

NameTypeDescription
_0addressundefined

Returns​

NameTypeDescription
_0uint256undefined

owner​

function owner() external view returns (address)

Returns the address of the current owner.

Returns​

NameTypeDescription
_0addressundefined

ownerOf​

function ownerOf(uint256 tokenId) external view returns (address)

See {IERC721-ownerOf}.

Parameters​

NameTypeDescription
tokenIduint256undefined

Returns​

NameTypeDescription
_0addressundefined

pause​

function pause() external nonpayable

paused​

function paused() external view returns (bool)

Returns true if the contract is paused, and false otherwise.

Returns​

NameTypeDescription
_0boolundefined

predictionByInfoHash​

function predictionByInfoHash(bytes32) external view returns (uint256)

Parameters​

NameTypeDescription
_0bytes32undefined

Returns​

NameTypeDescription
_0uint256undefined

predictions​

function predictions(uint256) external view returns (address issuer, bytes32 symbol, bytes32 entropy, bytes32 salt, bool isDirectionUp, bytes32 infoHash, struct Predictions.ChangeableInfo changeableInfo, struct Predictions.LifecycleInfo lifecycleInfo, uint256 leverage)

Parameters​

NameTypeDescription
_0uint256undefined

Returns​

NameTypeDescription
issueraddressundefined
symbolbytes32undefined
entropybytes32undefined
saltbytes32undefined
isDirectionUpboolundefined
infoHashbytes32undefined
changeableInfoPredictions.ChangeableInfoundefined
lifecycleInfoPredictions.LifecycleInfoundefined
leverageuint256undefined

predictionsLifetime​

function predictionsLifetime() external view returns (uint256)

Returns​

NameTypeDescription
_0uint256undefined

pricesAddress​

function pricesAddress() external view returns (address)

Returns​

NameTypeDescription
_0addressundefined

renounceOwnership​

function renounceOwnership() external nonpayable

Leaves the contract without owner. It will not be possible to call onlyOwner functions. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby disabling any functionality that is only available to the owner.

safeTransferFrom​

function safeTransferFrom(address from, address to, uint256 tokenId) external nonpayable

See {IERC721-safeTransferFrom}.

Parameters​

NameTypeDescription
fromaddressundefined
toaddressundefined
tokenIduint256undefined

safeTransferFrom​

function safeTransferFrom(address from, address to, uint256 tokenId, bytes data) external nonpayable

See {IERC721-safeTransferFrom}.

Parameters​

NameTypeDescription
fromaddressundefined
toaddressundefined
tokenIduint256undefined
databytesundefined

setApprovalForAll​

function setApprovalForAll(address operator, bool approved) external nonpayable

See {IERC721-setApprovalForAll}.

Parameters​

NameTypeDescription
operatoraddressundefined
approvedboolundefined

setBaseURI​

function setBaseURI(string newBaseURI) external nonpayable

Parameters​

NameTypeDescription
newBaseURIstringundefined

setIssuerBaseURI​

function setIssuerBaseURI(string newBaseURI) external nonpayable

Parameters​

NameTypeDescription
newBaseURIstringundefined

setTrustedForwarder​

function setTrustedForwarder(address forwarder) external nonpayable

Parameters​

NameTypeDescription
forwarderaddressundefined

supportsInterface​

function supportsInterface(bytes4 interfaceId) external view returns (bool)

See {IERC165-supportsInterface}.

Parameters​

NameTypeDescription
interfaceIdbytes4undefined

Returns​

NameTypeDescription
_0boolundefined

symbol​

function symbol() external view returns (string)

See {IERC721Metadata-symbol}.

Returns​

NameTypeDescription
_0stringundefined

tokenByIndex​

function tokenByIndex(uint256 index) external pure returns (uint256)

Parameters​

NameTypeDescription
indexuint256undefined

Returns​

NameTypeDescription
_0uint256undefined

tokenOfOwnerByIndex​

function tokenOfOwnerByIndex(address) external view returns (uint256)

Parameters​

NameTypeDescription
_0addressundefined

Returns​

NameTypeDescription
_0uint256undefined

tokenURI​

function tokenURI(uint256 tokenId) external view returns (string)

See {IERC721Metadata-tokenURI}.

Parameters​

NameTypeDescription
tokenIduint256undefined

Returns​

NameTypeDescription
_0stringundefined

tokenURIs​

function tokenURIs(address) external view returns (string)

Parameters​

NameTypeDescription
_0addressundefined

Returns​

NameTypeDescription
_0stringundefined

totalSupply​

function totalSupply() external view returns (uint256)

Returns​

NameTypeDescription
_0uint256undefined

transferFrom​

function transferFrom(address from, address to, uint256 tokenId) external nonpayable

See {IERC721-transferFrom}.

Parameters​

NameTypeDescription
fromaddressundefined
toaddressundefined
tokenIduint256undefined

transferOwnership​

function transferOwnership(address newOwner) external nonpayable

Transfers ownership of the contract to a new account (newOwner). Can only be called by the current owner.

Parameters​

NameTypeDescription
newOwneraddressundefined

unpause​

function unpause() external nonpayable

Events​

Approval​

event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId)

Emitted when owner enables approved to manage the tokenId token.

Parameters​

NameTypeDescription
owner indexedaddressundefined
approved indexedaddressundefined
tokenId indexeduint256undefined

ApprovalForAll​

event ApprovalForAll(address indexed owner, address indexed operator, bool approved)

Emitted when owner enables or disables (approved) operator to manage all of its assets.

Parameters​

NameTypeDescription
owner indexedaddressundefined
operator indexedaddressundefined
approvedboolundefined

CompetitionsAddressChanged​

event CompetitionsAddressChanged(address indexed newCompetitionsAddress)

Parameters​

NameTypeDescription
newCompetitionsAddress indexedaddressundefined

DefaultOracleUntrusted​

event DefaultOracleUntrusted(address indexed issuer, bool indexed isUntrusted)

Parameters​

NameTypeDescription
issuer indexedaddressundefined
isUntrusted indexedboolundefined

DurationToClosePredictionsChanged​

event DurationToClosePredictionsChanged(uint256 indexed newDurationToClosePredictions)

Parameters​

NameTypeDescription
newDurationToClosePredictions indexeduint256undefined

MaxLeverageChanged​

event MaxLeverageChanged(uint256 indexed newMaxLeverage)

Parameters​

NameTypeDescription
newMaxLeverage indexeduint256undefined

MaxOpenPredictionsCountChanged​

event MaxOpenPredictionsCountChanged(uint256 indexed newMaxOpenPredictionsCount)

Parameters​

NameTypeDescription
newMaxOpenPredictionsCount indexeduint256undefined

NewBaseURI​

event NewBaseURI(string newBaseURI)

Parameters​

NameTypeDescription
newBaseURIstringundefined

NewIssuerBaseURI​

event NewIssuerBaseURI(string newBaseURI, address indexed issuer)

Parameters​

NameTypeDescription
newBaseURIstringundefined
issuer indexedaddressundefined

OracleTrusted​

event OracleTrusted(address indexed issuer, address indexed oracle, bool indexed isTrusted)

Parameters​

NameTypeDescription
issuer indexedaddressundefined
oracle indexedaddressundefined
isTrusted indexedboolundefined

OwnershipTransferred​

event OwnershipTransferred(address indexed previousOwner, address indexed newOwner)

Parameters​

NameTypeDescription
previousOwner indexedaddressundefined
newOwner indexedaddressundefined

Paused​

event Paused(address account)

Emitted when the pause is triggered by account.

Parameters​

NameTypeDescription
accountaddressundefined

PredictionCanceled​

event PredictionCanceled(uint256 indexed predictionID, address indexed issuer, address indexed oracle)

Parameters​

NameTypeDescription
predictionID indexeduint256undefined
issuer indexedaddressundefined
oracle indexedaddressundefined

PredictionChanged​

event PredictionChanged(uint256 indexed predictionID, address indexed issuer, address indexed oracle)

Parameters​

NameTypeDescription
predictionID indexeduint256undefined
issuer indexedaddressundefined
oracle indexedaddressundefined

PredictionClosed​

event PredictionClosed(uint256 indexed predictionID, address indexed issuer, address indexed oracle, int256 predictionPerformance)

Parameters​

NameTypeDescription
predictionID indexeduint256undefined
issuer indexedaddressundefined
oracle indexedaddressundefined
predictionPerformanceint256undefined

PredictionCreated​

event PredictionCreated(uint256 predictionID, address indexed issuer, address indexed oracle, bytes32 indexed infoHash)

Parameters​

NameTypeDescription
predictionIDuint256undefined
issuer indexedaddressundefined
oracle indexedaddressundefined
infoHash indexedbytes32undefined

PredictionExpired​

event PredictionExpired(uint256 indexed predictionID, address indexed issuer, address indexed oracle)

Parameters​

NameTypeDescription
predictionID indexeduint256undefined
issuer indexedaddressundefined
oracle indexedaddressundefined

PredictionOpened​

event PredictionOpened(uint256 indexed predictionID, address indexed issuer, address indexed oracle)

Parameters​

NameTypeDescription
predictionID indexeduint256undefined
issuer indexedaddressundefined
oracle indexedaddressundefined

PredictionsLifetimeChanged​

event PredictionsLifetimeChanged(uint256 indexed newPredictionsLifetime)

Parameters​

NameTypeDescription
newPredictionsLifetime indexeduint256undefined

PricesAddressChanged​

event PricesAddressChanged(address indexed newPricesAddress)

Parameters​

NameTypeDescription
newPricesAddress indexedaddressundefined

Transfer​

event Transfer(address indexed from, address indexed to, uint256 indexed tokenId)

Emitted when tokenId token is transferred from from to to.

Parameters​

NameTypeDescription
from indexedaddressundefined
to indexedaddressundefined
tokenId indexeduint256undefined

Unpaused​

event Unpaused(address account)

Emitted when the pause is lifted by account.

Parameters​

NameTypeDescription
accountaddressundefined

Errors​

ERC721IncorrectOwner​

error ERC721IncorrectOwner(address sender, uint256 tokenId, address owner)

Indicates an error related to the ownership over a particular token. Used in transfers.

Parameters​

NameTypeDescription
senderaddressAddress whose tokens are being transferred.
tokenIduint256Identifier number of a token.
owneraddressAddress of the current owner of a token.

ERC721InsufficientApproval​

error ERC721InsufficientApproval(address operator, uint256 tokenId)

Indicates a failure with the operator’s approval. Used in transfers.

Parameters​

NameTypeDescription
operatoraddressAddress that may be allowed to operate on tokens without being their owner.
tokenIduint256Identifier number of a token.

ERC721InvalidApprover​

error ERC721InvalidApprover(address approver)

Indicates a failure with the approver of a token to be approved. Used in approvals.

Parameters​

NameTypeDescription
approveraddressAddress initiating an approval operation.

ERC721InvalidOperator​

error ERC721InvalidOperator(address operator)

Indicates a failure with the operator to be approved. Used in approvals.

Parameters​

NameTypeDescription
operatoraddressAddress that may be allowed to operate on tokens without being their owner.

ERC721InvalidOwner​

error ERC721InvalidOwner(address owner)

Indicates that an address can't be an owner. For example, address(0) is a forbidden owner in EIP-20. Used in balance queries.

Parameters​

NameTypeDescription
owneraddressAddress of the current owner of a token.

ERC721InvalidReceiver​

error ERC721InvalidReceiver(address receiver)

Indicates a failure with the token receiver. Used in transfers.

Parameters​

NameTypeDescription
receiveraddressAddress to which tokens are being transferred.

ERC721InvalidSender​

error ERC721InvalidSender(address sender)

Indicates a failure with the token sender. Used in transfers.

Parameters​

NameTypeDescription
senderaddressAddress whose tokens are being transferred.

ERC721NonexistentToken​

error ERC721NonexistentToken(uint256 tokenId)

Indicates a tokenId whose owner is the zero address.

Parameters​

NameTypeDescription
tokenIduint256Identifier number of a token.

EnforcedPause​

error EnforcedPause()

The operation failed because the contract is paused.

ExpectedPause​

error ExpectedPause()

The operation failed because the contract is not paused.

OwnableInvalidOwner​

error OwnableInvalidOwner(address owner)

The owner is not a valid owner account. (eg. address(0))

Parameters​

NameTypeDescription
owneraddressundefined

OwnableUnauthorizedAccount​

error OwnableUnauthorizedAccount(address account)

The caller account is not authorized to perform an operation.

Parameters​

NameTypeDescription
accountaddressundefined