Quote Handler

QuoteHandler: Handles P2P DeFi quotes, validating addresses and whitelisting. Manages on-chain and off-chain quotes, signature verification, merkle proof, and interacts with AddressRegistry.

Summary:

QuoteHandler.sol is a contract that handles on-chain and off-chain quotes in the Peer-to-Peer DeFi framework. It interacts with the AddressRegistry contract to validate addresses and whitelist states.

Key Features:

  • Adds, updates, and deletes on-chain quotes.

  • Manages the nonce for off-chain quotes.

  • Validates and registers on-chain and off-chain quotes.

  • Verifies signatures and performs merkle proof verification.

Key Functions:

  • constructor(address _addressRegistry): Initializes the QuoteHandler contract with the address of the AddressRegistry contract.

  • addOnChainQuote(): Adds a new on-chain quote to a specific lender vault.

  • updateOnChainQuote(): Updates an existing on-chain quote for a specific lender vault.

  • deleteOnChainQuote(): Deletes an on-chain quote for a specific lender vault.

  • incrementOffChainQuoteNonce(): Increments the nonce for off-chain quotes of a specific lender vault.

  • invalidateOffChainQuote(): Invalidates an off-chain quote for a specific lender vault.

  • checkAndRegisterOnChainQuote(): Checks and registers an on-chain quote for a borrower and lender vault.

  • checkAndRegisterOffChainQuote(): Checks and registers an off-chain quote for a borrower and lender vault.

  • areValidSignatures(): Verifies the signatures of an off-chain quote.

  • hashOffChainQuote(): Calculates the hash of an off-chain quote.

  • checkSenderAndGeneralQuoteInfo(): Checks the sender and general quote information for validity.

  • isValidOnChainQuote(): Checks the validity of an on-chain quote.

  • hashOnChainQuote(): Calculates the hash of an on-chain quote.

Libraries:

  • MerkleProof: The contract imports the MerkleProof library from the OpenZeppelin library to perform merkle proof verification.

  • ECDSA: The contract imports the ECDSA library from the OpenZeppelin library for ECDSA signature verification.

Interfaces:

  • IAddressRegistry: The contract imports the IAddressRegistry interface to interact with the AddressRegistry contract.

  • ILenderVaultImpl: The contract imports the ILenderVaultImpl interface to access the owner and signer information of a lender vault.

Dependencies:

  • Constants: The contract imports the Constants contract to access predefined constants used in quote validation.

  • DataTypesPeerToPeer: The contract imports the DataTypesPeerToPeer contract to access the data structures used for quotes.

  • Errors: The contract imports the Errors library, which provides custom error messages for different exceptional scenarios.

Last updated