View Source: contracts/connectors/loantoken/modules/beaconLogicLM/LoanTokenLogicLM.sol
↗ Extends: LoanTokenLogicStandard
- getListFunctionSignatures()
- mint(address receiver, uint256 depositAmount, bool useLM)
- burn(address receiver, uint256 burnAmount, bool useLM)
This function is MANDATORY, which will be called by LoanTokenLogicBeacon and be registered. Every new public function, the signature needs to be included in this function. *
function getListFunctionSignatures() external pure
returns(functionSignatures bytes4[], moduleName bytes32)
Source Code
function getListFunctionSignatures()
external
pure
returns (bytes4[] memory functionSignatures, bytes32 moduleName)
{
bytes4[] memory res = new bytes4[](32);
// Loan Token Logic Standard
res[0] = this.borrow.selector;
res[1] = this.marginTrade.selector;
res[2] = this.marginTradeAffiliate.selector;
res[3] = this.transfer.selector;
res[4] = this.transferFrom.selector;
res[5] = this.profitOf.selector;
res[6] = this.tokenPrice.selector;
res[7] = this.checkpointPrice.selector;
res[8] = this.marketLiquidity.selector;
res[9] = this.avgBorrowInterestRate.selector;
res[10] = this.borrowInterestRate.selector;
res[11] = this.nextBorrowInterestRate.selector;
res[12] = this.supplyInterestRate.selector;
res[13] = this.nextSupplyInterestRate.selector;
res[14] = this.totalSupplyInterestRate.selector;
res[15] = this.totalAssetBorrow.selector;
res[16] = this.totalAssetSupply.selector;
res[17] = this.getMaxEscrowAmount.selector;
res[18] = this.assetBalanceOf.selector;
res[19] = this.getEstimatedMarginDetails.selector;
res[20] = this.getDepositAmountForBorrow.selector;
res[21] = this.getBorrowAmountForDeposit.selector;
res[22] = this.checkPriceDivergence.selector;
res[23] = this.calculateSupplyInterestRate.selector;
// Loan Token LM & OVERLOADING function
/**
* @notice BE CAREFUL,
* LoanTokenLogicStandard also has mint & burn function (overloading).
* You need to compute the function signature manually --> bytes4(keccak256("mint(address,uint256,bool)"))
*/
res[24] = bytes4(keccak256("mint(address,uint256)")); /// LoanTokenLogicStandard
res[25] = bytes4(keccak256("mint(address,uint256,bool)")); /// LoanTokenLogicLM
res[26] = bytes4(keccak256("burn(address,uint256)")); /// LoanTokenLogicStandard
res[27] = bytes4(keccak256("burn(address,uint256,bool)")); /// LoanTokenLogicLM
// Advanced Token
res[28] = this.approve.selector;
// Advanced Token Storage
res[29] = this.totalSupply.selector;
res[30] = this.balanceOf.selector;
res[31] = this.allowance.selector;
return (res, stringToBytes32("LoanTokenLogicLM"));
}
deposit into the lending pool and optionally participate at the Liquidity Mining Program
function mint(address receiver, uint256 depositAmount, bool useLM) external nonpayable nonReentrant globallyNonReentrant
returns(minted uint256)
Arguments
Name | Type | Description |
---|---|---|
receiver | address | the receiver of the tokens |
depositAmount | uint256 | The amount of underlying tokens provided on the loan. (Not the number of loan tokens to mint). |
useLM | bool | if true -> deposit the pool tokens into the Liquidity Mining contract |
Source Code
function mint(
address receiver,
uint256 depositAmount,
bool useLM
) external nonReentrant globallyNonReentrant returns (uint256 minted) {
if (useLM) return _mintWithLM(receiver, depositAmount);
else return _mintToken(receiver, depositAmount);
}
withdraws from the lending pool and optionally retrieves the pool tokens from the Liquidity Mining Contract
function burn(address receiver, uint256 burnAmount, bool useLM) external nonpayable nonReentrant globallyNonReentrant
returns(redeemed uint256)
Arguments
Name | Type | Description |
---|---|---|
receiver | address | the receiver of the underlying tokens. note: potetial LM rewards are always sent to the msg.sender |
burnAmount | uint256 | The amount of pool tokens to redeem. |
useLM | bool | if true -> deposit the pool tokens into the Liquidity Mining contract |
Source Code
function burn(
address receiver,
uint256 burnAmount,
bool useLM
) external nonReentrant globallyNonReentrant returns (uint256 redeemed) {
if (useLM) redeemed = _burnFromLM(burnAmount);
else redeemed = _burnToken(burnAmount);
//this needs to be here and not in _burnTokens because of the WRBTC implementation
if (redeemed != 0) {
_safeTransfer(loanTokenAddress, receiver, redeemed, "asset transfer failed");
}
}
- Address
- Administered
- AdminRole
- AdvancedToken
- AdvancedTokenStorage
- Affiliates
- AffiliatesEvents
- ApprovalReceiver
- BProPriceFeed
- CheckpointsShared
- Constants
- Context
- DevelopmentFund
- DummyContract
- EnumerableAddressSet
- EnumerableBytes32Set
- EnumerableBytes4Set
- ERC20
- ERC20Detailed
- ErrorDecoder
- Escrow
- EscrowReward
- FeedsLike
- FeesEvents
- FeeSharingCollector
- FeeSharingCollectorProxy
- FeeSharingCollectorStorage
- FeesHelper
- FourYearVesting
- FourYearVestingFactory
- FourYearVestingLogic
- FourYearVestingStorage
- GenericTokenSender
- GovernorAlpha
- GovernorVault
- IApproveAndCall
- IChai
- IContractRegistry
- IConverterAMM
- IERC1820Registry
- IERC20_
- IERC20
- IERC777
- IERC777Recipient
- IERC777Sender
- IFeeSharingCollector
- IFourYearVesting
- IFourYearVestingFactory
- IFunctionsList
- ILiquidityMining
- ILiquidityPoolV1Converter
- ILoanPool
- ILoanToken
- ILoanTokenLogicBeacon
- ILoanTokenLogicModules
- ILoanTokenLogicProxy
- ILoanTokenModules
- ILoanTokenWRBTC
- ILockedSOV
- IMoCState
- IModulesProxyRegistry
- Initializable
- InterestUser
- IPot
- IPriceFeeds
- IPriceFeedsExt
- IProtocol
- IRSKOracle
- ISovryn
- ISovrynSwapNetwork
- IStaking
- ISwapsImpl
- ITeamVesting
- ITimelock
- IV1PoolOracle
- IVesting
- IVestingFactory
- IVestingRegistry
- IWrbtc
- IWrbtcERC20
- LenderInterestStruct
- LiquidationHelper
- LiquidityMining
- LiquidityMiningConfigToken
- LiquidityMiningProxy
- LiquidityMiningStorage
- LoanClosingsEvents
- LoanClosingsLiquidation
- LoanClosingsRollover
- LoanClosingsShared
- LoanClosingsWith
- LoanClosingsWithoutInvariantCheck
- LoanInterestStruct
- LoanMaintenance
- LoanMaintenanceEvents
- LoanOpenings
- LoanOpeningsEvents
- LoanParamsStruct
- LoanSettings
- LoanSettingsEvents
- LoanStruct
- LoanToken
- LoanTokenBase
- LoanTokenLogicBeacon
- LoanTokenLogicLM
- LoanTokenLogicProxy
- LoanTokenLogicStandard
- LoanTokenLogicStorage
- LoanTokenLogicWrbtc
- LoanTokenSettingsLowerAdmin
- LockedSOV
- MarginTradeStructHelpers
- Medianizer
- ModuleCommonFunctionalities
- ModulesCommonEvents
- ModulesProxy
- ModulesProxyRegistry
- MultiSigKeyHolders
- MultiSigWallet
- Mutex
- Objects
- OrderStruct
- OrigingVestingCreator
- OriginInvestorsClaim
- Ownable
- Pausable
- PausableOz
- PreviousLoanToken
- PreviousLoanTokenSettingsLowerAdmin
- PriceFeedRSKOracle
- PriceFeeds
- PriceFeedsLocal
- PriceFeedsMoC
- PriceFeedV1PoolOracle
- ProtocolAffiliatesInterface
- ProtocolLike
- ProtocolSettings
- ProtocolSettingsEvents
- ProtocolSettingsLike
- ProtocolSwapExternalInterface
- ProtocolTokenUser
- Proxy
- ProxyOwnable
- ReentrancyGuard
- RewardHelper
- RSKAddrValidator
- SafeERC20
- SafeMath
- SafeMath96
- setGet
- SharedReentrancyGuard
- SignedSafeMath
- SOV
- sovrynProtocol
- StakingAdminModule
- StakingGovernanceModule
- StakingInterface
- StakingProxy
- StakingRewards
- StakingRewardsProxy
- StakingRewardsStorage
- StakingShared
- StakingStakeModule
- StakingStorageModule
- StakingStorageShared
- StakingVestingModule
- StakingWithdrawModule
- State
- SwapsEvents
- SwapsExternal
- SwapsImplLocal
- SwapsImplSovrynSwap
- SwapsUser
- TeamVesting
- Timelock
- TimelockHarness
- TimelockInterface
- TokenSender
- UpgradableProxy
- USDTPriceFeed
- Utils
- VaultController
- Vesting
- VestingCreator
- VestingFactory
- VestingLogic
- VestingRegistry
- VestingRegistry2
- VestingRegistry3
- VestingRegistryLogic
- VestingRegistryProxy
- VestingRegistryStorage
- VestingStorage
- WeightedStakingModule
- WRBTC