My contract will be holding ETH because I'm selling NFT's, but how do I transfer a specific amount to a specific wallet address?
wallet address and amount if fixed
transfer.to(wallet, amount);
My contract will be holding ETH because I'm selling NFT's, but how do I transfer a specific amount to a specific wallet address?
wallet address and amount if fixed
transfer.to(wallet, amount);
create an external method that is only callable by you, pass wallet and amount as parameters and call transfer
Only callable by me, will not work, this needs to be done automatically when a user mints a NFT
then call walletAddress.transfer(amount) in the mint function
Tried.....
address(0xdD870fA1b7C4700F2BD7f44238821C26f7392148).transfer(1000000000000000000);
This throws an error: TypeError: "send" and "transfer" are only available for objects of type "address payable", not "address".
replace "address" with "payable":
payable(0xdD870fA1b7C4700F2BD7f44238821C26f7392148).transfer(1000000000000000000);
payable() creates an object of type address payable. This is necessary since solidity 6.0.0 (source)