Questions tagged [payable]

The payable modifier in Solidity can be used to make smart contract functions able to receive either, or to make Ether transfers to address variables possible.

Filter by
Sorted by
Tagged with
0
votes
2answers
366 views

Why transfer funds breaks contract?

My deployed contract called successfully only by "function invocation" through web3 or Remix. But it always failed when I sending funds to the contract. I thought that only requirement that contract ...
7
votes
1answer
1k views

How to cast address to address payable in solidity 0.5.0

Got address from 3rd-party library: address wallet = rlp[5].toAddress(); And wanna transfer some funds to it: wallet.transfer(amount); Got error: TypeError: Member "transfer" not found or not ...
16
votes
2answers
5k views

What's the difference between 'address' and 'address payable'?

I saw a Solidity smart contract where some variables were declared with the type address and some were declared with the type address payable. What are the differences between the two? Do they store ...
2
votes
2answers
889 views

How to accept bitcoin and transfer tokens from smart contract to sender ethereum address

I have created sample tokens Smart Contract with the payable feature/constructor, if someone pay from their Ethereum address to Smart Contract will get instant token into their Ethereum address. But ...
4
votes
2answers
3k views

How can a smart contract run when receiving ether directly, not through a function?

I have a smart contract with a payable bet() function. When someone sends 1 ether to the bet function, the contract is executed. I'd like the contract to run the same code when someone sends ether to ...
14
votes
1answer
1k views

Bad Jump Destination error

I wrote what I thought was a dead simple contract - a saving jar... you add value ("save") into the jar and when the balance of the contract reaches a certain amount ("target"), then I am able to ...
3
votes
1answer
2k views

What denomination should I issue my ERC20 token by?

Following the "Create a cryptocurrency" tutorial on ethereum.org, I ended up with the following function (stripped down): function () payable { if (msg.value == 0) { return; } uint256 tokens =...
3
votes
0answers
1k views

Hi i am getting error msg.value non-payable [duplicate]

I had this function function enter() { if (msg.value >10 finney) { uint amount=msg.value; uint payout; but i am getting error: ballot.sol:56:9: Warning: "msg.value" used in non-payable ...
2
votes
1answer
60 views

Are the functions in this code missing the payable modifier?

These functions are transferring ether between balances, so why aren't they modified with payable?
2
votes
0answers
1k views

Web3 - how to send transaction with some data and include Ether at the same time?

Using web3 0.20.3 I want to call function and send some Etherium at the same time. JavaScript Contract = web3.eth.contract(ABI); Instance = Contract.at('0x162b74ea16da6ae9d7f7b349eaeab2fcadf4e835')...
0
votes
1answer
929 views

Call a smart contract payable function sending erc20 token

We can send a er20 token to a smart contract. To track it we can use a function ( msg.value is always wei ) But how do i verify if the erc20 token is actually sent ? For example i want to set map ...