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

feat: tectonic integration #609

Merged
merged 1 commit into from
Jun 13, 2022

Conversation

CronosLabsDev
Copy link
Contributor

@CronosLabsDev CronosLabsDev commented Jun 9, 2022

Description

  • Balance fetcher
  • Supply token fetcher
  • Borrow position fetcher
  • TVL fetcher
  • Add logo

Checklist

How to test?

  1. Add ENABLED_APPS=tectonic to .env
  2. run pnpm dev to spin up the nest server
  3. Get endpoints to see responses

Balance fetcher

endpoint: http://localhost:5001/apps/tectonic/balances?addresses[]=<ADDRESS>&network=cronos

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":1586706411.7294934,"price":0.10119867228267163,"pricePerShare":0.1008959843296826,"tokens":[{"id":"315763","networkId":13,"address":"0xc21223249ca28397b4b6541dffaecc539bff0c59","name":"USD Coin","symbol":"USDC","decimals":6,"coingeckoId":"usd-coin","status":"pending","hide":false,"canExchange":true,"updatedAt":"2022-06-09T11:09:49.087Z","createdAt":"2022-05-24T13:24:09.986Z","price":1.003,"networkEnumValue":"cronos","type":"base-token","network":"cronos"}],"dataProps":{"supplyApy":0.00942742793404494,"borrowApy":0.02675559640135594,"liquidity":160572582.16942683,"tectonicCoreAddress":"0xb3831584acb95ED9cCb0C11f677B5AD01DeaeEc0"},"displayProps":{"label":"USDC","secondaryLabel":{"type":"dollar","value":1.003},"tertiaryLabel":"0.943% APY","images":["https://storage.googleapis.com/zapper-fi-assets/tokens/cronos/0xc21223249ca28397b4b6541dffaecc539bff0c59.png"],"statsItems":[{"label":"Supply APY","value":{"type":"pct","value":0.00942742793404494}},{"label":"Liquidity","value":{"type":"dollar","value":160572582.16942683}}],"balanceDisplayMode":"underlying"}},{"type":"app-token","address":"0x67fd498e94d95972a4a2a44acce00a000af7fe00","network":"cronos","appId":"tectonic","groupId":"supply","symbol":"tWBTC","decimals":8,"supply":10494.17612283,"price":3068.222763614648,"pricePerShare":0.10067338529430876,"tokens":[{"id":"315522","networkId":13,"address":"0x062e66477faf219f25d27dced647bf57c3107d52","name":"Wrapped BTC","symbol":"WBTC","decimals":8,"coingeckoId":"wrapped-bitcoin","status":"pending","hide":false,"canExchange":true,"updatedAt":"2022-06-09T11:09:49.087Z","createdAt":"2022-05-24T13:24:09.986Z","price":30477,"networkEnumValue":"cronos","type":"base-token","network":"cronos"}],"dataProps":{"supplyApy":0.0016548504681204168,"borrowApy":0.044548203636369355,"liquidity":32198470.065448318,"tectonicCoreAddress":"0xb3831584acb95ED9cCb0C11f677B5AD01DeaeEc0"},"displayProps":{"label":"WBTC","secondaryLabel":{"type":"dollar","value":30477},"tertiaryLabel":"0.165% APY","images":["https://storage.googleapis.com/zapper-fi-assets/tokens/cronos/0x062e66477faf219f25d27dced647bf57c3107d52.png"],"statsItems":[{"label":"Supply APY","value":{"type":"pct","value":0.0016548504681204168}},{"label":"Liquidity","value":{"type":"dollar","value":32198470.065448318}}],"balanceDisplayMode":"underlying"}},{"type":"app-token","address":"0x543f4db9bd26c9eb6ad4dd1c33522c966c625774","network":"cronos","appId":"tectonic","groupId":"supply","symbol":"tWETH","decimals":8,"supply":112814.46501901,"price":182.19174782726745,"pricePerShare":0.10042373228712316,"tokens":[{"id":"315802","networkId":13,"address":"0xe44fd7fcb2b1581822d0c862b68222998a0c299a","name":"Wrapped Ether","symbol":"WETH","decimals":18,"coingeckoId":"weth","status":"pending","hide":false,"canExchange":true,"updatedAt":"2022-06-09T11:09:49.087Z","createdAt":"2022-05-24T13:24:09.986Z","price":1814.23,"networkEnumValue":"cronos","type":"base-token","network":"cronos"}],"dataProps":{"supplyApy":0.0030974404010044587,"borrowApy":0.04990266084300443,"liquidity":20553864.562011555,"tectonicCoreAddress":"0xb3831584acb95ED9cCb0C11f677B5AD01DeaeEc0"},"displayProps":{"label":"WETH","secondaryLabel":{"type":"dollar","value":1814.23},"tertiaryLabel":"0.310% APY","images":["https://storage.googleapis.com/zapper-fi-assets/tokens/cronos/0xe44fd7fcb2b1581822d0c862b68222998a0c299a.png"],"statsItems":[{"label":"Supply APY","value":{"type":"pct","value":0.0030974404010044587}},{"label":"Liquidity","value":{"type":"dollar","value":20553864.562011555}}],"balanceDisplayMode":"underlying"}},{"type":"app-token","address":"0xeadf7c01da7e93fdb5f16b0aa9ee85f978e89e95","network":"cronos","appId":"tectonic","groupId":"supply","symbol":"tCRO","decimals":8,"supply":2424027527.9717054,"price":0.018297780358207755,"pricePerShare":0.10289363195717169,"tokens":[{"id":"315504","networkId":13,"address":"0x0000000000000000000000000000000000000000","name":"Cronos","symbol":"CRO","decimals":18,"coingeckoId":"crypto-com-chain","status":"pending","hide":false,"canExchange":true,"updatedAt":"2022-06-09T11:09:49.087Z","createdAt":"2022-05-24T13:24:09.986Z","price":0.177832,"networkEnumValue":"cronos","type":"base-token","network":"cronos"}],"dataProps":{"supplyApy":0.03628822037985846,"borrowApy":0.0560114498785671,"liquidity":44354323.28907557,"tectonicCoreAddress":"0xb3831584acb95ED9cCb0C11f677B5AD01DeaeEc0"},"displayProps":{"label":"CRO","secondaryLabel":{"type":"dollar","value":0.177832},"tertiaryLabel":"3.629% APY","images":["https://storage.googleapis.com/zapper-fi-assets/tokens/cronos/0x0000000000000000000000000000000000000000.png"],"statsItems":[{"label":"Supply APY","value":{"type":"pct","value":0.03628822037985846}},{"label":"Liquidity","value":{"type":"dollar","value":44354323.28907557}}],"balanceDisplayMode":"underlying"}},{"type":"app-token","address":"0xe1c4c56f772686909c28c319079d41adfd6ec89b","network":"cronos","appId":"tectonic","groupId":"supply","symbol":"tDAI","decimals":8,"supply":324367886.72961015,"price":0.10127075267559552,"pricePerShare":0.1010686154447061,"tokens":[{"id":"315822","networkId":13,"address":"0xf2001b145b43032aaf5ee2884e456ccd805f677d","name":"Dai Stablecoin","symbol":"DAI","decimals":18,"coingeckoId":"dai","status":"pending","hide":false,"canExchange":true,"updatedAt":"2022-06-09T11:09:49.087Z","createdAt":"2022-05-24T13:24:09.986Z","price":1.002,"networkEnumValue":"cronos","type":"base-token","network":"cronos"}],"dataProps":{"supplyApy":0.007829854001132563,"borrowApy":0.025040533596319747,"liquidity":32848980.03289993,"tectonicCoreAddress":"0xb3831584acb95ED9cCb0C11f677B5AD01DeaeEc0"},"displayProps":{"label":"DAI","secondaryLabel":{"type":"dollar","value":1.002},"tertiaryLabel":"0.783% APY","images":["https://storage.googleapis.com/zapper-fi-assets/tokens/cronos/0xf2001b145b43032aaf5ee2884e456ccd805f677d.png"],"statsItems":[{"label":"Supply APY","value":{"type":"pct","value":0.007829854001132563}},{"label":"Liquidity","value":{"type":"dollar","value":32848980.03289993}}],"balanceDisplayMode":"underlying"}},{"type":"app-token","address":"0xa683fdfd9286eedfea81cf6da14703da683c44e5","network":"cronos","appId":"tectonic","groupId":"supply","symbol":"tUSDT","decimals":8,"supply":983240381.3237243,"price":0.10085074494784198,"pricePerShare":0.1007499949528891,"tokens":[{"id":"315677","networkId":13,"address":"0x66e428c3f67a68878562e79a0234c1f83c208770","name":"Tether USD","symbol":"USDT","decimals":6,"coingeckoId":"tether","status":"pending","hide":false,"canExchange":true,"updatedAt":"2022-06-09T11:09:49.087Z","createdAt":"2022-05-24T13:24:09.986Z","price":1.001,"networkEnumValue":"cronos","type":"base-token","network":"cronos"}],"dataProps":{"supplyApy":0.0022319449717078665,"borrowApy":0.013311037017887495,"liquidity":99160524.9192978,"tectonicCoreAddress":"0xb3831584acb95ED9cCb0C11f677B5AD01DeaeEc0"},"displayProps":{"label":"USDT","secondaryLabel":{"type":"dollar","value":1.001},"tertiaryLabel":"0.223% APY","images":["https://storage.googleapis.com/zapper-fi-assets/tokens/cronos/0x66e428c3f67a68878562e79a0234c1f83c208770.png"],"statsItems":[{"label":"Supply APY","value":{"type":"pct","value":0.0022319449717078665}},{"label":"Liquidity","value":{"type":"dollar","value":99160524.9192978}}],"balanceDisplayMode":"underlying"}},{"type":"app-token","address":"0xfe6934fdf050854749945921faa83191bccf20ad","network":"cronos","appId":"tectonic","groupId":"supply","symbol":"tTONIC","decimals":8,"supply":66389638671795.195,"price":1.8997195205178462e-8,"pricePerShare":0.11253595880089132,"tokens":[{"id":"315791","networkId":13,"address":"0xdd73dea10abc2bff99c60882ec5b2b81bb1dc5b2","name":"Tectonic Governance Token","symbol":"TONIC","decimals":18,"coingeckoId":"tectonic","status":"pending","hide":false,"canExchange":true,"updatedAt":"2022-06-09T11:09:49.087Z","createdAt":"2022-05-24T13:24:09.986Z","price":1.6881e-7,"networkEnumValue":"cronos","type":"base-token","network":"cronos"}],"dataProps":{"supplyApy":1.1024496228332294,"borrowApy":1.441844976143258,"liquidity":1261216.9254493583,"tectonicCoreAddress":"0xb3831584acb95ED9cCb0C11f677B5AD01DeaeEc0"},"displayProps":{"label":"TONIC","secondaryLabel":{"type":"dollar","value":1.6881e-7},"tertiaryLabel":"110.245% APY","images":["https://storage.googleapis.com/zapper-fi-assets/tokens/cronos/0xdd73dea10abc2bff99c60882ec5b2b81bb1dc5b2.png"],"statsItems":[{"label":"Supply APY","value":{"type":"pct","value":1.1024496228332294}},{"label":"Liquidity","value":{"type":"dollar","value":1261216.9254493583}}],"balanceDisplayMode":"underlying"}}]

