import { ethers } from 'ethers' import { BaseProject } from './base' export const aethirChain = { id: 42161, name: 'Arbitrum', nativeCurrency: { name: 'Arbitrum ETH', symbol: 'ETH', decimals: 18, }, rpcUrls: { default: { http: [ 'https://g.w.lavanet.xyz:443/gateway/arb1/rpc-http/f470a5c4be79ac5bb070fa8e497d015e', ], }, }, blockExplorers: { default: { name: 'sepolia', url: 'https://arbiscan.io', }, }, } export const aethirTestnetChain = { id: 11155111, name: 'Sepolia', nativeCurrency: { name: 'Sepolia ETH', symbol: 'tETH', decimals: 18, }, rpcUrls: { default: { http: ['https://sepolia.drpc.org'] }, }, blockExplorers: { default: { name: 'sepolia', url: 'https://sepolia.etherscan.io/', }, }, testnet: true, } export const aethirContract = { core: '0x3812fA8c9488C33cee917A0f761b5DEdAB603Dbc', delegationPool: '0xC5229E49A6812014c6e3035A0746330E82057A09', pToken: '0xc537e67Eb192b3F0B6B183ff52060Ee92475f398', miningToken: '0xc87b37a581ec3257b734886d9d3a581f5a9d056c', dataHelper: '0x2032F104069CC3023C0A0b6874F8A5fB21A5E511', } export const aethirTestnetContract = { core: '0x83360826EA7AA6a76e1F8DaAd52eBB8c072fa598', delegationPool: '0xE951C5c7778ef1dd5f8B69A5b6C2171633e88D64', pToken: '0xe8E9A90BecCC6E1f08e7E821BeAd075C5e8Ac02d', miningToken: '0x9c9C2e731E93823c94F39d20CD0540864B8B8FA8', dataHelper: '0x7fA247A62bf21FE69Bb2c5B0f860D63E0a0B677A', } export class AethirProject extends BaseProject { name = 'Aethir' thawingEnabled = false miningToken = { name: 'ATH', symbol: 'ATH', decimals: 18, isNative: false, icon: 'https://d135ugxgwtnu1c.cloudfront.net/ath-4d4899ee.png', } pToken = { name: 'pATH', symbol: 'pATH', decimals: 18, icon: 'https://d135ugxgwtnu1c.cloudfront.net/ath-4d4899ee.png', } chainConfig = aethirChain contracts: { core: string delegationPool: string pToken: string miningToken: string dataHelper: string } metadata = { guideLink: 'https://docs.parasail.network/delegation-guides/guide-for-aethir-users/', website: 'https://aethir.com/', description: 'Mining rewards consist of locked and unlocked portion. Rewards will be unlocked daily until it reaches the expected returns. Unlocked rewards can be withdrawn anytime. Locked rewards can be withdrawn early and converted at a 1:1 rate to liquid pATH tokens. These tokens can be traded on the DEX.', about: 'Aethir is building a scalable decentralized cloud infrastructure for gaming and AI.', withdrawTips: 'The amount of tokens available for immediate withdrawal. Larger withdrawals need to wait for the reserve to be replenished by new deposits or operator repayments', } constructor({ isTestnet, provider, contracts = {}, }: { isTestnet: boolean provider?: ethers.providers.JsonRpcProvider contracts?: { core?: string delegationPool?: string pToken?: string miningToken?: string dataHelper?: string } }) { super(provider) this.chainConfig = isTestnet ? aethirTestnetChain : aethirChain this.contracts = isTestnet ? { ...aethirTestnetContract, ...contracts } : { ...aethirContract, ...contracts } this.isTestnet = isTestnet } deposit = async (address: string, amount: string, signer: ethers.Signer) => { const contract = this.getPoolContract() const tx = await contract .connect(signer) .deposit( ethers.utils.parseUnits(amount, this.miningToken.decimals), address ) return tx } withdraw = async (address: string, amount: string, signer: ethers.Signer) => { const contract = this.getPoolContract().connect(signer) const tx = await contract.withdraw( ethers.utils.parseUnits(amount, this.pToken.decimals), address ) await tx.wait(1) return tx } getAssetsInfo = async () => { const data = await fetch( this.isTestnet ? 'https://test.parasail.network/api/staking-projects?project=ATH' : 'https://www.parasail.network/api/staking-projects?project=ATH' ) const json = await data.json() return { apy: json.apy, lockedAssets: json.tvl / json.price, } } }