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.

256 questions
2
votes
1 answer

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?
Jossie Calderon
  • 792
  • 1
  • 8
  • 14
1
vote
0 answers

Why i cant initialise a variabel with msg.sender

why i can't initialise a variable address payable public owner=msg.sender; but i have to do this instead address payable public owner; constructor() payable { owner = payable(msg.sender); }
0
votes
1 answer

ParserError: Expected ',' but got 'payable' admin.transfer(address payable(this).balance); ^-----^

I have write a small smart contract. however there is problem. please see below full code pragma solidity ^0.5.16; import "./x.sol"; contract xSale { address admin; x public tokenContract; uint256 public tokenPrice; uint256 public…
0
votes
1 answer

payable function not working

function() payable external { eth_balance[msg.sender] += msg.value; } This is not working. The execution is reverted and uses about 21,000 gas. No matter if I set the gas crazy high like 800,000 it still fails. This is on rinkeby network. Any…