Added logic to change token name and symbol

This commit is contained in:
Thrilok Kumar 2021-03-23 03:24:10 +05:30
parent 3135dbe7b1
commit 9e1c295711
2 changed files with 21 additions and 22 deletions

View File

@ -1,12 +1,7 @@
pragma solidity ^0.7.0;
pragma experimental ABIEncoderV2;
import {
TokenDelegateStorageV1,
TokenEvents,
TimelockInterface,
TokenInterface
} from "./TokenInterfaces.sol";
import { TokenDelegateStorageV1, TokenEvents} from "./TokenInterfaces.sol";
import { SafeMath } from "./SafeMath.sol";
// TODO @thrilok209 @KaymasJain - Rename it
@ -80,6 +75,21 @@ contract TokenDelegate is TokenDelegateStorageV1, TokenEvents {
emit TransferUnpaused(msg.sender);
}
/**
* @notice Pause the token transfer
*/
// TODO @KaymasJain - Looks good? And should we have two functions or single?
function changeNameAndSymbol(string calldata name_, string calldata symbol_) external {
require(msg.sender == minter, "Tkn::changeNameAndSymbol: only the minter can change token name and symbol");
require(bytes(name_).length > 0, "Tkn::changeNameAndSymbol: name_name_ length invaild");
require(bytes(symbol_).length > 0, "Tkn::changeNameAndSymbol: symbol_ length invaild");
emit ChangedNameAndSymbol(name, name_, symbol, symbol_);
name = name_;
symbol = symbol_;
}
/**
* @notice Get the number of tokens `spender` is approved to spend on behalf of `account`
* @param account The address of the account holding the funds

View File

@ -1,20 +1,6 @@
pragma solidity ^0.7.0;
pragma experimental ABIEncoderV2;
interface TimelockInterface {
function delay() external view returns (uint);
function GRACE_PERIOD() external view returns (uint);
function acceptAdmin() external;
function queuedTransactions(bytes32 hash) external view returns (bool);
function queueTransaction(address target, uint value, string calldata signature, bytes calldata data, uint eta) external returns (bytes32);
function cancelTransaction(address target, uint value, string calldata signature, bytes calldata data, uint eta) external;
function executeTransaction(address target, uint value, string calldata signature, bytes calldata data, uint eta) external payable returns (bytes memory);
}
interface TokenInterface {
function getPriorVotes(address account, uint blockNumber) external view returns (uint96);
}
contract TokenEvents {
/// @notice An event thats emitted when an account changes its delegate
@ -36,10 +22,13 @@ contract TokenEvents {
event NewImplementation(address oldImplementation, address newImplementation);
/// @notice An event thats emitted when the token transfered is paused
event TransferPaused(address minter);
event TransferPaused(address indexed minter);
/// @notice An event thats emitted when the token transfered is unpaused
event TransferUnpaused(address minter);
event TransferUnpaused(address indexed minter);
/// @notice An event thats emitted when the token name and symbol is changed
event ChangedNameAndSymbol(string oldName, string newName, string oldSybmol, string newSybmol);
}
contract TokenDelegatorStorage {