3. Core contract

The DeCredit Oracle protocol is mainly composed of three parts: the on-chain smart contract, the on-chain oracle smart contract, and the off-chain external data source API. We call the on-chain workflow the data feedback flow. The DeCredit core oracle smart contract library contains three important smart contracts: ChainToOracle( ), RwaToOracle( ), BackToRwa( ) as follows: ChainToOracle contract

The on-chain smart contract initiates a data request to the DeCredit Oracle smart contract, and this request contains the encoded information FromChainRequestTo required for the successful run of the loop.

RwaToOracle contract The external data source sends data to the DeCredit Oracle smart contract through the completed function construct. This request contains the encoded information FromRwaRequestTo required for the loop to succeed.

BackToRwa contract The DeCredit Oracle smart contract feeds data back to the on-chain smart contract.

ChainToOracle( ), RwaToOracle( ), BackToRwa( ) are integrated in the Decredit client. The DeCredit Oracle API will also be provided for integrating oracle functions into your own client contracts.

The operation of the contracts

Oracle contracts are owned by DeCredit oracle node operators, which run alongside off-chain oracle nodes.

The oracle contract has a request function that is used by the node to complete the request once the node gets the operation result. This function returns the result to the Decredit client or API using the return function defined in the original request.

The parameter format for launching the client contract is:

· Oracle address

· Operation ID, so oracle knows which tasks to operate

· Return function to which oracle will send the response

· Whether it is cross-chain, if crosschain it’s 1, it is cross-chain, otherwise it is not cross-chain. The crosschain parameter defaults to be 0, that is, not cross-chain.

· Whether it supports rating

最后更新于