Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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.

Awesome Lists containing this project

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
```