I am in the process of porting hundreds of Node.js source code files to deno.

I have encountered a number of interesting problems porting the code and found some solutions. Here’s a list of problems and solutions. If you know of more problems and solutions please let me know so I can add them to the list.

Problems & Solutions Porting Node.js Code to Deno

  1. Problem: Node.js’ dynamic “require” is synchronous. Deno has no dynamic import or require that is synchronous. Instead it has an asynchronous “import”.
    Solution: This is a real pain in the butt. Convert all code that uses and relies on dynamic “require”s to async…


Note: A diamond is a contract that gets its external functions from other deployed contracts called facets. A diamond implements the diamond standard.

Storage

In my last article about storage layout I explained how storage layout works in Solidity and I showed three different ways proxy contracts and diamonds handle storage layout. And I explained the downsides of each approach.

But now, all of a sudden, there is a new way, a better way. It has none of the downsides of the old ways.

The new way is made possible by a change to the Solidity compiler that happened yesterday.


Note: A proxy contract is a contract that delegates its function calls to another contract called a delegate contract or logic contract or facet. A diamond is a contract that can delegate function calls to different contracts called facets. Diamonds are specified by the diamond standard. Proxies and diamonds are used for contract upgrades and to reuse functionality in existing deployed contracts.

Storage Layout

Storage layout is how and where state variables in contracts are actually stored in contract storage.

Storage layout isn’t something you have to think about when writing a regular contract. …


Oh no! I got an error! But why?

If you get this error it probably means you have too many function arguments, local variables or return values in your function.

Christian Reitwiessner, creator of Solidity, says this:

There are several situations in which this or similar errors occur. Most are related to too many local variables, parameters or return variables in functions. It might also happen if you have expressions that are too deeply nested.

Don’t worry, if you can’t reduce these things there is a simple solution. Use structs.

A single struct can hold multiple values. …


The diamond standard is a new architecture for upgradeable contracts.

The diamond standard was just updated to include the following summary about why to make diamonds:

The flexibility of this standard makes a lot of designs possible. There are reasons to make diamonds that the author of this standard doesn’t know about and reasons to make diamonds that have not been discovered yet. Here are some known reasons:

1. You exceed the max size of a contract and you have related functionality that needs to access and use the same storage variables. Make a diamond.

2. Diamonds can be large…


NOTE: The Diamond Standard has been released. Make a user interface for that instead. See here: https://github.com/ethereum/EIPs/issues/2535

The transparent contract standard, ERC1538, is an upgradeable contract architecture that provides the following functionality:

  1. A way to add, replace and remove multiple functions of a contract atomically (at the same time).
  2. Standard events to show what functions are added, replaced and removed from a contract, and why the changes are made.
  3. A standard way to query a contract to discover and retrieve information about all functions exposed by it.
  4. Solves the 24KB maximum contract size limitation, making the maximum contract size of…


mokens.io yet again has a big new change.

Before today a person could create and own a new moken by submitting information about the moken and paying some ether. That changes today.

Mokens are proposed on the mint webpage. No fees are paid for this. MetaMask is not even needed. Technically it is easier than ever to create a moken. It costs nothing and there is no technical crypto hurdle. The hardest part is proposing something good.

If a moken is accepted then it gets minted. Unlike before, you do not own it once it is created. Instead it gets…


I want to let you know about some changes to mokens.

The purpose of the mokens project is to create and trade valuable mokens. All changes that have been made have been done to support that purpose.

  1. The term ‘era’, which is a set of mokens created during a time period has been renamed to ‘collection’. The reason for this is because I see in the future the possibility of having multiple collections open at the same time. Whereas there can only be one era at a time.
  2. Moderation functionality has been released on mokens.io. The reason for this is…


Mokens.io was one of the very first dapps that enabled people to create their own cryptocollectibles.

I would say it was the easiest tool for someone to create cryptocollectibles. A person just filled out a short form and submitted a transaction using MetaMask and voila, a new cryptocollectible was born. Over 450 mokens were created this way.

Mokens.io was the first application to implement the Composable Non-Fungible Token Standard, and the first application to implement “upgradeable” cryptocollectibles.

But mokens is changing. Moderation to submitted mokens was added.

Why?

The Mokens project is no longer about creating random NFTs.

The purpose of…

Nick Mudge

Ethereum contract programmer, security auditor and standards author. Author of the diamond standard.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store