GoodDocs
  • Welcome to GoodDocs!
  • GoodDollar Ecosystem Vision
  • About the Protocol
    • Usage
    • Tokenomics
    • Sybil-Resistance
    • Protocol V3 Documentation
      • Architecture & Value Flow
      • System's Elements
      • Core Contracts & API
        • GoodDollar
        • GoodCompoundStaking V2 (DAI)
        • GoodAaveStaking V2 (USDC)
        • GoodReserveCDai
        • GoodFundManager
        • GoodMarketMaker
        • ContributionCalculation
        • UBIScheme
        • Identity
        • FirstClaimPool
        • AdminWallet
        • OneTimePayments
        • DonationsStaking
        • NameService
        • GReputation
        • CompoundVotingMachine
        • StakersDistribution
        • UniswapV2SwapHelper
        • Invites
        • GovernanceStaking
        • ClaimersDistribution
        • CompoundStakingFactory
        • AaveStakingFactory
        • ExchangeHelper
        • FuseFaucet
        • GoodDollarMintBurnWrapper
      • Previous Protocol Versions
        • Protocol V1
          • Architecture & Value Flow
          • Core Contracts & API
        • Protocol V2
          • Architecture & Value Flow
          • System's Elements
            • 1. The token (G$)
            • 2. The Reserve
            • 3. The Trust
            • 4. Staking rewards (APR)
            • 5. The Fund Manager
            • 6. The Distribution Contract (DisCo)
            • 7. Governance (DAO)
          • Core Contracts & API
            • GoodDollar
            • GoodCompoundStaking V2 (DAI)
            • GoodAaveStaking V2 (USDC)
            • GoodReserveCDai
            • GoodFundManager
            • GoodMarketMaker
            • ContributionCalculation
            • UBIScheme
            • Identity
            • FirstClaimPool
            • AdminWallet
            • OneTimePayments
            • DonationsStaking
            • NameService
            • GReputation
            • CompoundVotingMachine
            • StakersDistribution
            • UniswapV2SwapHelper
            • Invites
            • GovernanceStaking
            • ClaimersDistribution
            • CompoundStakingFactory
            • AaveStakingFactory
            • ExchangeHelper
            • FuseFaucet
  • User Guides
    • Buy & Sell G$
    • Stake to create UBI
    • Claim GOOD and G$X
    • Bridge GoodDollars
    • Connect another wallet address to identity
  • Liquidity
  • Wallet and Products
    • GoodWallet
    • GoodDapp
    • New GoodWallet
    • GoodCollective
    • GoodID & GoodOffers
    • 3rd Party Partners and Integrations
  • Frequently Asked Questions
    • Web3 basic knowledge and security tips - by Consensys
    • About GoodDollar
    • GoodDollar Protocol & G$ Token
    • Using GoodDollar
    • GoodDollar Community
    • Troubleshooting
  • For Developers
    • Contributing to GoodDollar
    • GoodDapp Developer Guides
      • Deploy your own GoodDapp UI
    • APIs & SDKs
      • Claim UBI
      • React Hooks Setup
      • Login With GoodDollar
      • Sybil Resistance
        • Identity (Ethers v5 / React)
        • Identity (Viem/Wagmi)
  • Useful Links
    • GoodDollar.org
    • GoodDapp
    • GoodWallet
    • GoodDollar User Guides
    • Statistics Dashboard
    • GoodDollar Whitepaper
    • GoodDollar Litepaper
    • GoodDollar Litepaper - Español
Powered by GitBook
On this page
  • Prerequisites
  • Buy G$ with DAI / cDAI
  • Sell G$ to the reserve
  • References

Was this helpful?

  1. User Guides

Buy & Sell G$

Instruction guide on how to interact with GoodDollarV2 contracts for buying and selling G$s directly

PreviousUser GuidesNextStake to create UBI

Last updated 1 year ago

Was this helpful?

There are key user and stakeholder hypotheses built into our theory of change and adoption. Ultimately, the success of the GoodDollar economy is contingent upon market demand from both those who support G$ and those who claim it, as the economy itself is a balance between supply and demand.

G$ is designed to gain usage and to be widely adopted as a means of exchange over time. Like Bitcoin, the initial dollar value, or “price”, of each G$ will be low – in the tenths of a cent on the dollar range to begin with. Our belief is that, because it offers free access to an instantly liquid, global basic income network, G$ will first be adopted in markets where smartphone-enabled populations currently live on less than US$10 a day. We believe that, for these populations, G$ could emerge as a useful complementary currency for use in peer-to-peer digital marketplaces as well as for on-the-ground goods and services, particularly as the network grows.

GoodDollar ERC20 is a reserve backed currency with issuance governed by an AMM (automated market maker) encoded in the GoodReserve contract. Each time you buy or sell, from or to, the reserve - tokens are respectively being minted or burned according to WhitePaper.

You are able to buy and sell G$ directly to, and from, the GoodDollar Reserve contract. This healthy activity grows the liquidity of the ecosystem and increases the impact of the UBI GoodDollar delivers. Two key enhancements to the Reserve AMM contract support this change:

  • The introduction of a 3% “exit contribution” fee on all sales of G$ into the #GoodDollar Reserve in exchange for supported cryptocurrencies. All fees go back into the #GoodDollar Reserve and grow the value of the overall economy.

  • The creation of a new ERC20 token – G$X – that lets people buy and sell G$ to the Reserve without a fee. All those who buy G$ from the reserve will also receive an equal number of G$X.

