Skip to main content
added 9 characters in body
Source Link
Blockpain
  • 173
  • 2
  • 10

Hoping some of you may be able to help me. I have a very simple contract that i have deployed. I won't post the entire contract here, but i will post the one function i am having trouble calling from the terminal.

3 important things... I am using Truffle develop and connected to the network, i have already successfully gotten an instance of contract and I was able to call the other functions in the terminal. This withdrw function i am unable to call. Since it takes a uint I am simply putting in uint but when i call the function it doesn't work. instance.withdraw(22); Shouldn't this call the function or do i need to put it in ether or something?

 require(balances[msg.sender]>= withdrawAmount); balances[msg.sender] -= withdrawAmount; emit LogWithdrawal(msg.sender, withdrawAmount, balances[msg.sender]); return balances[msg.sender]; } } 
function withdraw(uint withdrawAmount) public returns (uint) { require(balances[msg.sender]>= withdrawAmount); balances[msg.sender] -= withdrawAmount; emit LogWithdrawal(msg.sender, withdrawAmount,balances[msg.sender]); return balances[msg.sender]; } } 

Again just to be clear, i am looking for the command in the truffle develop terminal to call this function. I am using instance.withdraw(22); which is not working.

Hoping some of you may be able to help me. I have a very simple contract that i have deployed. I won't post the entire contract here, but i will post the one function i am having trouble calling from the terminal.

3 important things... I am using Truffle develop and connected to the network, i have already successfully gotten an instance of contract and I was able to call the other functions in the terminal. This withdrw function i am unable to call. Since it takes a uint I am simply putting in uint but when i call the function it doesn't work. instance.withdraw(22); Shouldn't this call the function or do i need to put it in ether or something?

 require(balances[msg.sender]>= withdrawAmount); balances[msg.sender] -= withdrawAmount; emit LogWithdrawal(msg.sender, withdrawAmount, balances[msg.sender]); return balances[msg.sender]; } } 

Again just to be clear, i am looking for the command in the truffle develop terminal to call this function. I am using instance.withdraw(22); which is not working.

Hoping some of you may be able to help me. I have a very simple contract that i have deployed. I won't post the entire contract here, but i will post the one function i am having trouble calling from the terminal.

3 important things... I am using Truffle develop and connected to the network, i have already successfully gotten an instance of contract and I was able to call the other functions in the terminal. This withdrw function i am unable to call. Since it takes a uint I am simply putting in uint but when i call the function it doesn't work. instance.withdraw(22); Shouldn't this call the function or do i need to put it in ether or something?

function withdraw(uint withdrawAmount) public returns (uint) { require(balances[msg.sender]>= withdrawAmount); balances[msg.sender] -= withdrawAmount; emit LogWithdrawal(msg.sender, withdrawAmount,balances[msg.sender]); return balances[msg.sender]; } } 

Again just to be clear, i am looking for the command in the truffle develop terminal to call this function. I am using instance.withdraw(22); which is not working.

Source Link
Blockpain
  • 173
  • 2
  • 10

Interacting with Deployed contract- Truffle develop

Hoping some of you may be able to help me. I have a very simple contract that i have deployed. I won't post the entire contract here, but i will post the one function i am having trouble calling from the terminal.

3 important things... I am using Truffle develop and connected to the network, i have already successfully gotten an instance of contract and I was able to call the other functions in the terminal. This withdrw function i am unable to call. Since it takes a uint I am simply putting in uint but when i call the function it doesn't work. instance.withdraw(22); Shouldn't this call the function or do i need to put it in ether or something?

 require(balances[msg.sender]>= withdrawAmount); balances[msg.sender] -= withdrawAmount; emit LogWithdrawal(msg.sender, withdrawAmount, balances[msg.sender]); return balances[msg.sender]; } } 

Again just to be clear, i am looking for the command in the truffle develop terminal to call this function. I am using instance.withdraw(22); which is not working.