forked from circlefin/stablecoin-evm
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Update centrehq to circlefin * Update centre-tokens references * Remove typo * Update more docs * Organize README * Add more content * Add reference to OZ Proxy Upgrade Pattern
- Loading branch information
1 parent
a1b5455
commit 08e3b16
Showing
6 changed files
with
298 additions
and
176 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,35 @@ | ||
# centre-tokens | ||
|
||
Fiat tokens on the [CENTRE](https://centre.io) network. | ||
<!-- prettier-ignore-start --> | ||
<!-- omit in toc --> | ||
# Circle's Stablecoin Smart Contracts on EVM-compatible blockchains | ||
<!-- prettier-ignore-end --> | ||
|
||
This repository contains the smart contracts used by | ||
[Circle's](https://www.circle.com/) stablecoins on EVM-compatible blockchains. | ||
All contracts are written in [Solidity](https://soliditylang.org/) and managed | ||
by the [Truffle](https://trufflesuite.com/) framework. | ||
|
||
<!-- prettier-ignore-start --> | ||
<!-- omit in toc --> | ||
## Table of contents | ||
<!-- prettier-ignore-end --> | ||
|
||
- [Setup](#setup) | ||
- [Development Environment](#development-environment) | ||
- [IDE](#ide) | ||
- [Development](#development) | ||
- [TypeScript type definition files for the contracts](#typescript-type-definition-files-for-the-contracts) | ||
- [Linting and Formatting](#linting-and-formatting) | ||
- [Testing](#testing) | ||
- [Deployment](#deployment) | ||
- [Contracts](#contracts) | ||
- [FiatToken features](#fiattoken-features) | ||
- [ERC20 compatible](#erc20-compatible) | ||
- [Pausable](#pausable) | ||
- [Upgradable](#upgradable) | ||
- [Blacklist](#blacklist) | ||
- [Minting/Burning](#mintingburning) | ||
- [Ownable](#ownable) | ||
- [Additional Documentations](#additional-documentations) | ||
|
||
## Setup | ||
|
||
|
@@ -11,9 +40,9 @@ Requirements: | |
- Node 16.14.0 | ||
- Yarn 1.22.19 | ||
|
||
``` | ||
$ git clone [email protected]:centrehq/centre-tokens.git | ||
$ cd centre-tokens | ||
```sh | ||
$ git clone [email protected]:circlefin/stablecoin-evm.git | ||
$ cd stablecoin-evm | ||
$ nvm use | ||
$ npm i -g [email protected] # Install yarn if you don't already have it | ||
$ yarn install # Install dependencies | ||
|
@@ -24,25 +53,27 @@ $ yarn install # Install dependencies | |
We recommend using VSCode for the project here with these | ||
[extensions](./.vscode/extensions.json) installed. | ||
|
||
## TypeScript type definition files for the contracts | ||
## Development | ||
|
||
### TypeScript type definition files for the contracts | ||
|
||
To generate type definitions: | ||
|
||
``` | ||
```sh | ||
$ yarn typechain | ||
``` | ||
|
||
## Linting and Formatting | ||
### Linting and Formatting | ||
|
||
To check code for problems: | ||
|
||
``` | ||
```sh | ||
$ yarn static-check # Runs a static check on the repo. | ||
``` | ||
|
||
or run the checks individually: | ||
|
||
``` | ||
```sh | ||
$ yarn typecheck # Type-check TypeScript code | ||
$ yarn lint # Check JavaScript and TypeScript code | ||
$ yarn lint --fix # Fix problems where possible | ||
|
@@ -52,33 +83,33 @@ $ yarn slither # Run Slither | |
|
||
To auto-format code: | ||
|
||
``` | ||
```sh | ||
$ yarn fmt | ||
``` | ||
|
||
## Testing | ||
### Testing | ||
|
||
First, make sure Ganache is running. | ||
|
||
``` | ||
```sh | ||
$ yarn ganache | ||
``` | ||
|
||
Run all tests: | ||
|
||
``` | ||
```sh | ||
$ yarn test | ||
``` | ||
|
||
To run tests in a specific file, run: | ||
|
||
``` | ||
```sh | ||
$ yarn test [path/to/file] | ||
``` | ||
|
||
To run tests and generate test coverage, run: | ||
|
||
``` | ||
```sh | ||
$ yarn coverage | ||
``` | ||
|
||
|
@@ -107,16 +138,22 @@ Run `yarn migrate --network NETWORK`, where NETWORK is either `mainnet` or | |
|
||
## Contracts | ||
|
||
The implementation uses 2 separate contracts - a proxy contract | ||
(`FiatTokenProxy.sol`) and an implementation contract (`FiatToken.sol`). This | ||
allows upgrading the contract, as a new implementation contact can be deployed | ||
and the Proxy updated to point to it. | ||
The FiatToken contracts adheres to OpenZeppelin's | ||
[Proxy Upgrade Pattern](https://docs.openzeppelin.com/upgrades-plugins/1.x/proxies) | ||
([permalink](https://github.com/OpenZeppelin/openzeppelin-upgrades/blob/65cf285bd36af24570186ca6409341540c67238a/docs/modules/ROOT/pages/proxies.adoc#L1)). | ||
There are 2 main contracts - an implementation contract | ||
([`FiatTokenV2_2.sol`](./contracts/v2/FiatTokenV2_2.sol)) that contains the main | ||
logic for FiatToken's functionalities, and a proxy contract | ||
([`FiatTokenProxy.sol`](./contracts/v1/FiatTokenProxy.sol)) that redirects | ||
function calls to the implementation contract. This allows upgrading FiatToken's | ||
functionalities, as a new implementation contact can be deployed and the Proxy | ||
can be updated to point to it. | ||
|
||
### FiatToken | ||
## FiatToken features | ||
|
||
The FiatToken offers a number of capabilities, which briefly are described | ||
below. There are more [detailed design docs](./doc/tokendesign.md) in the `doc` | ||
folder. | ||
directory. | ||
|
||
### ERC20 compatible | ||
|
||
|
@@ -155,3 +192,13 @@ the `masterMinter`. | |
The contract has an Owner, who can change the `owner`, `pauser`, `blacklister`, | ||
or `masterMinter` addresses. The `owner` can not change the `proxyOwner` | ||
address. | ||
|
||
## Additional Documentations | ||
|
||
- [FiatToken design](./doc/tokendesign.md) | ||
- [MasterMinter design](./doc/masterminter.md) | ||
- [Deployment process](./doc/deployment.md) | ||
- [Preparing an upgrade](./doc/upgrade.md) | ||
- [Upgrading from v1 to v2](./doc/v2_upgrade.md) | ||
- [Upgrading from v2 to v2.1](./doc/v2.1_upgrade.md) | ||
- [Upgrading from v2.1 to v2.2](./doc/v2.2_upgrade.md) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.