File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ import { ethers } from 'ethers'
2+ import { contractFactory , addresses } from '@devprotocol/dev-kit'
3+
4+ // use main net
5+ const registryContractAddress = addresses . eth . main . registry
6+ const provider = new ethers . providers . JsonRpcProvider ( process . env . WEB3_PROVIDER_URL )
7+ const contract = contractFactory ( provider )
8+ const propertyAddress = '0xac1AC9d00314aE7B4a7d6DbEE4860bECedF92309'
9+ const lockupContractAddress = await contract . registry ( registryContractAddress ) . lockup ( )
10+
11+ const propertyStakingAmount = await contract . lockup ( lockupContractAddress ) . getPropertyValue ( propertyAddress )
12+ const stakingAmount = ethers . BigNumber . from ( propertyStakingAmount ) . div ( new ethers . BigNumber . from ( 10 ) . pow ( 18 ) )
13+ console . log ( `${ propertyAddress } 's staking amount is ${ stakingAmount . toBigInt ( ) } DEV` )
14+
15+ const propertyRewards = await contract . lockup ( lockupContractAddress ) . calculateRewardAmount ( propertyAddress )
16+ const reward = ethers . BigNumber . from ( propertyRewards [ 0 ] ) . div ( new ethers . BigNumber . from ( 10 ) . pow ( 36 ) )
17+ console . log ( `${ propertyAddress } 's rewards is ${ reward . toBigInt ( ) } DEV` )
You can’t perform that action at this time.
0 commit comments