contract DTWDToken is Context, ERC20Burnable, ERC20Pausable, DTWDContractBase {
	uint8 public decs = 18;	
	uint256 public INITIAL_SUPPLY = 300000000000 * (10 ** uint256(decs));
	
	constructor() public ERC20("Digital New Taiwan Dollar Token", "DTWD"){
	  _mint(msg.sender, INITIAL_SUPPLY);
	}

	// For common use case (e.g. Write trading record on Ethereum):
	function approveAndCall(address spender, uint256 amount, string memory data) public returns (bool success) {
		approve(spender, amount);	// 給予要操作轉帳的合約允許之意。
        TokenRecipient(spender).receiveApproval(msg.sender, amount, address(this), data);
        return true;
	}
	
	function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual override(ERC20, ERC20Pausable) {
        super._beforeTokenTransfer(from, to, amount);
    }

	function balanceOfWei(address owner) public view returns(string memory amount) {
		return uint2str(this.balanceOf(owner));
	}

	function uint2str(uint i) internal pure returns (string memory) {
    	if (i == 0) return "0";
    	uint j = i;
    	uint length;
    	while (j != 0) {
        	length++;
        	j /= 10;
    	}
    	bytes memory bstr = new bytes(length);
    	uint k = length - 1;
    	while (i != 0) {
			bstr[k--] = byte(uint8(48 + i % 10)); 
        	i /= 10;
    	}
    	return string(bstr);
	}
}
function approveAndCall(address spender, uint256 amount, string memory data) public returns (bool success) {
	approve(spender, amount);	// 給予要操作轉帳的合約允許之意。
       TokenRecipient(spender).receiveApproval(msg.sender, amount, address(this), data);
       return true;
}

// For common use case (e.g. Write trading record on Ethereum):