@berachain/berajs 0.2.8-beta.2 → 0.2.8-beta.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/abi/exports.cjs +4452 -1
- package/dist/abi/exports.cjs.map +1 -1
- package/dist/abi/exports.mjs +4452 -1
- package/dist/abi/exports.mjs.map +1 -1
- package/dist/actions/exports.cjs +918 -1
- package/dist/actions/exports.cjs.map +1 -1
- package/dist/actions/exports.mjs +918 -1
- package/dist/actions/exports.mjs.map +1 -1
- package/dist/chunk-24HMIYTN.cjs +36 -0
- package/dist/chunk-24HMIYTN.cjs.map +1 -0
- package/dist/chunk-2LL77B3T.cjs +135 -0
- package/dist/chunk-2LL77B3T.cjs.map +1 -0
- package/dist/chunk-3LXVARBJ.cjs +417 -0
- package/dist/chunk-3LXVARBJ.cjs.map +1 -0
- package/dist/chunk-4HDIUUSV.cjs +130 -0
- package/dist/chunk-4HDIUUSV.cjs.map +1 -0
- package/dist/chunk-7ONKBHXY.cjs +169 -0
- package/dist/chunk-7ONKBHXY.cjs.map +1 -0
- package/dist/chunk-7TFV6UKF.mjs +24 -0
- package/dist/{chunk-MK5NS5B5.mjs.map → chunk-7TFV6UKF.mjs.map} +1 -1
- package/dist/chunk-A4FPM7U3.cjs +63 -0
- package/dist/chunk-A4FPM7U3.cjs.map +1 -0
- package/dist/chunk-A7P3JVU7.cjs +4694 -0
- package/dist/chunk-A7P3JVU7.cjs.map +1 -0
- package/dist/chunk-ALPEMPZI.mjs +417 -0
- package/dist/chunk-ALPEMPZI.mjs.map +1 -0
- package/dist/chunk-BEHP54S3.cjs +24 -0
- package/dist/chunk-BEHP54S3.cjs.map +1 -0
- package/dist/chunk-CYBZH6U3.mjs +135 -0
- package/dist/{chunk-FM3WDBFH.mjs.map → chunk-CYBZH6U3.mjs.map} +1 -1
- package/dist/chunk-EWBKSMPG.cjs +13 -0
- package/dist/chunk-EWBKSMPG.cjs.map +1 -0
- package/dist/chunk-GLWPRM33.mjs +13 -0
- package/dist/{chunk-575OK77P.mjs.map → chunk-GLWPRM33.mjs.map} +1 -1
- package/dist/chunk-GWSTVITN.mjs +572 -0
- package/dist/{chunk-NLVWRMGD.mjs.map → chunk-GWSTVITN.mjs.map} +1 -1
- package/dist/chunk-H3Z37RYU.cjs +15 -0
- package/dist/chunk-H3Z37RYU.cjs.map +1 -0
- package/dist/chunk-HCC4FJTD.cjs +97 -0
- package/dist/chunk-HCC4FJTD.cjs.map +1 -0
- package/dist/chunk-J6EHBYSV.mjs +97 -0
- package/dist/{chunk-IDFMLLDY.mjs.map → chunk-J6EHBYSV.mjs.map} +1 -1
- package/dist/chunk-JA4DHMTG.mjs +15 -0
- package/dist/{chunk-OGBD5YOG.mjs.map → chunk-JA4DHMTG.mjs.map} +1 -1
- package/dist/chunk-KL6YZ5VR.mjs +63 -0
- package/dist/{chunk-OGJMSGB2.mjs.map → chunk-KL6YZ5VR.mjs.map} +1 -1
- package/dist/chunk-MILSHCKW.cjs +168 -0
- package/dist/chunk-MILSHCKW.cjs.map +1 -0
- package/dist/chunk-MKS6W5NI.mjs +403 -0
- package/dist/{chunk-COMMLZ3O.mjs.map → chunk-MKS6W5NI.mjs.map} +1 -1
- package/dist/chunk-MXWPP6MS.cjs +572 -0
- package/dist/chunk-MXWPP6MS.cjs.map +1 -0
- package/dist/chunk-OWUI3VPI.mjs +169 -0
- package/dist/{chunk-QRAIGQF2.mjs.map → chunk-OWUI3VPI.mjs.map} +1 -1
- package/dist/chunk-PBCE7JTE.mjs +36 -0
- package/dist/{chunk-MJZHJFZO.mjs.map → chunk-PBCE7JTE.mjs.map} +1 -1
- package/dist/chunk-QISQSMCV.cjs +1843 -0
- package/dist/chunk-QISQSMCV.cjs.map +1 -0
- package/dist/chunk-SYWYIMY7.mjs +4694 -0
- package/dist/chunk-SYWYIMY7.mjs.map +1 -0
- package/dist/chunk-TDW5SPXR.cjs +244 -0
- package/dist/chunk-TDW5SPXR.cjs.map +1 -0
- package/dist/chunk-TGHG6Q3C.cjs +403 -0
- package/dist/chunk-TGHG6Q3C.cjs.map +1 -0
- package/dist/chunk-WAFQFAI7.mjs +130 -0
- package/dist/{chunk-BEKH5EYT.mjs.map → chunk-WAFQFAI7.mjs.map} +1 -1
- package/dist/chunk-WEULAXBE.mjs +168 -0
- package/dist/{chunk-T5FSQ3YE.mjs.map → chunk-WEULAXBE.mjs.map} +1 -1
- package/dist/chunk-ZCEFC2TK.mjs +244 -0
- package/dist/{chunk-NAXAZJJY.mjs.map → chunk-ZCEFC2TK.mjs.map} +1 -1
- package/dist/chunk-ZV7DCQQY.mjs +1843 -0
- package/dist/{chunk-74QD4JAH.mjs.map → chunk-ZV7DCQQY.mjs.map} +1 -1
- package/dist/contexts/exports.cjs +82 -1
- package/dist/contexts/exports.cjs.map +1 -1
- package/dist/contexts/exports.mjs +82 -1
- package/dist/contexts/exports.mjs.map +1 -1
- package/dist/enum/exports.cjs +58 -1
- package/dist/enum/exports.cjs.map +1 -1
- package/dist/enum/exports.mjs +58 -1
- package/dist/enum/exports.mjs.map +1 -1
- package/dist/errors/exports.cjs +38 -1
- package/dist/errors/exports.cjs.map +1 -1
- package/dist/errors/exports.mjs +38 -1
- package/dist/hooks/exports.cjs +8327 -3
- package/dist/hooks/exports.cjs.map +1 -1
- package/dist/hooks/exports.mjs +8327 -3
- package/dist/hooks/exports.mjs.map +1 -1
- package/dist/utils/exports.cjs +786 -1
- package/dist/utils/exports.cjs.map +1 -1
- package/dist/utils/exports.mjs +786 -1
- package/dist/utils/exports.mjs.map +1 -1
- package/package.json +4 -4
- package/src/actions/dex/aggregators/base.ts +3 -1
- package/src/actions/governance/getDecodedFunctionData.ts +6 -1
- package/src/actions/honey/getHoneyPythPriceOracle.ts +1 -1
- package/src/actions/honey/getHoneyRootPriceOracle.ts +1 -1
- package/src/actions/pol/getRewardVaultBeaconImplementation.ts +1 -1
- package/src/actions/pol/getTotalStakedAmount.ts +1 -1
- package/src/actions/pol/getUserClaimableIncentives.ts +1 -1
- package/src/actions/pol/getUserVaultsReward.ts +1 -1
- package/src/actions/tokens/getUnderlyingToken.ts +3 -1
- package/src/actions/validators/getUserBoosts.ts +1 -1
- package/src/utils/getErrorResponse.ts +1 -1
- package/dist/chunk-2YBHAMDV.cjs +0 -2
- package/dist/chunk-2YBHAMDV.cjs.map +0 -1
- package/dist/chunk-3YEM767C.mjs +0 -4
- package/dist/chunk-3YEM767C.mjs.map +0 -1
- package/dist/chunk-575OK77P.mjs +0 -2
- package/dist/chunk-57RINXU6.cjs +0 -2
- package/dist/chunk-57RINXU6.cjs.map +0 -1
- package/dist/chunk-64OF6RU5.cjs +0 -4
- package/dist/chunk-64OF6RU5.cjs.map +0 -1
- package/dist/chunk-74QD4JAH.mjs +0 -2
- package/dist/chunk-74WA35RI.cjs +0 -2
- package/dist/chunk-74WA35RI.cjs.map +0 -1
- package/dist/chunk-BEKH5EYT.mjs +0 -2
- package/dist/chunk-CF3LFNXG.cjs +0 -2
- package/dist/chunk-CF3LFNXG.cjs.map +0 -1
- package/dist/chunk-COMMLZ3O.mjs +0 -2
- package/dist/chunk-DDEQFR3M.cjs +0 -2
- package/dist/chunk-DDEQFR3M.cjs.map +0 -1
- package/dist/chunk-DK42F2ZM.cjs +0 -2
- package/dist/chunk-DK42F2ZM.cjs.map +0 -1
- package/dist/chunk-FM3WDBFH.mjs +0 -2
- package/dist/chunk-I7M43BB4.cjs +0 -2
- package/dist/chunk-I7M43BB4.cjs.map +0 -1
- package/dist/chunk-IDFMLLDY.mjs +0 -2
- package/dist/chunk-LNVR4BW6.cjs +0 -2
- package/dist/chunk-LNVR4BW6.cjs.map +0 -1
- package/dist/chunk-MJZHJFZO.mjs +0 -2
- package/dist/chunk-MK5NS5B5.mjs +0 -2
- package/dist/chunk-NAXAZJJY.mjs +0 -2
- package/dist/chunk-NLVWRMGD.mjs +0 -2
- package/dist/chunk-NMH7LHPW.cjs +0 -2
- package/dist/chunk-NMH7LHPW.cjs.map +0 -1
- package/dist/chunk-NVHV2LDK.cjs +0 -2
- package/dist/chunk-NVHV2LDK.cjs.map +0 -1
- package/dist/chunk-OGBD5YOG.mjs +0 -2
- package/dist/chunk-OGJMSGB2.mjs +0 -2
- package/dist/chunk-OIYXOKTT.cjs +0 -2
- package/dist/chunk-OIYXOKTT.cjs.map +0 -1
- package/dist/chunk-OUD27MU7.cjs +0 -2
- package/dist/chunk-OUD27MU7.cjs.map +0 -1
- package/dist/chunk-PLIH6KQM.mjs +0 -2
- package/dist/chunk-PLIH6KQM.mjs.map +0 -1
- package/dist/chunk-QRAIGQF2.mjs +0 -2
- package/dist/chunk-RWOICHRW.cjs +0 -2
- package/dist/chunk-RWOICHRW.cjs.map +0 -1
- package/dist/chunk-T5FSQ3YE.mjs +0 -2
- package/dist/chunk-WRFDB3QJ.cjs +0 -2
- package/dist/chunk-WRFDB3QJ.cjs.map +0 -1
- package/dist/chunk-XNJLSA6P.cjs +0 -2
- package/dist/chunk-XNJLSA6P.cjs.map +0 -1
package/dist/actions/exports.cjs
CHANGED
|
@@ -1,2 +1,919 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } async function _asyncNullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return await rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }var _chunk64OF6RU5cjs = require('../chunk-64OF6RU5.cjs');require('../chunk-OUD27MU7.cjs');var _chunkCF3LFNXGcjs = require('../chunk-CF3LFNXG.cjs');require('../chunk-OIYXOKTT.cjs');require('../chunk-WRFDB3QJ.cjs');require('../chunk-DK42F2ZM.cjs');var _chunk2YBHAMDVcjs = require('../chunk-2YBHAMDV.cjs');var _chunkNVHV2LDKcjs = require('../chunk-NVHV2LDK.cjs');var _chunk74WA35RIcjs = require('../chunk-74WA35RI.cjs');require('../chunk-NMH7LHPW.cjs');var _viem = require('viem');var _metaMorphoV11 = require('@berachain/abis/bend-metamorpho/metaMorphoV11');async function _t({vaultAddress:e,publicClient:t}){let o=await t.readContract({address:e,abi:_metaMorphoV11.metaMorphoV11Abi,functionName:"maxDeposit",args:[e]});return _viem.formatEther.call(void 0, o)}var _berancersdk = require('@berachain-foundation/berancer-sdk');var $t=e=>({type:_berancersdk.mapPoolType.call(void 0, e.type),protocolVersion:e.protocolVersion,tokens:e.tokens.map(t=>({...t,address:t.address})),id:e.id,address:e.address});var _vault = require('@berachain/abis/bex/vault');async function zt({publicClient:e,...t}){let{config:o}=_chunk74WA35RIcjs.a.call(void 0, t);return(await e.readContract({address:o.bex.vault,abi:_vault.vaultAbi,functionName:"getPausedState"}))[0]}var _internal = require('@berachain/config/internal');var _beraChef = require('@berachain/abis/pol/rewards/beraChef');var _rewardVault = require('@berachain/abis/pol/rewards/rewardVault');function G(e){return e.some(t=>t.name==="implementation"||t.name==="proxyType"||t.type==="constructor"&&_optionalChain([t, 'access', _2 => _2.inputs, 'optionalAccess', _3 => _3[0], 'optionalAccess', _4 => _4.name])==="implementation")}async function N({contractAddress:e,chainId:t,publicClient:o}){let r=`https://api.etherscan.io/v2/api?module=contract&action=getabi&address=${e}&apikey=${_internal.appConfig.apiKeys.private.etherscan}&chainId=${t}`,a=await fetch(r);if(!a.ok)throw new Error(`Failed to fetch ABI: ${a.statusText}`);let n=await a.json();if(n.status==="0")throw new Error(n.result);let m=JSON.parse(n.result);if(!G(m))return m;let i=await o.getStorageAt({address:e,slot:"0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc"});if(!i||_viem.trim.call(void 0, i)==="0x00")return m;let s=_viem.pad.call(void 0, _viem.trim.call(void 0, i),{size:20});return N({contractAddress:s,chainId:t,publicClient:o})}async function q({address:e,callData:t,knownAbi:o,chainId:r,publicClient:a}){try{if(_viem.decodeFunctionData.call(void 0, {data:t,abi:o}))return o}catch (e2){}try{return await N({contractAddress:e,chainId:r,publicClient:a})}catch (e3){}}function z(e,t){try{return _viem.decodeFunctionData.call(void 0, {data:e,abi:t})}catch (e4){return}}function X(e,t){return e.find(o=>o.type==="function"&&o.name===t)}function j(e){if(e)try{return _viem.toFunctionSignature.call(void 0, e)}catch(t){console.error(t)}}async function Yt({address:e,callData:t,chainId:o=_internal.defaultChainId,publicClient:r}){let a=[..._beraChef.beraChefAbi,..._rewardVault.rewardVaultAbi,..._viem.erc20Abi],n=await q({address:e,callData:t,knownAbi:a,chainId:o,publicClient:r}),m=z(t,n);if(!n||!m)return{args:[]};let i=X(n,m.functionName),s=j(i);return{abiItem:i,functionSignature:s,functionName:m.functionName,args:m.args}}var _honeyFactory = require('@berachain/abis/honey/honeyFactory');async function ar({client:e,collateralList:t,...o}){let{config:r}=_chunk74WA35RIcjs.a.call(void 0, o);try{let a={mint:[],redeem:[]};for(let s of t)a.mint.push(e.readContract({address:r.honey.factory,abi:_honeyFactory.honeyFactoryAbi,functionName:"mintRates",args:[s.address]})),a.redeem.push(e.readContract({address:r.honey.factory,abi:_honeyFactory.honeyFactoryAbi,functionName:"redeemRates",args:[s.address]}));let[n,m,i]=await Promise.all([Promise.all(a.mint),Promise.all(a.redeem),e.readContract({address:r.honey.factory,abi:_honeyFactory.honeyFactoryAbi,functionName:"getWeights"})]);return t.reduce((s,c)=>{let p=t.indexOf(c);return s.single[c.address]={mintFee:1-+_viem.formatUnits.call(void 0, n[p],18),redeemFee:1-+_viem.formatUnits.call(void 0, m[p],18)},s.basket.mintFee+=s.single[c.address].mintFee*+_viem.formatUnits.call(void 0, i[p],18),s.basket.redeemFee+=s.single[c.address].redeemFee*+_viem.formatUnits.call(void 0, i[p],18),s},{single:{},basket:{mintFee:0,redeemFee:0}})}catch(a){throw console.log(a),a}}var _honey = require('@berachain/abis/honey/honey');async function mr({client:e,...t}){let{config:o}=_chunk74WA35RIcjs.a.call(void 0, t),r=o.honey.token;return await e.readContract({address:r,abi:_honey.honeyAbi,functionName:"paused"})}var _rootPriceOracle = require('@berachain/abis/extras/rootPriceOracle');async function pr({pythOracle:e,publicClient:t}){return await t.readContract({address:e,abi:_rootPriceOracle.rootPriceOracleAbi,functionName:"pythOracle"})}async function yr({publicClient:e,factory:t,...o}){let{config:r}=_chunk74WA35RIcjs.a.call(void 0, o);return await e.readContract({address:_nullishCoalesce(t, () => (r.honey.factory)),abi:_honeyFactory.honeyFactoryAbi,functionName:"priceOracle"})}async function hr({defaultBlockTime:e,publicClient:t,blocksSpan:o,...r}){_chunk2YBHAMDVcjs.c.call(void 0, t);let{config:a}=_chunk74WA35RIcjs.a.call(void 0, r),n=_nullishCoalesce(e, () => (a.averageBlockTime)),m=_nullishCoalesce(o, () => (Math.floor(_chunkNVHV2LDKcjs.q.call(void 0, 1)/n))),i=await _optionalChain([t, 'optionalAccess', _5 => _5.getBlock, 'call', _6 => _6({blockTag:"latest"})]),s=await _optionalChain([t, 'optionalAccess', _7 => _7.getBlock, 'call', _8 => _8({blockNumber:i.number-BigInt(m)})]);return(_chunkNVHV2LDKcjs.l.call(void 0, Date.now())-Number(_optionalChain([s, 'optionalAccess', _9 => _9.timestamp])))/(Number(_optionalChain([i, 'optionalAccess', _10 => _10.number]))-Number(_optionalChain([s, 'optionalAccess', _11 => _11.number])))}var _lstStakerVault = require('@berachain/abis/pol/lst/lstStakerVault');async function Nr({tokenList:e,publicClient:t,lstStakingVaults:o,...r}){_chunk2YBHAMDVcjs.c.call(void 0, t);let{config:a}=_chunk74WA35RIcjs.a.call(void 0, {...r,chainId:_nullishCoalesce(_optionalChain([t, 'access', _12 => _12.chain, 'optionalAccess', _13 => _13.id]), () => (r.chainId))}),n=e.filter(i=>o.includes(i.address));return n.length===0?[]:(await Promise.all(n.map(async i=>({assetTokenAddress:await t.readContract({address:i.address,abi:_lstStakerVault.lstStakerVaultAbi,functionName:"asset"}),stakingToken:i})))).reduce((i,{assetTokenAddress:s,stakingToken:c})=>{let p=e.find(g=>_chunk74WA35RIcjs.e.call(void 0, g,s));return p&&i.push({id:c.address,receiptToken:c,inputTokens:[p]}),i},[])}var _rewardVaultFactory = require('@berachain/abis/pol/rewards/rewardVaultFactory');var S=[{inputs:[{internalType:"address",name:"initialOwner",type:"address"},{internalType:"address",name:"initialImplementation",type:"address"}],stateMutability:"payable",type:"constructor"},{inputs:[],name:"NewImplementationHasNoCode",type:"error"},{inputs:[],name:"NewOwnerIsZeroAddress",type:"error"},{inputs:[],name:"Unauthorized",type:"error"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"oldOwner",type:"address"},{indexed:!0,internalType:"address",name:"newOwner",type:"address"}],name:"OwnershipTransferred",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"implementation",type:"address"}],name:"Upgraded",type:"event"},{inputs:[],name:"implementation",outputs:[{internalType:"address",name:"result",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"owner",outputs:[{internalType:"address",name:"result",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"renounceOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newOwner",type:"address"}],name:"transferOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newImplementation",type:"address"}],name:"upgradeTo",outputs:[],stateMutability:"nonpayable",type:"function"}];async function v({publicClient:e,...t}){let{config:o}=_chunk74WA35RIcjs.a.call(void 0, t),r=o.pol.factory;_chunk2YBHAMDVcjs.b.call(void 0, e,"publicClient"),_chunk2YBHAMDVcjs.d.call(void 0, o.pol.factory,"factoryAddress");let a=await e.readContract({address:r,abi:_rewardVaultFactory.rewardVaultFactoryAbi,functionName:"beacon"});return await e.readContract({address:a,abi:S,functionName:"implementation"})}async function Wr({publicClient:e,...t}){_chunk2YBHAMDVcjs.c.call(void 0, e);let o=await v({publicClient:e,...t}),[r,a]=await Promise.all([e.readContract({address:o,abi:_rewardVault.rewardVaultAbi,functionName:"MIN_REWARD_DURATION"}),e.readContract({address:o,abi:_rewardVault.rewardVaultAbi,functionName:"MAX_REWARD_DURATION"})]);return{minRewardDuration:Number(r),maxRewardDuration:Number(a)}}async function Er({tokenAddress:e,publicClient:t,factoryAddress:o,...r}){let{config:a}=_chunk74WA35RIcjs.a.call(void 0, r),n=await t.readContract({address:_nullishCoalesce(o, () => (a.pol.factory)),abi:_rewardVaultFactory.rewardVaultFactoryAbi,functionName:"getVault",args:[e]});return n===_viem.zeroAddress?null:n}var _pythPriceOracle = require('@berachain/abis/extras/pythPriceOracle');async function qr({tokenList:e,publicClient:t,...o}){let{config:r}=_chunk74WA35RIcjs.a.call(void 0, o);try{let a=await Promise.all(e.map(n=>t.readContract({address:r.honey.pythOracle,abi:_pythPriceOracle.pythPriceOracleAbi,functionName:"feeds",args:[n]})));return e.reduce((n,m,i)=>({...n,[m]:a[i]}),{})}catch(a){throw console.error("getPythPriceFeedId",a),a}}async function Kr({url:e,...t}={}){let{config:o}=_chunk74WA35RIcjs.a.call(void 0, t);returnawait _asyncNullishCoalesce((await _chunkNVHV2LDKcjs.d.call(void 0, {url:_nullishCoalesce(e, () => (o.lists.tokenList)),type:"rest",name:"GitHub"})).tokens, async () => ([]))}var _bgt = require('@berachain/abis/pol/bgt');async function to({publicClient:e,ui:t,...o}){let{config:r}=_chunk74WA35RIcjs.a.call(void 0, o),[a,n,m,i,s,c,p,g]=await Promise.all([e.readContract({address:r.pol.beraChef,abi:_beraChef.beraChefAbi,functionName:"MAX_COMMISSION_RATE"}),e.readContract({address:r.pol.beraChef,abi:_beraChef.beraChefAbi,functionName:"commissionChangeDelay"}),e.readContract({address:r.pol.beraChef,abi:_beraChef.beraChefAbi,functionName:"rewardAllocationBlockDelay"}),e.readContract({address:r.pol.beraChef,abi:_beraChef.beraChefAbi,functionName:"maxWeightPerVault"}),e.readContract({address:r.pol.beraChef,abi:_beraChef.beraChefAbi,functionName:"maxNumWeightsPerRewardAllocation"}),e.readContract({address:r.tokens.bgt,abi:_bgt.bgtAbi,functionName:"dropBoostDelay"}),e.readContract({address:r.tokens.bgt,abi:_bgt.bgtAbi,functionName:"activateBoostDelay"}),e.readContract({address:r.pol.beraChef,abi:_beraChef.beraChefAbi,functionName:"rewardAllocationInactivityBlockSpan"})]);return{maxCommissionRate:Number(a)/1e4,boostDelay:Number(p),unboostDelay:Number(c),commissionChangeDelay:Number(n),rewardAllocationBlockDelay:Number(m),maxWeightPerVault:Number(i)/1e4,maxNumWeightsPerRewardAllocation:Number(s),rewardAllocationInactivityBlockSpan:Number(g),ui:t}}function ao({rewardAllocationWeights:e,activeOnly:t=!0}){let o=e.filter(r=>_optionalChain([r, 'optionalAccess', _14 => _14.receivingVault])).reduce((r,a)=>{for(let n of _nullishCoalesce(_optionalChain([a, 'access', _15 => _15.receivingVault, 'optionalAccess', _16 => _16.activeIncentives]), () => ([]))){if(t&&n.remainingAmount==="0")continue;let m=new (0, _chunkNVHV2LDKcjs.a)(n.incentiveRate).times(a.percentage),i=new (0, _chunkNVHV2LDKcjs.a)(n.incentiveRateUsd).times(a.percentage),s=n.token.address.toLowerCase(),c=r.get(s);c?r.set(s,{...c,incentiveRate:new (0, _chunkNVHV2LDKcjs.a)(c.incentiveRate).plus(m).toString(),incentiveRateUsd:new (0, _chunkNVHV2LDKcjs.a)(c.incentiveRateUsd).plus(i).toString(),remainingAmount:new (0, _chunkNVHV2LDKcjs.a)(c.remainingAmount).plus(n.remainingAmount).toString(),remainingAmountUsd:new (0, _chunkNVHV2LDKcjs.a)(c.remainingAmountUsd).plus(n.remainingAmountUsd).toString()}):r.set(s,{...n,tokenAddress:n.token.address,token:n.token,incentiveRate:m.toString(),incentiveRateUsd:i.toString(),remainingAmount:n.remainingAmount})}return r},new Map);return Array.from(o.values())}function ae(e){return _optionalChain([e, 'optionalAccess', _17 => _17.rewardAllocationWeights, 'optionalAccess', _18 => _18.reduce, 'call', _19 => _19((t,o)=>{if(!o)return t;let r=_nullishCoalesce(_optionalChain([o, 'access', _20 => _20.receivingVault, 'optionalAccess', _21 => _21.activeIncentives, 'access', _22 => _22.filter, 'call', _23 => _23(a=>Number(a.remainingAmount)>0), 'access', _24 => _24.reduce, 'call', _25 => _25((a,n)=>{let m=Number(n.remainingAmountUsd)/Number(n.remainingAmount);return a+Number(n.incentiveRate)*m},0)]), () => (0));return t+r*o.percentage},0)])}function io({validator:e,bgtPrice:t}){let o=Number(_nullishCoalesce(_optionalChain([e, 'access', _26 => _26.dynamicData, 'optionalAccess', _27 => _27.activeBoostAmount]), () => (0))),r=ae(e);return!r||!o?0:r*Number(_nullishCoalesce(_optionalChain([e, 'access', _28 => _28.dynamicData, 'optionalAccess', _29 => _29.lastDayDistributedBGTAmount]), () => (0)))*365/(o*t)}exports.BalancerApi = _chunk64OF6RU5cjs.f; exports.BaseAggregator = _chunk64OF6RU5cjs.e; exports.BeraApolloClient = _chunk64OF6RU5cjs.b; exports.HoneyPreviewMethod = _chunk64OF6RU5cjs.D; exports.MOCKED_PROPOSAL_STATUSES = _chunk64OF6RU5cjs.o; exports.RewardVaultDistributionMode = _chunk64OF6RU5cjs.M; exports.aggregateValidatorIncentives = ao; exports.beraWriteContract = _chunk64OF6RU5cjs.ma; exports.checkProposalField = _chunk64OF6RU5cjs.n; exports.computeActualStatus = _chunk64OF6RU5cjs.p; exports.formatValidatorRewardAllocation = _chunk64OF6RU5cjs.ra; exports.getActiveBoostAndCommissionChangeDelay = to; exports.getAllPools = _chunk64OF6RU5cjs.g; exports.getAllProposals = _chunk64OF6RU5cjs.q; exports.getAllValidators = _chunk64OF6RU5cjs.na; exports.getAllowances = _chunk64OF6RU5cjs.ka; exports.getApiEnrichedAllocation = _chunk64OF6RU5cjs.oa; exports.getApiPool = _chunk64OF6RU5cjs.h; exports.getApiValidator = _chunk64OF6RU5cjs.pa; exports.getApolloClient = _chunk64OF6RU5cjs.c; exports.getBalanceCall = _chunkCF3LFNXGcjs.b; exports.getBgtAprSimulation = _chunk64OF6RU5cjs.O; exports.getBlockTime = hr; exports.getBlockTimestamp = _chunk64OF6RU5cjs.L; exports.getBodyErrors = _chunk64OF6RU5cjs.r; exports.getChartData = _chunk64OF6RU5cjs.w; exports.getCollateralWeights = _chunk64OF6RU5cjs.x; exports.getConvertToAssets = _chunk64OF6RU5cjs.a; exports.getDailyValidatorBlockStats = _chunk64OF6RU5cjs.qa; exports.getDecodedFunctionData = Yt; exports.getDefaultRewardAllocation = _chunk64OF6RU5cjs.va; exports.getEarnedStakedBeraVault = _chunk64OF6RU5cjs.P; exports.getEnsoClient = _chunkCF3LFNXGcjs.a; exports.getGlobalCapLimit = _chunk64OF6RU5cjs.B; exports.getGlobalData = _chunk64OF6RU5cjs.R; exports.getGlobalLiquidityAndSwapVolume = _chunk64OF6RU5cjs.i; exports.getHoneyCollaterals = _chunk64OF6RU5cjs.z; exports.getHoneyFees = ar; exports.getHoneyGlobalData = _chunk64OF6RU5cjs.C; exports.getHoneyPausedState = mr; exports.getHoneyPreview = _chunk64OF6RU5cjs.E; exports.getHoneyPythFeeds = qr; exports.getHoneyPythOracle = pr; exports.getHoneyRootPriceOracle = yr; exports.getHoneyVaultsBalance = _chunk64OF6RU5cjs.F; exports.getIncentiveFeeClaimStats = _chunk64OF6RU5cjs.S; exports.getLSTStakeConfig = Nr; exports.getMarkets = _chunk64OF6RU5cjs.T; exports.getMaxDeposit = _t; exports.getOnChainPool = _chunk64OF6RU5cjs.k; exports.getPoolEvents = _chunk64OF6RU5cjs.l; exports.getPoolHistoricalData = _chunk64OF6RU5cjs.m; exports.getPoolPausedState = _chunk64OF6RU5cjs.j; exports.getPoolState = $t; exports.getProposalDetails = _chunk64OF6RU5cjs.s; exports.getProposalFromTx = _chunk64OF6RU5cjs.u; exports.getProposalVotes = _chunk64OF6RU5cjs.v; exports.getPythLatestPrices = _chunk64OF6RU5cjs.G; exports.getPythUpdateFee = _chunk64OF6RU5cjs.I; exports.getRelativeCapLimit = _chunk64OF6RU5cjs.H; exports.getRewardProofsByValidator = _chunk64OF6RU5cjs.U; exports.getRewardTokenToBeraRate = _chunk64OF6RU5cjs.V; exports.getRewardVault = _chunk64OF6RU5cjs.W; exports.getRewardVaultDurationConstants = Wr; exports.getRewardVaultFromToken = Er; exports.getRewardVaultIncentives = _chunk64OF6RU5cjs.X; exports.getRewardVaultRewards = _chunk64OF6RU5cjs.N; exports.getRewardVaultStakingToken = _chunk64OF6RU5cjs.Y; exports.getRewardVaults = _chunk64OF6RU5cjs.Q; exports.getSWBeraVaultMetadata = _chunk64OF6RU5cjs.aa; exports.getSWBeraWithdrawal = _chunk64OF6RU5cjs.ba; exports.getStakeWithdrawalCooldown = _chunk64OF6RU5cjs.$; exports.getStakedBeraAPR = _chunk64OF6RU5cjs.Z; exports.getStakedBeraSnapshots = _chunk64OF6RU5cjs._; exports.getStakingPoolBatch = _chunk64OF6RU5cjs.wa; exports.getSwapPayload = _chunk64OF6RU5cjs.J; exports.getTokenCurrentPrices = _chunk64OF6RU5cjs.ja; exports.getTokenInformation = _chunk64OF6RU5cjs.y; exports.getTokens = Kr; exports.getTotalStakedAmount = _chunk64OF6RU5cjs.ca; exports.getUserActiveValidators = _chunk64OF6RU5cjs.ya; exports.getUserBoostsOnValidator = _chunk64OF6RU5cjs.xa; exports.getUserClaimableIncentives = _chunk64OF6RU5cjs.da; exports.getUserStakingPositions = _chunk64OF6RU5cjs.za; exports.getUserVaultInfo = _chunk64OF6RU5cjs.fa; exports.getUserVaults = _chunk64OF6RU5cjs.ga; exports.getUserVaultsReward = _chunk64OF6RU5cjs.ea; exports.getValidatorAnalytics = _chunk64OF6RU5cjs.Aa; exports.getValidatorBoostApy = io; exports.getValidatorCommission = _chunk64OF6RU5cjs.Ba; exports.getValidatorEstimatedBgtPerYear = _chunk64OF6RU5cjs.Ca; exports.getValidatorOperatorAddress = _chunk64OF6RU5cjs.Da; exports.getValidatorQueuedCommission = _chunk64OF6RU5cjs.Ea; exports.getValidatorQueuedOperatorAddress = _chunk64OF6RU5cjs.Fa; exports.getValidatorQueuedRewardAllocation = _chunk64OF6RU5cjs.Ga; exports.getValidatorReturnPerBgt = ae; exports.getValidatorRewardAllocation = _chunk64OF6RU5cjs.ta; exports.getVaultHistory = _chunk64OF6RU5cjs.ha; exports.getVaultPausedState = zt; exports.getVaultValidators = _chunk64OF6RU5cjs.ia; exports.getWalletBalances = _chunkCF3LFNXGcjs.c; exports.gql = _chunk64OF6RU5cjs.d; exports.isBadCollateralAsset = _chunk64OF6RU5cjs.A; exports.isBasketModeEnabled = _chunk64OF6RU5cjs.K; exports.isDefaultRewardAllocation = _chunk64OF6RU5cjs.ua; exports.isImpersonateAccount = _chunk64OF6RU5cjs.la; exports.isSameRewardAllocation = _chunk64OF6RU5cjs.sa; exports.parseProposalBody = _chunk64OF6RU5cjs.t;
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
var _chunkA7P3JVU7cjs = require('../chunk-A7P3JVU7.cjs');
|
|
90
|
+
require('../chunk-MXWPP6MS.cjs');
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
var _chunk2LL77B3Tcjs = require('../chunk-2LL77B3T.cjs');
|
|
96
|
+
require('../chunk-TDW5SPXR.cjs');
|
|
97
|
+
require('../chunk-A4FPM7U3.cjs');
|
|
98
|
+
require('../chunk-4HDIUUSV.cjs');
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
var _chunk7ONKBHXYcjs = require('../chunk-7ONKBHXY.cjs');
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
var _chunk3LXVARBJcjs = require('../chunk-3LXVARBJ.cjs');
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
var _chunkHCC4FJTDcjs = require('../chunk-HCC4FJTD.cjs');
|
|
114
|
+
require('../chunk-QISQSMCV.cjs');
|
|
115
|
+
|
|
116
|
+
// src/actions/bend/getMaxDeposit.ts
|
|
117
|
+
var _viem = require('viem');
|
|
118
|
+
var _metaMorphoV11 = require('@berachain/abis/bend-metamorpho/metaMorphoV11');
|
|
119
|
+
async function getMaxDeposit({
|
|
120
|
+
vaultAddress,
|
|
121
|
+
publicClient
|
|
122
|
+
}) {
|
|
123
|
+
const maxDeposit = await publicClient.readContract({
|
|
124
|
+
address: vaultAddress,
|
|
125
|
+
abi: _metaMorphoV11.metaMorphoV11Abi,
|
|
126
|
+
functionName: "maxDeposit",
|
|
127
|
+
args: [vaultAddress]
|
|
128
|
+
});
|
|
129
|
+
return _viem.formatEther.call(void 0, maxDeposit);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
// src/actions/dex/getPoolWithState.ts
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
var _berancersdk = require('@berachain-foundation/berancer-sdk');
|
|
136
|
+
var getPoolState = (apiPool) => {
|
|
137
|
+
return {
|
|
138
|
+
type: _berancersdk.mapPoolType.call(void 0, apiPool.type),
|
|
139
|
+
protocolVersion: apiPool.protocolVersion,
|
|
140
|
+
tokens: apiPool.tokens.map(
|
|
141
|
+
(pt) => ({
|
|
142
|
+
...pt,
|
|
143
|
+
address: pt.address
|
|
144
|
+
})
|
|
145
|
+
),
|
|
146
|
+
id: apiPool.id,
|
|
147
|
+
address: apiPool.address
|
|
148
|
+
};
|
|
149
|
+
};
|
|
150
|
+
|
|
151
|
+
// src/actions/dex/getVaultPausedState.ts
|
|
152
|
+
var _vault = require('@berachain/abis/bex/vault');
|
|
153
|
+
async function getVaultPausedState({
|
|
154
|
+
publicClient,
|
|
155
|
+
...args
|
|
156
|
+
}) {
|
|
157
|
+
const { config } = _chunkHCC4FJTDcjs.parseBaseArgs.call(void 0, args);
|
|
158
|
+
const vaultPausedState = await publicClient.readContract({
|
|
159
|
+
address: config.bex.vault,
|
|
160
|
+
abi: _vault.vaultAbi,
|
|
161
|
+
functionName: "getPausedState"
|
|
162
|
+
});
|
|
163
|
+
return vaultPausedState[0];
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
// src/actions/governance/getDecodedFunctionData.ts
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
var _internal = require('@berachain/config/internal');
|
|
175
|
+
var _beraChef = require('@berachain/abis/pol/rewards/beraChef');
|
|
176
|
+
var _rewardVault = require('@berachain/abis/pol/rewards/rewardVault');
|
|
177
|
+
function isProxyABI(abi) {
|
|
178
|
+
return abi.some(
|
|
179
|
+
(item) => item.name === "implementation" || item.name === "proxyType" || item.type === "constructor" && _optionalChain([item, 'access', _ => _.inputs, 'optionalAccess', _2 => _2[0], 'optionalAccess', _3 => _3.name]) === "implementation"
|
|
180
|
+
);
|
|
181
|
+
}
|
|
182
|
+
async function _getAbi({
|
|
183
|
+
contractAddress,
|
|
184
|
+
chainId,
|
|
185
|
+
publicClient
|
|
186
|
+
}) {
|
|
187
|
+
const url = `https://api.etherscan.io/v2/api?module=contract&action=getabi&address=${contractAddress}&apikey=${_internal.appConfig.apiKeys.private.etherscan}&chainId=${chainId}`;
|
|
188
|
+
const response = await fetch(url);
|
|
189
|
+
if (!response.ok) {
|
|
190
|
+
throw new Error(`Failed to fetch ABI: ${response.statusText}`);
|
|
191
|
+
}
|
|
192
|
+
const data = await response.json();
|
|
193
|
+
if (data.status === "0") throw new Error(data.result);
|
|
194
|
+
const abi = JSON.parse(data.result);
|
|
195
|
+
if (!isProxyABI(abi)) return abi;
|
|
196
|
+
const implementationResult = await publicClient.getStorageAt({
|
|
197
|
+
address: contractAddress,
|
|
198
|
+
// bytes32(uint256(keccak256('eip1967.proxy.implementation')) - 1)).
|
|
199
|
+
slot: "0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc"
|
|
200
|
+
});
|
|
201
|
+
if (!implementationResult || _viem.trim.call(void 0, implementationResult) === "0x00")
|
|
202
|
+
return abi;
|
|
203
|
+
const implementationAddress = _viem.pad.call(void 0, _viem.trim.call(void 0, implementationResult), { size: 20 });
|
|
204
|
+
return _getAbi({
|
|
205
|
+
contractAddress: implementationAddress,
|
|
206
|
+
chainId,
|
|
207
|
+
publicClient
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
async function _getAbiForCallData({
|
|
211
|
+
address,
|
|
212
|
+
callData,
|
|
213
|
+
knownAbi,
|
|
214
|
+
chainId,
|
|
215
|
+
publicClient
|
|
216
|
+
}) {
|
|
217
|
+
try {
|
|
218
|
+
if (_viem.decodeFunctionData.call(void 0, { data: callData, abi: knownAbi })) {
|
|
219
|
+
return knownAbi;
|
|
220
|
+
}
|
|
221
|
+
} catch (e2) {
|
|
222
|
+
}
|
|
223
|
+
try {
|
|
224
|
+
const abi = await _getAbi({
|
|
225
|
+
contractAddress: address,
|
|
226
|
+
chainId,
|
|
227
|
+
publicClient
|
|
228
|
+
});
|
|
229
|
+
return abi;
|
|
230
|
+
} catch (e3) {
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
function _decodeCallData(callData, abi) {
|
|
234
|
+
try {
|
|
235
|
+
return _viem.decodeFunctionData.call(void 0, { data: callData, abi });
|
|
236
|
+
} catch (e4) {
|
|
237
|
+
return void 0;
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
function _findAbiItem(abi, functionName) {
|
|
241
|
+
return abi.find(
|
|
242
|
+
(a) => a.type === "function" && a.name === functionName
|
|
243
|
+
);
|
|
244
|
+
}
|
|
245
|
+
function _getFunctionSignature(abiItem) {
|
|
246
|
+
if (!abiItem) return;
|
|
247
|
+
try {
|
|
248
|
+
return _viem.toFunctionSignature.call(void 0, abiItem);
|
|
249
|
+
} catch (error) {
|
|
250
|
+
console.error(error);
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
async function getDecodedFunctionData({
|
|
254
|
+
address,
|
|
255
|
+
callData,
|
|
256
|
+
chainId = _internal.defaultChainId,
|
|
257
|
+
publicClient
|
|
258
|
+
}) {
|
|
259
|
+
const knownAbi = [..._beraChef.beraChefAbi, ..._rewardVault.rewardVaultAbi, ..._viem.erc20Abi];
|
|
260
|
+
const abi = await _getAbiForCallData({
|
|
261
|
+
address,
|
|
262
|
+
callData,
|
|
263
|
+
knownAbi,
|
|
264
|
+
chainId,
|
|
265
|
+
publicClient
|
|
266
|
+
});
|
|
267
|
+
const decodedData = _decodeCallData(callData, abi);
|
|
268
|
+
if (!abi || !decodedData) {
|
|
269
|
+
return { args: [] };
|
|
270
|
+
}
|
|
271
|
+
const abiItem = _findAbiItem(abi, decodedData.functionName);
|
|
272
|
+
const functionSignature = _getFunctionSignature(abiItem);
|
|
273
|
+
return {
|
|
274
|
+
abiItem,
|
|
275
|
+
functionSignature,
|
|
276
|
+
functionName: decodedData.functionName,
|
|
277
|
+
args: decodedData.args
|
|
278
|
+
};
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
// src/actions/honey/getHoneyFees.ts
|
|
282
|
+
|
|
283
|
+
var _honeyFactory = require('@berachain/abis/honey/honeyFactory');
|
|
284
|
+
async function getHoneyFees({
|
|
285
|
+
client,
|
|
286
|
+
collateralList,
|
|
287
|
+
...args
|
|
288
|
+
}) {
|
|
289
|
+
const { config } = _chunkHCC4FJTDcjs.parseBaseArgs.call(void 0, args);
|
|
290
|
+
try {
|
|
291
|
+
const promiseList = {
|
|
292
|
+
mint: [],
|
|
293
|
+
redeem: []
|
|
294
|
+
};
|
|
295
|
+
for (const coll of collateralList) {
|
|
296
|
+
promiseList.mint.push(
|
|
297
|
+
client.readContract({
|
|
298
|
+
address: config.honey.factory,
|
|
299
|
+
abi: _honeyFactory.honeyFactoryAbi,
|
|
300
|
+
functionName: "mintRates",
|
|
301
|
+
args: [coll.address]
|
|
302
|
+
})
|
|
303
|
+
);
|
|
304
|
+
promiseList.redeem.push(
|
|
305
|
+
client.readContract({
|
|
306
|
+
address: config.honey.factory,
|
|
307
|
+
abi: _honeyFactory.honeyFactoryAbi,
|
|
308
|
+
functionName: "redeemRates",
|
|
309
|
+
args: [coll.address]
|
|
310
|
+
})
|
|
311
|
+
);
|
|
312
|
+
}
|
|
313
|
+
const [mintRates, redeemRates, collateralWeights] = await Promise.all([
|
|
314
|
+
Promise.all(promiseList.mint),
|
|
315
|
+
Promise.all(promiseList.redeem),
|
|
316
|
+
// fetch the collateral weights, needed to calculate the weighted basket rates
|
|
317
|
+
client.readContract({
|
|
318
|
+
address: config.honey.factory,
|
|
319
|
+
abi: _honeyFactory.honeyFactoryAbi,
|
|
320
|
+
functionName: "getWeights"
|
|
321
|
+
})
|
|
322
|
+
]);
|
|
323
|
+
return collateralList.reduce(
|
|
324
|
+
(acc, coll) => {
|
|
325
|
+
const collIdx = collateralList.indexOf(coll);
|
|
326
|
+
acc.single[coll.address] = {
|
|
327
|
+
mintFee: 1 - +_viem.formatUnits.call(void 0, mintRates[collIdx], 18),
|
|
328
|
+
redeemFee: 1 - +_viem.formatUnits.call(void 0, redeemRates[collIdx], 18)
|
|
329
|
+
};
|
|
330
|
+
acc.basket.mintFee += acc.single[coll.address].mintFee * +_viem.formatUnits.call(void 0, collateralWeights[collIdx], 18);
|
|
331
|
+
acc.basket.redeemFee += acc.single[coll.address].redeemFee * +_viem.formatUnits.call(void 0, collateralWeights[collIdx], 18);
|
|
332
|
+
return acc;
|
|
333
|
+
},
|
|
334
|
+
{
|
|
335
|
+
single: {},
|
|
336
|
+
basket: { mintFee: 0, redeemFee: 0 }
|
|
337
|
+
}
|
|
338
|
+
);
|
|
339
|
+
} catch (e) {
|
|
340
|
+
console.log(e);
|
|
341
|
+
throw e;
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
// src/actions/honey/getHoneyPausedState.ts
|
|
346
|
+
var _honey = require('@berachain/abis/honey/honey');
|
|
347
|
+
async function getHoneyPausedState({
|
|
348
|
+
client,
|
|
349
|
+
...args
|
|
350
|
+
}) {
|
|
351
|
+
const { config } = _chunkHCC4FJTDcjs.parseBaseArgs.call(void 0, args);
|
|
352
|
+
const honeyAddress = config.honey.token;
|
|
353
|
+
const honeyPausedState = await client.readContract({
|
|
354
|
+
address: honeyAddress,
|
|
355
|
+
abi: _honey.honeyAbi,
|
|
356
|
+
functionName: "paused"
|
|
357
|
+
});
|
|
358
|
+
return honeyPausedState;
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
// src/actions/honey/getHoneyPythPriceOracle.ts
|
|
362
|
+
var _rootPriceOracle = require('@berachain/abis/extras/rootPriceOracle');
|
|
363
|
+
async function getHoneyPythOracle({
|
|
364
|
+
pythOracle,
|
|
365
|
+
publicClient
|
|
366
|
+
}) {
|
|
367
|
+
return publicClient.readContract({
|
|
368
|
+
address: pythOracle,
|
|
369
|
+
abi: _rootPriceOracle.rootPriceOracleAbi,
|
|
370
|
+
functionName: "pythOracle"
|
|
371
|
+
});
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
// src/actions/honey/getHoneyRootPriceOracle.ts
|
|
375
|
+
|
|
376
|
+
async function getHoneyRootPriceOracle({
|
|
377
|
+
publicClient,
|
|
378
|
+
factory,
|
|
379
|
+
...args
|
|
380
|
+
}) {
|
|
381
|
+
const { config } = _chunkHCC4FJTDcjs.parseBaseArgs.call(void 0, args);
|
|
382
|
+
return publicClient.readContract({
|
|
383
|
+
address: _nullishCoalesce(factory, () => ( config.honey.factory)),
|
|
384
|
+
abi: _honeyFactory.honeyFactoryAbi,
|
|
385
|
+
functionName: "priceOracle"
|
|
386
|
+
});
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
// src/actions/pol/getBlockTime.ts
|
|
390
|
+
async function getBlockTime({
|
|
391
|
+
defaultBlockTime,
|
|
392
|
+
publicClient,
|
|
393
|
+
blocksSpan,
|
|
394
|
+
...args
|
|
395
|
+
}) {
|
|
396
|
+
_chunk7ONKBHXYcjs.assertPublicClient.call(void 0, publicClient);
|
|
397
|
+
const { config } = _chunkHCC4FJTDcjs.parseBaseArgs.call(void 0, args);
|
|
398
|
+
const blockTime = _nullishCoalesce(defaultBlockTime, () => ( config.averageBlockTime));
|
|
399
|
+
const span = _nullishCoalesce(blocksSpan, () => ( Math.floor(_chunk3LXVARBJcjs.hoursInSeconds.call(void 0, 1) / blockTime)));
|
|
400
|
+
const currentBlock = await _optionalChain([publicClient, 'optionalAccess', _4 => _4.getBlock, 'call', _5 => _5({ blockTag: "latest" })]);
|
|
401
|
+
const oldestBlock = await _optionalChain([publicClient, 'optionalAccess', _6 => _6.getBlock, 'call', _7 => _7({
|
|
402
|
+
blockNumber: currentBlock.number - BigInt(span)
|
|
403
|
+
})]);
|
|
404
|
+
return (
|
|
405
|
+
// we need to use current timestamp as the latest block might not have been minted (chain halted)
|
|
406
|
+
(_chunk3LXVARBJcjs.msToSeconds.call(void 0, Date.now()) - Number(_optionalChain([oldestBlock, 'optionalAccess', _8 => _8.timestamp]))) / (Number(_optionalChain([currentBlock, 'optionalAccess', _9 => _9.number])) - Number(_optionalChain([oldestBlock, 'optionalAccess', _10 => _10.number])))
|
|
407
|
+
);
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
// src/actions/pol/getLSTStakeConfig.ts
|
|
411
|
+
var _lstStakerVault = require('@berachain/abis/pol/lst/lstStakerVault');
|
|
412
|
+
async function getLSTStakeConfig({
|
|
413
|
+
tokenList,
|
|
414
|
+
publicClient,
|
|
415
|
+
lstStakingVaults,
|
|
416
|
+
...args
|
|
417
|
+
}) {
|
|
418
|
+
_chunk7ONKBHXYcjs.assertPublicClient.call(void 0, publicClient);
|
|
419
|
+
const { config } = _chunkHCC4FJTDcjs.parseBaseArgs.call(void 0, {
|
|
420
|
+
...args,
|
|
421
|
+
chainId: _nullishCoalesce(_optionalChain([publicClient, 'access', _11 => _11.chain, 'optionalAccess', _12 => _12.id]), () => ( args.chainId))
|
|
422
|
+
});
|
|
423
|
+
const lstStakingTokens = tokenList.filter(
|
|
424
|
+
(token) => lstStakingVaults.includes(token.address)
|
|
425
|
+
);
|
|
426
|
+
if (lstStakingTokens.length === 0) {
|
|
427
|
+
return [];
|
|
428
|
+
}
|
|
429
|
+
const assets = await Promise.all(
|
|
430
|
+
lstStakingTokens.map(async (stakingToken) => {
|
|
431
|
+
const assetTokenAddress = await publicClient.readContract({
|
|
432
|
+
address: stakingToken.address,
|
|
433
|
+
abi: _lstStakerVault.lstStakerVaultAbi,
|
|
434
|
+
functionName: "asset"
|
|
435
|
+
});
|
|
436
|
+
return { assetTokenAddress, stakingToken };
|
|
437
|
+
})
|
|
438
|
+
);
|
|
439
|
+
return assets.reduce(
|
|
440
|
+
(acc, { assetTokenAddress, stakingToken }) => {
|
|
441
|
+
const assetToken = tokenList.find(
|
|
442
|
+
(token) => _chunkHCC4FJTDcjs.isToken.call(void 0, token, assetTokenAddress)
|
|
443
|
+
);
|
|
444
|
+
if (!assetToken) return acc;
|
|
445
|
+
acc.push({
|
|
446
|
+
id: stakingToken.address,
|
|
447
|
+
receiptToken: stakingToken,
|
|
448
|
+
inputTokens: [assetToken]
|
|
449
|
+
});
|
|
450
|
+
return acc;
|
|
451
|
+
},
|
|
452
|
+
[]
|
|
453
|
+
);
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
// src/actions/pol/getRewardVaultDurationConstants.ts
|
|
457
|
+
|
|
458
|
+
|
|
459
|
+
// src/actions/pol/getRewardVaultBeaconImplementation.ts
|
|
460
|
+
var _rewardVaultFactory = require('@berachain/abis/pol/rewards/rewardVaultFactory');
|
|
461
|
+
|
|
462
|
+
// src/abi/utils/upgradableBeacon.ts
|
|
463
|
+
var upgradableBeaconAbi = [
|
|
464
|
+
{
|
|
465
|
+
inputs: [
|
|
466
|
+
{ internalType: "address", name: "initialOwner", type: "address" },
|
|
467
|
+
{
|
|
468
|
+
internalType: "address",
|
|
469
|
+
name: "initialImplementation",
|
|
470
|
+
type: "address"
|
|
471
|
+
}
|
|
472
|
+
],
|
|
473
|
+
stateMutability: "payable",
|
|
474
|
+
type: "constructor"
|
|
475
|
+
},
|
|
476
|
+
{ inputs: [], name: "NewImplementationHasNoCode", type: "error" },
|
|
477
|
+
{ inputs: [], name: "NewOwnerIsZeroAddress", type: "error" },
|
|
478
|
+
{ inputs: [], name: "Unauthorized", type: "error" },
|
|
479
|
+
{
|
|
480
|
+
anonymous: false,
|
|
481
|
+
inputs: [
|
|
482
|
+
{
|
|
483
|
+
indexed: true,
|
|
484
|
+
internalType: "address",
|
|
485
|
+
name: "oldOwner",
|
|
486
|
+
type: "address"
|
|
487
|
+
},
|
|
488
|
+
{
|
|
489
|
+
indexed: true,
|
|
490
|
+
internalType: "address",
|
|
491
|
+
name: "newOwner",
|
|
492
|
+
type: "address"
|
|
493
|
+
}
|
|
494
|
+
],
|
|
495
|
+
name: "OwnershipTransferred",
|
|
496
|
+
type: "event"
|
|
497
|
+
},
|
|
498
|
+
{
|
|
499
|
+
anonymous: false,
|
|
500
|
+
inputs: [
|
|
501
|
+
{
|
|
502
|
+
indexed: true,
|
|
503
|
+
internalType: "address",
|
|
504
|
+
name: "implementation",
|
|
505
|
+
type: "address"
|
|
506
|
+
}
|
|
507
|
+
],
|
|
508
|
+
name: "Upgraded",
|
|
509
|
+
type: "event"
|
|
510
|
+
},
|
|
511
|
+
{
|
|
512
|
+
inputs: [],
|
|
513
|
+
name: "implementation",
|
|
514
|
+
outputs: [{ internalType: "address", name: "result", type: "address" }],
|
|
515
|
+
stateMutability: "view",
|
|
516
|
+
type: "function"
|
|
517
|
+
},
|
|
518
|
+
{
|
|
519
|
+
inputs: [],
|
|
520
|
+
name: "owner",
|
|
521
|
+
outputs: [{ internalType: "address", name: "result", type: "address" }],
|
|
522
|
+
stateMutability: "view",
|
|
523
|
+
type: "function"
|
|
524
|
+
},
|
|
525
|
+
{
|
|
526
|
+
inputs: [],
|
|
527
|
+
name: "renounceOwnership",
|
|
528
|
+
outputs: [],
|
|
529
|
+
stateMutability: "nonpayable",
|
|
530
|
+
type: "function"
|
|
531
|
+
},
|
|
532
|
+
{
|
|
533
|
+
inputs: [{ internalType: "address", name: "newOwner", type: "address" }],
|
|
534
|
+
name: "transferOwnership",
|
|
535
|
+
outputs: [],
|
|
536
|
+
stateMutability: "nonpayable",
|
|
537
|
+
type: "function"
|
|
538
|
+
},
|
|
539
|
+
{
|
|
540
|
+
inputs: [
|
|
541
|
+
{ internalType: "address", name: "newImplementation", type: "address" }
|
|
542
|
+
],
|
|
543
|
+
name: "upgradeTo",
|
|
544
|
+
outputs: [],
|
|
545
|
+
stateMutability: "nonpayable",
|
|
546
|
+
type: "function"
|
|
547
|
+
}
|
|
548
|
+
];
|
|
549
|
+
|
|
550
|
+
// src/actions/pol/getRewardVaultBeaconImplementation.ts
|
|
551
|
+
async function getRewardVaultBeaconImplementation({
|
|
552
|
+
publicClient,
|
|
553
|
+
...args
|
|
554
|
+
}) {
|
|
555
|
+
const { config } = _chunkHCC4FJTDcjs.parseBaseArgs.call(void 0, args);
|
|
556
|
+
const factoryAddress = config.pol.factory;
|
|
557
|
+
_chunk7ONKBHXYcjs.assertDefined.call(void 0, publicClient, "publicClient");
|
|
558
|
+
_chunk7ONKBHXYcjs.assertAddress.call(void 0, config.pol.factory, "factoryAddress");
|
|
559
|
+
const beacon = await publicClient.readContract({
|
|
560
|
+
address: factoryAddress,
|
|
561
|
+
abi: _rewardVaultFactory.rewardVaultFactoryAbi,
|
|
562
|
+
functionName: "beacon"
|
|
563
|
+
});
|
|
564
|
+
return publicClient.readContract({
|
|
565
|
+
address: beacon,
|
|
566
|
+
abi: upgradableBeaconAbi,
|
|
567
|
+
functionName: "implementation"
|
|
568
|
+
});
|
|
569
|
+
}
|
|
570
|
+
|
|
571
|
+
// src/actions/pol/getRewardVaultDurationConstants.ts
|
|
572
|
+
async function getRewardVaultDurationConstants({
|
|
573
|
+
publicClient,
|
|
574
|
+
...baseArgs
|
|
575
|
+
}) {
|
|
576
|
+
_chunk7ONKBHXYcjs.assertPublicClient.call(void 0, publicClient);
|
|
577
|
+
const beaconImplementation = await getRewardVaultBeaconImplementation({
|
|
578
|
+
publicClient,
|
|
579
|
+
...baseArgs
|
|
580
|
+
});
|
|
581
|
+
const [minRewardDuration, maxRewardDuration] = await Promise.all([
|
|
582
|
+
publicClient.readContract({
|
|
583
|
+
address: beaconImplementation,
|
|
584
|
+
abi: _rewardVault.rewardVaultAbi,
|
|
585
|
+
functionName: "MIN_REWARD_DURATION"
|
|
586
|
+
}),
|
|
587
|
+
publicClient.readContract({
|
|
588
|
+
address: beaconImplementation,
|
|
589
|
+
abi: _rewardVault.rewardVaultAbi,
|
|
590
|
+
functionName: "MAX_REWARD_DURATION"
|
|
591
|
+
})
|
|
592
|
+
]);
|
|
593
|
+
return {
|
|
594
|
+
minRewardDuration: Number(minRewardDuration),
|
|
595
|
+
maxRewardDuration: Number(maxRewardDuration)
|
|
596
|
+
};
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
// src/actions/pol/getRewardVaultFromToken.ts
|
|
600
|
+
|
|
601
|
+
|
|
602
|
+
async function getRewardVaultFromToken({
|
|
603
|
+
tokenAddress,
|
|
604
|
+
publicClient,
|
|
605
|
+
factoryAddress,
|
|
606
|
+
...args
|
|
607
|
+
}) {
|
|
608
|
+
const { config } = _chunkHCC4FJTDcjs.parseBaseArgs.call(void 0, args);
|
|
609
|
+
const vaultAddress = await publicClient.readContract({
|
|
610
|
+
address: _nullishCoalesce(factoryAddress, () => ( config.pol.factory)),
|
|
611
|
+
abi: _rewardVaultFactory.rewardVaultFactoryAbi,
|
|
612
|
+
functionName: "getVault",
|
|
613
|
+
args: [tokenAddress]
|
|
614
|
+
});
|
|
615
|
+
if (vaultAddress === _viem.zeroAddress) {
|
|
616
|
+
return null;
|
|
617
|
+
}
|
|
618
|
+
return vaultAddress;
|
|
619
|
+
}
|
|
620
|
+
|
|
621
|
+
// src/actions/pyth/getHoneyPythFeeds.ts
|
|
622
|
+
var _pythPriceOracle = require('@berachain/abis/extras/pythPriceOracle');
|
|
623
|
+
async function getHoneyPythFeeds({
|
|
624
|
+
tokenList,
|
|
625
|
+
publicClient,
|
|
626
|
+
...args
|
|
627
|
+
}) {
|
|
628
|
+
const { config } = _chunkHCC4FJTDcjs.parseBaseArgs.call(void 0, args);
|
|
629
|
+
try {
|
|
630
|
+
const priceFeedIds = await Promise.all(
|
|
631
|
+
tokenList.map(
|
|
632
|
+
(token) => publicClient.readContract({
|
|
633
|
+
address: config.honey.pythOracle,
|
|
634
|
+
abi: _pythPriceOracle.pythPriceOracleAbi,
|
|
635
|
+
functionName: "feeds",
|
|
636
|
+
args: [token]
|
|
637
|
+
})
|
|
638
|
+
)
|
|
639
|
+
);
|
|
640
|
+
return tokenList.reduce(
|
|
641
|
+
(acc, token, index) => ({
|
|
642
|
+
...acc,
|
|
643
|
+
[token]: priceFeedIds[index]
|
|
644
|
+
}),
|
|
645
|
+
{}
|
|
646
|
+
);
|
|
647
|
+
} catch (e) {
|
|
648
|
+
console.error("getPythPriceFeedId", e);
|
|
649
|
+
throw e;
|
|
650
|
+
}
|
|
651
|
+
}
|
|
652
|
+
|
|
653
|
+
// src/actions/tokens/getTokens.ts
|
|
654
|
+
async function getTokens({
|
|
655
|
+
url,
|
|
656
|
+
...args
|
|
657
|
+
} = {}) {
|
|
658
|
+
const { config } = _chunkHCC4FJTDcjs.parseBaseArgs.call(void 0, args);
|
|
659
|
+
const tokenList = await _chunk3LXVARBJcjs.beraFetchJson.call(void 0, {
|
|
660
|
+
url: _nullishCoalesce(url, () => ( config.lists.tokenList)),
|
|
661
|
+
type: "rest",
|
|
662
|
+
name: "GitHub"
|
|
663
|
+
});
|
|
664
|
+
return _nullishCoalesce(tokenList.tokens, () => ( []));
|
|
665
|
+
}
|
|
666
|
+
|
|
667
|
+
// src/actions/validators/getActiveBoostAndCommissionChangeDelay.ts
|
|
668
|
+
var _bgt = require('@berachain/abis/pol/bgt');
|
|
669
|
+
|
|
670
|
+
async function getActiveBoostAndCommissionChangeDelay({
|
|
671
|
+
publicClient,
|
|
672
|
+
ui,
|
|
673
|
+
...args
|
|
674
|
+
}) {
|
|
675
|
+
const { config } = _chunkHCC4FJTDcjs.parseBaseArgs.call(void 0, args);
|
|
676
|
+
const [
|
|
677
|
+
maxCommissionRate,
|
|
678
|
+
commissionChangeDelay,
|
|
679
|
+
rewardAllocationBlockDelay,
|
|
680
|
+
maxWeightPerVault,
|
|
681
|
+
maxNumWeightsPerRewardAllocation,
|
|
682
|
+
dropBoostDelay,
|
|
683
|
+
activateBoostDelay,
|
|
684
|
+
rewardAllocationInactivityBlockSpan
|
|
685
|
+
] = await Promise.all([
|
|
686
|
+
publicClient.readContract({
|
|
687
|
+
address: config.pol.beraChef,
|
|
688
|
+
abi: _beraChef.beraChefAbi,
|
|
689
|
+
functionName: "MAX_COMMISSION_RATE"
|
|
690
|
+
}),
|
|
691
|
+
publicClient.readContract({
|
|
692
|
+
address: config.pol.beraChef,
|
|
693
|
+
abi: _beraChef.beraChefAbi,
|
|
694
|
+
functionName: "commissionChangeDelay"
|
|
695
|
+
}),
|
|
696
|
+
publicClient.readContract({
|
|
697
|
+
address: config.pol.beraChef,
|
|
698
|
+
abi: _beraChef.beraChefAbi,
|
|
699
|
+
functionName: "rewardAllocationBlockDelay"
|
|
700
|
+
}),
|
|
701
|
+
publicClient.readContract({
|
|
702
|
+
address: config.pol.beraChef,
|
|
703
|
+
abi: _beraChef.beraChefAbi,
|
|
704
|
+
functionName: "maxWeightPerVault"
|
|
705
|
+
}),
|
|
706
|
+
publicClient.readContract({
|
|
707
|
+
address: config.pol.beraChef,
|
|
708
|
+
abi: _beraChef.beraChefAbi,
|
|
709
|
+
functionName: "maxNumWeightsPerRewardAllocation"
|
|
710
|
+
}),
|
|
711
|
+
publicClient.readContract({
|
|
712
|
+
address: config.tokens.bgt,
|
|
713
|
+
abi: _bgt.bgtAbi,
|
|
714
|
+
functionName: "dropBoostDelay"
|
|
715
|
+
}),
|
|
716
|
+
publicClient.readContract({
|
|
717
|
+
address: config.tokens.bgt,
|
|
718
|
+
abi: _bgt.bgtAbi,
|
|
719
|
+
functionName: "activateBoostDelay"
|
|
720
|
+
}),
|
|
721
|
+
publicClient.readContract({
|
|
722
|
+
address: config.pol.beraChef,
|
|
723
|
+
abi: _beraChef.beraChefAbi,
|
|
724
|
+
functionName: "rewardAllocationInactivityBlockSpan"
|
|
725
|
+
})
|
|
726
|
+
]);
|
|
727
|
+
return {
|
|
728
|
+
maxCommissionRate: Number(maxCommissionRate) / 1e4,
|
|
729
|
+
boostDelay: Number(activateBoostDelay),
|
|
730
|
+
unboostDelay: Number(dropBoostDelay),
|
|
731
|
+
commissionChangeDelay: Number(commissionChangeDelay),
|
|
732
|
+
rewardAllocationBlockDelay: Number(rewardAllocationBlockDelay),
|
|
733
|
+
maxWeightPerVault: Number(maxWeightPerVault) / 1e4,
|
|
734
|
+
maxNumWeightsPerRewardAllocation: Number(maxNumWeightsPerRewardAllocation),
|
|
735
|
+
rewardAllocationInactivityBlockSpan: Number(
|
|
736
|
+
rewardAllocationInactivityBlockSpan
|
|
737
|
+
),
|
|
738
|
+
ui
|
|
739
|
+
};
|
|
740
|
+
}
|
|
741
|
+
|
|
742
|
+
// src/actions/validators/utils/aggregateValidatorIncentives.ts
|
|
743
|
+
function aggregateValidatorIncentives({
|
|
744
|
+
rewardAllocationWeights,
|
|
745
|
+
activeOnly = true
|
|
746
|
+
}) {
|
|
747
|
+
const map = rewardAllocationWeights.filter((x) => _optionalChain([x, 'optionalAccess', _13 => _13.receivingVault])).reduce((acc, rv) => {
|
|
748
|
+
for (const incentive of _nullishCoalesce(_optionalChain([rv, 'access', _14 => _14.receivingVault, 'optionalAccess', _15 => _15.activeIncentives]), () => ( []))) {
|
|
749
|
+
if (activeOnly && incentive.remainingAmount === "0") {
|
|
750
|
+
continue;
|
|
751
|
+
}
|
|
752
|
+
const incentiveRate = new (0, _chunk3LXVARBJcjs.bignumber_js_default)(incentive.incentiveRate).times(
|
|
753
|
+
rv.percentage
|
|
754
|
+
);
|
|
755
|
+
const incentiveRateUsd = new (0, _chunk3LXVARBJcjs.bignumber_js_default)(
|
|
756
|
+
incentive.incentiveRateUsd
|
|
757
|
+
).times(rv.percentage);
|
|
758
|
+
const token = incentive.token.address.toLowerCase();
|
|
759
|
+
const existing = acc.get(token);
|
|
760
|
+
if (existing) {
|
|
761
|
+
acc.set(token, {
|
|
762
|
+
...existing,
|
|
763
|
+
incentiveRate: new (0, _chunk3LXVARBJcjs.bignumber_js_default)(existing.incentiveRate).plus(incentiveRate).toString(),
|
|
764
|
+
incentiveRateUsd: new (0, _chunk3LXVARBJcjs.bignumber_js_default)(existing.incentiveRateUsd).plus(incentiveRateUsd).toString(),
|
|
765
|
+
remainingAmount: new (0, _chunk3LXVARBJcjs.bignumber_js_default)(existing.remainingAmount).plus(incentive.remainingAmount).toString(),
|
|
766
|
+
remainingAmountUsd: new (0, _chunk3LXVARBJcjs.bignumber_js_default)(existing.remainingAmountUsd).plus(incentive.remainingAmountUsd).toString()
|
|
767
|
+
});
|
|
768
|
+
} else {
|
|
769
|
+
acc.set(token, {
|
|
770
|
+
...incentive,
|
|
771
|
+
tokenAddress: incentive.token.address,
|
|
772
|
+
token: incentive.token,
|
|
773
|
+
incentiveRate: incentiveRate.toString(),
|
|
774
|
+
incentiveRateUsd: incentiveRateUsd.toString(),
|
|
775
|
+
remainingAmount: incentive.remainingAmount
|
|
776
|
+
});
|
|
777
|
+
}
|
|
778
|
+
}
|
|
779
|
+
return acc;
|
|
780
|
+
}, /* @__PURE__ */ new Map());
|
|
781
|
+
return Array.from(map.values());
|
|
782
|
+
}
|
|
783
|
+
|
|
784
|
+
// src/actions/validators/utils/getValidatorBoostApy.ts
|
|
785
|
+
function getValidatorReturnPerBgt(validator) {
|
|
786
|
+
return _optionalChain([validator, 'optionalAccess', _16 => _16.rewardAllocationWeights, 'optionalAccess', _17 => _17.reduce, 'call', _18 => _18((acc, ab) => {
|
|
787
|
+
if (!ab) return acc;
|
|
788
|
+
const totalIncentiveValue = _nullishCoalesce(_optionalChain([ab, 'access', _19 => _19.receivingVault, 'optionalAccess', _20 => _20.activeIncentives, 'access', _21 => _21.filter, 'call', _22 => _22((inc) => Number(inc.remainingAmount) > 0), 'access', _23 => _23.reduce, 'call', _24 => _24((totalIncentiveValue2, currIncentive) => {
|
|
789
|
+
const tokenPrice = Number(currIncentive.remainingAmountUsd) / Number(currIncentive.remainingAmount);
|
|
790
|
+
return totalIncentiveValue2 + Number(currIncentive.incentiveRate) * tokenPrice;
|
|
791
|
+
}, 0)]), () => ( 0));
|
|
792
|
+
return acc + totalIncentiveValue * ab.percentage;
|
|
793
|
+
}, 0)]);
|
|
794
|
+
}
|
|
795
|
+
function getValidatorBoostApy({
|
|
796
|
+
validator,
|
|
797
|
+
bgtPrice
|
|
798
|
+
}) {
|
|
799
|
+
const validatorActiveBoostAmount = Number(
|
|
800
|
+
_nullishCoalesce(_optionalChain([validator, 'access', _25 => _25.dynamicData, 'optionalAccess', _26 => _26.activeBoostAmount]), () => ( 0))
|
|
801
|
+
);
|
|
802
|
+
const returnPerBgt = getValidatorReturnPerBgt(validator);
|
|
803
|
+
if (!returnPerBgt || !validatorActiveBoostAmount) {
|
|
804
|
+
return 0;
|
|
805
|
+
}
|
|
806
|
+
const boostApy = returnPerBgt * Number(_nullishCoalesce(_optionalChain([validator, 'access', _27 => _27.dynamicData, 'optionalAccess', _28 => _28.lastDayDistributedBGTAmount]), () => ( 0))) * 365 / (validatorActiveBoostAmount * bgtPrice);
|
|
807
|
+
return boostApy;
|
|
808
|
+
}
|
|
809
|
+
|
|
810
|
+
|
|
811
|
+
|
|
812
|
+
|
|
813
|
+
|
|
814
|
+
|
|
815
|
+
|
|
816
|
+
|
|
817
|
+
|
|
818
|
+
|
|
819
|
+
|
|
820
|
+
|
|
821
|
+
|
|
822
|
+
|
|
823
|
+
|
|
824
|
+
|
|
825
|
+
|
|
826
|
+
|
|
827
|
+
|
|
828
|
+
|
|
829
|
+
|
|
830
|
+
|
|
831
|
+
|
|
832
|
+
|
|
833
|
+
|
|
834
|
+
|
|
835
|
+
|
|
836
|
+
|
|
837
|
+
|
|
838
|
+
|
|
839
|
+
|
|
840
|
+
|
|
841
|
+
|
|
842
|
+
|
|
843
|
+
|
|
844
|
+
|
|
845
|
+
|
|
846
|
+
|
|
847
|
+
|
|
848
|
+
|
|
849
|
+
|
|
850
|
+
|
|
851
|
+
|
|
852
|
+
|
|
853
|
+
|
|
854
|
+
|
|
855
|
+
|
|
856
|
+
|
|
857
|
+
|
|
858
|
+
|
|
859
|
+
|
|
860
|
+
|
|
861
|
+
|
|
862
|
+
|
|
863
|
+
|
|
864
|
+
|
|
865
|
+
|
|
866
|
+
|
|
867
|
+
|
|
868
|
+
|
|
869
|
+
|
|
870
|
+
|
|
871
|
+
|
|
872
|
+
|
|
873
|
+
|
|
874
|
+
|
|
875
|
+
|
|
876
|
+
|
|
877
|
+
|
|
878
|
+
|
|
879
|
+
|
|
880
|
+
|
|
881
|
+
|
|
882
|
+
|
|
883
|
+
|
|
884
|
+
|
|
885
|
+
|
|
886
|
+
|
|
887
|
+
|
|
888
|
+
|
|
889
|
+
|
|
890
|
+
|
|
891
|
+
|
|
892
|
+
|
|
893
|
+
|
|
894
|
+
|
|
895
|
+
|
|
896
|
+
|
|
897
|
+
|
|
898
|
+
|
|
899
|
+
|
|
900
|
+
|
|
901
|
+
|
|
902
|
+
|
|
903
|
+
|
|
904
|
+
|
|
905
|
+
|
|
906
|
+
|
|
907
|
+
|
|
908
|
+
|
|
909
|
+
|
|
910
|
+
|
|
911
|
+
|
|
912
|
+
|
|
913
|
+
|
|
914
|
+
|
|
915
|
+
|
|
916
|
+
|
|
917
|
+
|
|
918
|
+
exports.BalancerApi = _chunkA7P3JVU7cjs.BalancerApi; exports.BaseAggregator = _chunkA7P3JVU7cjs.BaseAggregator; exports.BeraApolloClient = _chunkA7P3JVU7cjs.BeraApolloClient; exports.HoneyPreviewMethod = _chunkA7P3JVU7cjs.HoneyPreviewMethod; exports.MOCKED_PROPOSAL_STATUSES = _chunkA7P3JVU7cjs.MOCKED_PROPOSAL_STATUSES; exports.RewardVaultDistributionMode = _chunkA7P3JVU7cjs.RewardVaultDistributionMode; exports.aggregateValidatorIncentives = aggregateValidatorIncentives; exports.beraWriteContract = _chunkA7P3JVU7cjs.beraWriteContract; exports.checkProposalField = _chunkA7P3JVU7cjs.checkProposalField; exports.computeActualStatus = _chunkA7P3JVU7cjs.computeActualStatus; exports.formatValidatorRewardAllocation = _chunkA7P3JVU7cjs.formatValidatorRewardAllocation; exports.getActiveBoostAndCommissionChangeDelay = getActiveBoostAndCommissionChangeDelay; exports.getAllPools = _chunkA7P3JVU7cjs.getAllPools; exports.getAllProposals = _chunkA7P3JVU7cjs.getAllProposals; exports.getAllValidators = _chunkA7P3JVU7cjs.getAllValidators; exports.getAllowances = _chunkA7P3JVU7cjs.getAllowances; exports.getApiEnrichedAllocation = _chunkA7P3JVU7cjs.getApiEnrichedAllocation; exports.getApiPool = _chunkA7P3JVU7cjs.getApiPool; exports.getApiValidator = _chunkA7P3JVU7cjs.getApiValidator; exports.getApolloClient = _chunkA7P3JVU7cjs.getApolloClient; exports.getBalanceCall = _chunk2LL77B3Tcjs.getBalanceCall; exports.getBgtAprSimulation = _chunkA7P3JVU7cjs.getBgtAprSimulation; exports.getBlockTime = getBlockTime; exports.getBlockTimestamp = _chunkA7P3JVU7cjs.getBlockTimestamp; exports.getBodyErrors = _chunkA7P3JVU7cjs.getBodyErrors; exports.getChartData = _chunkA7P3JVU7cjs.getChartData; exports.getCollateralWeights = _chunkA7P3JVU7cjs.getCollateralWeights; exports.getConvertToAssets = _chunkA7P3JVU7cjs.getConvertToAssets; exports.getDailyValidatorBlockStats = _chunkA7P3JVU7cjs.getDailyValidatorBlockStats; exports.getDecodedFunctionData = getDecodedFunctionData; exports.getDefaultRewardAllocation = _chunkA7P3JVU7cjs.getDefaultRewardAllocation; exports.getEarnedStakedBeraVault = _chunkA7P3JVU7cjs.getEarnedStakedBeraVault; exports.getEnsoClient = _chunk2LL77B3Tcjs.getEnsoClient; exports.getGlobalCapLimit = _chunkA7P3JVU7cjs.getGlobalCapLimit; exports.getGlobalData = _chunkA7P3JVU7cjs.getGlobalData; exports.getGlobalLiquidityAndSwapVolume = _chunkA7P3JVU7cjs.getGlobalLiquidityAndSwapVolume; exports.getHoneyCollaterals = _chunkA7P3JVU7cjs.getHoneyCollaterals; exports.getHoneyFees = getHoneyFees; exports.getHoneyGlobalData = _chunkA7P3JVU7cjs.getHoneyGlobalData; exports.getHoneyPausedState = getHoneyPausedState; exports.getHoneyPreview = _chunkA7P3JVU7cjs.getHoneyPreview; exports.getHoneyPythFeeds = getHoneyPythFeeds; exports.getHoneyPythOracle = getHoneyPythOracle; exports.getHoneyRootPriceOracle = getHoneyRootPriceOracle; exports.getHoneyVaultsBalance = _chunkA7P3JVU7cjs.getHoneyVaultsBalance; exports.getIncentiveFeeClaimStats = _chunkA7P3JVU7cjs.getIncentiveFeeClaimStats; exports.getLSTStakeConfig = getLSTStakeConfig; exports.getMarkets = _chunkA7P3JVU7cjs.getMarkets; exports.getMaxDeposit = getMaxDeposit; exports.getOnChainPool = _chunkA7P3JVU7cjs.getOnChainPool; exports.getPoolEvents = _chunkA7P3JVU7cjs.getPoolEvents; exports.getPoolHistoricalData = _chunkA7P3JVU7cjs.getPoolHistoricalData; exports.getPoolPausedState = _chunkA7P3JVU7cjs.getPoolPausedState; exports.getPoolState = getPoolState; exports.getProposalDetails = _chunkA7P3JVU7cjs.getProposalDetails; exports.getProposalFromTx = _chunkA7P3JVU7cjs.getProposalFromTx; exports.getProposalVotes = _chunkA7P3JVU7cjs.getProposalVotes; exports.getPythLatestPrices = _chunkA7P3JVU7cjs.getPythLatestPrices; exports.getPythUpdateFee = _chunkA7P3JVU7cjs.getPythUpdateFee; exports.getRelativeCapLimit = _chunkA7P3JVU7cjs.getRelativeCapLimit; exports.getRewardProofsByValidator = _chunkA7P3JVU7cjs.getRewardProofsByValidator; exports.getRewardTokenToBeraRate = _chunkA7P3JVU7cjs.getRewardTokenToBeraRate; exports.getRewardVault = _chunkA7P3JVU7cjs.getRewardVault; exports.getRewardVaultDurationConstants = getRewardVaultDurationConstants; exports.getRewardVaultFromToken = getRewardVaultFromToken; exports.getRewardVaultIncentives = _chunkA7P3JVU7cjs.getRewardVaultIncentives; exports.getRewardVaultRewards = _chunkA7P3JVU7cjs.getRewardVaultRewards; exports.getRewardVaultStakingToken = _chunkA7P3JVU7cjs.getRewardVaultStakingToken; exports.getRewardVaults = _chunkA7P3JVU7cjs.getRewardVaults; exports.getSWBeraVaultMetadata = _chunkA7P3JVU7cjs.getSWBeraVaultMetadata; exports.getSWBeraWithdrawal = _chunkA7P3JVU7cjs.getSWBeraWithdrawal; exports.getStakeWithdrawalCooldown = _chunkA7P3JVU7cjs.getStakeWithdrawalCooldown; exports.getStakedBeraAPR = _chunkA7P3JVU7cjs.getStakedBeraAPR; exports.getStakedBeraSnapshots = _chunkA7P3JVU7cjs.getStakedBeraSnapshots; exports.getStakingPoolBatch = _chunkA7P3JVU7cjs.getStakingPoolBatch; exports.getSwapPayload = _chunkA7P3JVU7cjs.getSwapPayload; exports.getTokenCurrentPrices = _chunkA7P3JVU7cjs.getTokenCurrentPrices; exports.getTokenInformation = _chunkA7P3JVU7cjs.getTokenInformation; exports.getTokens = getTokens; exports.getTotalStakedAmount = _chunkA7P3JVU7cjs.getTotalStakedAmount; exports.getUserActiveValidators = _chunkA7P3JVU7cjs.getUserActiveValidators; exports.getUserBoostsOnValidator = _chunkA7P3JVU7cjs.getUserBoostsOnValidator; exports.getUserClaimableIncentives = _chunkA7P3JVU7cjs.getUserClaimableIncentives; exports.getUserStakingPositions = _chunkA7P3JVU7cjs.getUserStakingPositions; exports.getUserVaultInfo = _chunkA7P3JVU7cjs.getUserVaultInfo; exports.getUserVaults = _chunkA7P3JVU7cjs.getUserVaults; exports.getUserVaultsReward = _chunkA7P3JVU7cjs.getUserVaultsReward; exports.getValidatorAnalytics = _chunkA7P3JVU7cjs.getValidatorAnalytics; exports.getValidatorBoostApy = getValidatorBoostApy; exports.getValidatorCommission = _chunkA7P3JVU7cjs.getValidatorCommission; exports.getValidatorEstimatedBgtPerYear = _chunkA7P3JVU7cjs.getValidatorEstimatedBgtPerYear; exports.getValidatorOperatorAddress = _chunkA7P3JVU7cjs.getValidatorOperatorAddress; exports.getValidatorQueuedCommission = _chunkA7P3JVU7cjs.getValidatorQueuedCommission; exports.getValidatorQueuedOperatorAddress = _chunkA7P3JVU7cjs.getValidatorQueuedOperatorAddress; exports.getValidatorQueuedRewardAllocation = _chunkA7P3JVU7cjs.getValidatorQueuedRewardAllocation; exports.getValidatorReturnPerBgt = getValidatorReturnPerBgt; exports.getValidatorRewardAllocation = _chunkA7P3JVU7cjs.getValidatorRewardAllocation; exports.getVaultHistory = _chunkA7P3JVU7cjs.getVaultHistory; exports.getVaultPausedState = getVaultPausedState; exports.getVaultValidators = _chunkA7P3JVU7cjs.getVaultValidators; exports.getWalletBalances = _chunk2LL77B3Tcjs.getWalletBalances; exports.gql = _chunkA7P3JVU7cjs.gql; exports.isBadCollateralAsset = _chunkA7P3JVU7cjs.isBadCollateralAsset; exports.isBasketModeEnabled = _chunkA7P3JVU7cjs.isBasketModeEnabled; exports.isDefaultRewardAllocation = _chunkA7P3JVU7cjs.isDefaultRewardAllocation; exports.isImpersonateAccount = _chunkA7P3JVU7cjs.isImpersonateAccount; exports.isSameRewardAllocation = _chunkA7P3JVU7cjs.isSameRewardAllocation; exports.parseProposalBody = _chunkA7P3JVU7cjs.parseProposalBody;
|
|
2
919
|
//# sourceMappingURL=exports.cjs.map
|