Protocol Structs

This page includes details of the structs used within Wildcat V2.

Note: you can generate this yourself via the calculate_structs.py Python script in the /scripts directory of the repository.

File: src/HooksFactory.sol

Struct: TmpMarketParameterStorage

address borrower

address asset

address feeRecipient

uint16 protocolFeeBips

uint128 maxTotalSupply

uint16 annualInterestBips

uint16 delinquencyFeeBips

uint32 withdrawalBatchDuration

uint16 reserveRatioBips

uint32 delinquencyGracePeriod

bytes32 packedNameWord0

bytes32 packedNameWord1

bytes32 packedSymbolWord0

bytes32 packedSymbolWord1

uint8 decimals

HooksConfig hooks // NOTE: type HooksConfig is uint256;

File: src/IHooksFactory.sol

Struct: HooksTemplate

/// @dev Asset used to pay origination fee

address originationFeeAsset

/// @dev Amount of `originationFeeAsset` paid to deploy a new market using

/// an instance of this template.

uint80 originationFeeAmount

/// @dev Basis points paid on interest for markets deployed using hooks

/// based on this template

uint16 protocolFeeBips

/// @dev Whether the template exists

bool exists

/// @dev Whether the template is enabled

bool enabled

/// @dev Index of the template address in the array of hooks templates

uint24 index

/// @dev Address to pay origination and interest fees

address feeRecipient

/// @dev Name of the template

string name

File: src/types/LenderStatus.sol

Struct: LenderStatus

bool isBlockedFromDeposits

address lastProvider

bool canRefresh

uint32 lastApprovalTimestamp

File: src/access/AccessControlHooks.sol

Struct: HookedMarket

bool isHooked

bool transferRequiresAccess

bool depositRequiresAccess

uint128 minimumDeposit

File: src/access/FixedTermLoanHooks.sol

Struct: HookedMarket

bool isHooked

bool transferRequiresAccess

bool depositRequiresAccess

bool withdrawalRequiresAccess

uint128 minimumDeposit

uint32 fixedTermEndTime

File: src/access/MarketConstraintHooks.sol

Struct: TemporaryReserveRatio

uint16 originalAnnualInterestBips

uint16 originalReserveRatioBips

uint32 expiry

File: src/libraries/MarketState.sol

Struct: MarketState

bool isClosed

uint128 maxTotalSupply

uint128 accruedProtocolFees

// Underlying assets reserved for withdrawals which have been paid

// by the borrower but not yet executed.

uint128 normalizedUnclaimedWithdrawals

// Scaled token supply (divided by scaleFactor)

uint104 scaledTotalSupply

// Scaled token amount in withdrawal batches that have not been

// paid by borrower yet.

uint104 scaledPendingWithdrawals

uint32 pendingWithdrawalExpiry

// Whether market is currently delinquent (liquidity under requirement)

bool isDelinquent

// Seconds borrower has been delinquent

uint32 timeDelinquent

// Fee charged to borrowers as a fraction of the annual interest rate

uint16 protocolFeeBips

// Annual interest rate accrued to lenders, in basis points

uint16 annualInterestBips

// Percentage of outstanding balance that must be held in liquid reserves

uint16 reserveRatioBips

// Ratio between internal balances and underlying token amounts

uint112 scaleFactor

uint32 lastInterestAccruedTimestamp

Struct: Account

uint104 scaledBalance

File: src/libraries/Withdrawal.sol

Struct: WithdrawalBatch

// Total scaled amount of tokens to be withdrawn

uint104 scaledTotalAmount

// Amount of scaled tokens that have been paid by borrower

uint104 scaledAmountBurned

// Amount of normalized tokens that have been paid by borrower

uint128 normalizedAmountPaid

Struct: AccountWithdrawalStatus

uint104 scaledAmount

uint128 normalizedAmountWithdrawn

Struct: WithdrawalData

FIFOQueue unpaidBatches

mapping(uint32 => WithdrawalBatch) batches

mapping(uint256 => mapping(address => AccountWithdrawalStatus)) accountStatuses

File: src/libraries/FIFOQueue.sol

Struct: FIFOQueue

uint128 startIndex

uint128 nextIndex

mapping(uint256 => uint32) data

File: src/spherex/ISphereXEngine.sol

Struct: ModifierLocals

bytes32[] storageSlots

bytes32[] valuesBefore

uint256 gas

address engine

File: ../src/interfaces/IWildcatSanctionsSentinel.sol

Struct: TmpEscrowParams

address borrower

address account

address asset

File: src/interfaces/WildcatStructsAndEnums.sol

Struct: MarketParameters

address asset

uint8 decimals

bytes32 packedNameWord0

bytes32 packedNameWord1

bytes32 packedSymbolWord0

bytes32 packedSymbolWord1

address borrower

address feeRecipient

address sentinel

uint128 maxTotalSupply

uint16 protocolFeeBips

uint16 annualInterestBips

uint16 delinquencyFeeBips

uint32 withdrawalBatchDuration

uint16 reserveRatioBips

uint32 delinquencyGracePeriod

address archController

address sphereXEngine

HooksConfig hooks

Struct: DeployMarketInputs

address asset

string namePrefix

string symbolPrefix

uint128 maxTotalSupply

uint16 annualInterestBips

uint16 delinquencyFeeBips

uint32 withdrawalBatchDuration

uint16 reserveRatioBips

uint32 delinquencyGracePeriod

HooksConfig hooks

Struct: MarketControllerParameters

address archController

address borrower

address sentinel

address marketInitCodeStorage

uint256 marketInitCodeHash

uint32 minimumDelinquencyGracePeriod

uint32 maximumDelinquencyGracePeriod

uint16 minimumReserveRatioBips

uint16 maximumReserveRatioBips

uint16 minimumDelinquencyFeeBips

uint16 maximumDelinquencyFeeBips

uint32 minimumWithdrawalBatchDuration

uint32 maximumWithdrawalBatchDuration

uint16 minimumAnnualInterestBips

uint16 maximumAnnualInterestBips

address sphereXEngine

Struct: ProtocolFeeConfiguration

address feeRecipient

address originationFeeAsset

uint80 originationFeeAmount

uint16 protocolFeeBips

Struct: MarketParameterConstraints

uint32 minimumDelinquencyGracePeriod

uint32 maximumDelinquencyGracePeriod

uint16 minimumReserveRatioBips

uint16 maximumReserveRatioBips

uint16 minimumDelinquencyFeeBips

uint16 maximumDelinquencyFeeBips

uint32 minimumWithdrawalBatchDuration

uint32 maximumWithdrawalBatchDuration

uint16 minimumAnnualInterestBips

uint16 maximumAnnualInterestBips

Last updated