Skip to content
This repository has been archived by the owner on Jan 24, 2024. It is now read-only.

fix(tectonic): fix tectonic token apy & liquidity calculation #805

Merged
merged 1 commit into from
Jun 30, 2022

Conversation

CronosLabsDev
Copy link
Contributor

@CronosLabsDev CronosLabsDev commented Jun 30, 2022

Description

Fix APY and liquidity calculations and make them match the display on tectonic app.

Checklist

How to test?

Regarding Supply token fetcher

endpoint: http://localhost:5001/apps/tectonic/tokens?groupIds[]=supply&network=cronos
response:

[{"type":"app-token","address":"0xb3bbf1be947b245aef26e3b6a9d777d7703f4c8e","network":"cronos","appId":"tectonic","groupId":"supply","symbol":"tUSDC","decimals":8,"supply":164803330.407479,"price":0.1011460472194537,"pricePerShare":0.1009441589016504,"tokens":[{"id":"315763","networkId":13,"address":"0xc21223249ca28397b4b6541dffaecc539bff0c59","name":"USD Coin","symbol":"USDC","decimals":6,"coingeckoId":"usd-coin","status":"approved","hide":false,"canExchange":true,"updatedAt":"2022-06-30T03:06:53.968Z","createdAt":"2022-05-24T13:24:09.986Z","price":1.002,"totalSupply":"835000000","networkEnumValue":"cronos","type":"base-token","network":"cronos"}],"dataProps":{"supplyApy":0.0086,"borrowApy":0.0233,"liquidity":100315820.58092299,"tectonicCoreAddress":"0xb3831584acb95ed9ccb0c11f677b5ad01deaeec0"},"displayProps":{"label":"USDC","secondaryLabel":{"type":"dollar","value":1.002},"tertiaryLabel":"0.86% APY","images":["https://storage.googleapis.com/zapper-fi-assets/tokens/cronos/0xc21223249ca28397b4b6541dffaecc539bff0c59.png"],"statsItems":[{"label":"APY","value":{"type":"pct","value":0.86}},{"label":"Liquidity","value":{"type":"number","value":100315820.58092299}}],"balanceDisplayMode":"underlying"}},{"type":"app-token","address":"0x67fd498e94d95972a4a2a44acce00a000af7fe00","network":"cronos","appId":"tectonic","groupId":"supply","symbol":"tWBTC","decimals":8,"supply":736.70258963,"price":2024.3450531117471,"pricePerShare":0.1007036639693437,"tokens":[{"id":"315522","networkId":13,"address":"0x062e66477faf219f25d27dced647bf57c3107d52","name":"Wrapped BTC","symbol":"WBTC","decimals":8,"coingeckoId":"wrapped-bitcoin","status":"approved","hide":false,"canExchange":true,"updatedAt":"2022-06-30T03:06:53.968Z","createdAt":"2022-05-24T13:24:09.986Z","price":20102,"totalSupply":"15458","networkEnumValue":"cronos","type":"base-token","network":"cronos"}],"dataProps":{"supplyApy":0.0077,"borrowApy":0.0552,"liquidity":605.69969716,"tectonicCoreAddress":"0xb3831584acb95ed9ccb0c11f677b5ad01deaeec0"},"displayProps":{"label":"WBTC","secondaryLabel":{"type":"dollar","value":20102},"tertiaryLabel":"0.77% APY","images":["https://storage.googleapis.com/zapper-fi-assets/tokens/cronos/0x062e66477faf219f25d27dced647bf57c3107d52.png"],"statsItems":[{"label":"APY","value":{"type":"pct","value":0.77}},{"label":"Liquidity","value":{"type":"number","value":605.69969716}}],"balanceDisplayMode":"underlying"}},{"type":"app-token","address":"0x543f4db9bd26c9eb6ad4dd1c33522c966c625774","network":"cronos","appId":"tectonic","groupId":"supply","symbol":"tWETH","decimals":8,"supply":9859.625183294256,"price":110.04464192646515,"pricePerShare":0.1004918834826084,"tokens":[{"id":"315802","networkId":13,"address":"0xe44fd7fcb2b1581822d0c862b68222998a0c299a","name":"Wrapped Ether","symbol":"WETH","decimals":18,"coingeckoId":"weth","status":"approved","hide":false,"canExchange":true,"updatedAt":"2022-06-30T03:06:53.968Z","createdAt":"2022-05-24T13:24:09.986Z","price":1095.06,"totalSupply":"158944","networkEnumValue":"cronos","type":"base-token","network":"cronos"}],"dataProps":{"supplyApy":0.012,"borrowApy":0.064,"liquidity":7490.968787961228,"tectonicCoreAddress":"0xb3831584acb95ed9ccb0c11f677b5ad01deaeec0"},"displayProps":{"label":"WETH","secondaryLabel":{"type":"dollar","value":1095.06},"tertiaryLabel":"1.2% APY","images":["https://storage.googleapis.com/zapper-fi-assets/tokens/cronos/0xe44fd7fcb2b1581822d0c862b68222998a0c299a.png"],"statsItems":[{"label":"APY","value":{"type":"pct","value":1.2}},{"label":"Liquidity","value":{"type":"number","value":7490.968787961228}}],"balanceDisplayMode":"underlying"}},{"type":"app-token","address":"0xeadf7c01da7e93fdb5f16b0aa9ee85f978e89e95","network":"cronos","appId":"tectonic","groupId":"supply","symbol":"tCRO","decimals":8,"supply":504962165.7838251,"price":0.011991997756324384,"pricePerShare":0.10298864442051171,"tokens":[{"id":"315504","networkId":13,"address":"0x0000000000000000000000000000000000000000","name":"Cronos","symbol":"CRO","decimals":18,"coingeckoId":"crypto-com-chain","status":"approved","hide":false,"canExchange":true,"updatedAt":"2022-06-30T03:06:53.968Z","createdAt":"2022-05-24T13:24:09.986Z","price":0.11644,"totalSupply":"30263013692","networkEnumValue":"cronos","type":"base-token","network":"cronos"}],"dataProps":{"supplyApy":0.0166,"borrowApy":0.0344,"liquidity":231340320.82077944,"tectonicCoreAddress":"0xb3831584acb95ed9ccb0c11f677b5ad01deaeec0"},"displayProps":{"label":"CRO","secondaryLabel":{"type":"dollar","value":0.11644},"tertiaryLabel":"1.66% APY","images":["https://storage.googleapis.com/zapper-fi-assets/tokens/cronos/0x0000000000000000000000000000000000000000.png"],"statsItems":[{"label":"APY","value":{"type":"pct","value":1.66}},{"label":"Liquidity","value":{"type":"number","value":231340320.82077944}}],"balanceDisplayMode":"underlying"}},{"type":"app-token","address":"0xe1c4c56f772686909c28c319079d41adfd6ec89b","network":"cronos","appId":"tectonic","groupId":"supply","symbol":"tDAI","decimals":8,"supply":25382538.16844891,"price":0.1012855265410362,"pricePerShare":0.10108335982139341,"tokens":[{"id":"315822","networkId":13,"address":"0xf2001b145b43032aaf5ee2884e456ccd805f677d","name":"Dai Stablecoin","symbol":"DAI","decimals":18,"coingeckoId":"dai","status":"approved","hide":false,"canExchange":true,"updatedAt":"2022-06-30T03:06:53.968Z","createdAt":"2022-05-24T13:24:09.986Z","price":1.002,"totalSupply":"161000000","networkEnumValue":"cronos","type":"base-token","network":"cronos"}],"dataProps":{"supplyApy":0.0023,"borrowApy":0.0123,"liquidity":20093170.56429557,"tectonicCoreAddress":"0xb3831584acb95ed9ccb0c11f677b5ad01deaeec0"},"displayProps":{"label":"DAI","secondaryLabel":{"type":"dollar","value":1.002},"tertiaryLabel":"0.22999999999999998% APY","images":["https://storage.googleapis.com/zapper-fi-assets/tokens/cronos/0xf2001b145b43032aaf5ee2884e456ccd805f677d.png"],"statsItems":[{"label":"APY","value":{"type":"pct","value":0.22999999999999998}},{"label":"Liquidity","value":{"type":"number","value":20093170.56429557}}],"balanceDisplayMode":"underlying"}},{"type":"app-token","address":"0xa683fdfd9286eedfea81cf6da14703da683c44e5","network":"cronos","appId":"tectonic","groupId":"supply","symbol":"tUSDT","decimals":8,"supply":168013387.214252,"price":0.10093948426149288,"pricePerShare":0.100838645615877,"tokens":[{"id":"315677","networkId":13,"address":"0x66e428c3f67a68878562e79a0234c1f83c208770","name":"Tether USD","symbol":"USDT","decimals":6,"coingeckoId":"tether","status":"approved","hide":false,"canExchange":true,"updatedAt":"2022-06-30T03:06:53.968Z","createdAt":"2022-05-24T13:24:09.986Z","price":1.001,"totalSupply":"587000000","networkEnumValue":"cronos","type":"base-token","network":"cronos"}],"dataProps":{"supplyApy":0.0112,"borrowApy":0.0274,"liquidity":90782780.418618,"tectonicCoreAddress":"0xb3831584acb95ed9ccb0c11f677b5ad01deaeec0"},"displayProps":{"label":"USDT","secondaryLabel":{"type":"dollar","value":1.001},"tertiaryLabel":"1.1199999999999999% APY","images":["https://storage.googleapis.com/zapper-fi-assets/tokens/cronos/0x66e428c3f67a68878562e79a0234c1f83c208770.png"],"statsItems":[{"label":"APY","value":{"type":"pct","value":1.1199999999999999}},{"label":"Liquidity","value":{"type":"number","value":90782780.418618}}],"balanceDisplayMode":"underlying"}},{"type":"app-token","address":"0xfe6934fdf050854749945921faa83191bccf20ad","network":"cronos","appId":"tectonic","groupId":"supply","symbol":"tTONIC","decimals":8,"supply":15407910937375.723,"price":1.839170340759725e-8,"pricePerShare":0.1132556817040184,"tokens":[{"id":"315791","networkId":13,"address":"0xdd73dea10abc2bff99c60882ec5b2b81bb1dc5b2","name":"Tectonic Governance Token","symbol":"TONIC","decimals":18,"coingeckoId":"tectonic","status":"approved","hide":false,"canExchange":true,"updatedAt":"2022-06-30T03:06:53.968Z","createdAt":"2022-05-24T13:24:09.986Z","price":1.62391e-7,"totalSupply":"500000000000000","networkEnumValue":"cronos","type":"base-token","network":"cronos"}],"dataProps":{"supplyApy":0.1001,"borrowApy":0.243,"liquidity":7458105054723.844,"tectonicCoreAddress":"0xb3831584acb95ed9ccb0c11f677b5ad01deaeec0"},"displayProps":{"label":"TONIC","secondaryLabel":{"type":"dollar","value":1.62391e-7},"tertiaryLabel":"10.01% APY","images":["https://storage.googleapis.com/zapper-fi-assets/tokens/cronos/0xdd73dea10abc2bff99c60882ec5b2b81bb1dc5b2.png"],"statsItems":[{"label":"APY","value":{"type":"pct","value":10.01}},{"label":"Liquidity","value":{"type":"number","value":7458105054723.844}}],"balanceDisplayMode":"underlying"}},{"type":"app-token","address":"0x4bd41f188f6a05f02b46bb2a1f8ba776e528f9d2","network":"cronos","appId":"tectonic","groupId":"supply","symbol":"tTUSD","decimals":8,"supply":6025024.153749979,"price":0.10063586506669374,"pricePerShare":0.10043499507654066,"tokens":[{"id":"2393187","networkId":13,"address":"0x87efb3ec1576dec8ed47e58b832bedcd86ee186e","name":"TrueUSD","symbol":"TUSD","decimals":18,"coingeckoId":"true-usd","status":"approved","hide":false,"canExchange":true,"updatedAt":"2022-06-30T03:06:53.968Z","createdAt":"2022-06-13T12:18:23.729Z","price":1.002,"totalSupply":"31001000","networkEnumValue":"cronos","type":"base-token","network":"cronos"}],"dataProps":{"supplyApy":0.0085,"borrowApy":0.0238,"liquidity":3612166.031206638,"tectonicCoreAddress":"0xb3831584acb95ed9ccb0c11f677b5ad01deaeec0"},"displayProps":{"label":"TUSD","secondaryLabel":{"type":"dollar","value":1.002},"tertiaryLabel":"0.8500000000000001% APY","images":["https://storage.googleapis.com/zapper-fi-assets/tokens/cronos/0x87efb3ec1576dec8ed47e58b832bedcd86ee186e.png"],"statsItems":[{"label":"APY","value":{"type":"pct","value":0.8500000000000001}},{"label":"Liquidity","value":{"type":"number","value":3612166.031206638}}],"balanceDisplayMode":"underlying"}}]

@CronosLabsDev CronosLabsDev force-pushed the tectonic-fix branch 2 times, most recently from 812902f to e6ab23c Compare June 30, 2022 06:28
@immasandwich immasandwich merged commit 7b566ae into Zapper-fi:main Jun 30, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants