• Stars
    star
    491
  • Rank 89,636 (Top 2 %)
  • Language
    JavaScript
  • License
    Apache License 2.0
  • Created almost 7 years ago
  • Updated 8 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Source repository for smart contracts used by Circle's stablecoins on EVM-compatible blockchains

centre-tokens

Fiat tokens on the CENTRE network.

Setup

Requirements:

  • Node >= v12
  • Yarn
$ git clone [email protected]:centrehq/centre-tokens.git
$ cd centre-tokens
$ npm i -g yarn       # Install yarn if you don't already have it
$ yarn install        # Install dependencies
$ yarn setup          # Setup Git hooks

TypeScript type definition files for the contracts

To generate type definitions:

$ yarn compile && yarn typechain

Linting and Formatting

To check code for problems:

$ yarn typecheck      # Type-check TypeScript code
$ yarn lint           # Check JavaScript and TypeScript code
$ yarn lint --fix     # Fix problems where possible
$ yarn solhint        # Check Solidity code
$ yarn slither        # Run Slither

To auto-format code:

$ yarn fmt

Testing

First, make sure Ganache is running.

$ yarn ganache

Run all tests:

$ yarn test

To run tests in a specific file, run:

$ yarn test [path/to/file]

To run tests and generate test coverage, run:

$ yarn coverage

Deployment

Create a copy of the file config.js.example, and name it config.js. Enter the BIP39 mnemonic phrase, the INFURA API key to use for deployment, and the addresses of proxy admin, owner, master minter, blacklister, and pauser in config.js. This file must not be checked into the repository. To prevent accidental check-ins, config.js is in .gitignore.

Run yarn migrate --network NETWORK, where NETWORK is either mainnet or ropsten.

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.

FiatToken

The FiatToken offers a number of capabilities, which briefly are described below. There are more detailed design docs in the doc folder.

ERC20 compatible

The FiatToken implements the ERC20 interface.

Pausable

The entire contract can be frozen, in case a serious bug is found or there is a serious key compromise. No transfers can take place while the contract is paused. Access to the pause functionality is controlled by the pauser address.

Upgradable

A new implementation contract can be deployed, and the proxy contract will forward calls to the new contract. Access to the upgrade functionality is guarded by a proxyOwner address. Only the proxyOwner address can change the proxyOwner address.

Blacklist

The contract can blacklist certain addresses which will prevent those addresses from transferring or receiving tokens. Access to the blacklist functionality is controlled by the blacklister address.

Minting/Burning

Tokens can be minted or burned on demand. The contract supports having multiple minters simultaneously. There is a masterMinter address which controls the list of minters and how much each is allowed to mint. The mint allowance is similar to the ERC20 allowance - as each minter mints new tokens their allowance decreases. When it gets too low they will need the allowance increased again by the masterMinter.

Ownable

The contract has an Owner, who can change the owner, pauser, blacklister, or masterMinter addresses. The owner can not change the proxyOwner address.

More Repositories

1

verite

TypeScript
136
star
2

evm-cctp-contracts

Official repository for all EVM-compatible smart contracts used by the Cross-Chain Transfer Protocol
Solidity
90
star
3

payments-sample-app

Vue
65
star
4

perimeter-protocol

Official repository for the Perimeter Protocol
TypeScript
58
star
5

centre-ecosystem

36
star
6

cctp-sample-app

Sample app to demonstrate capabilities of Cross-Chain Transfer Protocol (CCTP)
TypeScript
35
star
7

circle-nodejs-sdk

Node.js SDK for Circle API
TypeScript
22
star
8

w3s-android-sample-app-wallets

Kotlin
12
star
9

w3s-ios-sample-app-wallets

Swift
11
star
10

contract-cli

CLI for Managing Smart Contracts
TypeScript
11
star
11

noble-cctp

Go
8
star
12

w3s-programmable-wallets-iOS-sample-app

Swift
7
star
13

w3s-programmable-wallets-test-server

JavaScript
7
star
14

circle-ecosystem

Python
7
star
15

w3s-digital-wallet-iOS-sample-app

A demonstration of integrating social sign-in functionality with web3 wallet generation.
JavaScript
6
star
16

verite-minter-allowlist

JavaScript
6
star
17

openapi

An OpenAPI specification for the Circle APIs.
6
star
18

robust-tss-lib

Official repository for Robust Threshold Signatures library robust-tss-lib
Go
4
star
19

recoverable-wrapper

The Official Repository for R&D on recoverable wrapper tokens
Solidity
4
star
20

w3s-ios-sdk

Objective-C
4
star
21

w3s-entity-secret-sample-code

Go
4
star
22

chainmail

Chainmail: authenticated email using the blockchain.
Python
4
star
23

verite-credential-utils

TypeScript
3
star
24

w3s-android-sdk

3
star
25

noble-fiattokenfactory

Repository for Noble fiat token factory code
Go
3
star
26

w3s-pw-web-sdk

TypeScript
1
star
27

solana-cctp-contracts

Official repository for Solana smart contracts used by the Cross-Chain Transfer Protocol
Rust
1
star
28

stablecoin-near

Repository for Circle stablecoins on NEAR
Rust
1
star
29

circle-postman

1
star