System Contract
Last updated
Last updated
The testnet EVM provides a system contract that allows querying native L1 information. The contract is available at 0x1111111111111111111111111111111111111111 and has methods for querying the L1 block number as well as oracle prices.
The L1 block production logic directly updates the system smart contract's values. Therefore, the values are guaranteed to match the L1 state at the time the EVM block is constructed.
Attached are the solidity and ABI files for the system contract as well as a python script that calls the contract and prints the results.
To convert to floating point numbers, divide the returned price by 10^(6 - asset szDecimals) for the perp ones and 10^(8 - base asset szDecimals) for the spot ones. The prices are returned in the same order as the meta.
Happy building and let us know if you have any questions or feedback.