Solidity
如何使用 msg.sender 創建 mint 函式
我想要一個薄荷函式,但不是 _mint(to, amount) 我想要 _mint(msg.sender, amount) 我該怎麼做?
你可以試試這個:
function mint(uint256 _amount) public { //Now you call the internal mint function from your ERC20 token //You can find more about it here //https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/ERC20.sol _mint(msg.sender, _amount); }