Maple
Search…
Pool
Pool maintains all accounting and functionality related to Pools.

Constructor

Constructor for a Pool. It emits a `PoolStateChanged` event.
1
constructor(
2
address _poolDelegate,
3
address _liquidityAsset,
4
address _stakeAsset,
5
address _slFactory,
6
address _llFactory,
7
uint256 _stakingFee,
8
uint256 _delegateFee,
9
uint256 _liquidityCap,
10
string name,
11
string symbol
12
)
Copied!

Parameters:

Index
Name
Type
Internal Type
Description
0
_poolDelegate
address
address
Address that has manager privileges of the Pool.
1
_liquidityAsset
address
address
Asset used to fund the Pool, It gets escrowed in LiquidityLocker.
2
_stakeAsset
address
address
Asset escrowed in StakeLocker.
3
_slFactory
address
address
Factory used to instantiate the StakeLocker.
4
_llFactory
address
address
Factory used to instantiate the LiquidityLocker.
5
_stakingFee
uint256
uint256
Fee that Stakers earn on interest, in basis points.
6
_delegateFee
uint256
uint256
Fee that the Pool Delegate earns on interest, in basis points.
7
_liquidityCap
uint256
uint256
Max amount of Liquidity Asset accepted by the Pool.
8
name
string
string
Name of Pool token.
9
symbol
string
string
Symbol of Pool token.

Functions

BPTVal

Calculates the value of BPT in units of Liquidity Asset.
1
function BPTVal(
2
address _bPool,
3
address _liquidityAsset,
4
address _staker,
5
address _stakeLocker
6
) view returns (
7
uint256
8
)
Copied!

Parameters:

Index
Name
Type
Internal Type
Description
0
_bPool
address
address
The address of Balancer pool.
1
_liquidityAsset
address
address
The asset used by Pool for liquidity to fund Loans.
2
_staker
address
address
The address that deposited BPTs to StakeLocker.
3
_stakeLocker
address
address
Escrows BPTs deposited by Staker.

Return Values:

Index
Name
Type
Internal Type
Description
0
uint256
uint256
USDC value of staker BPTs.

DL_FACTORY (state variable)

The factory type of `DebtLockerFactory`.
1
function DL_FACTORY(
2
) view returns (
3
uint8
4
)
Copied!

Return Values:

Index
Name
Type
Internal Type
Description
0
uint8
uint8

accumulativeFundsOf

Returns the amount of funds that an account has earned in total. accumulativeFundsOf(_owner) = withdrawableFundsOf(_owner) + withdrawnFundsOf(_owner) = (pointsPerShare * balanceOf(_owner) + pointsCorrection[_owner]) / pointsMultiplier
1
function accumulativeFundsOf(
2
address _owner
3
) view returns (
4
uint256
5
)
Copied!

Parameters:

Index
Name
Type
Internal Type
Description
0
_owner
address
address
The address of a token holder.

Return Values:

Index
Name
Type
Internal Type
Description
0
uint256
uint256
The amount of funds that `_owner` has earned in total.

accumulativeLossesOf

Returns the amount of losses that an account has earned in total. accumulativeLossesOf(_owner) = recognizableLossesOf(_owner) + recognizedLossesOf(_owner) = (lossesPerShare * balanceOf(_owner) + lossesCorrection[_owner]) / pointsMultiplier
1
function accumulativeLossesOf(
2
address _owner
3
) view returns (
4
uint256
5
)
Copied!

Parameters:

Index
Name
Type
Internal Type
Description
0
_owner
address
address
The address of a token holder.

Return Values:

Index
Name
Type
Internal Type
Description
0
uint256
uint256
The amount of losses that `_owner` has earned in total.

allowance

Returns the remaining number of tokens that `spender` will be allowed to spend on behalf of `owner` through {transferFrom}. This is zero by default. This value changes when {approve} or {transferFrom} are called.
1
function allowance(
2
address owner,
3
address spender
4
) view returns (
5
uint256
6
)
Copied!

Parameters:

Index
Name
Type
Internal Type
Description
0
owner
address
address
1
spender
address
address

Return Values:

Index
Name
Type
Internal Type
Description
0
uint256
uint256

allowedLiquidityProviders (state variable)

1
function allowedLiquidityProviders(
2
address
3
) view returns (
4
bool
5
)
Copied!

Parameters:

Index
Name
Type
Internal Type
Description
0
``
address
address

Return Values:

Index
Name
Type
Internal Type
Description
0
bool
bool
Whether `liquidityProvider` has early access to the Pool.

approve

Sets `amount` as the allowance of `spender` over the caller's tokens. Returns a boolean value indicating whether the operation succeeded. IMPORTANT: Beware that changing an allowance with this method brings the risk that someone may use both the old and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards: https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 Emits an {Approval} event.
1
function approve(
2
address spender,
3
uint256 amount
4
) nonpayable returns (
5
bool
6
)
Copied!

Parameters:

Index
Name
Type
Internal Type
Description
0
spender
address
address
1
amount
uint256
uint256

Return Values:

