import { ethers } from 'ethers' import { BaseProject } from './base' export const silencioChain = { id: 3338, name: 'PEAQ Network', nativeCurrency: { name: 'PEAQ', symbol: 'PEAQ', decimals: 18, }, rpcUrls: { default: { http: ['https://quicknode1.peaq.xyz'] }, }, blockExplorers: { default: { name: 'Peaq Network', url: 'https://peaq.subscan.io', }, }, } export const silencioTestnetChain = { id: 9990, name: 'Agung Network', nativeCurrency: { name: 'AGNG', symbol: 'AGNG', decimals: 18, }, rpcUrls: { default: { http: ['https://wss-async.agung.peaq.network'] }, }, blockExplorers: { default: { name: 'Agung Network', url: 'https://polkadot.js.org/apps/?rpc=wss:///wss-async.agung.peaq.network#/explorer', }, }, testnet: true, } export const silencioContract = { delegationPool: '0x0Ac817b19b38df47118041d06BA2728d1492F726', pToken: '0x99c484f904E14a81e063bb68348C436645c67953', miningToken: '0x5c3126bfb9a68a7021d461230127470b3824886b', thawing: '0xD084C2a2061a7588CD73d01811627a1949Ec315c', vesting: '0xc6953cAc52A5dD41D8022A388e44c397B397636F', } export const silencioTestnetContract = { delegationPool: '0xaa5d9eDFD680297533A14E121b70aE9faDD77831', pToken: '0xfADCEdd120099eD71AA371A9b6dA99400CD3a14a', miningToken: '0x1944Ce28Add25A15004cC6a22731018520E3bBF1', thawing: '0x7c588e0fE57760b965f7A3B886848B28c4158127', vesting: '0xE877923C6163CCEDB2B1da73997dfF4aFe39B2a4', } export class SilencioProject extends BaseProject { name = 'Silencio' thawingEnabled = true miningToken = { name: 'Silencio', symbol: 'SLC', decimals: 18, isNative: false, icon: 'https://d135ugxgwtnu1c.cloudfront.net/pSLC-e04833e2.svg', } pToken = { name: 'pSLC', symbol: 'pSLC', decimals: 18, icon: 'https://d135ugxgwtnu1c.cloudfront.net/pSLC-e04833e2.svg', } chainConfig = silencioChain contracts: { delegationPool: string pToken: string miningToken: string thawing: string vesting: string } metadata = { guideLink: 'https://docs.parasail.network/delegation-guides/guide-for-silencio-users', website: 'https://silencio.network/', description: `Silencio is an app-based network that rewards you for sharing your smartphone data. By joining, you contribute to the world's largest noise level database, helping to improve the lives of many. Take control of your data, start earning rewards, and be part of a global effort to make better decisions for a quieter world`, about: `Silencio is an app-based network that rewards you for sharing your smartphone data. By joining, you contribute to the world's largest noise level database, helping to improve the lives of many. Take control of your data, start earning rewards, and be part of a global effort to make better decisions for a quieter world`, } constructor({ isTestnet, provider, contracts = {}, }: { isTestnet: boolean provider?: ethers.providers.JsonRpcProvider contracts?: { delegationPool?: string pToken?: string miningToken?: string thawing?: string vesting?: string } }) { super(provider) this.chainConfig = isTestnet ? silencioTestnetChain : silencioChain this.contracts = isTestnet ? { ...silencioTestnetContract, ...contracts } : { ...silencioContract, ...contracts } this.isTestnet = isTestnet } getAssetsInfo = async () => { const vestingContract = this.getVestingContract() const [totalSupply, totalVestingAmount, vestingPeriod] = await Promise.all([ this.getTokenContract(this.contracts.pToken).totalSupply(), vestingContract.totalVestingAmount(), vestingContract.vestingPeriod(), ]) const rewardOneYear = (Number( ethers.utils.formatUnits(totalVestingAmount, this.miningToken.decimals) ) * (365 * 24 * 60 * 60)) / Number(vestingPeriod) const apy = totalSupply.eq(0) ? 0 : rewardOneYear / Number(ethers.utils.formatUnits(totalSupply, this.pToken.decimals)) return { apy: Number(apy), lockedAssets: Number(ethers.utils.formatUnits(totalSupply, this.pToken.decimals)) + Number( ethers.utils.formatUnits( totalVestingAmount, this.miningToken.decimals ) ), } } }