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

Was this helpful?

  1. Technical reference
  2. Vault and Treasury Protection

LosslessGuardian

PreviousLosslessControllerV2NextStrategyBase

Last updated 3 years ago

Was this helpful?

This contract is a contract that maintains data needed for the protection mechanism to function properly. It allows verified protection strategy contracts to communicate with lossless controller by working as an intermediary.

Contract can be found here:

Variables

  • protectionAdmin

  • verifiedStrategies

  • verifiedTokens

  • verifiedAddresses

  • lossless

protectionAdmin

Every token has a protection admin. Protection admin is allowed to configure protections for the verified addresses.

verifiedStrategies

This mapping defines which strategy contracts are allowed to interact with this guardian contract.

verifiedTokens

Before LERC20 token can start using any of the protections, it must first be verified by the lossless team. This variable saves verified contracts.

verifiedAddresses

Before a verified LERC20 token can have a protected address, that particular address must first be verified by the lossless team. This variables saves verified addresses.

lossless

Lossless controller's address.

Events

  • event TokenVerified(address indexed token, bool value)

  • event AddressVerified(address indexed token, address indexed verifiedAddress, bool value)

  • event ProtectionAdminSet(address indexed token, address indexed admin)

  • event StrategyVerified(address indexed strategy, bool value)

Modifiers

  • onlyLosslessAdmin

  • onlyVerifiedStrategy

  • onlyVerifiedToken

onlyLosslessAdmin

Checks if msg.sender is admin.

onlyVerifiedStrategy

Checks if msg.sender is a verifiedStrategy smart contract.

onlyVerifiedToken

Checks if msg.sender is verifiedToken smart contract.

Functions

  • isAddressVerified

  • verifyStrategies

  • verifyToken

  • verifyAddress

  • setProtectionAdmin

  • setProtectedAddress

  • removeProtectedAddresses

isAddressVerified

function isAddressVerified(address token, address addressToCheck) external view returns(bool) 

Returns if the addressToCheck is verified for token.

Parameters:

Name
Type
Description

token

address

Token for which the verification is set.

addressToCheck

address

Address to check the verification for.

verifyStrategies

function verifyStrategies(address[] calldata strategies, bool value) external onlyLosslessAdmin

Sets either true or false for every address in the strategies list. This either marks address as verified strategy or removes the verification. Can be called only by lossless admin.

Parameters:

Name
Type
Description

strategies

address[]

Smart contracts that should be verified or have their verification removed.

value

bool

Value that defines if contracts in the list should be verified.

verifyToken

function verifyToken(address token, bool value) external onlyLosslessAdmin 

Sets either true or false for token address. This either marks token address as verified or removes the verification. Can be called only by lossless admin.

Parameters:

Name
Type
Description

token

address

Token which should be verified or have it's verification removed.

value

bool

Value that defines if token should be verified or have it's verification removed.

verifyAddress

function verifyAddress(address token, address verifiedAddress, bool value) external onlyLosslessAdmin onlyVerifiedToken(token) 

Sets either true or false for protected address. This either marks address as verified or removes the verification. Can be called only by lossless admin. Only verified addresses are allowed to have protection rules turned on.

Parameters:

Name
Type
Description

token

address

Token which should be verified.

verifiedAddress

bool

Value that defines if address should be verified or not.

setProtectionAdmin

function setProtectionAdmin(address token, address admin) external onlyVerifiedToken(token) {

Sets protection admin for the token. Can be called only by the LERC20 admin address and only for the token that is already verified.

Parameters:

Name
Type
Description

token

address

Token for which the protection admin should be set.

admin

bool

New protection admin address.

setProtectedAddress

function setProtectedAddress(address token, address guardedAddress) external onlyVerifiedStrategy 

Sets protection rules for a particular address. Can be done only for verified token and for verified address. Can be called only by verified strategy.

Parameters:

Name
Type
Description

token

address

Token for which the protection should be applied.

guardedAddress

bool

Address for which the protection rules should be applied.

removeProtectedAddresses

function removeProtectedAddresses(address token, address protectedAddress) external

Removes protection rules for a particular address. Can be called only by the verified strategy or by protection admin of a particular token.

Parameters:

Name
Type
Description

token

address

Token for which the protection removal should be applied.

protectedAddress

bool

Address for which the protection rules should be removed.

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