-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NuCypher tvl #86
base: main
Are you sure you want to change the base?
NuCypher tvl #86
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you clarify why we're tracking here the NU balance of staking escrow?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as above
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
mainnet
network. We need to figure out how to get theNuCypherStakingEscrow
andNuCypherWorkLock
contracts 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
:.env
file:yarn
yarn start