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
  • Events
  • Functions

Was this helpful?

  1. Technical reference
  2. Vault and Treasury Protection

TreasuryProtectionStrategy

PreviousStrategyBaseNextLiquidityProtectionSingleLimitStrategy

Last updated 3 years ago

Was this helpful?

Contract that implement protection strategy using a whitelist. Inherits from .

Contract can be found here:

Variables

  • protectedAddresses

protectedAddresses

A mapping of addresses and their protection rules.

Events

  • event WhitelistAddresses(address[] whitelist)

Functions

  • isAddressWhitelisted

  • isTransferAllowed

  • setProtectedAddress

  • removeProtectedAddresses

isAddressWhitelisted

function isAddressWhitelisted(address token, address protectedAddress, address whitelistedAddress) public view returns(bool)

Returns true if particular whitelistedAddress is in the whitelist of protectedAddress for token.

Parameters:

Name
Type
Description

token

address

Token for which the protection rules are being checked.

protectedAddress

address

Address for which the whitelist is being checked.

whitelistedAddress

address

Address to check if it's in the whitelist.

isTransferAllowed

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

Reverts in case transfer from sender to recipient is not possible due to recipient not being in the sender's whitelist. This is called by the lossless controller every time a transfer is done from the protected address.

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 sent.

setProtectedAddress

function setProtectedAddress(address token, address protectedAddress, address[] calldata whitelist) public onlyProtectionAdmin(token)

Sets a whitelist for the protected address inside one particular token's scope. Can be called only by the protection admin of a token.

Parameters:

Name
Type
Description

token

address

Token for which the protection rules are being checked.

protectedAddress

address

Address for which the protection rules should be applied.

whitelist

address[]

A list of addresses that are allowed to receive tokens from the protected address.

removeProtectedAddresses

function removeProtectedAddresses(address token, address[] calldata addressesToRemove) public onlyProtectionAdmin(token) 

Removes whitelist from the addresses in the list.

Parameters:

Name
Type
Description

token

address

Token for which the protection rules are being removed.

addressesToRemove

address[]

A list of address that should get their whitelist removed.

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