All Questions
Tagged with payable transactions
23 questions
0
votes
1
answer
36
views
Why is the function throwing an error when called from another contract but not when called independently?
I have 3 solidity contracts, main.sol, provider.sol and allowance.sol
Now from main.sol, I am calling a function "Transact", which calls another function "Transact" in provider.sol ...
0
votes
1
answer
748
views
how to send wei unit in call [duplicate]
In a contract i was trying to send ether in wei units using the call method.
or is there any way to send fractions of ether like 0.048 ,
i wanna send 0.048to my contract from an account which ...
0
votes
1
answer
36
views
Is the method call along with the book-keeping to send funds to a smart contract and the transaction to actually transfer funds separate?
I am new to ethereum or any blockchain for that matter. I have conceptual questions after looking at the "Fundme" example from freecodecamp.
The simplified fund() method does simple book-...
0
votes
1
answer
538
views
How to Call a payable function I am getting error={"code":-32603,"message":"Internal JSON-RPC error.","data":{"code":3,"message":"execution reverted"}
I am trying to call buy function which is a payable function using metamask signer method. I am getting error for sending incorrect ether value. Here I have set the price as 1 which is 0x01 in hex ...
0
votes
1
answer
194
views
Payable function transaction failing
Please see the following code:
// SPDX-License-Identifier: GPL-3.0
pragma solidity 0.8.1;
contract Crowdfund {
uint fundLimit = 3 ether;
bool contractOpen = true;
function donate() ...
2
votes
1
answer
2k
views
How to transfer Ether from a smart contract to an account?
I wrote a very simple smart contract. The goal is to:
transfer some Ether from an account A to the smart-contract
and then from the smart-contract to another account B.
Here is the contract:
pragma ...
3
votes
3
answers
3k
views
What’s the difference between fallback() and receive() and between payable vs transfer?
I saw there are two type of function available, but I don't understand the difference. If another contract send to my contract for example $100 BUSD, how do I know when I received them?
I saw there ...
0
votes
1
answer
1k
views
Where to pass the value at while using msg.value?
I had been using remix IDE for a long time but recently switched to using Truffle. Everything else was fine until I had to build a function for payment. In remix IDE, there is a box provided, labelled ...
0
votes
1
answer
168
views
How does Solidity handle multiple payables in one function?
While I was experimenting with Solidity, this question popped in my head and I've been struggling to figure it out ever since. To test things, I wrote this simple contract:
contract test{
uint256 ...
0
votes
0
answers
72
views
How to send ethers to specific address based on solidity contract but not web3py?
I have written a solidity code, running it on Remix and I use ganache and web3py library to interact with it.
My code is something like this:
contract simplePayment{
function sendPayment(...
1
vote
2
answers
249
views
How to send Ethereum to smart contract address without using keyword "payable"?
I have tried to send Ethereum from my wallet to the smart contract address by using the below code:
pragma solidity >=0.6.10;
contract NoUsePayable {
function getBalance() public view returns (...
0
votes
1
answer
755
views
How can a Smart Contract pull an amount of Ether equal to its own balance from an External Account?
I'm writing a 2 Player Game. Rules:
Player 1 must place a bet (and send some ether to the contract).
Then, Player 2 must match the bet placed by Player 1, and send the same exact amount of ether to ...
0
votes
1
answer
49
views
Smart contracts: is every public function payable?
I am aware of the payable annotation on the public methods. But just want to make things more clear:
is every public function payable? Even without the payable annotation?
what would happen if a ...
0
votes
1
answer
507
views
Sending the bool to ```function() payable``` in another contract
I am trying to create a pair of contracts, let's say C1 and C2. I want to add an if...else in payable function function() public payable{} of C2, which works on the bool value returned by contract C1, ...
1
vote
1
answer
354
views
32/5000 Update on balance in contract
How do I update my balance on a contract?
I created a function that receives an address as a parameter, I can visualize the balance:
address.balance.
But I want to transfer the balance to an ...
8
votes
4
answers
19k
views
Transfer from contract address
I created a contract with a payable function but the ether is stored in the contract I am looking for a way to transfer the ether to another address
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')...
1
vote
1
answer
2k
views
Transaction reverting when it hits Require statement in payable function
So briefly, when the user clicks a submit button from UI, it needs to pass a fixed price _price to pay() function (there are options to choose a fixed price on UI ex: 0.01, 0.02, 0.03). In the ...
4
votes
1
answer
636
views
Transaction fee restrictions with solidity
Can I restrict transaction fee (gas price) for the payable method of the crowdsale contract. And if I can, how?
And one more question, if I restrict fee and call revert() - this transaction will be ...
2
votes
2
answers
3k
views
Gas limit dangerously high
When I tried to send ether to my contract, I get this error. Even if try to change the value of Gas Limit and Gas Price the transaction still fails. What could be the possible reason?
What I ...
0
votes
1
answer
382
views
Crowdsale Contract, why I can't send ether to contract?
Ethereum wallet displays:
It seems this transaction will fail.
But why? Here is the code:
function () payable {
uint amount = 0;
amount += msg.value;
balanceOf[msg.sender] += amount;
...
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 ...
4
votes
1
answer
568
views
Will payable modifier throw if no ether is sent to it?
Should I add a check to make sure Ether was sent along with the transaction or is that redundant?