Index
Name
Type
Internal Type
Description
0
bool
bool

balanceOf

Returns the amount of tokens owned by `account`.
1
function balanceOf(
2
address account
3
) view returns (
4
uint256
5
)
Copied!

Parameters:

Index
Name
Type
Internal Type
Description
0
account
address
address

Return Values:

Index
Name
Type
Internal Type
Description
0
uint256
uint256

cancelWithdraw

Cancels an initiated withdrawal by resetting the account's withdraw cooldown. It emits a `Cooldown` event.
1
function cancelWithdraw(
2
) nonpayable
Copied!

claim

Claims available funds for the Loan through a specified DebtLockerFactory. Only the Pool Delegate or a Pool Admin can call this function. It emits two `BalanceUpdated` events. It emits a `Claim` event.
1
function claim(
2
address loan,
3
address dlFactory
4
) nonpayable returns (
5
uint256[7] claimInfo
6
)
Copied!

Parameters:

Index
Name
Type
Internal Type
Description
0
loan
address
address
The address of the loan to claim from.
1
dlFactory
address
address
The address of the DebtLockerFactory.

Return Values:

Index
Name
Type
Internal Type
Description
0
claimInfo
uint256[7]
uint256[7]
The claim details. [0] => Total amount claimed, [1] => Interest portion claimed, [2] => Principal portion claimed, [3] => Fee portion claimed, [4] => Excess portion claimed, [5] => Recovered portion claimed (from liquidations), [6] => Default suffered.

custodyAllowance (state variable)

1
function custodyAllowance(
2
address,
3
address
4
) view returns (
5
uint256
6
)
Copied!

Parameters:

Index
Name
Type
Internal Type
Description
0
``
address
address
1
``
address
address

Return Values:

Index
Name
Type
Internal Type
Description
0
uint256
uint256
The amount of PoolFDTs of `account` that are "locked" at `custodian`.

deactivate

Triggers deactivation, permanently shutting down the Pool. Must have less than 100 USD worth of Liquidity Asset `principalOut`. Only the Pool Delegate can call this function. It emits a `PoolStateChanged` event.
1
function deactivate(
2
) nonpayable
Copied!

debtLockers (state variable)

1
function debtLockers(
2
address,
3
address
4
) view returns (
5
address
6
)
Copied!

Parameters:

Index
Name
Type
Internal Type
Description
0
``
address
address
1
``
address
address

Return Values:

Index
Name
Type
Internal Type
Description
0
address
address
The address of the DebtLocker corresponding to `loan` and `debtLockerFactory`.

decimals

Returns the number of decimals used to get its user representation. For example, if `decimals` equals `2`, a balance of `505` tokens should be displayed to a user as `5,05` (`505 / 10 ** 2`). Tokens usually opt for a value of 18, imitating the relationship between Ether and Wei. This is the value {ERC20} uses, unless {setupDecimals} is called. NOTE: This information is only used for _display purposes: it in no way affects any of the arithmetic of the contract, including {IERC20-balanceOf} and {IERC20-transfer}.
1
function decimals(
2
) view returns (
3
uint8
4
)
Copied!

Return Values:

Index
Name
Type
Internal Type
Description
0
uint8
uint8

decreaseAllowance

Atomically decreases the allowance granted to `spender` by the caller. This is an alternative to {approve} that can be used as a mitigation for problems described in {IERC20-approve}. Emits an {Approval} event indicating the updated allowance. Requirements: - `spender` cannot be the zero address. - `spender` must have allowance for the caller of at least `subtractedValue`.
1
function decreaseAllowance(
2
address spender,
3
uint256 subtractedValue
4
) nonpayable returns (
5
bool
6
)
Copied!

Parameters:

Index
Name
Type
Internal Type
Description
0
spender
address
address
1
subtractedValue
uint256
uint256

Return Values:

Index
Name
Type
Internal Type
Description
0
bool
bool

delegateFee (state variable)

The fee the Pool Delegate earns (in basis points).
1
function delegateFee(
2
) view returns (
3
uint256
4
)
Copied!

Return Values:

Index
Name
Type
Internal Type
Description
0
uint256
uint256

deposit

Handles Liquidity Providers depositing of Liquidity Asset into the LiquidityLocker, minting PoolFDTs. It emits a `DepositDateUpdated` event. It emits a `BalanceUpdated` event. It emits a `Cooldown` event.
1
function deposit(
2
uint256 amt
3
) nonpayable
Copied!

Parameters:

Index
Name
Type
Internal Type
Description
0
amt
uint256
uint256
The amount of Liquidity Asset to deposit.

depositDate (state variable)

Used for withdraw penalty calculation.
1
function depositDate(
2
address
3
) view returns (
4
uint256
5
)
Copied!

Parameters:

Index
Name
Type
Internal Type
Description
0
``
address
address

Return Values:

Index
Name
Type
Internal Type
Description
0
uint256
uint256
The unix timestamp of the weighted average deposit date of `account`.

finalize

