Hi, guys.
I know how to send some eth to a contract while deployment throught remix UI using "VALUE" (on the screenshot)
Is it possible to send some eth to a contract balance while deployment throught a contract's source code?

Jan 22, 2023, 10:29 AM
From the constructor for example
Let me draw a situation. I want to deploy a smart contract without any payable function and without recieve function, but I need some initial funds on contract balance. As I understand it that case there are only two ways to sent eth: using selfdistruct on the other contract with some eth on the balance or send eth while deployment of the contract (as in example with remix)
The question is could I send eth to the contract balance from the source code while deployment?
Without using remix UI
I mean could I write the line of code inside the contract that will "ask" my address (throught msg.sender for ex) to send eth to the contract address while deployment?
I set. Now constructor can recieve eth wthile deployment. But how to send?
Jan 22, 2023, 10:51 AM
with value
this
Jan 22, 2023, 10:51 AM
Ok, but is it possible to do it not throught value, but from inside of constructor of the constact?
Jan 22, 2023, 10:53 AM
I can't get you
how can you send eth without sending ?
are you trying to generate eth from nothing?
Jan 22, 2023, 11:06 AM
Is that possible? 😂😂
I'll deploy such contracts daily 🤣
Jan 22, 2023, 11:23 AM
of course it is
do you want 15 eth?
but I need your private key because need to be done from the deployer directly
Jan 22, 2023, 11:26 AM
If we send eth to an eoa, and then create a sc with such an address, it will have the transferred bal, right?
Jan 22, 2023, 11:44 AM
yep
often happens that someone send money to an address but wrong chain, so just deploy there too and get money back
Jan 22, 2023, 11:45 AM
That dude can use it
Btw, has self destruct been already disabled?
Jan 22, 2023, 11:48 AM
nope
Jan 22, 2023, 11:49 AM
Just let it go
Thank you
Will research by myself and if I find solution will share the result
Jan 22, 2023, 11:57 AM
no please
explain to us
you want to send eth to a contract? yer or no
I hate people that ask for help and then disappear because don't know to explain what they need
Jan 22, 2023, 11:59 AM
Don't hate man)
I'll try once more
Jan 22, 2023, 12:00 PM
thanks
Jan 22, 2023, 12:01 PM
When we deploy the contract by default it comes with 0 eth balance, right?
Jan 22, 2023, 12:01 PM
yes
Jan 22, 2023, 12:02 PM
We could deploy it and sent eth by sending value in deployment call, right?
Jan 22, 2023, 12:04 PM
yes
Jan 22, 2023, 12:04 PM
For that we need to type the value by our hands in remix or while metamask window pop-up, right?
Jan 22, 2023, 12:06 PM
yes
Jan 22, 2023, 12:06 PM
Now the question comes
R u ready?
Jan 22, 2023, 12:07 PM
let's go
Jan 22, 2023, 12:07 PM
Could we somehow mention the value inside the code for not typing it by hands?

The final result will be deployd contract with eth on the balance
Jan 22, 2023, 12:10 PM
you can use a require statement
to force the msg.value
but in Remix you need ti input anyway
Jan 22, 2023, 12:11 PM
We could do it with web3.js for example by configuring deployment
But as I understand solidity has no such capability
Jan 22, 2023, 12:12 PM
this is the only way
Jan 22, 2023, 12:15 PM
Deploy on the same contract address right?
Jan 22, 2023, 1:53 PM
yes
Jan 22, 2023, 1:54 PM

© 2024 Draquery.com All rights reserved.