LiquidityProtectionSingleLimitStrategy

Contract that implements protection strategy using a single limit. Inherits from StrategyBase.

Contract can be found here:

Variables

  • protection

protection

A mapping of addresses and their protection rules.

Functions

  • getLimit

  • setLimitBatched

  • setLimit

  • removeLimits

  • pause

  • isTransferAllowed

getLimit

function getLimit(address token, address protectedAddress) external view returns(Limit memory)

Returns limit info for particular protected address.

Parameters:

setLimitBatched

function setLimitBatched(
        address token,
        address[] calldata protectedAddresses,
        uint256 periodInSeconds,
        uint256 amountPerPeriod,
        uint256 startTimestamp
    ) external onlyProtectionAdmin(token) 

Sets limits for a list of addresses. Can be called only by token protection admin.

Parameters:

setLimit

function setLimit(
        address token,
        address protectedAddress,
        uint256 periodInSeconds,
        uint256 amountPerPeriod,
        uint256 startTimestamp
    ) external onlyProtectionAdmin(token)

Sets limit for a single address. Can be called only by token protection admin.

Parameters:

removeLimits

function removeLimits(address token, address[] calldata protectedAddresses) external onlyProtectionAdmin(token)

Removes limits for addresses in the list. Can be called only by token protection admin.

Parameters:

pause

function pause(address token, address protectedAddress) external onlyProtectionAdmin(token)

Change limit to 0, ie, pause transfers from this address. Can be called only by token protection admin.

Parameters:

isTransferAllowed

function isTransferAllowed(address token, address sender, address recipient, uint256 amount) external 

Checks if transfer from the sender is allowed. Internally it validates if limit is not reached and updates limit info after transfer is allowed to go through.

Parameters:

Last updated