Prerequisites

  1. You should have a web3 wallet (like ).

  2. You should have enough ETH in your wallet in order to pay the gas fees of the transaction.

  3. You should have enough balance of the currency you are using to buy/sell with.

  4. You should approve to exchangeHelper enough allowance to use your balance in order to buy/sell G$.

    1. Go to the contract page of the currency you are willing to buy/sell with, for example and click on “Contract”:

2. Now click on “Write as Proxy”:

3. Connect to your wallet by clicking on “Connect to Web3”:

4. Now scroll down and click on “11. approve”:

5. You will have to enter two parameters: Spender and Amount. The spender is the contract address of the ExchangeHelper (find the relevant exchangeHelper address in the references section on the bottom of the page), the amount is the amount you would like to approve in the currency you are buying with, click Write.

Buy G$ with DAI / cDAI

  1. First, make sure you have done everything in the prerequisites section.

  2. Optional step, using the buyReturn function you can check how much G$ you will get.

    1. Go to GoodMarketMaker (either Mainnet, Kovan or Ropsten, link in the references below).

    2. Click on “Contract”:

3. Click on “Read as Proxy”:

4. Click on “2. buyReturn”:

5. At “_token (address) insert the address of the token you are planning to buy with and at the “_tokenAmount (uint256)” insert the amount that you would like to pay with (don’t forget to add the relevant amount of decimals.

6. For example, let’s check how much G$ you will get for 10 cDAI, so you will put cDAI contract address (in this case it’s Kovan network) at the first field and 1000000000 (which is 10 cDAI because cDAi has 8 decimals):

And you got a result of 9080104 which is 90801.04 G$ because G$ has 2 decimals.

3. Now, go to the exchangeHelper (either Mainnet, Kovan or Ropsten, link in the references below)

4. Click on “Contract”:

5. Click on “Write as Proxy”:

6. Connect your wallet by clicking on “Connect to Web3” button:

7. Click on “1. buy”:

8. Finally, we are about to purchase G$, your screen should look like that now:

9. Now let’s explain those 6 parameters, followed by an example:

  1. buy: Payable amount in ether, if you buy in DAI / cDAI insert 0.

  2. _buyPath (address[]): The address of the token you want to buy with, if you buy with DAI / cDAI than insert one of those addresses.

  3. _tokenAmount (uint256): Amount of G$ you would like to buy in the currency you are paying with, don’t forget to add the correct amount of zeros according to the specific token, for example 8 zeros for cDAI and 18 zeros for DAI.

  4. _minReturn (uint256): Minimum amount of G$s expected after buy transaction.

  5. _minDAIAmount (uint256): If input token is not cDAI then this parameter must be provided in order to correct swap and this parameter for minimum DAI return amount from Uniswap swap transaction

  6. _targetAddress (address): Recipient address, if the recipient is you then insert 0x0000000000000000000000000000000000000000

Example with cDAI:

Sell G$ to the reserve

  1. Optional step, using the sellReturn function you can check how much you will get for the G$ you are planning to sell.

    1. Go to GoodMarketMaker (check the references section for the relevant link).

    2. Click “Read as Proxy”.

    3. Go to “13. sellReturn”.

    4. You will have two parameters to fill;

      1. _token (address) - this is the address of the token contract you would like to check how much you will get for your GoodDollars you are planning to sell.

      2. _gdAmount (uint256) - this is the G$ amount you would like to sell and check how much you will get for, don’t forget to add the two decimals.

  2. Go to exchangeHelper contract page.

  3. Click on “Contract”.

  4. Click on “Write as Proxy”.

  5. Connect to your wallet by clicking on “Connect to Web3” button.

  6. Open the sell function by clicking on “3. Sell”.

  7. Now the parameters here are almost the same as the parameters on the buy function.

    1. _sellPath (address[]): The address of the token you would like to get for the G$ you are selling, if you buy with DAI / cDAI than insert one of those addresses.

    2. _gdAmount (uint256): Amount of G$ you would like to sell, don’t forget to add two zeros as G$ has two decimals.

    3. _minReturn (uint256): Minimum amount of G$s expected after buy transaction.

    4. _minTokenReturn (uint256): If input token is not cDAI then this parameter must be provided in order to correct swap and this parameter for minimum DAI return amount from Uniswap swap transaction

    5. _targetAddress (address): Recipient address, if the recipient is you then insert 0x0000000000000000000000000000000000000000

References

Contract

Mainnet

Kovan

Ropsten

Gooddollar ERC20

exchangeHelper

Did not released yet

GoodMarketMaker

Did not released yet

DAI

cDAI

G$X token lets people buy and sell G$ to the Reserve without an exit fee. All those who buy G$ from the reserve will also receive an equal number of G$X. See

Claim GOOD and G$X
0x67C5870b4A41D4Ebef24d2456547A03F1f3e094B
0x46183b8822BB7Cbf27E10A1acc95DfB3b5f0ec79
0x4738C5e91C4F809da21DD0Df4B5aD5f699878C1c
0x7C8f7F618c2F84C656aeb51D652848ce76990dB7
0xAaB60FE459C0eB809461d858ce9A98523d826c2A
0xE0fdF6e09C4ac5aa5A8952ac32b16446eE0D0b79
0xAaB60FE459C0eB809461d858ce9A98523d826c2A
0x6b175474e89094c44da98b954eedeac495271d0f
0x4f96fe3b7a6cf9725f59d353f723c1bdb64ca6aa
0xB5E5D0F8C0cbA267CD3D7035d6AdC8eBA7Df7Cdd
0x5d3a536e4d6dbd6114cc1ead35777bab948e3643
0xf0d0eb522cfa50b716b3b1604c4f0fa6f04376ad
0x6ce27497a64fffb5517aa4aee908b1e7eb63b9ff
equation 2
MetaMask
cDAI contract page