Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ZeframLou/token-migrator
A simple contract for migrating from an old ERC20 token to a new ERC20 token.
https://github.com/ZeframLou/token-migrator
Last synced: about 2 months ago
JSON representation
A simple contract for migrating from an old ERC20 token to a new ERC20 token.
- Host: GitHub
- URL: https://github.com/ZeframLou/token-migrator
- Owner: ZeframLou
- License: agpl-3.0
- Created: 2022-01-17T09:33:58.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2022-01-23T22:00:01.000Z (almost 3 years ago)
- Last Synced: 2024-08-04T01:02:22.164Z (5 months ago)
- Language: Solidity
- Size: 30.3 KB
- Stars: 35
- Watchers: 2
- Forks: 7
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-foundry - TokenMigrator - A simple contract for migrating from an old ERC20 token to a new ERC20 token. (Templates & Libraries)
README
# TokenMigrator
A simple contract for migrating from an old ERC20 token to a new ERC20 token.
Also supports letting migrators get back their old tokens after a certain time (e.g. 99 years) for shady legal reasons.
The new ERC20 token MUST implement the [IERC20Migrateable](src/interfaces/IERC20Migrateable.sol) interface, specifically a migrate function following the interface `function migrate(uint256 oldTokenAmount, address recipient) external returns (uint256 newTokenAmount)`. When called, the new ERC20 token must mint some amount of new tokens to `recipient` based on `oldTokenAmount`, and return the amount of new tokens minted as `newTokenAmount`. It does not need to make checks about whether old tokens have been locked. It MUST check that the caller is indeed the `TokenMigrator` contract.
## Installation
To install with [DappTools](https://github.com/dapphub/dapptools):
```
dapp install zeframlou/token-migrator
```To install with [Foundry](https://github.com/gakonst/foundry):
```
forge install zeframlou/token-migrator
```## Local development
This project uses [Foundry](https://github.com/gakonst/foundry) as the development framework.
### Dependencies
```
make update
```### Compilation
```
make build
```### Testing
```
make test
```