PrimaryLendingPlatformWrappedTokenGatewayCore

Overview

License: MIT

abstract contract PrimaryLendingPlatformWrappedTokenGatewayCore is Initializable, AccessControlUpgradeable, ReentrancyGuardUpgradeable

Core contract for the Primary Lending Platform Wrapped Token Gateway Core

Abstract contract that defines the core functionality of the primary lending platform wrapped token gateway.

Events info

SetPrimaryLendingPlatform

event SetPrimaryLendingPlatform(address newPrimaryLendingPlatform)

Emitted when the PrimaryLendingPlatform contract address is updated.

Parameters:

NameTypeDescription

newPrimaryLendingPlatform

address

The new address of the PrimaryLendingPlatform contract.

SetPITLiquidation

event SetPITLiquidation(address newPITLiquidation)

Emitted when the PIT liquidation address is set.

SetPITLeverage

event SetPITLeverage(address newPITLeverage)

Emitted when the PIT (Pool Interest Token) leverage is set to a new address.

Parameters:

NameTypeDescription

newPITLeverage

address

The address of the new PIT leverage contract.

SetWETH

event SetWETH(address newWETH)

Emitted when the WETH address is set.

Parameters:

NameTypeDescription

newWETH

address

The address of the new WETH contract.

Constants info

MODERATOR_ROLE (0x797669c9)

bytes32 constant MODERATOR_ROLE = keccak256("MODERATOR_ROLE")

State variables info

primaryLendingPlatform (0x92641a7c)

contract IPrimaryLendingPlatform primaryLendingPlatform

WETH (0xad5c4648)

contract IWETH WETH

pitLiquidation (0xf8514cae)

contract IPrimaryLendingPlatformLiquidation pitLiquidation

pitLeverage (0x22c7ddee)

contract IPrimaryLendingPlatformLeverage pitLeverage

Modifiers info

onlyModerator

modifier onlyModerator()

Modifier that allows only the moderator to execute the function.

isProjectTokenListed

modifier isProjectTokenListed(address projectToken)

Modifier that checks if the project token is listed.

Parameters:

NameTypeDescription

projectToken

address

Address of the project token.

isLendingTokenListed

modifier isLendingTokenListed(address lendingToken)

Modifier that checks if the lending token is listed.

Parameters:

NameTypeDescription

lendingToken

address

Address of the lending token.

Functions info

initialize (0xf8c8765e)

function initialize(
    address pit,
    address weth,
    address pitLiquidationAddress,
    address pitLeverageAddress
) public initializer

Initializes the PrimaryLendingPlatformWrappedTokenGateway contract.

Parameters:

NameTypeDescription

pit

address

Address of the primary index token contract.

weth

address

Address of the wrapped Ether (WETH) token contract.

pitLiquidationAddress

address

Address of the primary index token liquidation contract.

pitLeverageAddress

address

Address of the primary index token leverage contract.

setWETH (0x5b769f3c)

function setWETH(address _weth) external onlyModerator

Sets the address of the WETH contract.

Requirements:

  • newWETH cannot be the zero address.

  • Caller must be a moderator.

Parameters:

NameTypeDescription

_weth

address

The address of the new WETH contract.

setPrimaryLendingPlatform (0xe801734a)

function setPrimaryLendingPlatform(address newPit) external onlyModerator

Sets the address of the primary lending platform contract.

Requirements:

  • newPit cannot be the zero address.

  • Caller must be a moderator.

Parameters:

NameTypeDescription

newPit

address

The address of the new primary lending platform contract.

setPITLiquidation (0x6ccf9e23)

function setPITLiquidation(address newLiquidation) external onlyModerator

Only the moderator can call this function.

Sets the address of the PrimaryLendingPlatformLiquidation contract for PIT liquidation.

Requirements:

  • newLiquidation cannot be the zero address.

  • Caller must be a moderator.

Parameters:

NameTypeDescription

newLiquidation

address

The address of the new PrimaryLendingPlatformLiquidation contract.

setPITLeverage (0x1a58ed4a)

function setPITLeverage(address newLeverage) external onlyModerator

Sets the Primary Lending Platform Leverage contract address.

Requirements:

  • newLeverage cannot be the zero address.

  • Caller must be a moderator.

Parameters:

NameTypeDescription

newLeverage

address

The address of the new Primary Lending Platform Leverage contract.

getTotalOutstanding (0x75efd575)

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

Returns the total outstanding balance of a user for a specific project token.

Parameters:

NameTypeDescription

user

address

The address of the user.

projectToken

address

The address of the project token.

Return values:

NameTypeDescription

outstanding

uint256

The total outstanding balance of the user.

deposit (0xd0e30db0)

function deposit() external payable nonReentrant

Deposits Ether into the PrimaryLendingPlatformWrappedTokenGatewayCore contract and wraps it into WETH.

repay (0x22867d78)

function repay(
    address projectToken,
    uint256 lendingTokenAmount
) external payable nonReentrant

Repays the specified amount of the project token's Ether outstanding debt using the lending token.

Parameters:

NameTypeDescription

projectToken

address

The address of the project token.

lendingTokenAmount

uint256

The amount of the lending token to be used for repayment.

receive

receive() external payable

Only WETH contract is allowed to transfer ETH here. Prevent other addresses to send Ether to this contract.

fallback

fallback() external payable

Reverts any fallback calls to the contract.

Last updated