Guest User

Untitled

a guest
Apr 27th, 2018
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.64 KB | None | 0 0
  1. function endSale() public {
  2. require(msg.sender == admin);
  3. require(tokenContract.transfer(admin,tokenContract.balanceOf(this)));
  4. selfdestruct(admin);
  5. }
  6.  
  7. it('ends token sale', function() {
  8. `enter preformatted text here` return DappToken.deployed().then(function(instance) {
  9. // Grab token instance first
  10. tokenInstance = instance;
  11. return DappTokenSale.deployed();
  12. }).then(function(instance) {
  13. // Then grab token sale instance
  14. tokenSaleInstance = instance;
  15. // Try to end sale from account other than the admin
  16. return tokenSaleInstance.endSale({ from: buyer });
  17. }).then(assert.fail).catch(function(error) {
  18. assert(error.message.indexOf('revert' >= 0, 'must be admin to end sale'));
  19. // End sale as admin
  20. return tokenSaleInstance.endSale({ from: admin });
  21. }).then(function(receipt) {
  22. return tokenInstance.balanceOf(admin);
  23. }).then(function(balance) {
  24. assert.equal(balance.toNumber(), 999990, 'returns all unsold dapp tokens to admin');
  25. // Check that token price was reset when selfDestruct was called
  26. return tokenSaleInstance.tokenPrice();
  27. }).then(function(price) {
  28. assert.equal(price.toNumber(), 0, 'token price was reset');
  29. });
  30. });
  31.  
  32. Error: Attempting to run transaction which calls a contract function, but recipient address 0x970c30c59d21df9fe660a266faf2ba0871dc25ad is not a contract address
  33.  
  34. at Object.InvalidResponse (/home/anupam/.config/yarn/global/node_modules/truffle/build/webpack:/~/web3/lib/web3/errors.js:38:1)
  35. at /home/anupam/.config/yarn/global/node_modules/truffle/build/webpack:/~/web3/lib/web3/requestmanager.js:86:1
  36. at /home/anupam/.config/yarn/global/node_modules/truffle/build/webpack:/~/truffle-provider/wrapper.js:134:1
  37. at XMLHttpRequest.request.onreadystatechange (/home/anupam/.config/yarn/global/node_modules/truffle/build/webpack:/~/web3/lib/web3/httpprovider.js:128:1)
  38. at XMLHttpRequestEventTarget.dispatchEvent (/home/anupam/.config/yarn/global/node_modules/truffle/build/webpack:/~/xhr2/lib/xhr2.js:64:1)
  39. at XMLHttpRequest._setReadyState (/home/anupam/.config/yarn/global/node_modules/truffle/build/webpack:/~/xhr2/lib/xhr2.js:354:1)
  40. at XMLHttpRequest._onHttpResponseEnd (/home/anupam/.config/yarn/global/node_modules/truffle/build/webpack:/~/xhr2/lib/xhr2.js:509:1)
  41. at IncomingMessage.<anonymous> (/home/anupam/.config/yarn/global/node_modules/truffle/build/webpack:/~/xhr2/lib/xhr2.js:469:1)
  42. at endReadableNT (_stream_readable.js:1064:12)
  43. at _combinedTickCallback (internal/process/next_tick.js:138:11)
  44. at process._tickCallback (internal/process/next_tick.js:180:9)
Add Comment
Please, Sign In to add comment