Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function endSale() public {
- require(msg.sender == admin);
- require(tokenContract.transfer(admin,tokenContract.balanceOf(this)));
- selfdestruct(admin);
- }
- it('ends token sale', function() {
- `enter preformatted text here` return DappToken.deployed().then(function(instance) {
- // Grab token instance first
- tokenInstance = instance;
- return DappTokenSale.deployed();
- }).then(function(instance) {
- // Then grab token sale instance
- tokenSaleInstance = instance;
- // Try to end sale from account other than the admin
- return tokenSaleInstance.endSale({ from: buyer });
- }).then(assert.fail).catch(function(error) {
- assert(error.message.indexOf('revert' >= 0, 'must be admin to end sale'));
- // End sale as admin
- return tokenSaleInstance.endSale({ from: admin });
- }).then(function(receipt) {
- return tokenInstance.balanceOf(admin);
- }).then(function(balance) {
- assert.equal(balance.toNumber(), 999990, 'returns all unsold dapp tokens to admin');
- // Check that token price was reset when selfDestruct was called
- return tokenSaleInstance.tokenPrice();
- }).then(function(price) {
- assert.equal(price.toNumber(), 0, 'token price was reset');
- });
- });
- Error: Attempting to run transaction which calls a contract function, but recipient address 0x970c30c59d21df9fe660a266faf2ba0871dc25ad is not a contract address
- at Object.InvalidResponse (/home/anupam/.config/yarn/global/node_modules/truffle/build/webpack:/~/web3/lib/web3/errors.js:38:1)
- at /home/anupam/.config/yarn/global/node_modules/truffle/build/webpack:/~/web3/lib/web3/requestmanager.js:86:1
- at /home/anupam/.config/yarn/global/node_modules/truffle/build/webpack:/~/truffle-provider/wrapper.js:134:1
- at XMLHttpRequest.request.onreadystatechange (/home/anupam/.config/yarn/global/node_modules/truffle/build/webpack:/~/web3/lib/web3/httpprovider.js:128:1)
- at XMLHttpRequestEventTarget.dispatchEvent (/home/anupam/.config/yarn/global/node_modules/truffle/build/webpack:/~/xhr2/lib/xhr2.js:64:1)
- at XMLHttpRequest._setReadyState (/home/anupam/.config/yarn/global/node_modules/truffle/build/webpack:/~/xhr2/lib/xhr2.js:354:1)
- at XMLHttpRequest._onHttpResponseEnd (/home/anupam/.config/yarn/global/node_modules/truffle/build/webpack:/~/xhr2/lib/xhr2.js:509:1)
- at IncomingMessage.<anonymous> (/home/anupam/.config/yarn/global/node_modules/truffle/build/webpack:/~/xhr2/lib/xhr2.js:469:1)
- at endReadableNT (_stream_readable.js:1064:12)
- at _combinedTickCallback (internal/process/next_tick.js:138:11)
- at process._tickCallback (internal/process/next_tick.js:180:9)
Add Comment
Please, Sign In to add comment