Fee Quoting, Collection, and Withdrawal
DVN owners should implement and deploy a DVN contract on every chain they want to support. The contract must implement theILayerZeroDVN interface, which specifies two core functions:
assignJob- Called by the Message Library when a packet is sent, paying the DVN for verificationgetFee- Returns the fee for verifying a message to a specific destination
assignJob function.
Building a DVN
The DVN has one off-chain workflow:-
The DVN first listens for the
PacketSentevent:The packet has the following structure:The encoded packet can be deserialized with thePacketSerializerand the option can be deserialized with theOptionSerializer. -
After the
PacketSentevent, theDVNFeePaidevent is how you know your DVN has been assigned to verify the packet’spayloadHash. -
After receiving the fee, your DVN should query the address of the MessageLib on the destination chain:
-
After your DVN has retrieved the receive MessageLib, you should read the MessageLib configuration from it. In the configuration is the required block
confirmationsto wait before callingverifyon the destination chain.This will return theUlnConfig, which you can use to read the number ofconfirmations: -
Your DVN should next do an idempotency check:
This returns a boolean value:
-
If the state is
true, then your idempotency check indicates that you already verified this packet. You can terminate your DVN workflow. -
If the state is
false, then you must callULN.verify:
-
If the state is