L2 Services
Registering and Using Oracle Network Services on L2 Chains
Registry Contract
This contract allows you to manage new chain and Orakl Network services.
L2 Chain Management
Please contact Orakl Network after you propose a new chain. We will support you to set things up.
Propose New Chain and Pay
proposeFee
function proposeNewChain(
uint256 _chainID,
string memory _jsonRpc,
address _endpoint
) external payable {
if (msg.value < proposeFee) {
revert NotEnoughFee();
}
if (chainRegistry[_chainID].owner != address(0)) {
revert ChainExisted();
}
pendingProposal[_chainID].jsonRpc = _jsonRpc;
pendingProposal[_chainID].endpoint = _endpoint;
pendingProposal[_chainID].owner = msg.sender;
emit ChainProposed(msg.sender, _chainID);
}Edit Chain Info
Account and Payment Functions
Before you can make a request from L2 chain, you need to create and deposit to your account.
Create Account
Deposit Funds Into the Account
Add Consumer Into Account
Remove Consumer From Account
The consumer address to add or remove to this account is on L2 chain, not mainnet.
Endpoint Contracts
L2Endpoint
L2EndpointYou need to deploy this contract on your chain; it acts as a coordinator for VRF and Request-Response.
Request Random Words From L2
Request Data From L2
How to Integrate VRF and Request-Response on L2
VRF
Refer to L2 VRF mock consumer contract.
Inherit from the
VRFConsumerBaseContract
Specify
l2Endpointin the Constructor
Implement the
requestRandomWordsFunction
Implement the
fulfillRandomWordsFunction
Request-Response
Inherit from the Base Contract for Request Data Types
Specify
l2Endpointin the Constructor
Implement
requestData*Function
Implement the
fulfillDataRequestFunction
Last updated