My test:
var DASToken = artifacts.require("DASToken");
contract('DASToken', function (accounts) {
const tokenName = 'DA$ name';
const tokenSymbol = 'DA$ symbol';
const tokenDecimals = 1;
const tokenSupply = Math.pow(10, 9 + tokenDecimals);
const tokenInitialHolder = accounts[0];
const tokenContractOwner = accounts[1];
it("Should test transmission of DA$ tokens", function () {
const tokensReceiver = accounts[2];
const amountToSend = 100;
var dasToken;
DASToken.new(
tokenName, tokenSymbol, tokenDecimals, tokenSupply, tokenInitialHolder, {from: tokenContractOwner}
).then(function (instance) {
dasToken = instance;
assert.ok(dasToken.address);
//
// Contract created, do the test transfer
console.log('send transaction');
return dasToken.transfer(tokensReceiver, amountToSend, {from: tokenInitialHolder});
}).then(function (instance) {
console.log('transaction finished');
})
});
});
Console output:
Contract: DASToken
✓ Should test transmission of DA$ tokens
5 passing (264ms)
send transaction
/usr/lib/node_modules/truffle/node_modules/bn.js/lib/bn.js:6
if (!val) throw new Error(msg || 'Assertion failed');
^
Error: Number can only safely store up to 53 bits
at assert (/usr/lib/node_modules/truffle/node_modules/bn.js/lib/bn.js:6:21)
at BN.toNumber (/usr/lib/node_modules/truffle/node_modules/bn.js/lib/bn.js:506:7)
at /usr/lib/node_modules/truffle/node_modules/ethjs-abi/lib/index.js:82:59
at Array.forEach (native)
at decodeParams (/usr/lib/node_modules/truffle/node_modules/ethjs-abi/lib/index.js:78:9)
at Object.decodeEvent (/usr/lib/node_modules/truffle/node_modules/ethjs-abi/lib/index.js:123:10)
at /usr/lib/node_modules/truffle/node_modules/truffle-contract/contract.js:73:38
at Array.map (native)
at Object.decodeLogs (/usr/lib/node_modules/truffle/node_modules/truffle-contract/contract.js:44:19)
at Object.callback (/usr/lib/node_modules/truffle/node_modules/truffle-contract/contract.js:172:35)
error produced by the line return dasToken.transfer(tokensReceiver, amountToSend, {from: tokenInitialHolder});
in the console I see send transaction but do not see transaction finished
I found a reason of this problem
to implement my token I used this code (ERC223): https://github.com/Dexaran/ERC23-tokens/tree/Recommended
contract DASToken is ERC223Token, Owned {...}
But ERC223 describes an event Transfer with indexed field bytes indexed data. If remove indexed from parameter type - everything is OK
This happens because only fixed-size types can be indexed.
i.e. bytes and string cannot be indexed.
Thanks for figuring this out! Cheers!
Most helpful comment
I found a reason of this problem
to implement my token I used this code (ERC223):
https://github.com/Dexaran/ERC23-tokens/tree/Recommendedcontract DASToken is ERC223Token, Owned {...}But ERC223 describes an event
Transferwith indexed fieldbytes indexed data. If removeindexedfrom parameter type - everything is OK