@soliditylabs/erc20-permit
v1.0.0
Published
Package for implementing the ERC20 permit (EIP-2612)
Downloads
3
Maintainers
Readme
ERC20-permit
Package for implementing the ERC20 permit (EIP-2612). Unaudited, use at own risk.
Installation
- Install the package via NPM:
$ npm install @soliditylabs/erc20-permit --save-dev
Or Yarn:
$ yarn add @soliditylabs/erc20-permit --dev
- Import it into your ERC-20 contract:
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.0;
import {ERC20, ERC20Permit} from "@soliditylabs/erc20-permit/contracts/ERC20Permit.sol";
contract ERC20PermitToken is ERC20Permit {
constructor (uint256 initialSupply) ERC20("ERC20Permit-Token", "EPT") {
_mint(msg.sender, initialSupply);
}
function mint(address to, uint256 amount) public {
_mint(to, amount);
}
function burn(address from, uint256 amount) public {
_burn(from, amount);
}
}
Running tests
- Clone the repository
$ git clone https://github.com/soliditylabs/ERC20-Permit
- Install the dependencies
$ cd ERC20-Permit
$ npm install
- Run Buidler Node
$ npx buidler node
- Run tests
$ npm test