Fraction ProtocoloracleFacetslendingOracle

LendingOracleFacet

LendingOracleFacet

NonPriceSetter

error NonPriceSetter(address account)

Thrown when attempting to set price from a non price setter account.

UnauthorizedInitialization

error UnauthorizedInitialization(address account)

Thrown when trying to initialize from non admin account.

LendingOracleCollateralPriceSet

event LendingOracleCollateralPriceSet(uint256 campaignId, uint256 collateralPrice)

SetCollateralPriceLimitsOnPostReceiveHookExecuted

event SetCollateralPriceLimitsOnPostReceiveHookExecuted(uint256 campaignId)

RemoveMarginFromPriceLimitsExecuted

event RemoveMarginFromPriceLimitsExecuted(uint256 campaignId, uint256 packetsMarginAmountRemoved)

initLendingOracleFacet

function initLendingOracleFacet(bytes initLendingOracleData) external

Initializes the lending oracle facet.

Called by the creator of the tokenizer.

Parameters

NameTypeDescription
initLendingOracleDatabytesThe data associated with the initialization.

setAndCheckLendingOracleFacet

function setAndCheckLendingOracleFacet(bytes setAndCheckLendingOracleData) external

Sets data on the lending oracle facet for the newly created campaignId and checks if all data are correct.

Called by the creator of the campaign.

Parameters

NameTypeDescription
setAndCheckLendingOracleDatabytesThe data associated with the setAndCheck.

setCollateralPrice

function setCollateralPrice(uint256 campaignId, uint256 collateralPrice) external

Sets the collateral price in funding packets for a given campaign.

Parameters

NameTypeDescription
campaignIduint256The campaignId associated with the action.
collateralPriceuint256The collateral price in funding packets.

setPriceLimitsOnPostReceive

function setPriceLimitsOnPostReceive(uint256 campaignId) external

Sets the price limits of the oracle after fractions are purchased.

This function should be registered as a before state hook on FUNDED state Can only be called after purchase phase is done, because thats when the amount of fractions actually purchased is revealed. (i.e., when the creator (the address that receives the loan) is able to receive the lent assets) Selector: 0xdd9a32c5

Parameters

NameTypeDescription
campaignIduint256The campaignId associated with the action.

removeMarginFromPriceLimits

function removeMarginFromPriceLimits(uint256 campaignId, uint256 packetsMarginAmount) external

Removes the margin added in case of a successful marginCall.

Parameters

NameTypeDescription
campaignIduint256The campaignId associated with the action.
packetsMarginAmountuint256The packetsMarginAmount that is added.

checkDifferenceBetweenPriceAndCurrentPriceLevel

function checkDifferenceBetweenPriceAndCurrentPriceLevel(uint256 campaignId) external view returns (uint256)

Returns the substraction between price of the collateral and the price of the limit reached.

Parameters

NameTypeDescription
campaignIduint256The campaignId associated with the action.

getRemainingObligation

function getRemainingObligation(uint256 campaignId) external view returns (uint256)

Returns the remaining obligation which is different from obligationToEachFraction * fractionsPurchased in case of Margin call.

Accounts for any added margin amounts, ensuring that the returned obligation is always current.

Parameters

NameTypeDescription
campaignIduint256The campaignId associated with the action.