pragmasolidity ^0.6.0;import"https://raw.githubusercontent.com/DefiOfThrones/DOTTokenContract/feature/dot-token-v2/libs/ERC20Capped.sol";
import"https://raw.githubusercontent.com/DefiOfThrones/DOTTokenContract/feature/dot-token-v2/libs/ERC20Burnable.sol";
import"https://raw.githubusercontent.com/DefiOfThrones/DOTTokenContract/feature/dot-token-v2/libs/ERC1363.sol";
import"https://raw.githubusercontent.com/DefiOfThrones/DOTTokenContract/feature/dot-token-v2/libs/Roles.sol";
import"https://raw.githubusercontent.com/DefiOfThrones/DOTTokenContract/feature/dot-token-v2/libs/TokenRecover.sol";
import"https://raw.githubusercontent.com/DefiOfThrones/DOTTokenContract/feature/dot-token-v2/libs/Pausable.sol";
/**
* @title DotTokenContract
* @author DefiOfThrones (https://github.com/DefiOfThrones/DOTTokenContract)
*/contractDotTokenContractisERC20Capped, ERC20Burnable, ERC1363, Roles, TokenRecover, Pausable{
// indicates if transfer is enabledboolprivate _transferEnabled =false;
/**
* Emitted during transfer enabling
*/eventTransferEnabled();
/**
* Tokens can be moved only after if transfer enabled or if you are an approved operator.
*/modifiercanTransfer(addressfrom) {
require(
_transferEnabled || hasRole(OPERATOR_ROLE, from),
"DotTokenContract: transfer is not enabled or from does not have the OPERATOR role"
);
_;
}
modifiervalidDestination(address to ) {
require(to !=address(0x0));
require(to !=address(this) );
_;
}
constructor(stringmemory name,
stringmemory symbol,
uint8 decimals,
uint256 cap,
uint256 initialSupply,
bool transferEnabled
)
publicERC20Capped(cap)
ERC1363(name, symbol)
{
require(
cap == initialSupply,
"DotTokenContract: cap must be equal to initialSupply"
);
_setupDecimals(decimals);
if (initialSupply >0) {
_mint(owner(), initialSupply);
}
if (transferEnabled) {
enableTransfer();
}
}
/**
* @return if transfer is enabled or not.
*/functiontransferEnabled() publicviewreturns (bool) {
return _transferEnabled;
}
/**
* Transfer tokens to a specified address.
* @param to The address to transfer to
* @param value The amount to be transferred
* @return A boolean that indicates if the operation was successful.
*/functiontransfer(address to, uint256 value) publicvirtualoverride(ERC20) validDestination(to) canTransfer(_msgSender()) whenNotPausedreturns (bool) {
returnsuper.transfer(to, value);
}
/**
* Transfer tokens from one address to another.
* @param from The address which you want to send tokens from
* @param to The address which you want to transfer to
* @param value the amount of tokens to be transferred
* @return A boolean that indicates if the operation was successful.
*/functiontransferFrom(addressfrom, address to, uint256 value) publicvirtualoverride(ERC20) validDestination(to) canTransfer(from) whenNotPausedreturns (bool) {
returnsuper.transferFrom(from, to, value);
}
functionapprove(address spender, uint256 amount) publicvirtualoverride(ERC20) whenNotPausedreturns (bool) {
returnsuper.approve(spender, amount);
}
functionincreaseAllowance(address spender, uint256 addedValue) publicvirtualoverride(ERC20) whenNotPausedreturns (bool) {
returnsuper.increaseAllowance(spender, addedValue);
}
functiondecreaseAllowance(address spender, uint256 subtractedValue) publicvirtualoverride(ERC20) whenNotPausedreturns (bool) {
returnsuper.decreaseAllowance(spender, subtractedValue);
}
/**
* Function to enable transfers.
*/functionenableTransfer() publiconlyOwner{
_transferEnabled =true;
emit TransferEnabled();
}
/**
* See {ERC20-_beforeTokenTransfer}.
*/function_beforeTokenTransfer(addressfrom, address to, uint256 amount) internalvirtualoverride(ERC20, ERC20Capped) validDestination(to) {
super._beforeTokenTransfer(from, to, amount);
}
}
Contract Source Code
File 5 of 20: ERC1363.sol
Contract Source Code
File 6 of 20: ERC165.sol
Contract Source Code
File 7 of 20: ERC20.sol
Contract Source Code
File 8 of 20: ERC20Burnable.sol
Contract Source Code
File 9 of 20: ERC20Capped.sol
Contract Source Code
File 10 of 20: EnumerableSet.sol
Contract Source Code
File 11 of 20: IERC1363.sol
Contract Source Code
File 12 of 20: IERC1363Receiver.sol
Contract Source Code
File 13 of 20: IERC1363Spender.sol
Contract Source Code
File 14 of 20: IERC165.sol
Contract Source Code
File 15 of 20: IERC20.sol
Contract Source Code
File 16 of 20: Ownable.sol
Contract Source Code
File 17 of 20: Pausable.sol
Contract Source Code
File 18 of 20: Roles.sol
Contract Source Code
File 19 of 20: SafeMath.sol
Contract Source Code
File 20 of 20: TokenRecover.sol
Settings
{"compilationTarget":{"browser/tests/DeFi Of Thrones/DotTokenContract.sol":"DotTokenContract"},"evmVersion":"istanbul","libraries":{},"metadata":{"bytecodeHash":"ipfs"},"optimizer":{"enabled":false,"runs":200},"remappings":[]}