‘클레이튼 댑 개발’ 정리 – Truffle

truffle v5.0.26까지 지원

원격 EN 노드로 배포하려면 truffle-hdwallet-provider-klaytn을 사용해야 한다.

https://ko.docs.klaytn.com/smart-contract/ide-and-tools/truffle

truffle console

–network <name>

 

let instance = await MetaCoin.deployed()

instance.sendCoin(accounts[1], 10, {from: accounts[0]})

let balance = await instance.getBalance(accounts[0])

balance.toNumber()

 

let result = await instance.sendCoin(accounts[1], 10, {from: accounts[0]})

result.logs[0]

 

let specificInstance = await MetaCoin.at(“0x1234…”);

 

instance.sendTransaction({…}).then(function(result) { // Same transaction result object as above. });

instance.send(web3.utils.toWei(1, “ether”)).then(function(result) { // Same result object as above. });

 

const instance = await MyContract.deployed(); const amountOfGas = await instance.sendTokens.estimateGas(4, myAccount);

const instance = await MyContract.deployed(); const result = await instance.getTokenBalance.sendTransaction(myAccount);

 

const instance = await MyContract.deployed(); instance.methods[‘setValue(uint256)’](123); instance.methods[‘setValue(uint256,uint256)’](11, 55);

About the Author
(주)뉴테크프라임 대표 김현남입니다. 저에 대해 좀 더 알기를 원하시는 분은 아래 링크를 참조하세요. http://www.umlcert.com/kimhn/

Leave a Reply

*