-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Description
The default ERC20 contract template provided in Remix does not deploy when compiled as-is.
Repro
- Visit https://remix.polkadot.io/
- Click on the big fat "ERC20" button on the start screen
- Select "MyToken.sol" in file explorer
- Click "Compile"
- Open "Deploy" menu
- Click "Deploy"
- Sign the tx
Error
creation of MyToken errored: Error occurred: the initcode size of this transaction is too large: it is 82059 while the max is 49152.
the initcode size of this transaction is too large: it is 82059 while the max is 49152
You may want to cautiously increase the gas limit if the transaction went out of gas.
Discussion
Apparently the ERC20Permit extension is too heavy to be compiled into the contract. Removing the import and extension bit makes the contract deploy.
Reducing the code to this works:
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
contract MyToken is ERC20 {
constructor() ERC20("MyToken", "MTK") {}
}Metadata
Metadata
Assignees
Labels
No labels