filecoin-project / devgrants

👟 Apply for a Filecoin devgrant. Help build the Filecoin ecosystem!
Other
371 stars 308 forks source link

RFP Application: Filecoin Standard Actor Library #1405

Closed Darko-Ethernal closed 1 year ago

Darko-Ethernal commented 1 year ago

RFP Proposal: Filecoin Standard Actor Library

Name of Project: Filecoin Standard Actor Library

Link to RFP: https://github.com/filecoin-project/devgrants/blob/master/rfps/fvm-rfp-ideas.md#collections--libraries-of-common-example-actors-for-native-fvm

RFP Category: devtools-libraries

Proposer: Ethernal-Tech

Do you agree to open source all work you do on behalf of this RFP and dual-license under MIT and APACHE2 licenses?: Yes

Project Description

Abstract

We propose creating a modular library of foundational native actors for the Filecoin Virtual Machine (FVM) that are similar to OpenZeppelin Contracts for the Ethereum Virtual Machine (EVM). This library would provide reusable and well-audited components for implementing standards such as ERC20 and ERC1155, as well as common utilities and access control patterns. By using these secure building blocks, developers can build more advanced actors without having to start from scratch. Library will include a set of security best practices and testing tools to help developers avoid common pitfalls and vulnerabilities. It will also include documentation and example code to help developers understand how to use the contracts and integrate them into their own projects.

Motivations

Smart contracts represent a significant functionality of most blockchain systems. The concept of developing the Filecoin system is based on the application of smart contracts, and with the development of the FEVM machine, a unique integral system of Solidity and Wasm smart contracts was defined. In order to encourage the use of the Filecoin System and the development of smart contracts on it, the development of tools that facilitate the work of users of Smart Contracts on the Filecoin System is of great importance. That tool could be used both for the development of smart contracts and for their execution and testing. We are ready to be an important participant in the Filecoin community and have super experienced developers for this purpose.

Retrospective of existing tools (Inspirations)

The simplicity and efficiency of developing and verifying smart contracts on a blockchain increases the number of system users and trust in the ecosystem. This is why many blockchain systems have specialized frameworks or libraries for smart contracts. Some commonly used tools are: OpenZeppelin, OpenBrush, CosmWasm and Anchor. OpenZeppelin is an open source framework for building secure Solidity smart contracts on Ethereum and other EVM based blockchain platforms. It provides a library of reusable and secure smart contract components, as well as tools for testing and deploying them. OpenZeppelin is designed to help developers create secure and reliable smart contracts by using library with following patterns: Access control, Upgradable Smart Contracts, Security (Reentrance Guard, Pausable), and support for Fungible token standards (ERC20, ERC777), NonFungible Token Standards (ERC721), Multitoken standard(ERC1155). Its functionalities will be the main guidelines for the development of the Smart Contract tool for Filecoin. OpenBrush is a Rust library for smart contract development on ink! (analogous to OpenZeppelin for Solidity). It proposes and build full implementation of the first WebAssembly Polkadot token standard (PSP22: Fungible Token, PSP34: Non-Fungible Token, PSP1155: Multi-Token) and other useful libraries for wasm smart contract development (Access control, Pausable, Upgradeable contract, Reentrancy guard, etc.). Initial idea for wasm contract ecosystem in Polkadot environment was from Patract Labs (Metis library, Redspot) and Supercolony was following this path and created OpenBrush. Additionally, its tool -Sol2Ink enables easy migration from Solidity to Ink! and Rust. Cosmwasm is Rust library written as a module that can plug into the Cosmos SDK and provides quickly and easily add CosmWasm smart contract support to a Cosmos-based chain (deploy and execution), without adjusting existing logic. Additionally, Cosmwasm enables efficient smart contracts development by using libraries with design patterns for actors, messaging and support for cw token standards. Cosm wasm contracts uses templates that allow many possibilities, such as: swapped out or upgraded a contract, avoiding reentrancy attacks (by design architecture), multichain contracts, contract composition and testing. The Solana Program Library (SPL) is a collection of on-chain programs targeting the Sealevel parallel runtime. These programs are tested against Solana's implementation of Sealevel, solana-runtime, and deployed to its mainnet. This program defines a common implementation for Fungible and Non Fungible tokens. Using Solang (Solidity Compiler), you can compile smart contracts written in Solidity for Solana and Parity Substrate. It uses the llvm compiler framework to produce WebAssembly (WASM) or BPF contract code. As a result, the output is highly optimized, which saves you in gas costs or compute units. Anchor is a framework providing several developer tools for writing smart contracts. Its goal is to provide convenient developer tools for writing smart contracts compatible with the Solana chain. Anchor could be a great inspiration with their technical architecture and implementation. They leverage Rust and macros to facilitate development of programs. The toolset testing is handled through JavaScript or Typescript.

Our Team

We are a group of university professors and with a group of super experienced developers we are working on the development of the following significant blockchain projects (website: ethernal.tech):

Our service

Deliverables

This project is the initial step of creating Smart Contract Framework for native Actors in the Filecoin ecosystem. In order to achieve a high quality solution, we will explore the widely used Rust and wasm libraries in other well-known ecosystems (such as Solana, Cosmos, Polkadot). As result of obtained research, modular software architecture and design will be created to enable comfortable and efficient smart contract implementation.
Functional specification of this application is similar as the FVM technical board suggested. We are proposing a solution for Smart contract framework that will have following characteristics:

  1. Open source and free to use for basic feature sets.
  2. Modular architecture.
  3. Smart contract library with functionalities:

