Conversation
This only work on a mainnet. We need to figure out how to use these contracts on ropsten and local network.
|
Preview uploaded to https://preview.dashboard.test.threshold.network/nu-tvl/index.html. |
| { | ||
| contract: nu.contract!, | ||
| method: "balanceOf", | ||
| args: [nuStakingEscrow?.address], |
There was a problem hiding this comment.
Can you clarify why we're tracking here the NU balance of staking escrow?
There was a problem hiding this comment.
TBH I implemented based on the https://github.com/nucypher/nucypher-monitor/blob/main/monitor/dashboard.py#L146-L163. Any tips on how to calculate NU TVL correctly would be appreciated 🙂
src/hooks/useFetchTvl.ts
Outdated
| const stakedNU = FixedNumber.fromString(nuInEscrow) | ||
| .subUnsafe( | ||
| FixedNumber.fromString(nuTotalSupply).subUnsafe( | ||
| FixedNumber.fromString(nuCurrenctPeriodSupply) |
There was a problem hiding this comment.
This equation seems a bit complex and I'm not sure if this yields a correct figure. Depending on what's the goal, i think there are other endpoints that are simpler as input.
Extract some hooks to separate files. Make calculations more readable.
|
Preview uploaded to https://preview.dashboard.test.threshold.network/nu-tvl/index.html. |
| type: "function", | ||
| }, | ||
| ] | ||
| const ESCROW_ADDRESS = "0xbbD3C0C794F40c4f993B03F65343aCC6fcfCb2e2" |
There was a problem hiding this comment.
What do you think about placing this in our .env? might be better so that we can just add ropsten & local address when they become available? Our env has the supported chainId, so we can be sure to use the correct one based on the env.
There was a problem hiding this comment.
I think it's a nice idea 👍 , but hopefully, we can get artifacts for mainnet/ropsten/local network from the package like we do for other contracts. So let's hold for a while and we will see if we can get a separate package for ropsten network.
|
|
||
| // TODO: Get contract abi from the package and figure out how to use these | ||
| // contracts on ropsten and local network. This only works on mainnet. | ||
| const WORK_LOCK_ADDRESS = "0xe9778E69a961e64d3cdBB34CF6778281d34667c2" |
We recently published an NPM package for this. Check out https://www.npmjs.com/package/@nucypher/nucypher-contracts, the artifacts directory contains the addresses and ABIs of some NU contracts. Let me know if you need something else there (perhaps WorkLock?) |
Nice thanks! As I can see it only contains the mainnet addresses. Could we have a separate npm package for Ropsten? Something like we have in threshold contracts pacakge? https://www.npmjs.com/package/@threshold-network/solidity-contracts/v/1.1.0-ropsten.0. It will help and simplify the T dapp deployment process on Ropsten network. Would be great if we could add |
I'm afraid we don't have a Ropsten deployment of NuCypher contracts. At some point I deployed just the token to facilitate integration of the Vending Machines, but we can't redeploy the whole set of contracts. I think for Ropsten you'd have to mock it somehow. For mainnet, yes, we can add the WorkLock artifact to the package. |
Why can't we have them redeployed? It's just for Ropsten and they would exist under new |
|
^ @cygnusv |
Depends on: #85
This PR adds support for computing the NU TVL. Implemented based on the nucypher-monitor source code.
Note
This implementation works only on
mainnetnetwork. We need to figure out how to get theNuCypherStakingEscrowandNuCypherWorkLockcontracts from package for mainnet, ropsten and local network. Would be great if we could have hardhat deployment scripts in https://github.com/nucypher/nucypher-contracts repo to deploy contracts locally and npm packages for mainnet and ropsten contracts. cc @cygnusv @Battenfield.Run the dapp on mainnet
package.json:.envfile:yarnyarn start