Elastic Chainlink Proposal
Last updated
Last updated
PWNSimpleLoanElasticChainlinkProposal.sol implements elastic loan proposals using Chainlink oracles for price feeds. This proposal type calculates collateral requirements dynamically based on real-time market data, supporting multiple intermediary denominations and LTV ratios.
The elastic proposal determines collateral amount during acceptance using Chainlink price feeds, LTV, and credit amount. Interest can be accruing or fixed, with support for L2 sequencer uptime checks.
PWNSimpleLoanElasticChainlinkProposal.sol is written in Solidity version 0.8.16
Dynamic proposal terms based on Chainlink price feeds
L2 sequencer uptime checks for oracle reliability
Feeds with last update older that 1 day are considered invalid
The PWN Simple Loan Elastic Chainlink Proposal contract defines one event and three errors.
Errors
Proposal
structcollateralCategory
MultiToken.Category
Collateral type (0=ERC20, 1=ERC721, 2=ERC1155)
collateralAddress
address
Collateral token address
collateralId
uint256
Collateral token ID (0 for ERC20)
checkCollateralStateFingerprint
bool
Enable ERC-5646 state verification
collateralStateFingerprint
bytes32
ERC-5646 state fingerprint
creditAddress
address
Loan credit token address
feedIntermediaryDenominations
address[]
Chainlink price feed conversion path
feedInvertFlags
bool[]
Flags for inverted price feeds
loanToValue
uint256
LTV ratio (6231 = 62.31%)
minCreditAmount
uint256
Minimum borrowable credit
availableCreditLimit
uint256
Maximum credit pool for multiple accepts
utilizedCreditId
bytes32
Shared credit utilization identifier
fixedInterestAmount
uint256
Minimum interest payment
accruingInterestAPR
uint24
APR with 2 decimals
durationOrDate
uint32
Loan duration (seconds) or end timestamp
expiration
uint40
Proposal expiration timestamp
allowedAcceptor
address
Whitelisted acceptor address
proposer
address
Proposal creator address
proposerSpecHash
bytes32
Proposer-specific data hash
isOffer
bool
True=loan offer, False=loan request
refinancingLoanId
uint256
ID of loan being refinanced
nonceSpace
uint256
Nonce grouping identifier
nonce
uint256
Proposal uniqueness nonce
loanContract
address
Associated loan contract address