Skip to content

Perper-net/perper-stablecoin

Repository files navigation

Perper

This repository contains the Perper stablecoin smart contract for EVM -blockchains.

Functionalities

Available functionalities in the token contract are listed below.

ERC20 standard

The token follows the ERC-20 token standard and implements all of its functionality through the OpenZeppelin ERC20 implementation.

Access restrictions

Access to certain functionality is restricted by OpenZeppelin role-based access control. More details about the used roles and which role can perform which operations can be found later in this document.

Upgrading the contract

The contract can be upgraded via OpenZeppelin UUPS pattern. Upgrading the contract retains the old contract state.

ERC20 permit

It is possible for any user to give allowance to their tokens without a transaction by signing an OpenZeppelin permit message.

Burning tokens

It is possible to burn tokens.

This can be achieved in either of the following two ways:

  1. Add allowance for an address with the burner user role to withdraw your tokens. This allowance can be given either with a direct ERC-20 approve transaction to the contract or with a permit signature. The address with the burner role burns the tokens.
  2. Transfer tokens to an address with the burner user role. That address then burns the tokens.

Note that this functionality should be coordinated with the Perper Stablecoin project and only executed after an agreement.

Minting tokens

It is possible to mint new tokens.

There are two ways to mint tokens: direct minting or batch minting.

Direct minting simply mints tokens to a given address.

A batch mint can include any number of minting actions - each action is a combination of a target (an address) and an amount (an integer). Each action mints an amount of new tokens, which are sent to the corresponding address.

Each batch has a unique identifier, which is provided by a backend system.

Each minting batch is checksummed, and the checksum value is provided along with the minting set. The checksum is validated in the contract before minting.

Pausing and unpausing the contract

Pausing the contract causes all token transfers to fail. It is also possible to unpause the contract.

Rescuing tokens

It is possible to rescue an arbitrary token sent to the token contract. This can be used if someone accidentally sends a large amount of tokens to the token contract itself. Please contact Membrane Finance directly if this has happened to you.

User roles

Access to certain functionality is restricted by user roles. Each role can be assigned to one or multiple Ethereum addresses.

The used roles are explained below. Unless otherwise stated, access to the named functionality is only available for an address with the said role.

Admin role

An address with the admin role can assign and unassign any role to any address, except an admin can't (un)block an address.

Proxyowner

An address with the proxyowner role can upgrade the token smart contract via proxy pattern.

Blocklister

An address with the blocklister role can assign and unassign the blocked role to any address.

Pauser

An address with the pauser role can pause the contract's functionality.

Unpauser

An address with the unpauser role can unpause the contract.

Minter

An address with the minter role can mint new tokens either by direct minting or batch minting.

Rescuer

An address with the rescuer role can rescue arbitrary tokens sent to the token contract.

Burner

An address with the burner role can burn their own tokens and burn tokens from an address with an allowance.

Blocked

An address with the blocked role can not transfer or receive tokens.

The token contract itself has the blocked role to prevent its own tokens from being transferred directly to it by accident.

Developer resources

See Developer resources for development details.