I'm pretty much new on this. But I really want to learn.
I just created a contract for mintable token on Kovan test-net. But, I'm getting confused when I try to buy the token, it's always shown x000.000.000.000.000.000 instead just 100 or 1000. My Token's decimal is 2 and the price is 150 for 1 ETH.
Here's the Token code :
contract Test is MintableToken {
string public constant name = "TestToken";
string public constant symbol = "TET";
uint8 public constant decimals = 2;
}
And here's the 2_deploy_contract.js code
var TestTokenPresaleTest = artifacts.require("./TestTokenPresaleTest.sol");
module.exports = function(deployer, network, accounts) {
return liveDeploy(deployer, accounts);
};
function latestTime(){
return web3.eth.getBlock('latest').timestamp;
}
const duration = {
seconds: function(val) { return val},
minutes: function(val) { return val * this.seconds(60) },
hours: function(val) {return val * this.minutes(60) },
days: function(val) {return val * this.hours(24) },
weeks: function(val) {return val * this.days(7) },
years: function(val) {return val * this.days(365) }
};
async function liveDeploy(deployer, accounts){
const BigNumber = web3.BigNumber;
const RATE = new web3.BigNumber(100);
const startTime = latestTime() + duration.minutes(10);
const endTime = startTime + duration.hours(12);
console.log([startTime, endTime, RATE, accounts[0]]);
// uint256 _startTime, uint256 _endTime, uint256 _rate, address _wallet)
return deployer.deploy(TestTokenPresaleTest, startTime, endTime, RATE, accounts[0]).then( async () => {
const instance = await TestTokenPresaleTest.deployed();
const token = await instance.token.call();
console.log('Token Address', token);
})
}
I'm using OpenZepellin and Truffle for doing this.
Can anyone help?
Best Regards