Acueos — The Decentralized Money Market Protocol on EOS

Acueos
6 min readJun 24, 2019

[Update 10/9/2019 Acueos has launched on mainnet]

I am incredibly excited to introduce Acueos, the decentralized money market protocol for the EOS blockchain, based on Compound Finance’s, with algorithmically set interest rates determined by supply and demand. Once we deploy Acueos to the EOS main network you can seamlessly supply assets into the protocol and earn interest without having to wait for a specific counterparty. You can also leverage your existing portfolio as collateral to instantaneously borrow other assets for uses like financing new investments or trading and shorting. As long as you maintain sufficient collateral you repay as little or as much as you want, whenever you want.

We’ve deployed Acueos to the EOS Jungle test network to give everyone (e.g., the developers, community, and you) a chance to “kick the tires” before real assets are involved. Please visit https://acueos.io and log in with Scatter to interact with the protocol. Before doing so you will need a test account and test EOS tokens which you can get by selecting the “Create Account” and “Faucet” options on the Jungle Testnet Monitor:

To get test CUSD tokens, the stable cryptocurrency from Carbon backed by the US dollar, select “EOS (Jungle)” and press the “SIGN IN TO EOS” button from the CUSD Faucet:

If you have any questions, want to share ideas and/or provide feedback about Acueos, you can do so on Telegram by joining here https://t.me/joinchat/IXMsLRZuw1Q9sKjBH_2eAA.

For those of you interested in fulfilling the role of liquidator and/or programmatically integrating with the protocol, please continue reading the sections below.

Liquidators

As is described in the Compound whitepaper:

If the value of a user’s supplied assets divided by the value of their outstanding borrowing declines below the collateral ratio, the user’s collateral becomes available to purchase (with the borrowed asset) at the current market price minus a liquidation discount; this incentivizes an ecosystem of arbitrageurs to quickly step in to reduce the borrower’s exposure, and eliminate the protocol’s risk.

Anyone wishing to fulfill the role of liquidator can do so easily with this tool and/or they can build their own by calling the money market contract directly. For details see the developer section below titled: “Compute and read account Liquidity, Supply balance, and Borrow balance”.

Developers

The documentation below is based on this. The actions described below are defined by the moneymarket1 smart contract. The examples make use of cleos, the EOS command line utility with the “push action” parameters.

Supply — Transfers an asset into the money market which begins accumulating interest based on the current supply rate for the asset. Example of supplying 100 CUSD:

cleos push action stablecarbon transfer ‘[ “figuerz11112”, “moneymarket1”, “100.00 CUSD”, “1,supply” ]’ -p figuerz11112@active

Withdraw — Transfers an asset from the money market to the user, reducing the user’s supply balance. The amount withdrawn must be less than the user’s account liquidity and the market’s available liquidity. Specifying a withdrawMax amount of 1 withdraws the maximum quantity of tokens available. Example of withdrawing 1 CUSD:

cleos push action moneymarket1 withdraw ‘{“sender”:”figuerz11112", “asset”:{“contract”:”stablecarbon", “quantity”:”1.00 CUSD”}, “withdrawMax”:0}’ -p figuerz11112@active

Borrow — The borrow function transfers an asset from the money market to the user, which begins accumulating interest based on the current borrow interest rate for the asset. The amount borrowed must be less than the user’s borrow capacity and the market’s available liquidity. Users must maintain a collateral requirement to avoid liquidation. Example borrowing 1 EOS:

cleos push action moneymarket1 borrow ‘{“sender”:”figuerz11112", “asset”:{“contract”:”eosio.token”, “quantity”:”1.0000 EOS”}}’ -p figuerz11112@active

Repay — The repay function transfers an asset into the money market, reducing the user’s borrow balance. Example of repaying 1 EOS:

cleos push action eosio.token transfer ‘[ “figuerz11112”, “moneymarket1”, “1.0000 EOS”, “1,repayBorrow” ]’ -p figuerz11112@active

Compute and read account Liquidity, Supply balance, and Borrow balance

Account liquidity is defined as the total value of a user’s supply balances subtracted by the total value of that user’s borrow balances multiplied by the protocol collateral ratio. Users who do not have positive account liquidity do not have the ability to withdraw or borrow any assets until they bring their account liquidity back positive by supplying more assets or paying back outstanding borrows. A negative value for account liquidity also means the user is subject to liquidation to bring their account liquidity back to zero.

Example of computing and reading current account liquidity, supply, balance and borrow balance:

cleos push action moneymarket1 cptbalances ‘{“account”:”figuerz11112"}’ -p figuerz11112@active

To read computed values read the corresponding tables:

Liquidity:

cleos get table moneymarket1 moneymarket1 actliqdty3

Corresponding liquidity table data (NOTE: see appendix below for the meaning of “block”):

Supply:

cleos get table moneymarket1 moneymarket1 splyblnces2

Corresponding supply data:

Borrow:

cleos get table moneymarket1 moneymarket1 brwblnces2

Corresponding borrow table data:

Liquidate — A user who has negative account liquidity is subject to liquidation by other users of the protocol to return his/her account liquidity back to 0 (i.e., exactly at the collateral requirement), reducing the risk of that account. When a liquidation occurs, a liquidator may repay some or all of an outstanding borrow on behalf of a liquidatee and in return receive a discounted amount of collateral held by the liquidatee; this discount is defined as the liquidation discount, and at launch will be 5%. Example below of account liquidator figuerz11111 targeting liquidatee figuerz11112. The result of the example below will be that the liquidator will receive CUSD at a discount in exchange for having paid down .0001 EOS of the debt position of the liquidatee.

cleos push action eosio.token transfer ‘[ “figuerz11111”, “moneymarket1”, “0.0001 EOS”, “1,liquidateBorrow,targetAccount=figuerz11112 assetCollateral=CUSD” ]’ -p figuerz11111@active

Note: In order to prevent spam-like misuse of the protocol there is a small origination fee of 0.025% for opening a borrowing position. So, for example, if a user borrows 1 EOS, the actual borrowing position will be for 1.00025 EOS.

Conclusion

In closing, I hope that you are able to participate in the Acueos community as we make history by democratizing the financial system.

Appendix

Settings Table

Example:

cleos get table moneymarket1 moneymarket1 settings3

Sample output:

NOTE on endianness : the EOSIO software returns the uint128_t type as little-endian so you’ll likely find a utility function like the one below to be helpful in converting it to big-endian:

Market Table

Meaning of “block” and “blockNumber” in the tables

It is a monotonically increasing number which is computed as follows:

Price Oracle Table

Example:

cleos get table priceoracle1 priceoracle1 prices4

Sample output:

--

--