Skip to content

Commit f70cd8d

Browse files
committed
add example of property info
1 parent aac4279 commit f70cd8d

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

examples/get-property-info.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
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`)

0 commit comments

Comments
 (0)