OpenBrush, an early alpha of our OpenZeppelin Library for Ink!

Earlier in the year, we attempted to analogize OpenZeppelin perfectly with Rust’s paradigm, enabling users to import contracts implemented by another user without problems and reuse the code. But we faced a challenge. Due to ink! low usability, and the fact that although ink! has guides on how to create your own ERC20, there is currently no library that can provide base implementations of ERC20 and how they can be imported/reused when customizing their own logic. At the moment, this kind of library is proving hard to create because of ink! Is not ready for that.

We took it upon ourselves to, therefore to re-writing smart contracts from solidity to ink!. As expected we faced considerable challenges along this path with a lot of unresolved questions as we explored deeper. For instance, several questions like:

How do you reuse ERC20 codes from examples in ink! repository?

How to do cross-contract calls?

How ink! calculates identifiers of function for cross-contract?

How to deploy an inherited contract?

How to override some basic logic and

And some other issues…

See here for the list of documented issues we faced while trying to work around creating a functional OpenZeppelin repository for ink!.

Typically our developers sought to get some of these answers of which we found answers to these questions in different places: the code of ink, some comments in issues, some examples in other repositories. For developers who typically look for ways to optimize their time, this is a problem as this information is not aggregated in one place. There’s no single library to help answer these questions. This resulted in another set of logical statements like:

“We need to show that the main problem is: the naming of traits influences identifiers of methods in smart contracts. It requires us to define one trait for ERC20 which must be implemented by everyone who wants to be part of the system (if everyone implements this trait, all will have the same identifiers).”

This, therefore, represents the core of our decision on standardization and creating a functional repository. So we thought of another idea added to our quest of rewriting contracts from solidity to ink!. What if we create a library ensuring that anyone who googles OpenZeppelin for ink! finds our library? Surely, this would save developers ample time, we thought. It seemed like a pretty interesting idea but, of course, a daunting challenge as it will require periodic maintenance to help keep the library updated.

This is what led to creating Openbrush, an early alpha of OpenZeppelin library for developers.

Project timeline on rewriting for OpenBrush

During re-writing of smart contracts, we investigated how ink! works, what we can do in the direction of code reuse and changing the structure of our project.

After 2 weeks of rigorous research, we defined our vision of how to build the project and contracts on the current version of ink!. It’s important for us to have a BIG PICTURE, hence, we also defined what we want to see in the final stage of ink!.

However, before we can reach the final stage ink! We must first resolve a set of issues we highlighted earlier. So, for now, we will provide a library on rust level. And we suggest building the architecture of any project in this manner.

It took our team about a week after answering vital questions, defining the architecture and writing basic logic (all these took us a month to complete before moving on to the next stage) in addition a week to directly work on OpenBrush and release the earliest alpha. We extracted standard code from our project and moved it to OpenBrush. We will refactor it for public usage and continue fixing issues as we encounter them. But you can already use it as an example.

About Supercolony

SuperColony operates as a DAO venture studio designing and building companies by bringing together experienced blockchain talent, resources, and capital to compress time, iterate quickly and scale more ambitiously than would otherwise be possible.

We connect founders to all of the necessary partners to achieve success in today’s crypto ecosystem. We have aligned ourselves with partners in every major crypto geography, including traditional trading firms, VC’s, legal/compliance experts, marketing and pr firms, launchpads, and security auditors.

Socials

Website | LinkedIn | Twitter | Instagram

We build and Invest in #Polkadot Companies.