Developer Docs
AppGitHub
  • Welcome!
  • Smart contracts
    • Core
      • Introduction
      • Deep Dive
      • Smart Contract Reference
        • PWN Hub
          • Tags
        • PWN Config
        • PWN Vault
        • Loan Types
          • Simple Loan
        • Proposals
          • Simple Loan Proposal
            • Simple Proposal
            • List Proposal
            • Elastic Proposal
            • Elastic Chainlink Proposal
            • Dutch Proposal
        • PWN Utilized Credit
        • PWN LOAN
        • PWN Revoked Nonce
        • Peripheral Contracts
          • Acceptor Controller
            • World ID
          • State Fingerprint Computer
            • UniV3
            • Chicken Bonds
          • Pool Adapter
            • Aave
            • Compound
            • ERC4626
        • Miscellaneous
          • PWN Fee Calculator
          • PWN Signature Checker
          • PWN Errors
          • PWN Periphery
          • Timelock
    • PWN DAO
      • Governance
        • Optimistic
        • Token
      • Tokens
        • PWN
        • stPWN
        • vePWN
          • Stake
          • Power
          • Metadata
      • Epoch Clock
      • Miscellaneous
        • Errors
        • EpochPowerLib
    • Tools
      • PWN Safe
        • Architecture
        • Security considerations
        • Smart Contract Reference
          • PWN Safe Factory
          • ATR Module
            • Tokenized Asset Manager
            • Recipient Permission Manager
          • Whitelist
          • ATR Guard
            • Operators context
      • Token Bundler
      • PWN Deployer
    • Libraries
      • MultiToken
    • Contract Addresses
  • More documentation
    • PWN Docs
    • FAQ
    • Audits
    • Using PWN without front-end
  • Deprecated
    • PWN Beta
      • Architecture
      • PWN
        • Off-chain signed offer
        • Offer types
      • PWN Vault
      • PWN LOAN
Powered by GitBook
On this page
  • 1. Summary
  • 2. Important links
  • 3. Contract details
  • Features
  • Functions
  • Events
Edit on GitHub
  1. Smart contracts
  2. Tools
  3. PWN Safe
  4. Smart Contract Reference

Whitelist

PreviousRecipient Permission ManagerNextATR Guard

Last updated 11 months ago

1. Summary

This contract is used by the ATR Module and is responsible for managing a whitelist of assets which are permitted to have their transfer rights tokenized.

2. Important links

3. Contract details

  • Whitelist.sol is written in Solidity version 0.8.15

Features

  • Keeps a whitelist of approved assets

  • Keeps a whitelist of approved libraries for delegate calls

Functions

canBeTokenized

Overview

A getter function to see if a certain asset or asset collection is whitelisted to be tokenised. The function returns a boolean.

This function takes one argument supplied by the caller:

  • addressassetAddress - Address of the asset or asset collection to check

Implementation

function canBeTokenized(address assetAddress) external view returns (bool) {
    if (!useWhitelist)
        return true;

    return isWhitelisted[assetAddress];
}
setUseWhitelist

Overview

A setter function to turn the whitelist on and off. It can be called only by the owner.

This function takes one argument supplied by the owner:

  • bool_useWhitelist - A boolean to update the useWhitelist flag

Implementation

function setUseWhitelist(bool _useWhitelist) external onlyOwner {
	useWhitelist = _useWhitelist;
}
setIsWhitelisted

Overview

A setter function to add or remove an address from the whitelist. It can be called only by the owner.

This function takes two arguments supplied by the owner:

  • addressassetAddress - Address of the asset being modified

  • bool_isWhitelisted - Boolean determining the addition or removal from the whitelist

Implementation

function setIsWhitelisted(
	address assetAddress,
	bool _isWhitelisted
) public onlyOwner {
	isWhitelisted[assetAddress] = _isWhitelisted;
}
setIsWhitelistedBatch

Overview

A setter function to add or remove multiple addresses from the whitelist. It can be called only by the owner.

This function takes two arguments supplied by the caller:

  • address[] calldataassetAddresses - Array of addresses being modified

  • bool_isWhitelisted - Boolean determining the addition or removal from the whitelist

Implementation

function setIsWhitelistedBatch(
	address[] calldata assetAddresses,
	bool _isWhitelisted
) external onlyWhitelistManager {
	uint256 length = assetAddresses.length;
	for (uint256 i; i < length; ) {
		setIsWhitelisted(assetAddresses[i], _isWhitelisted);
		unchecked {
			++i;
		}
	}
}
setIsWhitelistedLib

Overview

A setter function to add or remove a library address from the whitelist. It can be called only by the owner.

This function takes two arguments supplied by the owner:

  • addresslibAddress - Address of the library being modified

  • bool_isWhitelisted - Boolean determining the addition or removal from the whitelist

Implementation

function setIsWhitelistedLib(address libAddress, bool _isWhitelisted) public onlyOwner {
    isWhitelistedLib[libAddress] = _isWhitelisted;
}

Events

The Whitelist contract defines one event and no custom errors.

event AssetWhitelisted(address indexed assetAddress, bool indexed isWhitelisted);
AssetWhitelisted

AssetWhitelisted event is emitted when an asset address is whitelisted or removed from the whitelist.

This event has two parameters:

  • address indexedassetAddress - Address of the whitelisted asset

  • boolindexedisWhitelisted - True if the asset was whitelisted and false if the asset was removed from the whitelist

This contract inherits the contract

Ownable
https://github.com/PWNFinance/pwn_safe/blob/main/src/Whitelist.solgithub.com
GitHub
5KB
Whitelist.json
JSON ABI