Access control modules- determining who has permission to perform actions and it is crucial in the realm of smart contracts. It plays a vital role in determining who can create tokens, cast votes on proposals, halt transfers and more. It is imperative to have access control to prevent unauthorized access and protect the system.

ERC-20 module - is a technical standard for Ethereum tokens. It defines a set of rules for issuing tokens on the Ethereum blockchain, including how new tokens can be created and transferred between addresses.

Security These modules aim to cover common security practices.

ERC1155 module - A standard interface for contracts that manage multiple token types. A single deployed contract may include any combination of fungible tokens, non-fungible tokens or other configurations (e.g. semi-fungible tokens).

After implementation of proposed functionalities we will prepare documentation and testing examples to help developers in efficient creation of smart contracts.

Milestones

Our idea is to analyze and investigate the functionalities of the mentioned tools and, based on the research, to design a tool that will enable efficient creation of smart contracts on the Filecoin system. In addition, we wish to share the positive experiences from the projects we worked on to the new tool. The project will be realized in three phases (as shown in the table):

  1. Research and software design.
  2. Code Implementation.
  3. Testing.

Slika1

Table – Timeline and task estimation Start End Duration (workdays) Task
2/20/2023* 2/24/2023 15 Research and analysis
2/27/2023 3/13/2023 33 Software design
3/14/2023 3/20/2023 15 Documentation
3/21/2023 3/29/2023 18 Fungible token actor (ERC20, FRC 0046)
3/28/2023 4/7/2023 18 Multi-token standard (ERC1155)
3/31/2023 4/12/2023 15 Access control
4/10/2023 4/19/2023 15 Security primitives
4/20/2023 5/5/2023 18 Unit tests
4/28/2023 5/12/2023 18 Actor execution scenario tests
4/24/2023 5/24/2023 30 Bug fixing, Code optimization

*start date depends on approval, the team will be ready to start development within 10 working days from approval

Description

M1 - Design Specification

Milestones no Name Description Time estimation (workdays)
1.1 Research and analysis Detailed analysis of OpenZeppelin contracts and other references. 15
1.2 Software design Defining exact scope/list of: Rust Actors and Rust Traits. Defining library content, format, structure and coding standards. 33
1.3 Documentation Creating documentation - just some usage examples of defined lib functionalities. 15
      Total:63 workdays

M2 - Smart Contract (Actor) library implementation

Milestones no Name Description Time estimation (workdays)
2.1 Fungible token actor (ERC20, FRC 0046) Implementation of the library for fungible token standards ERC20 and FRC 0046 18
2.2 Multi-token standard (ERC1155) Implementation of the library for multi-token standard ERC1155 18
2.3 Access control Implementation of the library for access control. 15
2.4 Security primitives Implementation of the library for Reentrancy guard, Pausable and Pull payment. 15
      Total:66 workdays

M3 - Testing

Milestones no Name Description Time estimation (workdays)
3.1 Unit tests Unit tests for all library functionalities. 18
3.2 Actor execution scenario tests Implementation of actors defined in M1.3 usage examples and bug fixing. 48
      Total: 66 workdays

Stage 2 - Adding new features - wizard and contract extension

Stage 2 Name Description Time estimation (workdays)
S 2.1 Wizard Development of an actor wizard Web App similar to OpenZeppelin Contracts Wizard. Manual testing) 60
S 2.2 Contract extension Contract Extension   Adding possibility to extend particular functions of a contract. Testing 60
      Total: 120 workdays

Stage 3 - Support and Maintenance

After release, the library will be regularly maintained and updated to fix any bugs that are found, but not adding new features. This involves responding to bug reports and working with users to address any issues.

Gantt chart

image Figure – Roadmap diagram

Funding

Budget : MVP + Stage 2 + Support - (20% discount for first project with Filecoin)

MVP version:

195 workdays * 460 USD = 89700 USD

89700 USD – 20% = 71760 USD

Adding new features (Stage 2 - wizard and contract extension):

120 workdays * 460 USD = 55200 USD

55200 USD – 20% = 44160 USD

Support (Stage 3 - 2 month):

2 month 23 workdays 460 USD = 21160 USD

21160 USD – 20% = 16928 USD

Funding steps Event Funding percentage
0 Signature of the RFP 25%
1 Milestone 1 delivered 25%
2 Milestone 2 delivered 25%
3 Milestone 3 delivered 25%
4 Stage 2 per feature
5 Support monthly

Team

The importance of application usage in the Filecoin ecosystem dictates the need for a dedicated team. A team of three developers will be involved in development and maintenance of the tool. In order to obtain a better quality solution, our team is ready to actively communicate with significant Filecoin developers at every stage of the project. After the implementation of this project, we can maintain the developed solution and add new functionalities, and our team is planning to actively participate in proposing new FIP, discussions, proposals, etc.

karadikid commented 1 year ago

Any progress on this batboy? Contributors?

We are interested in this project and others like it.

Karadikid

vastris commented 1 year ago

This is such an exciting initiative by the Filecoin project! I really appreciate their commitment to supporting developers through the devgrants program. Creating a well-defined and comprehensive software development RFP is crucial for successful collaborations, and it's great to see the Filecoin community emphasizing this aspect. Kudos to the team for fostering innovation and providing the necessary resources for project growth.

ErinOCon commented 1 year ago

@Darko-Ethernal, thank you for your proposal and for your patience with our review. We would be happy to consider supporting this project once we have made additional progress on our development road map (we anticipate four to seven months).

Please feel welcome to re-connect with our team at this time!