Rough Guide for buying GoodDollar from the GoodReserve

From Democratic Money wiki
Revision as of 19:58, 11 December 2020 by Fcecin (talk | contribs)

This is what I did to buy GoodDollars (if I'm not mistaken).

You can see what I did on the blockchain by looking at the account I set up specifically for that, which is https://etherscan.io/address/0x5e2b72898d14426e886967717f433673624fcefd

This might not be the most capital-efficient way. If I'm not mistaken, the liquidity of G$ on Uniswap is bad, and I don't think it has any liquidity at any other exchange. So the GoodReserve is the best market for GoodDollar right now, and it can respond to any quantity, as it is a Bancor market.

Install the Metamask plugin into your favorite browser (e.g. Firefox) and set up a wallet there.

Make sure "ETH mainnet" is selected on Metamask, so you're not trying to send testnet transactions.

Transfer some ETH into that wallet, like, I don't know, $50 or $100.

Buy cDAI. Binance does not have cDAI. There are two main ways: either go to Uniswap and buy it there or go to https://compound.finance and do it there. I did the latter, through I think the next time I buy cDAI I might do it on Uniswap. Using compound.finance is a pain in the ass and it's expensive. It has a bunch of "unlock" and "approve" and "borrow" transactions etc. It's a bureaucracy and some transactions can cost like $30. It's painful. Few things in computing have sucked more in my life than Compound.Finance.

Ok, you have some ETH and some cDAI now. I assume both are in the wallet you created for your metamask plugin that's installed in the browser you're using for all of this.

Go to https://goodswap.xyz.

Click on "Inject." This will link your Metamask plugin with the Goodswap website.

Now, this is important. You need to authorize the amount of cDAI you are going to spend. It's more stupid bureaucracy. That request will (I think) talk to the cDAI contract. That is, the cDAI token cannot be spent on a contract (like the GoodReserve) unless you pay Ethereum to execute a "spending authorization" on cDAI, which is fucking stupid, but whatever. That authorization is on the form of (spender, amount), so you're telling the cDAI contract that you are authorizing spending a specific amount of cDAI on the GoodReserve. And that's what we are going to do next.

Enter the amount of cDAI that you want to spend. If you enter less than the cDAI you have, you won't be able to spend it all on the next step. So if you want to spend all of your cDAI, enter all of that amount there.

Now, just to make sure, we are going to fill in the other field, which is the minimum amount of GoodDollars that we expect. That field is not really important, you can enter like "1" there. But if you want to be a nerd, here's what you do:

Go into the GoodDollar contract: https://etherscan.io/readContract?m=normal&a=0x5C16960F2Eeba27b7de4F1F6e84E616C1977e070&v=0x5C16960F2Eeba27b7de4F1F6e84E616C1977e070#readCollapse5

Expand the "CurrentPrice" form.

Enter "0x5d3a536E4D6DbD6114cc1Ead35777bAB948E3643" in the string input field (this is the cDAI contract)

It will spit out a number like, in my case, "590530".

Add 8 decimal places to that number. In my case, that yielded 0.00590530. That is the price of 1 GoodDollar (G$) in cDAI. Remembering that cDAI is NOT a DAI. So it is not worth 1 USD. You actually have to go into HTTPS://COINGECKO.COM (CoinMarketCap does NOT have cDAI listed) and check how much a cDAI is worth. Right now, 1 cDAI is like 0.021 USD.

So now take the number of cDAI you have, like "100", and divide by that price. Say, 100 / 0.00590530 = 16933.94069734 GoodDollars.

In other words, spending 100 cDAI into the GoodReserve should yield 16933.94069734 GoodDollars for you. However, we don't want the transaction to fail, so we are not going to enter "16933.94069734" there, because that's a minimum return and, the GoodReserve uses the Bancor curve, which has slippage. So in my case I entered like "16000" which was a safe number. So if the slippage or whatever of the GoodReserve contract would exceed 933 GoodDollars, the transaction would be reverted and I would keep my cDAI. But really, what you want to do, really, is just YOLO into the contract and just throw the cDAI there, and whatever GoodDollars return, that's OK, because the Bancor curve actually works. But whatever, you can use a number there that's like 5% or 10% less than the exchange rate that you calculate by going into the GoodReserve contract and doing all this math, just in case, to max out the nerdiness.

OK, to recap, in my case, I put "100" in the CDAI field and "16000" in the minimum GoodDollar amount field.

Now, I click on "UNLOCK." This will propose a transaction to your Metamask plugin. If you think it's OK, you accept it, otherwise you reject it. Notice that you're going to be spending some ETH and the amounts aren't nothing. It's like $2 here, $5 there, etc. So pay attention to the ETH transaction fee costs.

That transaction has "prepared" you to spend the amount of CDAI that you said you would spend. Monitor your wallet address on Etherscan to see its progress. When it goes through, the interface of GoodSwap.xyz should indicate that on the upper right corner.

Now that you have "Unlocked the CDAI" (sigh...) you can pay the Ethereum miners again, but now you actually do buy the GoodDollars. Since you have already filled out both the CDAI amount field and the GoodDollar minimum amount field, you can click on BUY and it should propose the buy transaction into Metamask. If you accept it, it will be sent to the network, and if the gas estimation is working, it should go through and on Etherscan you will see the GoodDollars be credited in your Ethereum wallet.

Now, the GoodDollars don't show up in your GoodDollar wallet because the GoodDollar wallet uses the FUSE chain. To send the GoodDollars into the FUSE sidechain and into your personal GoodDollar wallet interface, you need to use a bridge contract, i.e. you send the GoodDollar ERC20 token into some Ethereum contract and it pops out on the FUSE world at the correct place. I don't know how to do that because I'm more interested in Bancor and the GoodReserve at the moment, but the GoodDollar guys will be more than happy to assist.

RPC communication between the GoodSwap.xyz site and the Metamask plugin can be debugged by pressing F12 on most browsers (Firefox at least) and going into the "Console" tab.

After your purchase of GoodDollar, you can see how much you have affected the GoodReserve G$ price. It's showing as "590532" now, so a 100 cDAI (about 2.1 USD) purchase increased the GoodDollar price from ~ (0.00590530 * 0,021) USD to ~ (0.00590532 * 0,021) USD.

Here's my Twitter thread with the aftermath of a large reserve purchase (5 million G$): https://twitter.com/fabianacecin/status/1337477583437508616