Build
Architecture
contracts
contracts
evm
ERC20Custody.sol
Contract.erc20custody

Git Source (opens in a new tab)

Inherits: ReentrancyGuard

ERC20Custody for depositing ERC20 assets into ZetaChain and making operations with them.

paused

If custody operations are paused.

bool public paused;

TSSAddress

TSSAddress is the TSS address collectively possessed by Zeta blockchain validators.

address public TSSAddress;

TSSAddressUpdater

Threshold Signature Scheme (TSS) [GG20] is a multi-sig ECDSA/EdDSA protocol.

address public TSSAddressUpdater;

zetaFee

Current zeta fee for depositing funds into ZetaChain.

uint256 public zetaFee;

zetaMaxFee

Maximum zeta fee for transaction.

uint256 public immutable zetaMaxFee;

zeta

Zeta ERC20 token .

IERC20 public immutable zeta;

whitelisted

Mapping of whitelisted token => true/false.

mapping(IERC20 => bool) public whitelisted;

onlyTSS

Only TSS address allowed modifier.

modifier onlyTSS();

onlyTSSUpdater

Only TSS address updater allowed modifier.

modifier onlyTSSUpdater();

constructor

constructor(address TSSAddress_, address TSSAddressUpdater_, uint256 zetaFee_, uint256 zetaMaxFee_, IERC20 zeta_);

updateTSSAddress

Update the TSSAddress in case of Zeta blockchain validator nodes churn.

function updateTSSAddress(address TSSAddress_) external onlyTSSUpdater;

Parameters

NameTypeDescription
TSSAddress_address

updateZetaFee

Update zeta fee

function updateZetaFee(uint256 zetaFee_) external onlyTSS;

Parameters

NameTypeDescription
zetaFee_uint256

renounceTSSAddressUpdater

Change the ownership of TSSAddressUpdater to the Zeta blockchain TSS nodes. Effectively, only Zeta blockchain validators collectively can update TSSAddress afterwards.

function renounceTSSAddressUpdater() external onlyTSSUpdater;

pause

Pause custody operations.

function pause() external onlyTSS;

unpause

Unpause custody operations.

function unpause() external onlyTSS;

whitelist

Whitelist asset.

function whitelist(IERC20 asset) external onlyTSS;

Parameters

NameTypeDescription
assetIERC20

unwhitelist

Unwhitelist asset.

function unwhitelist(IERC20 asset) external onlyTSS;

Parameters

NameTypeDescription
assetIERC20

deposit

Deposit asset amount to recipient with message that encodes additional zetachain evm call or message.

function deposit(bytes calldata recipient, IERC20 asset, uint256 amount, bytes calldata message)
    external
    nonReentrant;

Parameters

NameTypeDescription
recipientbytes
assetIERC20
amountuint256
messagebytes

withdraw

Withdraw asset amount to recipient by custody TSS owner.

function withdraw(address recipient, IERC20 asset, uint256 amount) external nonReentrant onlyTSS;

Parameters

NameTypeDescription
recipientaddress
assetIERC20
amountuint256

Paused

event Paused(address sender);

Unpaused

event Unpaused(address sender);

Whitelisted

event Whitelisted(IERC20 indexed asset);

Unwhitelisted

event Unwhitelisted(IERC20 indexed asset);

Deposited

event Deposited(bytes recipient, IERC20 indexed asset, uint256 amount, bytes message);

Withdrawn

event Withdrawn(address indexed recipient, IERC20 indexed asset, uint256 amount);

RenouncedTSSUpdater

event RenouncedTSSUpdater(address TSSAddressUpdater_);

UpdatedTSSAddress

event UpdatedTSSAddress(address TSSAddress_);

UpdatedZetaFee

event UpdatedZetaFee(uint256 zetaFee_);

NotWhitelisted

error NotWhitelisted();

NotPaused

error NotPaused();

InvalidSender

error InvalidSender();

InvalidTSSUpdater

error InvalidTSSUpdater();

ZeroAddress

error ZeroAddress();

IsPaused

error IsPaused();

ZetaMaxFeeExceeded

error ZetaMaxFeeExceeded();

ZeroFee

error ZeroFee();