LPManualWhitelist

LP addresses are whitelisted (and un-whitelisted) manually with transactions by user with given role

Types

WhitelistOptions

Enum with the different options for whitelisting status

enum WhitelistOptions {
  undefined,
  whitelisted,
  blacklisted
}

WhitelistStatus

struct WhitelistStatus {
  enum LPManualWhitelist.WhitelistOptions deposit;
  enum LPManualWhitelist.WhitelistOptions withdraw;
  enum LPManualWhitelist.WhitelistOptions sendTransfer;
  enum LPManualWhitelist.WhitelistOptions receiveTransfer;
}

Events

LPWhitelistStatusChanged

event LPWhitelistStatusChanged(address provider, struct LPManualWhitelist.WhitelistStatus whitelisted)

Emitted when the whitelist status for a provider (or the defaults entry at address(0)) is updated.

Parameters

Name Type Description
provider address The provider whose status was changed. address(0) denotes the defaults entry.
whitelisted struct LPManualWhitelist.WhitelistStatus The new status stored for the provider.

Errors

InvalidProvider

error InvalidProvider(address provider)

InvalidWhitelistStatus

error InvalidWhitelistStatus(struct LPManualWhitelist.WhitelistStatus newStatus)

Public Functions

constructor

constructor(contract IPolicyPool policyPool_) public

initialize

function initialize(struct LPManualWhitelist.WhitelistStatus defaultStatus) public virtual

Initializes the Whitelist contract

whitelistAddress

function whitelistAddress(address provider, struct LPManualWhitelist.WhitelistStatus newStatus) external

Sets a custom whitelist status for provider.

Parameters

Name Type Description
provider address The LP address whose status will be updated. Must be non-zero.
newStatus struct LPManualWhitelist.WhitelistStatus The status to store for provider. Fields may be undefined to indicate "use defaults".

Pre-conditions

  • provider != address(0)

Throws

{InvalidProvider}
if `provider == address(0)`

setWhitelistDefaults

function setWhitelistDefaults(struct LPManualWhitelist.WhitelistStatus newStatus) external

Updates the default whitelist status stored at _wlStatus[address(0)].

Parameters

Name Type Description
newStatus struct LPManualWhitelist.WhitelistStatus The new defaults entry. All fields must be non-undefined.

Pre-conditions

  • newStatus.deposit != WhitelistOptions.undefined
  • newStatus.withdraw != WhitelistOptions.undefined
  • newStatus.sendTransfer != WhitelistOptions.undefined
  • newStatus.receiveTransfer != WhitelistOptions.undefined

Throws

{InvalidWhitelistStatus}
if any defaults field is `undefined`

getWhitelistDefaults

function getWhitelistDefaults() external view returns (struct LPManualWhitelist.WhitelistStatus)

Returns the default whitelist status stored at _wlStatus[address(0)].

supportsInterface

function supportsInterface(bytes4 interfaceId) public view virtual returns (bool)

See {IERC165-supportsInterface}.

acceptsDeposit

function acceptsDeposit(contract IEToken, address provider, uint256) external view returns (bool)

Indicates whether or not a liquidity provider can do a deposit in an eToken.

Parameters

Name Type Description
contract IEToken
provider address The address of the liquidity provider (user) that wants to deposit
uint256

Return Values

Name Type Description
[0] bool true if provider deposit is accepted, false if not

acceptsWithdrawal

function acceptsWithdrawal(contract IEToken, address provider, uint256) external view returns (bool)

Indicates whether or not a liquidity provider can withdraw an eToken.

Parameters

Name Type Description
contract IEToken
provider address The address of the liquidity provider (user) that wants to withdraw
uint256

Return Values

Name Type Description
[0] bool true if provider withdraw request is accepted, false if not

acceptsTransfer

function acceptsTransfer(contract IEToken, address providerFrom, address providerTo, uint256) external view returns (bool)

Indicates whether or not the eTokens can be transferred from providerFrom to providerTo

Parameters

Name Type Description
contract IEToken
providerFrom address The current owner of the tokens
providerTo address The destination of the tokens if the transfer is accepted
uint256

Return Values

Name Type Description
[0] bool true if the transfer operation is accepted, false if not.

acceptsOperation

function acceptsOperation(contract IEToken, address provider, enum ILPWhitelist.Operation operation) external view returns (bool)

Returns whether provider is allowed to perform operation on etoken.

Parameters

Name Type Description
contract IEToken
provider address The address of the liquidity provider.
operation enum ILPWhitelist.Operation The operation to check.

Return Values

Name Type Description
[0] bool true if the operation is accepted, false otherwise.

Private Functions

__LPManualWhitelist_init

function __LPManualWhitelist_init(struct LPManualWhitelist.WhitelistStatus defaultStatus) internal

__LPManualWhitelist_init_unchained

function __LPManualWhitelist_init_unchained(struct LPManualWhitelist.WhitelistStatus defaultStatus) internal

_checkDefaultStatus

function _checkDefaultStatus(struct LPManualWhitelist.WhitelistStatus newStatus) internal pure

Internal validator for the defaults entry. All fields must be explicitly set (non-undefined).

Parameters

Name Type Description
newStatus struct LPManualWhitelist.WhitelistStatus Candidate defaults status.

Pre-conditions

  • newStatus.deposit != WhitelistOptions.undefined
  • newStatus.withdraw != WhitelistOptions.undefined
  • newStatus.sendTransfer != WhitelistOptions.undefined
  • newStatus.receiveTransfer != WhitelistOptions.undefined

Throws

{InvalidWhitelistStatus}
if any field is `undefined`

_whitelistAddress

function _whitelistAddress(address provider, struct LPManualWhitelist.WhitelistStatus newStatus) internal

Stores newStatus for provider.

Parameters

Name Type Description
provider address The provider whose entry is being written.
newStatus struct LPManualWhitelist.WhitelistStatus The status to store.

Emits

{LPWhitelistStatusChanged}