Solidity libraries

With Filecoin Virtual Machine (FVM), Solidity developers can use existing libraries listed on this page in their FVM smart contracts.


OpenZeppelin provides a library of battle-tested smart contract templates, including widely used implementations of ERC token standards. For a guided example that implements an ERC20 token on the Filecoin network, see Example using an ERC20 contract.


OpenZeppelin offers the following to smart contract developers:

  • Implementations of standards like ERC20, ERC721, and ERC1155.

  • Flexible access control schemes like Ownable, AccessControl, and onlyRole.

  • Useful and secure utilities for signature verification, SafeMath, etc..

Token standards, such as ERC20, are the most widely used smart contract libraries from OpenZeppelin. These contracts, listed below, implement both fungible and non-fungible tokens:

  • ERC20 is the simplest and most widespread token standard for fungible assets.

  • ERC721 is the standard solution for non-fungible tokens and is often used for collectibles and games.

  • ERC777 provides a richer standard for fungible tokens, supporting new use cases and backwards compatibility with ERC20.

  • ERC1155 is a new standard for multi-tokens, where a single contract represents multiple fungible and non-fungible tokens, and operations are batched for increased gas efficiency.

Using OpenZeppelin with FVM

The general procedure for using OpenZeppelin with FVM is as follows:

  1. Install OpenZeppelin. For example, using npm:

npm install @openzeppelin/contracts
  1. Import the specific library you want to use.

  2. In your smart contract, inherit the library.

Thanks to the FVM, your contract can be integrated and deployed on the Filecoin network with OpenZeppelin inheritance. For a guided example that implements an ERC20 token on the Filecoin network, see Example using an ERC20 contract.

Example using an ERC-20 contract

In the following tutorial, you’ll write and deploy a smart contract that implements the ERC-20 on the Calibration testnet using Remix and MetaMask:


Let’s take an ERC20 contract as an example to write and deploy it on the Calibration testnet using Remix & MetaMask:


In this procedure, you will create, deploy, mint and send an ERC20 token on Calibration using Remix and MetaMask.

  1. Navigate to

  2. Next to Workspaces, click the + icon to create a new workspace.

  3. In the Choose a template dropdown, select ERC20 along with the Mintable checkbox

  4. Click OK.

  5. In the contract directory, open MyToken.sol.

  6. Set the token <name> and <symbol>:

// contracts/GLDToken.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "@openzeppelin/contracts/token/ERC20/ERC20.sol";

contract MyToken is ERC20 {
   constructor(uint256 initialSupply) ERC20(<name>, <symbol>) {
      _mint(msg.sender, initialSupply);
  1. Next, compile and deploy the contract on Filecoin.

  2. At the top of the workspace, click the green play symbol to compile the contract.

  3. Once the contract compiles, open the Deploy tab on the left.

  4. Under the Environment dropdown, select Injected Provider - MetaMask.

  5. In the MetaMask popup window, select Confirmed connection.

  6. Click Deploy, and confirm the transaction on MetaMask. Your token contract will be deployed to the Calibration testnet once the network confirms the transaction.

  7. In Remix, open the Deployed Contracts dropdown.

  8. In the mint method, set:

    • to to your wallet address.

    • amount to 1000000000000000000 (1 FIL).

  9. Click Transact.

  10. In MetaMask, confirm the transaction.

Once the network processes the transaction, the token is minted and sent to your network address. Congratulations, you’ve completed the tutorial!

Additional resources

Learn more about OpenZeppelin with the following resources:


The DappSys library provides safe, simple, and flexible Ethereum contract building blocks for common Ethereum and Solidity use cases.

0x protocol

The 0x protocol library provides a set of secure smart contracts that facilitate peer-to-peer exchange of Ethereum-based assets.

Last updated