Borrow position fetcher

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

[{"type":"contract-position","address":"0xb3bbf1be947b245aef26e3b6a9d777d7703f4c8e","network":"cronos","appId":"tectonic","groupId":"borrow","tokens":[{"metaType":"borrowed","id":"315763","networkId":13,"address":"0xc21223249ca28397b4b6541dffaecc539bff0c59","name":"USD Coin","symbol":"USDC","decimals":6,"coingeckoId":"usd-coin","status":"pending","hide":false,"canExchange":true,"updatedAt":"2022-06-09T11:11:45.239Z","createdAt":"2022-05-24T13:24:09.986Z","price":1.003,"networkEnumValue":"cronos","type":"base-token","network":"cronos"}],"dataProps":{"supplyApy":0.00942742793404494,"borrowApy":0.02675559640135594,"liquidity":100578334.8987086,"tectonicCoreAddress":"0xb3831584acb95ED9cCb0C11f677B5AD01DeaeEc0","supply":160572586.46941233,"borrow":59994251.57070373},"displayProps":{"label":"Borrowed USDC","secondaryLabel":{"type":"dollar","value":1.003},"tertiaryLabel":"2.676% APR","images":["https://storage.googleapis.com/zapper-fi-assets/tokens/cronos/0xc21223249ca28397b4b6541dffaecc539bff0c59.png"],"statsItems":[{"label":"Borrow APR","value":{"type":"pct","value":0.02675559640135594}}]}},{"type":"contract-position","address":"0x67fd498e94d95972a4a2a44acce00a000af7fe00","network":"cronos","appId":"tectonic","groupId":"borrow","tokens":[{"metaType":"borrowed","id":"315522","networkId":13,"address":"0x062e66477faf219f25d27dced647bf57c3107d52","name":"Wrapped BTC","symbol":"WBTC","decimals":8,"coingeckoId":"wrapped-bitcoin","status":"pending","hide":false,"canExchange":true,"updatedAt":"2022-06-09T11:11:45.239Z","createdAt":"2022-05-24T13:24:09.986Z","price":30503,"networkEnumValue":"cronos","type":"base-token","network":"cronos"}],"dataProps":{"supplyApy":0.0016548504681204168,"borrowApy":0.044548203636369355,"liquidity":30732315.36951675,"tectonicCoreAddress":"0xb3831584acb95ED9cCb0C11f677B5AD01DeaeEc0","supply":32225938.807493415,"borrow":1493623.4379766658},"displayProps":{"label":"Borrowed WBTC","secondaryLabel":{"type":"dollar","value":30503},"tertiaryLabel":"4.455% APR","images":["https://storage.googleapis.com/zapper-fi-assets/tokens/cronos/0x062e66477faf219f25d27dced647bf57c3107d52.png"],"statsItems":[{"label":"Borrow APR","value":{"type":"pct","value":0.044548203636369355}}]}},{"type":"contract-position","address":"0x543f4db9bd26c9eb6ad4dd1c33522c966c625774","network":"cronos","appId":"tectonic","groupId":"borrow","tokens":[{"metaType":"borrowed","id":"315802","networkId":13,"address":"0xe44fd7fcb2b1581822d0c862b68222998a0c299a","name":"Wrapped Ether","symbol":"WETH","decimals":18,"coingeckoId":"weth","status":"pending","hide":false,"canExchange":true,"updatedAt":"2022-06-09T11:11:45.239Z","createdAt":"2022-05-24T13:24:09.986Z","price":1815.26,"networkEnumValue":"cronos","type":"base-token","network":"cronos"}],"dataProps":{"supplyApy":0.0030974404010044587,"borrowApy":0.04990266084300443,"liquidity":18960767.873054508,"tectonicCoreAddress":"0xb3831584acb95ED9cCb0C11f677B5AD01DeaeEc0","supply":20565533.870647226,"borrow":1604765.9975927174},"displayProps":{"label":"Borrowed WETH","secondaryLabel":{"type":"dollar","value":1815.26},"tertiaryLabel":"4.990% APR","images":["https://storage.googleapis.com/zapper-fi-assets/tokens/cronos/0xe44fd7fcb2b1581822d0c862b68222998a0c299a.png"],"statsItems":[{"label":"Borrow APR","value":{"type":"pct","value":0.04990266084300443}}]}},{"type":"contract-position","address":"0xeadf7c01da7e93fdb5f16b0aa9ee85f978e89e95","network":"cronos","appId":"tectonic","groupId":"borrow","tokens":[{"metaType":"borrowed","id":"315504","networkId":13,"address":"0x0000000000000000000000000000000000000000","name":"Cronos","symbol":"CRO","decimals":18,"coingeckoId":"crypto-com-chain","status":"pending","hide":false,"canExchange":true,"updatedAt":"2022-06-09T11:11:45.239Z","createdAt":"2022-05-24T13:24:09.986Z","price":0.177841,"networkEnumValue":"cronos","type":"base-token","network":"cronos"}],"dataProps":{"supplyApy":0.03628822037985846,"borrowApy":0.0560114498785671,"liquidity":12371227.016838718,"tectonicCoreAddress":"0xb3831584acb95ED9cCb0C11f677B5AD01DeaeEc0","supply":44356571.802459784,"borrow":31985344.785621066},"displayProps":{"label":"Borrowed CRO","secondaryLabel":{"type":"dollar","value":0.177841},"tertiaryLabel":"5.601% APR","images":["https://storage.googleapis.com/zapper-fi-assets/tokens/cronos/0x0000000000000000000000000000000000000000.png"],"statsItems":[{"label":"Borrow APR","value":{"type":"pct","value":0.0560114498785671}}]}},{"type":"contract-position","address":"0xe1c4c56f772686909c28c319079d41adfd6ec89b","network":"cronos","appId":"tectonic","groupId":"borrow","tokens":[{"metaType":"borrowed","id":"315822","networkId":13,"address":"0xf2001b145b43032aaf5ee2884e456ccd805f677d","name":"Dai Stablecoin","symbol":"DAI","decimals":18,"coingeckoId":"dai","status":"pending","hide":false,"canExchange":true,"updatedAt":"2022-06-09T11:11:45.239Z","createdAt":"2022-05-24T13:24:09.986Z","price":1.002,"networkEnumValue":"cronos","type":"base-token","network":"cronos"}],"dataProps":{"supplyApy":0.007829854001132563,"borrowApy":0.025040533596319747,"liquidity":21407414.993408095,"tectonicCoreAddress":"0xb3831584acb95ED9cCb0C11f677B5AD01DeaeEc0","supply":32848980.764075,"borrow":11441565.770666905},"displayProps":{"label":"Borrowed DAI","secondaryLabel":{"type":"dollar","value":1.002},"tertiaryLabel":"2.504% APR","images":["https://storage.googleapis.com/zapper-fi-assets/tokens/cronos/0xf2001b145b43032aaf5ee2884e456ccd805f677d.png"],"statsItems":[{"label":"Borrow APR","value":{"type":"pct","value":0.025040533596319747}}]}},{"type":"contract-position","address":"0xa683fdfd9286eedfea81cf6da14703da683c44e5","network":"cronos","appId":"tectonic","groupId":"borrow","tokens":[{"metaType":"borrowed","id":"315677","networkId":13,"address":"0x66e428c3f67a68878562e79a0234c1f83c208770","name":"Tether USD","symbol":"USDT","decimals":6,"coingeckoId":"tether","status":"pending","hide":false,"canExchange":true,"updatedAt":"2022-06-09T11:11:45.239Z","createdAt":"2022-05-24T13:24:09.986Z","price":1.001,"networkEnumValue":"cronos","type":"base-token","network":"cronos"}],"dataProps":{"supplyApy":0.0022319449717078665,"borrowApy":0.013311037017887495,"liquidity":80651192.57577482,"tectonicCoreAddress":"0xb3831584acb95ED9cCb0C11f677B5AD01DeaeEc0","supply":99160525.55022009,"borrow":18509332.97444527},"displayProps":{"label":"Borrowed USDT","secondaryLabel":{"type":"dollar","value":1.001},"tertiaryLabel":"1.331% APR","images":["https://storage.googleapis.com/zapper-fi-assets/tokens/cronos/0x66e428c3f67a68878562e79a0234c1f83c208770.png"],"statsItems":[{"label":"Borrow APR","value":{"type":"pct","value":0.013311037017887495}}]}},{"type":"contract-position","address":"0xfe6934fdf050854749945921faa83191bccf20ad","network":"cronos","appId":"tectonic","groupId":"borrow","tokens":[{"metaType":"borrowed","id":"315791","networkId":13,"address":"0xdd73dea10abc2bff99c60882ec5b2b81bb1dc5b2","name":"Tectonic Governance Token","symbol":"TONIC","decimals":18,"coingeckoId":"tectonic","status":"pending","hide":false,"canExchange":true,"updatedAt":"2022-06-09T11:11:45.239Z","createdAt":"2022-05-24T13:24:09.986Z","price":1.68662e-7,"networkEnumValue":"cronos","type":"base-token","network":"cronos"}],"dataProps":{"supplyApy":1.102450196774583,"borrowApy":1.4418454661494935,"liquidity":46453.2285205828,"tectonicCoreAddress":"0xb3831584acb95ED9cCb0C11f677B5AD01DeaeEc0","supply":1260114.0083382041,"borrow":1213660.7798176212},"displayProps":{"label":"Borrowed TONIC","secondaryLabel":{"type":"dollar","value":1.68662e-7},"tertiaryLabel":"144.185% APR","images":["https://storage.googleapis.com/zapper-fi-assets/tokens/cronos/0xdd73dea10abc2bff99c60882ec5b2b81bb1dc5b2.png"],"statsItems":[{"label":"Borrow APR","value":{"type":"pct","value":1.4418454661494935}}]}}]

