Contract-Development

什麼是黑名單以及為什麼在 Tether 代幣智能合約中使用它?在 Tether 中暫停和取消暫停有什麼用?

  • December 19, 2018

合約黑名單是可擁有的,BasicToken {

function getBlackListStatus(address _maker) external constant returns (bool) {
   return isBlackListed[_maker];
}
function getOwner() external constant returns (address) {
   return owner;
}
mapping (address => bool) public isBlackListed;
function addBlackList (address _evilUser) public onlyOwner {
   isBlackListed[_evilUser] = true;
   emit AddedBlackList(_evilUser); //event emmiting
}
function removeBlackList (address _clearedUser) public onlyOwner {
   isBlackListed[_clearedUser] = false;
   emit RemovedBlackList(_clearedUser);
}
function destroyBlackFunds (address _blackListedUser) public onlyOwner {
   require(isBlackListed[_blackListedUser]);
   uint dirtyFunds = balanceOf(_blackListedUser);
   balances[_blackListedUser] = 0;
   _totalSupply -= dirtyFunds;
   emit DestroyedBlackFunds(_blackListedUser, dirtyFunds);
}
event DestroyedBlackFunds(address _blackListedUser, uint _balance);
event AddedBlackList(address _user);
event RemovedBlackList(address _user);

}

契約 Pausable 是 Ownable {

event Pause();
event Unpause();
bool public paused = false;
modifier whenNotPaused() {
require(!paused);
_;

} 修飾符 whenPaused() { 需要(暫停); _; }

函式 pause() onlyOwner whenNotPaused public { paused = true; 發出暫停();} function unpause() onlyOwner whenPaused public { paused = false; 發出 Unpause(); } }

BlackLiast 的使用是為了提供功能來阻止使用者以防止異常活動超過契約。對於暫停或取消暫停,我在您的給定程式碼中看不到任何功能,請提供完整程式碼,以便輕鬆回答。

引用自:https://ethereum.stackexchange.com/questions/64295