in my solidity contract ERC20 I have a function that looks like this:
function buy() payable public {
uint amount = msg.value / buyPrice; // calculates the amount
_transfer(address(this), msg.sender, amount); // makes the transfers
}
Who should be paid in order to buy some tokens? Is the owner of the tokens minted? Also a normal "send" Ether to the owner of the contract would suffice to buy tokens?
Thank you in advance for the answers.
Who should be paid in order to buy some tokens? Is the owner of the tokens minted?
As I know, all amount we send for buy tokens should be paid to contract itself. It means all ethers that sent to contract for buy tokens that are stored on contract and these ethers are used for buying or selling tokens circulation(if you provided sell option in a contract).