Lossless Protocol
  • Lossless Whitepaper
  • FAQ
  • Technical reference
    • LERC20
      • Audits
    • Vault and Treasury Protection
      • LosslessControllerV2
      • LosslessGuardian
      • StrategyBase
      • TreasuryProtectionStrategy
      • LiquidityProtectionSingleLimitStrategy
      • Deployments
      • Audits
    • Hack Mitigation Protocol
      • Overview
      • How it works
      • Configuration
        • Current Configuration
      • Audits
      • Deployments
      • Smart Contracts
        • Lossless Controller V3
        • Lossless Governance
        • Lossless Reporting
        • Lossless Staking
    • Lossless Controller
      • Deployments
    • Wrapped Tokens
      • Lossless Wrapped Protection
        • Lossless Wrapped ERC20
        • Lossless Wrapped ERC20 Ownable
      • Extensible Wrapped Tokens
        • Lossless Wrapped ERC20 Extensible
        • Lossless Extensions Core
        • Extensions
          • Lossless Core Extension
      • UMA Protocol Integration
        • DAO Voting
      • Kleros Integration
      • Deployments
  • Guides
    • Wrapped Tokens
    • Committee Voting
    • Lossless Vault Protection User Guide
    • How To Use Vault Protection Smart Contracts
    • Lossless Integration Into The Token
      • Custom Token
      • Standard Token
Powered by GitBook
On this page
  • Variables
  • Functions

Was this helpful?

  1. Technical reference
  2. Vault and Treasury Protection

LiquidityProtectionSingleLimitStrategy

PreviousTreasuryProtectionStrategyNextDeployments

Last updated 3 years ago

Was this helpful?

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

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:

Name
Type
Description

token

address

Token for which the protection rules are being checked.

protectedAddress

address

Address for which the limit should be returned.

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:

Name
Type
Description

token

address

Token for which the protection rules are being applied.

protectedAddresses

address[]

A list of addresses that should get the limit applied.

periodInSeconds

uint256

Limit period.

amountPerPeriod

uint256

Limit amount per period.

startTimestamp

uint256

Limit start time.

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:

Name
Type
Description

token

address

Token for which the protection rules are being applied.

protectedAddress

address

Address that should get the limit applied.

periodInSeconds

uint256

Limit period.

amountPerPeriod

uint256

Limit amount per period.

startTimestamp

uint256

Limit start time.

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:

Name
Type
Description

token

address

Token for which the protection rules are being applied.

protectedAddresses

address[]

Addresses that should get limits removed.

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:

Name
Type
Description

token

address

Token for which the protection rules are being applied.

protectedAddress

address

Address that should get it's limit paused.

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:

Name
Type
Description

token

address

Token for which the protection rules are being checked.

sender

address

Sender's address.

recipient

address

Recipient's address.

amount

uint256

Amount of tokens being transferred.

StrategyBase
lossless-v2/LiquidityProtectionSingleLimitStrategy.sol at master · Lossless-Cash/lossless-v2GitHub
Logo