Finalizes the Pool, enabling deposits. Checks the amount the Pool Delegate deposited to the StakeLocker. Only the Pool Delegate can call this function. It emits a `PoolStateChanged` event.
1
function finalize(
2
) nonpayable
Copied!

fundLoan

Funds a Loan for an amount, utilizing the supplied DebtLockerFactory for DebtLockers. Only the Pool Delegate can call this function. It emits a `LoanFunded` event. It emits a `BalanceUpdated` event.
1
function fundLoan(
2
address loan,
3
address dlFactory,
4
uint256 amt
5
) nonpayable
Copied!

Parameters:

Index
Name
Type
Internal Type
Description
0
loan
address
address
The address of the Loan to fund.
1
dlFactory
address
address
The address of the DebtLockerFactory to utilize.
2
amt
uint256
uint256
The amount to fund the Loan.

getInitialStakeRequirements

Returns information on the stake requirements.
1
function getInitialStakeRequirements(
2
) view returns (
3
uint256,
4
uint256,
5
bool,
6
uint256,
7
uint256
8
)
Copied!

Return Values:

Index
Name
Type
Internal Type
Description
0
uint256
uint256
The min amount of Liquidity Asset coverage from staking required.
1
uint256
uint256
The present amount of Liquidity Asset coverage from the Pool Delegate stake.
2
bool
bool
Whether enough stake is present from the Pool Delegate for finalization.
3
uint256
uint256
The staked BPTs required for minimum Liquidity Asset coverage.
4
uint256
uint256
The current staked BPTs.

getPoolSharesRequired

Calculates BPTs required if burning BPTs for the Liquidity Asset, given supplied `tokenAmountOutRequired`.
1
function getPoolSharesRequired(
2
address _bPool,
3
address _liquidityAsset,
4
address _staker,
5
address _stakeLocker,
6
uint256 _liquidityAssetAmountRequired
7
) view returns (
8
uint256,
9
uint256
10
)
Copied!

Parameters:

Index
Name
Type
Internal Type
Description
0
_bPool
address
address
The Balancer pool that issues the BPTs.
1
_liquidityAsset
address
address
Swap out asset (e.g. USDC) to receive when burning BPTs.
2
_staker
address
address
The address that deposited BPTs to StakeLocker.
3
_stakeLocker
address
address
Escrows BPTs deposited by Staker.
4
_liquidityAssetAmountRequired
uint256
uint256
The amount of Liquidity Asset required to recover.

Return Values:

Index
Name
Type
Internal Type
Description
0
uint256
uint256
The `poolAmountIn` required.
1
uint256
uint256
The `poolAmountIn` currently staked.

increaseAllowance

Atomically increases the allowance granted to `spender` by the caller. This is an alternative to {approve} that can be used as a mitigation for problems described in {IERC20-approve}. Emits an {Approval} event indicating the updated allowance. Requirements: - `spender` cannot be the zero address.
1
function increaseAllowance(
2
address spender,
3
uint256 addedValue
4
) nonpayable returns (
5
bool
6
)
Copied!

Parameters:

Index
Name
Type
Internal Type
Description
0
spender
address
address
1
addedValue
uint256
uint256

Return Values:

Index
Name
Type
Internal Type
Description
0
bool
bool

increaseCustodyAllowance

Increases the custody allowance for a given Custodian corresponding to the calling account (`msg.sender`). It emits a `CustodyAllowanceChanged` event. It emits a `TotalCustodyAllowanceUpdated` event.
1
function increaseCustodyAllowance(
2
address custodian,
3
uint256 amount
4
) nonpayable
Copied!

Parameters:

Index
Name
Type
Internal Type
Description
0
custodian
address
address
The address which will act as Custodian of a given amount for an account.
1
amount
uint256
uint256
The number of additional FDTs to be custodied by the Custodian.

intendToWithdraw

Activates the cooldown period to withdraw. It can't be called if the account is not providing liquidity. It emits a `Cooldown` event.
1
function intendToWithdraw(
2
) nonpayable
Copied!

interestBalance

The amount of earned interest present and accounted for in this contract.
1
function interestBalance(
2
) view returns (
3
uint256
4
)
Copied!

Return Values:

Index
Name
Type
Internal Type
Description
0
uint256
uint256

interestSum

The sum of all withdrawable interest.
1
function interestSum(
2
) view returns (
3
uint256
4
)
Copied!

Return Values:

Index
Name
Type
Internal Type
Description
0
uint256
uint256

isDepositAllowed

Checks that the given deposit amount is acceptable based on current liquidityCap.
1
function isDepositAllowed(
2
uint256 depositAmt
3
) view returns (
4
bool
5
)
Copied!

Parameters:

Index
Name
Type
Internal Type
Description
0
depositAmt
uint256
uint256
The amount of tokens (i.e liquidityAsset type) the account is trying to deposit.

Return Values:

Index
Name
Type
Internal Type
Description
0
bool
bool

isPoolFinalized

Checks that the Pool state is `Finalized`.
1
function isPoolFinalized(
2
) view returns (
3
bool
4
)
Copied!

Return Values:

Index
Name
Type
Internal Type
Description
0
bool
bool