Advanced Deployment
Customize your Oval deployment.
Last updated
Customize your Oval deployment.
Last updated
The Quickstart Deployment guide shows you how to use the simplest possible Oval deployment with a source adapter, a destination adapter and an immutable controller. Deployments can be extended by using custom components within the Oval setup.
Integration controllers control how an Oval instance is updated. They influence the behaviour of Oval in exactly 3 ways:
Who can initiate an OEV auction, (as discussed here), known as unlockers
How long the permissioned actor(s) have to initiate an auction from an update, known as lockWindow
. This also governs the maximum delay a source update is blocked before being released to a downstream protocol in the event of the permissioned actor(s) going offline or MEV-Share breaking (see )
How many max iterations to traverse when looking for historic values, called maxTraversal
. This value is less important to control and exists to accommodate long lockWindows
coupled with high speed updates on source oracles. It is safe to leave it at a value of 4.
The simplest way to customize these settings is to use the BaseController
within your Oval deployment which gives you control over all 3 configurations listed above. This controller has an Owner
which has exclusive permissions to modify these settings. An example usage of this controller could be to set the BaseController
to be owned by your DAO or multisig, thereby giving you control over these settings within the Oval deployment.
This example will guide you in deploying and customizing the ChainlinkOvalBase
contract, a version of Oval that uses the BaseController
. The deployment flow here is very similar to that of the Quickstart Deployment tutorial except we can now configure the unlockers
, lockWindow
, and maxTraversal
after deployment.
This getting started makes some assumptions:
Foundry is installed on your machine. If not, it can be found here.
You are using Chainlink and know the address of the source Chainlink oracle you want to connect to. A full list of Chainlink oracles can be found here.
You have an RPC URL to connect to. If not, you can get one from Infura.
Next, we need to define some envs to setup the deployment environment. In particular we need a private key and an RPC URL:
Then open .env
file with your favorite editor and change its contents accordingly. For this advanced configuration we only need a PRIVATE_KEY
and RPC_MAINNET
Next, we can directly deploy the ChainlinkOvalBase.sol
contract and leave the configuration until the next step. To deploy the contract, run the forge create
command. The example below deploys an Oval contract that wraps the Chainlink ETH/USD oracle. Be sure to set the number of decimals (8 in the example below) corresponding to the decimals()
value from the Chainlink oracle.
Once this deployment is done, you can call functions on your Oval contract to customize the deployment:
setUnlocker
to add a new unlocker to the unlockers
set (actors who can unlock prices). To add an unlocker, set the second argument to true. To remove an unlocker, set the second argument to false.
setLockWindow
to change the lockWindow
(how long a price will be locked before being automatically unlocked). This effectively controls the auction period.
setMaxTraversal
to change the maximum traversals a historic lookback can loop through.
Lastly, given that ChainlinkOvalBase inherits from OpenZepplin Ownable, you can call transferOwnership
once the configuration is done to transfer the ownership to your DAO/multisig or other address.
The Oval contract architecture has been designed such that custom controllers are possible, as long as they conform to the interface defined within the Integration Controllers specification. For example you might want to have a set of addresses that can disable your Oval contract, making it act as a passthrough by setting lockWindow=0
. Or you may want to have a different set of addresses to manage the unlockers
list. Reach out to us on Discord if you'd like support in creating custom controllers.