Skip to main content

LATValidator

LATValidator

LAT_TYPEHASH

bytes32 LAT_TYPEHASH

_nonces

mapping(uint256 => uint256) _nonces

validateCreditor

modifier validateCreditor(address creditor, struct DataTypes.LoanAssetInfo info)

requireValidator

modifier requireValidator(struct DataTypes.LoanAssetInfo info)

requireNonceValid

modifier requireNonceValid(struct DataTypes.LoanAssetInfo info)

_checkNonceValid

function _checkNonceValid(struct DataTypes.LoanAssetInfo info) internal

This function checks if nonces are valid for each tokenId in info.tokenIds array. It requires that the nonce at index i matches _nonces[info.tokenIds[i]]. If it does, then increment _nonces[info.tokenIds[i]] by one and emit a NonceChanged event.

Parameters

NameTypeDescription
infostruct DataTypes.LoanAssetInfoLoanAssetInfo containing tokenIds and corresponding nonces.

__LATValidator_init

function __LATValidator_init() internal

Initializes the contract, setting the name and version for EIP712 signature generation.

__LATValidator_init_unchained

function __LATValidator_init_unchained() internal

isValidator

function isValidator(address pool, address sender) public view virtual returns (bool)

nonce

function nonce(uint256 tokenId) external view returns (uint256)

_Returns the nonce for a given token ID.

Requirements:

  • The index must exist._

Parameters

NameTypeDescription
tokenIduint256The ID of the token to get the nonce of.

Return Values

NameTypeDescription
[0]uint256The nonce of the token.

_checkValidator

function _checkValidator(struct DataTypes.LoanAssetInfo latInfo) internal view returns (bool)

Checks if the provided loan asset information is valid.

The function takes in LoanAssetInfo struct which contains tokenIds, nonces and validator address. It calculates a hash of this data using keccak256 and abi encode. Then it checks if the signature is valid by calling isValidSignatureNow on the validator's address with the calculated digest and provided signature.

Parameters

NameTypeDescription
latInfostruct DataTypes.LoanAssetInfoThe loan asset information to be checked.

Return Values

NameTypeDescription
[0]boolbool Returns true if the signature is valid, false otherwise.

domainSeparatorV4

function domainSeparatorV4() external view returns (bytes32)

Returns the domain separator used in the encoding of the signature for {permit}.