How do i take ETH from msg.sender?
If my contract public function is for a 0.01 ETH donation, how can i transfer the ETH from the msg.sender to the contract?
Jan 11, 2022, 2:06 PM
there is no transferFrom for native tokens.
Only payable functions with msg.value
Only payable functions with msg.value
Jan 11, 2022, 2:18 PM
awesome, figured it out. Thanks
Jan 11, 2022, 2:30 PM
No there is a way to transfer native coin
It comes something like address(this).transfer(msg.value)
Sorry i forgotten about that
I can't remember it perfectly
Jan 11, 2022, 3:42 PM
In Remix Javascript VM , can i send ETH to a contract address without adding a function to the contract to receive Eth?
Jan 11, 2022, 3:52 PM
You cant
You need to add a fallback function for that
Or else your transaction will be reverted
Jan 11, 2022, 4:03 PM
You would need to add a receive/default funciton for that
Jan 11, 2022, 4:03 PM
My contract has the fallback and receive functions. However i cant see anywhere in the Remix UI that allows me to transfer Eth.
Jan 11, 2022, 4:04 PM
that's because remix only shows u the interface of the contract (the functions available). Idk if it provides some input to send normal tx
are u using a testnet? if so, you could just send ether through your wallet
Jan 11, 2022, 4:06 PM
Ya i can do it on the testnet with Metamask, just wondering if i can do it using remix. Doesnt seem its possible.
Jan 11, 2022, 4:06 PM
I think you can just use another function for that
Just to send ether to a specific address
Jan 11, 2022, 4:15 PM
like this: function pay()public payable{}
Jan 11, 2022, 4:16 PM
Yeah
Function pay(address _to) public payable {}
In that function
Jan 11, 2022, 4:17 PM
Ya just didnt want to be added unnecessary functions to my contract.
Jan 11, 2022, 4:17 PM
Then i will check about it for you and tell you
Jan 11, 2022, 4:18 PM
thanks
Jan 11, 2022, 4:18 PM
I think there is no normal way
But there might be some way like using web3
Jan 11, 2022, 4:20 PM
Can i just send someone my LP tokens and that gives them ownership over the liquidity?
Jan 11, 2022, 4:25 PM
You can check it out in the task manager
Jan 11, 2022, 6:12 PM