This repository contains the Perper stablecoin smart contract for EVM -blockchains.
Available functionalities in the token contract are listed below.
The token follows the ERC-20 token standard and implements all of its functionality through the OpenZeppelin ERC20 implementation.
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.
The contract can be upgraded via OpenZeppelin UUPS pattern. Upgrading the contract retains the old contract state.
It is possible for any user to give allowance to their tokens without a transaction by signing an OpenZeppelin permit message.
It is possible to burn tokens.
This can be achieved in either of the following two ways:
- 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 apermit
signature. The address with the burner role burns the tokens. - 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.
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 the contract causes all token transfers to fail. It is also possible to unpause the contract.
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.
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.
An address with the admin role can assign and unassign any role to any address, except an admin can't (un)block an address.
An address with the proxyowner role can upgrade the token smart contract via proxy pattern.
An address with the blocklister role can assign and unassign the blocked role to any address.
An address with the pauser role can pause the contract's functionality.
An address with the unpauser role can unpause the contract.
An address with the minter role can mint new tokens either by direct minting or batch minting.
An address with the rescuer role can rescue arbitrary tokens sent to the token contract.
An address with the burner role can burn their own tokens and burn tokens from an address with an allowance.
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.
See Developer resources for development details.