PrimaryLendingPlatformAtomicRepaymentCore

Overview

License: MIT

abstract contract PrimaryLendingPlatformAtomicRepaymentCore is Initializable, AccessControlUpgradeable, ReentrancyGuardUpgradeable

Core contract for the atomic repayment functionality for the PrimaryLendingPlatform contract.

Abstract contract that implements the atomic repayment core functionality for the PrimaryLendingPlatform contract.

Events info

SetExchangeAggregator

event SetExchangeAggregator(address indexed exchangeAggregator, address indexed registryAggregator)

Emitted when the exchange aggregator and registry aggregator addresses are set.

Parameters:

SetPrimaryLendingPlatform

event SetPrimaryLendingPlatform(address indexed newPrimaryLendingPlatform)

Emitted when the primary lending platform address is set.

Parameters:

AtomicRepayment

event AtomicRepayment(address indexed user, address indexed collateral, address indexed lendingAsset, uint256 amountSold, uint256 amountReceive)

Emitted when an atomic repayment is executed, where a user sells collateral to repay a loan.

Parameters:

Constants info

MODERATOR_ROLE (0x797669c9)

bytes32 constant MODERATOR_ROLE = keccak256("MODERATOR_ROLE")

BUFFER_PERCENTAGE (0x952038c2)

uint16 constant BUFFER_PERCENTAGE = 500

State variables info

primaryLendingPlatform (0x92641a7c)

contract IPrimaryLendingPlatform primaryLendingPlatform

exchangeAggregator (0x60df4f35)

address exchangeAggregator

registryAggregator (0xf38cb29a)

address registryAggregator

Modifiers info

onlyModerator

modifier onlyModerator()

Throws if the caller is not the moderator.

isProjectTokenListed

modifier isProjectTokenListed(address projectToken)

Throws if the project token is not listed.

Parameters:

Functions info

initialize (0xc4d66de8)

function initialize(address pit) public initializer

Sets up initial roles, initializes AccessControl, and sets the provided PIT address

Parameters:

setExchangeAggregator (0x3c4841b4)

function setExchangeAggregator(
    address exchangeAggregatorAddress,
    address registryAggregatorAddress
) external onlyModerator

Updates the Exchange Aggregator contract and registry contract addresses.

Requirements:

  • The caller must be the moderator.

  • exchangeAggregatorAddress must not be the zero address.

  • registryAggregatorAddress must be a valid Augustus contract if it is not the zero address.

Parameters:

setPrimaryLendingPlatform (0xe801734a)

function setPrimaryLendingPlatform(address pit) external onlyModerator

Sets the address of the primary lending platform contract.

Parameters:

Requirements:

  • pit cannot be the zero address. |

getTotalOutstanding (0x00fe5da3)

function getTotalOutstanding(
    address user,
    address projectToken,
    address lendingAsset
) public view returns (uint256 outstanding)

Calculates the outstanding amount (i.e., loanBody + accrual) for a given user, project token, and lending token.

Parameters:

Return values:

getRemainingDeposit (0xf8f8b436)

function getRemainingDeposit(
    address user,
    address projectToken
) public view returns (uint256 remainingDeposit)

Returns the remaining deposit of a user for a specific project token.

Parameters:

Return values:

Last updated