TVL fetcher

endpoint: http://localhost:5001/apps/tectonic/tvl?network=cronos
response:

{"appId":"tectonic","appName":"tectonic","network":"cronos","tvl":390718716.2078469}

@CronosLabsDev CronosLabsDev force-pushed the tectonic-integration branch from 1dd6fe4 to 07b39fd Compare June 9, 2022 12:43
@immasandwich
Copy link
Contributor

immasandwich commented Jun 10, 2022

Hello @CronosLabsDev !

The PR is still marked as a draft, so I haven't taken a look yet for review. Let us know when you're ready for review and we'll begin!

@CronosLabsDev CronosLabsDev marked this pull request as ready for review June 10, 2022 02:47
@CronosLabsDev
Copy link
Contributor Author

CronosLabsDev commented Jun 10, 2022

@immasandwich The PR is ready to review! Thank you!

@CronosLabsDev CronosLabsDev force-pushed the tectonic-integration branch from 07b39fd to 44d2b48 Compare June 10, 2022 05:32
network,
lensAddress: '0x37baFE282Cb7D4EF6AD80eE979C341c91dEf4C17',
rewardTokenAddress: '0xDD73dEa10ABC2Bff99c60882EC5b2B81Bb1Dc5B2',
tectonicCoreAddress: '0xb3831584acb95ED9cCb0C11f677B5AD01DeaeEc0',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Keep addresses lowercased 🙏

