DefiLlama / DefiLlama-Adapters

861 stars 4.92k forks source link

Add Umoja TVL. #11075

Closed DarkRoku12 closed 1 month ago

DarkRoku12 commented 1 month ago
Name (to be shown on DefiLlama):

Umoja Protocol

Twitter Link:

https://x.com/UmojaProtocol

List of audit links if any:

https://umoja.gitbook.io/umoja-protocol/umoja-protocol/protocol-audits Audits by: Quantstamp, Cyberscope, Hacken.

Website Link:

https://umoja.xyz/

Logo (High resolution, will be shown with rounded borders):

Grab it from Twitter/X please: https://x.com/UmojaProtocol

Current TVL:

~ 198.69 k

Chain:

Arbitrum

Short Description (to be shown on DefiLlama):

Umoja is an asset management protocol that uses 'smartcoins' to automate money, enabling money itself to autonomously minimize risk & optimize returns.

Category (full list at https://defillama.com/categories) *Please choose only one:

Synthetics

Methodology (what is being counted as tvl, how is tvl being calculated):

The TVL is calculated by the collateral value the users deposits when creating an Umoja Synth. The life of an Umoja Synth ends when the position closes or expires, and all the balance accrued by the Umoja Synth is sent back to the user.

llamatester commented 1 month ago

The adapter at projects/umoja exports TVL:

arbitrum                  199.18 k

total                    199.18 k 
g1nt0ki commented 1 month ago

hi, bit confused, how is the tvl higher than the amount of USDC locked in the synth pool?

DarkRoku12 commented 1 month ago

hi, bit confused, how is the tvl higher than the amount of USDC locked in the synth pool?

We don't hold that USDC balance under the contract that opens/closes the positions among other public actions. Umoja Synth Pool [perhaps a somewhat misleading name] contract address is 0x7ba46133E8D6075af638ffDc9472AcCFEFb27A2b

If you check the transactions list for that contract.

You can filter by the withdraw tokens function. Example: https://arbiscan.io/tx/0xa9d69f4b23b54234a9627ecc810f15b96bd509b3188e51dc8454a7aa120536ac

We use another address as a proxy (1) to later move the funds to a CEX to execute the position (2).

  1. https://arbiscan.io/token/0xaf88d065e77c8cc2239327c5edb3a432268e5831?a=0x7e75fd30135ace9d824e45d21e7a0c8911f11cc5
  2. https://arbiscan.io/tx/0x46b685eb1dcd42997c6561157310621d5ed175743cff8a8db50b17bfa022245e

While the placement of the position is executed on the blockchain, the trading part is centralized. Until we refund whatever the remaining Umoja Synth balance is, we have those funds 'locked' in our platform.

Hope the explanation serves.

g1nt0ki commented 1 month ago

hmm, is there some other way to get value locked other than looking at logs, maybe via graph api? current implementation is not scalable as time goes on, #logs go up

Other issue is, if the funds are moved to cex, technically it is not locked in the smart contract, need to think how to categorize/display this.

DarkRoku12 commented 1 month ago

We might do a combination of API + Blockchain calls, to get only active Umoja Synths and their transactions hash list (API), those we can then verify the collateral within the DefiLlama middleware.

Since DeFiLLama is discouraging API/Fetch adapters, I preferred to go to the fully DeFi route (Logs). Currently, we have no other way to track TVL on the Blockchain than using Creation + Closing logs.

Any thoughts @g1nt0ki ?

DarkRoku12 commented 1 month ago

@g1nt0ki any updates on DeFiLlama side?

g1nt0ki commented 1 month ago

@DarkRoku12 sorry for the delay, we had an internal discussion about this, can you update code to pull tvl via rest api? I think it is fine in this case.

llamatester commented 1 month ago

The adapter at projects/umoja exports TVL:

arbitrum                  8.87 k

total                    8.87 k 
DarkRoku12 commented 1 month ago

@DarkRoku12 sorry for the delay, we had an internal discussion about this, can you update code to pull tvl via rest api? I think it is fine in this case.

I've updated the PR, now it does fetch TVL from our API.