I have been using Remix for really quick contracts rather than spinning up a Truffle or a Hardhat project (both of which are still pretty quick to do).
This makes it easy to import OpenZeppelin Contracts.
Note: You should only use code published in an official release of OpenZeppelin Contracts, the latest release is 3.4. When importing via GitHub on Remix you can specify the release tag, (otherwise you will get the latest code in the master branch). The example below imports v3.4.0.
Thanks for this, Andrew @abcoathup . Just to confirm for others as I have tested it, this contract creates an ERC-20 with fixed supply, 18 as decimal input with your chosen token symbol and name. @abcoathup can you confirm that this is fixed supply? I think for burn / mint it would need to invoke a more complex smart contract.
I think yes, cause the type of function _mint() is internal and it only is called in the constructor .
If you want mint/burn in your token contract, you can write a contract derives from ERC20, so you can write function contains _mint() and _burn() to achieve, such as:
function mint(address to, uint256 amount) public onlyOwner {
_mint(to, amount);
}
The example is of a fixed supply ERC20, with 18 decimals and hardcoded name and symbol.
As @skyge suggested, for a mintable, pausable contract you could create your own extending from the OpenZeppelin Contracts ERC20 implementation and Access Control.
Trying to verify my token on PolygonScan 0x3d1a45b45f7d2476ca093b02179daeffd6a95213.
I did a simple contract in remix the other day using the import function but when you do that it doesnt show the whole contract. I successfully deployed the token but Now I would like to verify it on Polygonscan.
I didnt change anything else. I cant remember if the pragma was a different version but I dont think so. Is there anyway to find this whole source code to verify it??
Another issue is when I deploy I get an orange box with this text inside:
contracts/Token.sol: Warning: SPDX license identifier not provided in source file. Before publishing, consider adding a comment containing "SPDX-License-Identifier: " to each source file. Use "SPDX-License-Identifier: UNLICENSED" for non-open-source code. Please see https://spdx.org for more information.
hello can you please give me inputs about importing openzeppelin conrtacts in remix? i saw you in this video, but the link provided in the youtube has gone missing. hope you can help. please. thank you! and God Bless!
copy openzeppelin contracts link you want to use, after that go to Remix and in home section you can see Load From , choose github and paste the link you copy and it will automatically import the file