network,
appId,
groupId,
tectonicCoreAddress: '0xb3831584acb95ED9cCb0C11f677B5AD01DeaeEc0',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lowercase 🙏

Copy link
Contributor

@immasandwich immasandwich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If nothing is changed in the helper classes from what was copied from src/apps/compound, you can use the helper classes from src/apps/compound/helpers directly. Just make sure you include CompoundAppModule as an import in your TectonicAppModule.

@immasandwich
Copy link
Contributor

Hey @CronosLabsDev !

  1. If you can, use the helpers from src/apps/compound/helpers directly, since they are intended for any fork of the Compound protocol.
  2. Keep addresses lowercased.

Rest looks good! Let me know when you have addressed the comments and we can merge.

@CronosLabsDev CronosLabsDev force-pushed the tectonic-integration branch from 44d2b48 to e84e7cd Compare June 13, 2022 07:40
@CronosLabsDev
Copy link
Contributor Author

@immasandwich Updated. please feel free to review, thanks!

@CronosLabsDev CronosLabsDev force-pushed the tectonic-integration branch from 4e74d8a to a5192cd Compare June 13, 2022 08:40
@CronosLabsDev
Copy link
Contributor Author

CronosLabsDev commented Jun 13, 2022

@immasandwich I need a favor here, I can't get the TrueUSD (TUSD) using the appToolkit.getBaseTokenPrices() function in app-toolkit, wondering if you have any suggestion to fix it?

@immasandwich
Copy link
Contributor

@CronosLabsDev absolutely. We'll add TUSD to the Cronos network right now. Give me 5 min.

@immasandwich immasandwich merged commit badfa33 into Zapper-fi:main Jun 13, 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