Skip to content

Instantly share code, notes, and snippets.

@wanderingstan
Created May 3, 2018 00:11
Show Gist options
  • Save wanderingstan/cdfe788a0cf855d2c6016ade9709a909 to your computer and use it in GitHub Desktop.
Save wanderingstan/cdfe788a0cf855d2c6016ade9709a909 to your computer and use it in GitHub Desktop.
Notes for debugging erc20 contracts with truffle

https://ethereum.stackexchange.com/questions/15100/how-to-interact-with-contracts-using-the-abstraction-in-truffle/15102

OriginToken.deployed().then(function(instance) { meta = instance; });

meta.getBalance.call(account).then(function(myBal) { balance = myBal; });

meta.balanceOf.call(account).then(function(myBal) { balance = myBal; });


var meta; var balance; var accounts; var account;
web3.eth.getAccounts(function(e,a) { accounts=a; account = accounts[0];}); 
account = accounts[0];

OriginToken.deployed().then(function(instance) { meta = instance; });

meta.balanceOf.call(account).then(function(myBal) { balance = myBal; console.log(myBal) });

balance.toString(10);



TutorialToken.deployed().then(function(instance) { meta = instance; });

var meta; var balance; var accounts; var account; web3.eth.getAccounts(function(e,a) { accounts=a; account = accounts[0];}); 

OriginToken.deployed().then(function(instance) { meta = instance; }); meta.balanceOf.call(account).then(function(myBal) { balance = myBal; console.log(myBal) });

TutorialToken.deployed().then(function(instance) { meta = instance; }); meta.balanceOf.call(account).then(function(myBal) { balance = myBal; console.log(myBal) });

TutorialToken.deployed().then(function(instance) { meta = instance; }); meta.balanceOf.call(account).then(function(myBal) { balance = myBal; console.log(myBal) });
TutorialToken.deployed().then(function(instance) { meta = instance; }); meta.balanceOf.call(account).then(function(myBal) { balance = myBal; console.log(myBal) });

TutorialToken.deployed().then(function(instance) { meta = instance; }); meta.transferFrom(account, "0xf17f52151EbEF6C7334FAD080c5704D77216b732", 100, { from: account, gas: 4476768 }).then(function(tx) { console.log(tx) });

How to view events:

https://ethereum.stackexchange.com/questions/31681/how-to-view-the-arguments-in-events-under-truffle-console

ENS for tokens?

https://medium.com/cardstack/upgradable-contracts-in-solidity-d5af87f0f913

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment