Smart Contract Architecture

Smart Contract Architecture

GoodDollar launched on Ethereum in September 2020. All GoodDollar smart contracts are written in Solidity and G$ is an ERC-20 compatible token [37]. Transactions using G$ coin are run on an Ethereum sidechain Fuse,which enables low-cost, high-volume transactions. As we anticipate a continual improvement in the scalability and efficiency of blockchain infrastructure, the protocol is designed to be dynamic, flexible, and adaptable to evolve with market developments.

GoodDollar Smart Contracts

GoodDollar Reserve Smart Contract

Also referred to as the “reserve”, this is a smart contract that governs the vault holding the supported cryptocurrencies that back G$ tokens. The algorithm that guides the reserve is based on the Bancor formula, which has been altered to fit GoodDollar’s needs. There are two important characteristics unique to the GoodDollar Reserve:

  • The reserve supports the generation of G$. Users can always convert to and from G$ via the reserve.

  • The unique math of the GoodDollar Reserve lends G$ exceptional stability.

  • The supported cryptocurrencies in the reserve can be swapped in exchange for G$, thereby ensuring the token’s value and liquidity. Users will also be able to receive G$ in exchange for supported cryptocurrency deposited into the reserve. The GoodDollar Reserve will initially hold one type of supported currency, but is capable of holding others, as per the decisions of the GoodDAO. It performs the following functions:

The GoodDollar Reserve performs three different functions important to the GoodDollar Economy: Expansion; Conversion; and Interest Deposits. These are outlined below (for more on the underlying math, please see the appendix).

  • Expansion is the pre-set annual rate by which the token supply increases, thereby reducing the reserve ratio. For instance, if the expansion rate is set to 10% annually and the year begins with a reserve ratio of 1, then by the end of the first year the reserve ratio would be 0.9, by the end of year two, 0.81, and so on (Equation 3).

  • Conversion is the process that enables users to exchange G$ for CDAI and vice versa. Since the GoodDollar Reserve is essentially an automated market maker (AMM) that works on a bonding curve, the amount of G$ minted or burned depends upon how much collateral is added or removed from the reserve. Users who buy G$ receive a matching number of G$X tokens as a reward for their purchases, which can be used to reduce their exit contributions when they choose to sell G$ (see below).

  • Interest deposits into the GoodDollar Reserve from a third-party protocol are converted to G$ in a different way than during the crypto exchange process outlined above. When a user buys G$ from the GoodDollar Reserve in exchange for a supported currency, new tokens are minted and the price of G$ rises. In contrast, when a user deposits interest, there are more tokens minted, but the price of G$ doesn’t change.

GoodStaking Smart Contract

The “accountant” of the GoodDollar economy, the GoodStaking smart contract ensures that value flows as intended, and transfers value to the correct place at the correct time. It performs the following functions:

  • Receives each staker’s principal to be staked in supported cryptocurrency

  • Sends the principal to the third-party protocol elected by each staker

  • Logs the amount of supported currency belonging to each staker

  • Receives the collateral token from the third-party protocol

  • Sends the interest in collateral token to the GoodDollar Reserve

  • Allows each staker to redeem the principal he or she has staked.

A typical staking transaction would involve sending supported currency to the GoodStaking smart contract, which automatically transfers the funds to the third-party protocol. The GoodStaking contract will create a log of the amount of supported currency that belongs to each Supporter. The interest earned forms the basis of the GoodDollar Reserve.

Stakers receive three different types of reward for their commitment to the GoodDollar mission: financial, governance and social. They are awarded with G$ worth the equivalent of the interest their staked assets generated in support of the generation of G$; they are rewarded with GOOD governance tokens which give them sway over GoodDollar’s future direction; and they are rewarded with Social APY, which is a report on the exact impact their backing has had on the GoodDollar impact economy.

While GOOD tokens are non-transferrable and have no market value, G$ rewards can be held, exchanged for supported cryptocurrencies, exchanged for goods and services on one of several community-led marketplaces, or left within the reserve to support basic income generation.

The GoodDollar Trust

The GoodDollar Trust is actually a collection of smart contracts designed to generate an ongoing flow of money into the GoodDollar Reserve. This group of trust funds, or staking contracts, is capable of “wrapping” third-party deposit-taking DeFi protocols. Each protocol and token has a separate trust fund. For example, Compound DAI is one trust fund; Compound ETH is another; and Aave DAI a third.

Each separate trust fund takes the interest generated by staked assets in the protocol it wraps and donates this to the GoodDollar Reserve, for the support of crypto UBI generation. As a reward for their commitment, stakers have the option of receiving a sum of newly minted G$ tokens. They can either withdraw these tokens, at which point they will be minted, or opt not to, which will serve to support G$ generation.

The Fund Manager

The Fund Manager is a smart contract responsible for several critical processes in the GoodDollar protocol. These include:

  • The activation of UBI generation.

  • The transfer of interest from the GoodDollar Trust to the GoodDollar Reserve.

  • The transfer of funds to the Bridge and onward to the DisCo for distribution to UBI Claimers via the Fuse blockchain.

As with all smart contracts, processes handled by the Fund Manager must be triggered manually. The task of triggering these processes falls to a group of volunteers called “Keepers”. In exchange for instructing the Fund Manager to execute tasks, these users earn rewards as well as compensation for transaction fees incurred during the process. Keepers can also earn G$ rewards for converting the status of verified users who have not made a claim in the past 14 days from “active” to “inactive”. This function is called “fishing”.

The Distribution Contract

The Distribution Contract (or “DisCo”), is a smart contract that handles the distribution of G$ to all addresses verified as belonging to real and unique people in the GoodDollar ecosystem housed in the Identity Contract. The DisCo is responsible for accepting G$ from elsewhere in the system and distributing this to all verified active users who have clicked “claim” in the GoodDollar Wallet app within the preceding 24 hours.

The GoodDao

This smart contract receives the G$ that is minted from the GoodDollar Reserve. It allocates the G$ coins back to supporters, and allocates G$ coins to be given out as basic income. All the monetary tools discussed above (such as the ability to change the expansion rate), along with any that will exist in the future, are controlled by the GoodDAO smart contract. This is where voting by way of the GoodDAO to adjust these monetary tools will occur.

Helper Contracts

Helper contracts are smart contracts that connect the GoodDollar Reserve to other liquidity networks in order to allow liquidity to flow from G$ to any other token that has an automated market maker (AMM). For example, if a user wants to convert token X to G$, the helper contract will first convert token X to DAI using Uniswap, and then convert DAI to CDAI using Compound. Finally, it will convert the CDAI to G$ using the GoodDollar Reserve. Future versions of the protocol may extend this functionality to additional protocols, such as Bancor and Aave.

Key Components

Third-Party Protocols

These are smart contract-based value-generation mechanisms operated by third-party corporations in the field of decentralized finance, unrelated to GoodDollar. By leveraging the open smart contract infrastructure, the GoodStaking smart contract connects to a third-party protocol and executes the staking functions as outlined above.

While the GoodDollar Trust only wraps Compound and Aave currently, it has the capacity to connect to other such protocols, subject to the will of the GoodDAO. Users who choose to deposit capital in support of the GoodDollar mission can select the third-party protocol with which they wish to stake, subject to the terms of that protocol.

Reserve Ratio (r)

The Reserve Ratio (r) is the ratio between the value of the supported currency in the GoodDollar Reserve (R) and the value of the total G$ in circulation (market capitalization)(Equation 1).

Minting of G$

The GoodDollar Reserve mints G$ in two ways: the first is based on new deposits into the reserve, and the second on the designated expansion rate. Every time interest is moved into the reserve, a certain quantity of G$ is printed to keep the price stable (Equation 5). Minting from the expansion rate is designed to stabilize the price according to the change in reserve ratio and is governed by the annual expansion rate (Equation 4).

Official G$ Price

This is the price of one G$ in supported currency. G$ is a reserve-based token and the GoodDollar Reserve functions as an automated market maker (AMM) according to an adapted version of the Bancor formula (Equation 2). The GoodDollar Reserve uses this price to calculate the amount of G$ allocated to stakers as interest, and adjusts the price when supported currency is bought from or sold to the GoodDollar Reserve. The formula has the properties of raising the G$ price when G$ is being bought from the reserve, and lowering it when G$ is being sold back to the reserve.

Social Rewards (social annual percentage yield)

Because staking is critical to GoodDollar’s ability to generate and distribute crypto UBI, it is important to offer a range of incentives to those willing to put up capital to assist the UBI mission. One of those incentives is a unique GoodDollar offering we call Social APY. To show users the power of their contribution, we set out for each user how much G$ will be distributed to the GoodDollar community each year as a result of his/her stake.

Sending/Receiving

G$ coins can be sent to and received from wallets across the Ethereum network. This feature enables the G$ coins to be used as a means of payment and therefore creates more use cases, and hence utility, for G$ coins.

Buying/Selling

A user can send his or her G$ to the GoodDollar Reserve smart contract and receive a supported currency in exchange. Alternatively, he or she can send supported currency to the GoodDollar Reserve smart contract and receive G$ in exchange.

Those who sell G$ to the reserve receive supported cryptocurrency minus a small penalty called an “exit contribution”. Those who buy G$ from the reserve receive a specialized token called G$X, which can be used to reduce any exit contributions faced on future transactions.

Confronting Potential System Abuse

The question of secure and unique identity is critical to whether the GoodDollar system succeeds or suffers abuse by malicious actors. Fraudulent activity is more than an irritant. It jeopardizes the economy’s integrity. Since GoodDollar distributes free G$, it is crucial to verify that each user can sign up only once. Secure digital identification has been considered key to achieving financial inclusion [38]. The simple option is to use government identification or a traditional “know your customer” process, but this is simply not practical if we are trying to reach the 1.7 billion people living “unbanked”, or with no or insufficient access to traditional financial services

To overcome this challenge and to accelerate adoption, GoodDollar has equipped the GoodDollar Wallet – the initial destination for users to sign up and claim G$ coins – with a built-in identity verification process. The app utilizes Facetec’s Zoom 3D to conduct facial verification and video capturing in order to ensure that each person is unique and alive. We believe that in the near future there will be multiple access and endpoints through which users can claim G$ coins. These will all be equipped with embedded identity solutions.

[37]ERC-20 Token Standard, November 2019 [38]White, O., Madgavkar, A., Manyika, J., Mahajan, D., Bughin, J., McCarthy, M., Sperling, O., Digital Identification: A Key to Inclusive Growth, January 2019

Last updated