Skip to main content

All Questions

Tagged with
Filter by
Sorted by
Tagged with
-1 votes
1 answer
145 views

sending eth to a specific address

i want to develop a contract where. when the function Optimizer is called it will send a specific amount of eth to a specific wallet address, problem is the wallet address is not receiving the amount ...
stofu's user avatar
  • 103
1 vote
1 answer
78 views

I tried to make a function that does the same operation both in ERC20, ETH. But I don't know how to do modularize it considering payable

I wanted to do commit both on ERC20 Token and ETH. _addCommitment function is about update local commit value. It will be better if two functions that work the same function can be combined into one, ...
Pia's user avatar
  • 11
0 votes
1 answer
183 views

Unable to deposit ether inside contract using receive function

Code is : contract sendEther{ //to send ether, we need to deposit some ether first in this contract //We can do it by declaring constructor as payable which enables us to deposit some ether ...
shikamaru's user avatar
0 votes
1 answer
217 views

Problem in withdraw() function in Auction contract, !payable is used still its able to refund the amount of the lower bidders when we click withdraw

In Withdraw Function, !payable condition is given, but payable condition not given, still when we click withdraw, then we will get our money back if we dont have the highest bid pragma solidity ^0.8.4;...
Aviral Chaudhary's user avatar
0 votes
1 answer
20 views

I'm trying to deploy a Wallet onto the Blockchain AND deposit some Ether in it AT THE SAME time...... ie using the Remix DEPLOY button

I feel this should be VERY SIMPLE. So code the Constructor to require an Amount and therefore that Amount will be then taken from the Metamask Wallet at the same time as the GasFees are paid for the ...
user16960918's user avatar
0 votes
1 answer
21 views

What would happen if I remove + from the line number 6?

pragma solidity ^0.8.1; contract SendMoneyExample{ uint public balanceRecived; function recivedMoney()public payable{ balanceRecived+=msg.value; } function getBalance()public ...
Akash's user avatar
  • 1
1 vote
1 answer
3k views

How can I use the payable function to transfer fixed ether in a transaction?

contract MyContract { address payable[] recipients; function sendEther(address payable recipient) external payable { recipient.transfer(1 ether); } } Error- transact to ...
Sumeet Suryawanshi's user avatar
1 vote
1 answer
2k views

How can i get the Payable function to send the right amount to the owner address?

function () public payable { uint tokens; /// this math isnt safe tokens = msg.value * 10; /// this didnt give us the address we needed address tokenOwner; ...
Fight Fire With Fire's user avatar
3 votes
2 answers
6k views

ParserError: Expected primary expression - address payable - payable()

I'm trying to get myself familiarized with ethereum. So I was going through a repo, and tried to rum the code : function transferFundOnResolve(uint cid) private { // Could also be used: ...
Maifee Ul Asad's user avatar
1 vote
2 answers
354 views

How to use function arguments of payable function for require statement?

function createCampaign(uint deposit, address ll) public payable{ dpst = deposit; require(msg.value > (40*dpst)/100 wei); address newCampaign = address((new Campaign).value(msg.value)(...
Rahul Savsani's user avatar
0 votes
1 answer
232 views

How to add actual Ether to custom token

I built a token by creating a smart contract for it, and have successfully connected to it, which is on a Ethereum test-net. Using web3.js I have been able to send token from one account to another ...
TJB's user avatar
  • 153
19 votes
1 answer
5k views

Can a contract with no payable function have ether?

The question in the title says it all. To the best of my understanding, the only way to deposit ether into a contract is by calling a payable function, and set msg.value larger than 0 (and of course, ...
goodvibration's user avatar
7 votes
1 answer
14k views

How do you send Ether as a function to a contract using Remix?

New to Solidity... When deploying a contract on a private blockchain using Remix, I am unable to execute payable functions. When executing these functions, the following error message displays: gas ...
29A's user avatar
  • 347
3 votes
0 answers
2k 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')...
Mars Robertson's user avatar
1 vote
1 answer
5k views

Can I see an example of a payable function in practical use?

I would like to see an example of a function modified as payable in practice. I would like for it to accept payment and hold the ether. I would like to read another function in the same contract that ...
Kuelf Deez's user avatar
2 votes
2 answers
2k 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 ...
Prabhat Sutar's user avatar
0 votes
0 answers
135 views

can't get transfer to execute

I am trying to run the following solidity function: function test() payable { msg.sender.transfer((balances[msg.sender]/1000)*this.balance); } Where this.balance is 0.1 Ether and balances[msg.sender]...
ZhouW's user avatar
  • 1,358
0 votes
3 answers
225 views

Require: How to avoid users of my smart contract from losing their ether

I have a smart contract lottery that requires people to send exactly 0.2 ethers to its address in order to participate. In the constructor: ante = 0.2 ether; And in the payable function ...
Anto's user avatar
  • 311
3 votes
1 answer
1k views

Send ether to a payable function from nethereum

I have created a payable function in a smart contract and deployed it in a private blockchain network. Now I am using Nethereum to make rpc calls to the geth node on which the network is running. But ...
vitoscalleta's user avatar
3 votes
2 answers
654 views

Can a miner "cheat" my lottery smart contract?

I developed a smart contract that you: 1) Send 1 ether to an address, the contract saves your address 2) After 5 people have sent one ether, the contract chooses one address at random and sends the ...
Anto's user avatar
  • 311
4 votes
2 answers
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 ...
Anto's user avatar
  • 311