Build secure lending protocols with powerful ML models and automation.
Prepare your ML model
Upload ML model
infernet-ml
libraries for detailed upload instructions.Setup a function to use our model to update LTV
requestOnnx
that assumes both the input and output of the model are encoded as
fixed point values with a scale of 18
. These defaults are common when working
with values on-chain, though the library allows you to set those values
explicitly to whatever your use case requires.Schedule automatic periodic updates
updateMarketLltv
function yourself, as the protocol, you want
to decentralize this operation by incentivizing keepers
. These keepers
call the function and receive a reward from the market’s pool for
performing this valuable service.A great feature of the Ritual chain is that it avoids this necessity and added expense by allowing you to enshrine
scheduled executions on-chain through scheduled transactions. Using our handy IScheduler
interface, we can first setup the Scheduler smart contract:scheduleMarketLltvUpdate
, you can initiate a request for having
repeated executions running your ONNX model and updating the provided market’s
liquidation threshold value.Note that the number and schedule of the repetitions is defined by the frequency
and numBlocks
that you pass as arguments
that are ultimately provided to the Scheduler contract.