@berachain/berajs 0.2.3 → 0.2.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/.claude/skills/berajs/SKILL.md +222 -0
- package/.claude/skills/berajs/references/dex.md +235 -0
- package/.claude/skills/berajs/references/pol.md +194 -0
- package/.claude/skills/berajs/references/staking.md +198 -0
- package/.claude/skills/berajs/references/tokens.md +170 -0
- package/dist/{BexStatusProvider-nS3NcdxI.d.cts → BexStatusProvider-DRymVlQf.d.cts} +1 -1
- package/dist/{BexStatusProvider-nS3NcdxI.d.ts → BexStatusProvider-DRymVlQf.d.ts} +1 -1
- package/dist/{HoneyConfigProvider-CK6mOKFH.d.ts → HoneyConfigProvider-DVP_9KZn.d.ts} +1 -1
- package/dist/{HoneyConfigProvider-Ca3ouozs.d.cts → HoneyConfigProvider-DfkjmzEf.d.cts} +1 -1
- package/dist/abi/exports.cjs +1 -1
- package/dist/abi/exports.cjs.map +1 -1
- package/dist/abi/exports.d.cts +1893 -25347
- package/dist/abi/exports.d.ts +1893 -25347
- package/dist/abi/exports.mjs +1 -1
- package/dist/abi/exports.mjs.map +1 -1
- package/dist/actions/exports.cjs +1 -1
- package/dist/actions/exports.cjs.map +1 -1
- package/dist/actions/exports.d.cts +10 -9
- package/dist/actions/exports.d.ts +10 -9
- package/dist/actions/exports.mjs +1 -1
- package/dist/actions/exports.mjs.map +1 -1
- package/dist/chunk-4GU2O2OW.cjs +4 -0
- package/dist/chunk-4GU2O2OW.cjs.map +1 -0
- package/dist/chunk-5XWELBWR.mjs +2 -0
- package/dist/chunk-5XWELBWR.mjs.map +1 -0
- package/dist/chunk-BS6K7HGH.cjs +2 -0
- package/dist/chunk-BS6K7HGH.cjs.map +1 -0
- package/dist/chunk-NLVWRMGD.mjs +2 -0
- package/dist/chunk-NLVWRMGD.mjs.map +1 -0
- package/dist/chunk-OUD27MU7.cjs +2 -0
- package/dist/chunk-OUD27MU7.cjs.map +1 -0
- package/dist/chunk-RW3JFPED.mjs +4 -0
- package/dist/chunk-RW3JFPED.mjs.map +1 -0
- package/dist/chunk-S3EAKCVM.cjs +2 -0
- package/dist/{chunk-PKXAW6MO.cjs.map → chunk-S3EAKCVM.cjs.map} +1 -1
- package/dist/chunk-YNO7BCCM.mjs +2 -0
- package/dist/{chunk-3YXSUBA5.mjs.map → chunk-YNO7BCCM.mjs.map} +1 -1
- package/dist/contexts/exports.d.cts +3 -3
- package/dist/contexts/exports.d.ts +3 -3
- package/dist/enum/exports.d.cts +1 -1
- package/dist/enum/exports.d.ts +1 -1
- package/dist/errors/exports.d.cts +1 -1
- package/dist/errors/exports.d.ts +1 -1
- package/dist/{getValidatorQueuedOperatorAddress-NrjpnEn8.d.ts → getValidatorQueuedOperatorAddress-CqR6cyqC.d.ts} +3 -3
- package/dist/{getValidatorQueuedOperatorAddress-D_LEt3vv.d.cts → getValidatorQueuedOperatorAddress-DZgrPmZ2.d.cts} +3 -3
- package/dist/{global.d-X3cqpCEB.d.ts → global.d-BeYWDreg.d.ts} +4 -4
- package/dist/{global.d-DLRtrPG5.d.cts → global.d-DghRxpHd.d.cts} +4 -4
- package/dist/hooks/exports.cjs +3 -3
- package/dist/hooks/exports.cjs.map +1 -1
- package/dist/hooks/exports.d.cts +40 -38
- package/dist/hooks/exports.d.ts +40 -38
- package/dist/hooks/exports.mjs +3 -3
- package/dist/hooks/exports.mjs.map +1 -1
- package/dist/{txnEnum-BlBYhNRl.d.cts → txnEnum-DxPRHSJt.d.cts} +1 -1
- package/dist/{txnEnum-BlBYhNRl.d.ts → txnEnum-DxPRHSJt.d.ts} +1 -1
- package/dist/types/exports.d.cts +3 -3
- package/dist/types/exports.d.ts +3 -3
- package/dist/{useHoneySwapState-D1DKG_Of.d.ts → useHoneySwapState-B494PQDl.d.ts} +1 -1
- package/dist/{useHoneySwapState-B-vmIP1b.d.cts → useHoneySwapState-D6vpv19r.d.cts} +1 -1
- package/dist/utils/exports.cjs +1 -1
- package/dist/utils/exports.cjs.map +1 -1
- package/dist/utils/exports.d.cts +2 -2
- package/dist/utils/exports.d.ts +2 -2
- package/dist/utils/exports.mjs +1 -1
- package/dist/utils/exports.mjs.map +1 -1
- package/package.json +8 -9
- package/src/abi/exports.ts +0 -27
- package/src/actions/bend/getConvertToAssets.ts +1 -1
- package/src/actions/bend/getMaxDeposit.ts +1 -1
- package/src/actions/dex/aggregators/bex.ts +2 -1
- package/src/actions/dex/aggregators/enso/enso.ts +3 -2
- package/src/actions/dex/aggregators/enso/ensoErc4626.debug.test.ts +2 -3
- package/src/actions/dex/aggregators/erc4626.ts +2 -1
- package/src/actions/dex/aggregators/fly.ts +2 -1
- package/src/actions/dex/aggregators/haiku.ts +2 -1
- package/src/actions/dex/aggregators/kyberswap.ts +2 -2
- package/src/actions/dex/aggregators/oogabooga.ts +2 -1
- package/src/actions/dex/aggregators/openOcean.ts +2 -1
- package/src/actions/dex/aggregators/wbera.ts +2 -1
- package/src/actions/dex/getVaultPausedState.ts +2 -1
- package/src/actions/enso/getEnsoUserTokensWithBalances.debug.test.ts +1 -1
- package/src/actions/governance/__tests__/checkProposalField.unit.test.ts +2 -1
- package/src/actions/governance/__tests__/getDecodedFunctionData.integration.test.ts +66 -78
- package/src/actions/governance/__tests__/getQuorum.integration.test.ts +6 -7
- package/src/actions/governance/getDecodedFunctionData.ts +2 -2
- package/src/actions/governance/getProposalFromTx.ts +2 -1
- package/src/actions/governance/getProposalParams.ts +3 -2
- package/src/actions/governance/getQuorum.ts +2 -1
- package/src/actions/honey/getCollateralWeights.ts +2 -1
- package/src/actions/honey/getGlobalCapLimit.ts +2 -1
- package/src/actions/honey/getHoneyCollaterals.ts +2 -1
- package/src/actions/honey/getHoneyFees.ts +2 -1
- package/src/actions/honey/getHoneyPausedState.ts +2 -1
- package/src/actions/honey/getHoneyPreview.ts +2 -1
- package/src/actions/honey/getHoneyPythPriceOracle.ts +1 -1
- package/src/actions/honey/getHoneyRootPriceOracle.ts +2 -1
- package/src/actions/honey/getHoneyVaultsBalance.ts +3 -2
- package/src/actions/honey/getRelativeCapLimit.ts +2 -1
- package/src/actions/honey/getSharesWithoutFees.ts +3 -2
- package/src/actions/honey/getSwapPayload.ts +3 -2
- package/src/actions/honey/isBadCollateralAsset.ts +3 -2
- package/src/actions/honey/isBasketModeEnabled.ts +3 -2
- package/src/actions/pol/getBgtTokenTotalBoosts.ts +2 -1
- package/src/actions/pol/getLSTStakeConfig.ts +2 -1
- package/src/actions/pol/getRewardTokenToBeraRate.ts +2 -1
- package/src/actions/pol/getRewardVaultBeaconImplementation.ts +2 -1
- package/src/actions/pol/getRewardVaultDurationConstants.ts +2 -1
- package/src/actions/pol/getRewardVaultFromToken.ts +2 -1
- package/src/actions/pol/getRewardVaultIncentives.ts +2 -1
- package/src/actions/pol/getRewardVaultRewards.ts +2 -1
- package/src/actions/pol/getRewardVaultStakingToken.ts +1 -1
- package/src/actions/pol/getRewardVaults.ts +2 -1
- package/src/actions/pol/getSWBeraVaultMetadata.ts +2 -1
- package/src/actions/pol/getSWBeraWithdrawal.ts +2 -1
- package/src/actions/pol/getStakeWithdrawalCooldown.ts +1 -1
- package/src/actions/pol/getTotalStakedAmount.ts +2 -1
- package/src/actions/pol/getUserVaults.ts +2 -1
- package/src/actions/pol/getUserVaultsBalance.ts +2 -1
- package/src/actions/pol/getUserVaultsReward.ts +1 -1
- package/src/actions/pol/getVaultsSupply.ts +1 -1
- package/src/actions/pyth/getHoneyPythFeeds.ts +2 -1
- package/src/actions/transactions/beraWriteContract.integration.test.ts +48 -51
- package/src/actions/validators/getActiveBoostAndCommissionChangeDelay.ts +3 -2
- package/src/actions/validators/getBaselineRewardAllocation.ts +2 -1
- package/src/actions/validators/getDefaultRewardAllocation.ts +2 -1
- package/src/actions/validators/getUserBoostsOnValidator.ts +2 -1
- package/src/actions/validators/getValidatorCommission.ts +2 -1
- package/src/actions/validators/getValidatorOperatorAddress.ts +2 -1
- package/src/actions/validators/getValidatorQueuedCommission.ts +2 -1
- package/src/actions/validators/getValidatorQueuedOperatorAddress.ts +2 -1
- package/src/actions/validators/getValidatorQueuedRewardAllocation.ts +2 -1
- package/src/actions/validators/getValidatorRewardAllocation.ts +2 -1
- package/src/actions/validators/getValidatorRewardAllocatorAddress.ts +2 -1
- package/src/actions/validators/utils/__tests__/validatorUtils.integration.test.ts +10 -11
- package/src/errors/getRevertReason.integration.test.ts +115 -107
- package/src/hooks/dex/useAggregatorsRouterFeeBps.ts +2 -1
- package/src/hooks/dex/useCreatePool.ts +2 -1
- package/src/hooks/dex/usePollPoolCreationRelayerApproval.ts +2 -1
- package/src/hooks/governance/useGetPastVotes.ts +2 -1
- package/src/hooks/governance/useHasVoted.ts +2 -1
- package/src/hooks/governance/useIsCanceller.ts +2 -1
- package/src/hooks/governance/usePollProposalThreshold.ts +2 -1
- package/src/hooks/governance/usePollUserDelegates.ts +2 -1
- package/src/hooks/governance/useProposalSnapshot.ts +2 -1
- package/src/hooks/governance/useProposalState.ts +2 -1
- package/src/hooks/governance/useProposalTimelockState.ts +5 -4
- package/src/hooks/pol/useBgtUnstakedBalance.ts +2 -1
- package/src/hooks/pol/useOnChainRewardVault.ts +2 -1
- package/src/hooks/pol/useRewardVaultBalanceFromStakingToken.ts +2 -1
- package/src/hooks/pol/useRewardVaultFromToken.ts +2 -1
- package/src/hooks/validators/useOnChainValidator.ts +4 -3
- package/dist/chunk-3YXSUBA5.mjs +0 -2
- package/dist/chunk-A4UDYSB6.mjs +0 -4
- package/dist/chunk-A4UDYSB6.mjs.map +0 -1
- package/dist/chunk-CYKCYPFR.cjs +0 -2
- package/dist/chunk-CYKCYPFR.cjs.map +0 -1
- package/dist/chunk-ECRMUMTA.mjs +0 -2
- package/dist/chunk-ECRMUMTA.mjs.map +0 -1
- package/dist/chunk-F4BKSBEM.mjs +0 -2
- package/dist/chunk-F4BKSBEM.mjs.map +0 -1
- package/dist/chunk-FL2N3XHK.cjs +0 -2
- package/dist/chunk-FL2N3XHK.cjs.map +0 -1
- package/dist/chunk-MUCEYO3E.cjs +0 -4
- package/dist/chunk-MUCEYO3E.cjs.map +0 -1
- package/dist/chunk-P2Q7CMUD.cjs +0 -2
- package/dist/chunk-P2Q7CMUD.cjs.map +0 -1
- package/dist/chunk-PKXAW6MO.cjs +0 -2
- package/dist/chunk-Q3SCM6WL.mjs +0 -2
- package/dist/chunk-Q3SCM6WL.mjs.map +0 -1
- package/dist/chunk-TEBJWAVU.mjs +0 -2
- package/dist/chunk-TEBJWAVU.mjs.map +0 -1
- package/dist/chunk-VP7XUOSI.cjs +0 -2
- package/dist/chunk-VP7XUOSI.cjs.map +0 -1
- package/dist/pythWrapper-CBjsmmsK.d.cts +0 -1958
- package/dist/pythWrapper-CBjsmmsK.d.ts +0 -1958
- package/src/abi/bend/metaMorpho.ts +0 -2584
- package/src/abi/bend/morpho.ts +0 -444
- package/src/abi/bex/aggregatorsRouter.ts +0 -492
- package/src/abi/bex/balancerComposableStablePoolFactoryV6.ts +0 -283
- package/src/abi/bex/balancerPoolCreationHelper.ts +0 -267
- package/src/abi/bex/balancerVault.ts +0 -757
- package/src/abi/governance/governance.ts +0 -1016
- package/src/abi/governance/governanceTimelock.ts +0 -589
- package/src/abi/honey/collateralVault.ts +0 -1144
- package/src/abi/honey/honey.ts +0 -563
- package/src/abi/honey/honeyFactory.ts +0 -1270
- package/src/abi/honey/honeyFactoryReader.ts +0 -894
- package/src/abi/honey/honeyRootOracle.ts +0 -492
- package/src/abi/honey/pythPriceOracle.ts +0 -619
- package/src/abi/honey/pythWrapper.ts +0 -446
- package/src/abi/pol/LSTStakerVault.ts +0 -2032
- package/src/abi/pol/beaconDeposit.ts +0 -595
- package/src/abi/pol/beraChef.ts +0 -1019
- package/src/abi/pol/bgt.ts +0 -1008
- package/src/abi/pol/bgtIncentiveDistributor.ts +0 -640
- package/src/abi/pol/bgtStaker.ts +0 -1034
- package/src/abi/pol/rewardAllocationFactory.ts +0 -408
- package/src/abi/pol/rewardVault.ts +0 -1928
- package/src/abi/pol/rewardVaultFactory.ts +0 -586
- package/src/abi/pol/rewardVaultHelper.ts +0 -882
- package/src/abi/pol/stakeBeraVault.ts +0 -1116
- package/src/abi/pol/stakeBeraVaultWithdrawalRequest.ts +0 -618
- package/src/abi/pol/wbera.ts +0 -366
|
@@ -12,7 +12,8 @@ import { decodeFunctionData, formatEther, zeroAddress } from "viem";
|
|
|
12
12
|
import { getUriFromLink } from "@berachain/config";
|
|
13
13
|
import { ChainId } from "@berachain/config/internal";
|
|
14
14
|
|
|
15
|
-
import { balancerVaultAbi } from "
|
|
15
|
+
import { vaultAbi as balancerVaultAbi } from "@berachain/abis/bex/vault";
|
|
16
|
+
|
|
16
17
|
import { BalancerApi } from "~/actions/dex/b-sdk";
|
|
17
18
|
import { Aggregators } from "~/enum/dex";
|
|
18
19
|
import { assertPublicClient } from "~/errors/assert";
|
|
@@ -2,12 +2,13 @@ import { zeroAddress } from "viem";
|
|
|
2
2
|
|
|
3
3
|
import { ChainId } from "@berachain/config/internal";
|
|
4
4
|
|
|
5
|
-
import { aggregatorsRouterAbi } from "
|
|
5
|
+
import { metaAggregatorAbi as aggregatorsRouterAbi } from "@berachain/abis/meta-aggregator/metaAggregator";
|
|
6
|
+
|
|
6
7
|
import { Aggregators } from "~/enum/dex";
|
|
7
8
|
import type { IAggregatorArgs, IRawAggregatorQuote } from "~/types/dex";
|
|
8
9
|
import { BaseAggregator } from "../base";
|
|
9
10
|
|
|
10
|
-
|
|
11
|
+
class EnsoAggregator extends BaseAggregator {
|
|
11
12
|
name = Aggregators.Enso;
|
|
12
13
|
supportedChains = [ChainId.MAINNET];
|
|
13
14
|
readonly type = "rest";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { berachain } from "viem/chains";
|
|
2
|
-
import { describe, it } from "vitest";
|
|
2
|
+
import { describe, expect, it } from "vitest";
|
|
3
3
|
|
|
4
4
|
import { mainnet } from "@berachain/config/mainnet";
|
|
5
5
|
|
|
@@ -31,7 +31,6 @@ describe("ensoErc4626", () => {
|
|
|
31
31
|
underlyingToken: getHoneyToken({ chainId: re7Honey.chainId }),
|
|
32
32
|
rewardVault: "0xdb6e93cd7bddc45ebc411619792fc5f977316c38",
|
|
33
33
|
});
|
|
34
|
-
|
|
35
|
-
console.log(quote);
|
|
34
|
+
expect(quote).toBeDefined();
|
|
36
35
|
});
|
|
37
36
|
});
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { erc4626Abi, formatUnits } from "viem";
|
|
2
2
|
|
|
3
|
-
import { stakeBeraVaultAbi } from "
|
|
3
|
+
import { wberaStakerVaultAbi as stakeBeraVaultAbi } from "@berachain/abis/pol/wberaStakerVault";
|
|
4
|
+
|
|
4
5
|
import { ContractName } from "~/enum/contracts";
|
|
5
6
|
import { Aggregators } from "~/enum/dex";
|
|
6
7
|
import { assertDefined, assertPublicClient } from "~/errors/assert";
|
|
@@ -2,7 +2,8 @@ import { type Address, type Hex, zeroAddress } from "viem";
|
|
|
2
2
|
|
|
3
3
|
import { ChainId } from "@berachain/config/internal";
|
|
4
4
|
|
|
5
|
-
import { aggregatorsRouterAbi } from "
|
|
5
|
+
import { metaAggregatorAbi as aggregatorsRouterAbi } from "@berachain/abis/meta-aggregator/metaAggregator";
|
|
6
|
+
|
|
6
7
|
import { Aggregators } from "~/enum/dex";
|
|
7
8
|
import type { IAggregatorArgs, IRawAggregatorQuote } from "~/types/dex";
|
|
8
9
|
import { isToken } from "~/utils/tokens";
|
|
@@ -2,7 +2,8 @@ import { formatUnits, parseUnits, zeroAddress } from "viem";
|
|
|
2
2
|
|
|
3
3
|
import { ChainId } from "@berachain/config/internal";
|
|
4
4
|
|
|
5
|
-
import { aggregatorsRouterAbi } from "
|
|
5
|
+
import { metaAggregatorAbi as aggregatorsRouterAbi } from "@berachain/abis/meta-aggregator/metaAggregator";
|
|
6
|
+
|
|
6
7
|
import { Aggregators, SwapReferrer } from "~/enum/dex";
|
|
7
8
|
import { BeraError } from "~/errors/BeraError";
|
|
8
9
|
import type { IAggregatorArgs, IRawAggregatorQuote } from "~/types/dex";
|
|
@@ -2,7 +2,8 @@ import { zeroAddress } from "viem";
|
|
|
2
2
|
|
|
3
3
|
import { ChainId } from "@berachain/config/internal";
|
|
4
4
|
|
|
5
|
-
import { aggregatorsRouterAbi } from "
|
|
5
|
+
import { metaAggregatorAbi as aggregatorsRouterAbi } from "@berachain/abis/meta-aggregator/metaAggregator";
|
|
6
|
+
|
|
6
7
|
import { Aggregators } from "~/enum/dex";
|
|
7
8
|
import type { IAggregatorArgs, IRawAggregatorQuote } from "~/types/dex";
|
|
8
9
|
import { BaseAggregator } from "./base";
|
|
@@ -22,7 +23,6 @@ class KyberSwapAggregator extends BaseAggregator {
|
|
|
22
23
|
tokenOut,
|
|
23
24
|
amount,
|
|
24
25
|
slippage,
|
|
25
|
-
account = zeroAddress,
|
|
26
26
|
aggregatorsFeeBps,
|
|
27
27
|
proxyAggregatorsThroughVercel = false,
|
|
28
28
|
rewardVault,
|
|
@@ -2,7 +2,8 @@ import { zeroAddress } from "viem";
|
|
|
2
2
|
|
|
3
3
|
import { ChainId } from "@berachain/config/internal";
|
|
4
4
|
|
|
5
|
-
import { aggregatorsRouterAbi } from "
|
|
5
|
+
import { metaAggregatorAbi as aggregatorsRouterAbi } from "@berachain/abis/meta-aggregator/metaAggregator";
|
|
6
|
+
|
|
6
7
|
import { Aggregators } from "~/enum/dex";
|
|
7
8
|
import type { IAggregatorArgs, IRawAggregatorQuote } from "~/types/dex";
|
|
8
9
|
import { BaseAggregator } from "./base";
|
|
@@ -2,7 +2,8 @@ import { zeroAddress } from "viem";
|
|
|
2
2
|
|
|
3
3
|
import { ChainId } from "@berachain/config/internal";
|
|
4
4
|
|
|
5
|
-
import { aggregatorsRouterAbi } from "
|
|
5
|
+
import { metaAggregatorAbi as aggregatorsRouterAbi } from "@berachain/abis/meta-aggregator/metaAggregator";
|
|
6
|
+
|
|
6
7
|
import { Aggregators } from "~/enum/dex";
|
|
7
8
|
import { assertPublicClient } from "~/errors/assert";
|
|
8
9
|
import { InvalidArgumentError } from "~/errors/InvalidArgumentError";
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ChainId } from "@berachain/config/internal";
|
|
2
2
|
|
|
3
|
-
import { wberaAbi } from "
|
|
3
|
+
import { wberaAbi } from "@berachain/abis/wbera";
|
|
4
|
+
|
|
4
5
|
import { Aggregators } from "~/enum/dex";
|
|
5
6
|
import type { IAggregatorArgs, IRawAggregatorQuote, Token } from "~/types/dex";
|
|
6
7
|
import type { IContractWrite } from "~/types/global";
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { PublicClient } from "viem";
|
|
2
2
|
|
|
3
|
-
import { balancerVaultAbi } from "
|
|
3
|
+
import { vaultAbi as balancerVaultAbi } from "@berachain/abis/bex/vault";
|
|
4
|
+
|
|
4
5
|
import { parseBaseArgs } from "~/utils/parseBaseArgs";
|
|
5
6
|
|
|
6
7
|
export async function getVaultPausedState({
|
|
@@ -28,7 +28,7 @@ describe("getEnsoUserTokensWithBalances", () => {
|
|
|
28
28
|
beforeEach(() => {
|
|
29
29
|
vi.clearAllMocks();
|
|
30
30
|
|
|
31
|
-
captureSpy = vi.spyOn(BeraMonitoring, "
|
|
31
|
+
captureSpy = vi.spyOn(BeraMonitoring, "captureException");
|
|
32
32
|
fetchSpy = vi.spyOn(global, "fetch");
|
|
33
33
|
});
|
|
34
34
|
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { describe, expect, it } from "vitest";
|
|
2
2
|
|
|
3
|
+
import { beraChefAbi } from "@berachain/abis/pol/rewards/beraChef";
|
|
4
|
+
|
|
3
5
|
import { ProposalErrorCodes } from "~/enum/governance";
|
|
4
6
|
import { parseBaseArgs } from "~/utils/parseBaseArgs";
|
|
5
|
-
import { beraChefAbi } from "../../../abi/pol/beraChef";
|
|
6
7
|
import { checkProposalField } from "../checkProposalField";
|
|
7
8
|
|
|
8
9
|
describe("checkProposalField", () => {
|
|
@@ -3,7 +3,8 @@ import { describe, expect, it } from "vitest";
|
|
|
3
3
|
|
|
4
4
|
import { ChainId, defaultChainId } from "@berachain/config/internal";
|
|
5
5
|
|
|
6
|
-
import { beraChefAbi } from "
|
|
6
|
+
import { beraChefAbi } from "@berachain/abis/pol/rewards/beraChef";
|
|
7
|
+
|
|
7
8
|
import { getServerSidePublicClient } from "~/utils/getServerSideClient";
|
|
8
9
|
import { parseBaseArgs } from "~/utils/parseBaseArgs";
|
|
9
10
|
import { getDecodedFunctionData } from "../getDecodedFunctionData";
|
|
@@ -36,92 +37,79 @@ describe.skipIf(defaultChainId !== ChainId.MAINNET)(
|
|
|
36
37
|
});
|
|
37
38
|
|
|
38
39
|
// requires upgrade once we add more ABIs
|
|
39
|
-
it.concurrent(
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
chainId,
|
|
53
|
-
publicClient,
|
|
54
|
-
});
|
|
40
|
+
it.concurrent("should match remote abi for immutable contract", {
|
|
41
|
+
// Fails frequently on CI probably because of connection issues?
|
|
42
|
+
retry: 3,
|
|
43
|
+
}, async () => {
|
|
44
|
+
// setDefaultFeeBps(10)
|
|
45
|
+
const calldata =
|
|
46
|
+
"0x4488b652000000000000000000000000000000000000000000000000000000000000000a";
|
|
47
|
+
const data = await getDecodedFunctionData({
|
|
48
|
+
address: chainConfig.tokens.wbtc,
|
|
49
|
+
callData: calldata,
|
|
50
|
+
chainId,
|
|
51
|
+
publicClient,
|
|
52
|
+
});
|
|
55
53
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
);
|
|
54
|
+
expect(data.functionSignature).toBe("setDefaultFeeBps(uint16)");
|
|
55
|
+
expect(data.abiItem).toBeDefined();
|
|
56
|
+
expect(data.args).toEqual([10]);
|
|
57
|
+
expect(data.functionName).toBe("setDefaultFeeBps");
|
|
58
|
+
});
|
|
62
59
|
|
|
63
60
|
// requires upgrade once we add more ABIs
|
|
64
|
-
it.concurrent(
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
publicClient,
|
|
76
|
-
});
|
|
61
|
+
it.concurrent("should not match remote abi for wrong immutable contract", async () => {
|
|
62
|
+
// setDefaultFeeBps(10)
|
|
63
|
+
const calldata =
|
|
64
|
+
"0x4488b652000000000000000000000000000000000000000000000000000000000000000a";
|
|
65
|
+
const data = await getDecodedFunctionData({
|
|
66
|
+
// purposely use a wrong contract, method is from wbtc
|
|
67
|
+
address: chainConfig.tokens.wbera,
|
|
68
|
+
callData: calldata,
|
|
69
|
+
chainId,
|
|
70
|
+
publicClient,
|
|
71
|
+
});
|
|
77
72
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
);
|
|
73
|
+
expect(data.args).toEqual([]);
|
|
74
|
+
expect(data.functionSignature).toBeUndefined();
|
|
75
|
+
expect(data.abiItem).toBeUndefined();
|
|
76
|
+
expect(data.functionName).toBeUndefined();
|
|
77
|
+
});
|
|
84
78
|
|
|
85
79
|
// requires upgrade once we add more ABIs
|
|
86
|
-
it.concurrent(
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
publicClient,
|
|
97
|
-
});
|
|
80
|
+
it.concurrent("should match remote abi for upgradeable contract", async () => {
|
|
81
|
+
// mint(wbera, 100e18)
|
|
82
|
+
const calldata =
|
|
83
|
+
"0x40c10f1900000000000000000000000069696969696969696969696969696969696969690000000000000000000000000000000000000000000000056bc75e2d63100000";
|
|
84
|
+
const data = await getDecodedFunctionData({
|
|
85
|
+
address: chainConfig.honey.token,
|
|
86
|
+
callData: calldata,
|
|
87
|
+
chainId,
|
|
88
|
+
publicClient,
|
|
89
|
+
});
|
|
98
90
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
);
|
|
91
|
+
expect(data.functionSignature).toBe("mint(address,uint256)");
|
|
92
|
+
expect(data.abiItem).toBeDefined();
|
|
93
|
+
expect(data.args).toEqual([chainConfig.tokens.wbera, BigInt(100e18)]);
|
|
94
|
+
expect(data.functionName).toBe("mint");
|
|
95
|
+
});
|
|
105
96
|
|
|
106
97
|
// requires upgrade once we add more ABIs
|
|
107
|
-
it.concurrent(
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
publicClient,
|
|
118
|
-
});
|
|
98
|
+
it.concurrent("should not match remote abi for unverified/non-contract", async () => {
|
|
99
|
+
// mint(wbera, 100e18)
|
|
100
|
+
const calldata =
|
|
101
|
+
"0x40c10f1900000000000000000000000069696969696969696969696969696969696969690000000000000000000000000000000000000000000000056bc75e2d63100000";
|
|
102
|
+
const data = await getDecodedFunctionData({
|
|
103
|
+
address: "0x000000000000000000000000000000000000dEaD",
|
|
104
|
+
callData: calldata,
|
|
105
|
+
chainId,
|
|
106
|
+
publicClient,
|
|
107
|
+
});
|
|
119
108
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
);
|
|
109
|
+
expect(data.args).toEqual([]);
|
|
110
|
+
expect(data.functionSignature).toBeUndefined();
|
|
111
|
+
expect(data.abiItem).toBeUndefined();
|
|
112
|
+
expect(data.functionName).toBeUndefined();
|
|
113
|
+
});
|
|
126
114
|
},
|
|
127
115
|
);
|
|
@@ -18,13 +18,12 @@ describe("getQuorum", () => {
|
|
|
18
18
|
},
|
|
19
19
|
} as const;
|
|
20
20
|
|
|
21
|
-
it.each(
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
);
|
|
21
|
+
it.each(
|
|
22
|
+
Object.entries(quorums[defaultChainId as ChainId]),
|
|
23
|
+
)("should match the quorum at %s", async (at, shouldBe) => {
|
|
24
|
+
const quorum = await getQuorum({ publicClient, at });
|
|
25
|
+
expect(quorum).toBe(shouldBe);
|
|
26
|
+
});
|
|
28
27
|
|
|
29
28
|
it("should have a quorum for the current time", async () => {
|
|
30
29
|
const testClient = getTestClient();
|
|
@@ -13,8 +13,8 @@ import {
|
|
|
13
13
|
|
|
14
14
|
import { appConfig, defaultChainId } from "@berachain/config/internal";
|
|
15
15
|
|
|
16
|
-
import { beraChefAbi } from "
|
|
17
|
-
import { rewardVaultAbi } from "
|
|
16
|
+
import { beraChefAbi } from "@berachain/abis/pol/rewards/beraChef";
|
|
17
|
+
import { rewardVaultAbi } from "@berachain/abis/pol/rewards/rewardVault";
|
|
18
18
|
|
|
19
19
|
// Function to check if ABI contains proxy-related functions
|
|
20
20
|
function isProxyABI(abi: Abi[]): boolean {
|
|
@@ -5,13 +5,14 @@ import {
|
|
|
5
5
|
type TransactionReceipt,
|
|
6
6
|
} from "viem";
|
|
7
7
|
|
|
8
|
+
import { berachainGovernanceAbi as governanceAbi } from "@berachain/abis/gov/berachainGovernance";
|
|
9
|
+
|
|
8
10
|
import {
|
|
9
11
|
type ExecutableCallSubsetFragment,
|
|
10
12
|
ProposalStatus,
|
|
11
13
|
type ProposalWithVotesFragment,
|
|
12
14
|
} from "@berachain/graphql/governance";
|
|
13
15
|
|
|
14
|
-
import { governanceAbi } from "~/abi/governance/governance";
|
|
15
16
|
import { assertPublicClient } from "~/errors/assert";
|
|
16
17
|
import { parseProposalBody } from "./parseProposalBody";
|
|
17
18
|
|
|
@@ -7,8 +7,9 @@ import {
|
|
|
7
7
|
toHex,
|
|
8
8
|
} from "viem";
|
|
9
9
|
|
|
10
|
-
import { beraChefAbi } from "
|
|
11
|
-
import { rewardVaultAbi } from "
|
|
10
|
+
import { beraChefAbi } from "@berachain/abis/pol/rewards/beraChef";
|
|
11
|
+
import { rewardVaultAbi } from "@berachain/abis/pol/rewards/rewardVault";
|
|
12
|
+
|
|
12
13
|
import { ProposalErrorCodes, ProposalTypeEnum } from "~/enum/governance";
|
|
13
14
|
import type {
|
|
14
15
|
CustomProposal,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { formatEther, type PublicClient } from "viem";
|
|
2
2
|
|
|
3
|
-
import { governanceAbi } from "
|
|
3
|
+
import { berachainGovernanceAbi as governanceAbi } from "@berachain/abis/gov/berachainGovernance";
|
|
4
|
+
|
|
4
5
|
import { assertPublicClient } from "~/errors/assert";
|
|
5
6
|
import { parseBaseArgs } from "~/utils/parseBaseArgs";
|
|
6
7
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { Address, PublicClient } from "viem";
|
|
2
2
|
|
|
3
|
-
import { honeyFactoryAbi } from "
|
|
3
|
+
import { honeyFactoryAbi } from "@berachain/abis/honey/honeyFactory";
|
|
4
|
+
|
|
4
5
|
import type { Token } from "~/types/dex";
|
|
5
6
|
import { parseBaseArgs } from "~/utils/parseBaseArgs";
|
|
6
7
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { type PublicClient, parseEther } from "viem";
|
|
2
2
|
|
|
3
|
-
import { honeyFactoryAbi } from "
|
|
3
|
+
import { honeyFactoryAbi } from "@berachain/abis/honey/honeyFactory";
|
|
4
|
+
|
|
4
5
|
import type { Token } from "~/types/dex";
|
|
5
6
|
import { CAP_LIMIT_BUFFER } from "~/utils/constants";
|
|
6
7
|
import { parseBaseArgs } from "~/utils/parseBaseArgs";
|
|
@@ -3,7 +3,8 @@ import type { PublicClient } from "viem";
|
|
|
3
3
|
import type { Address } from "@berachain/config";
|
|
4
4
|
import type { EdgeConfigSchema } from "@berachain/config/internal/edge-config";
|
|
5
5
|
|
|
6
|
-
import { honeyFactoryAbi } from "
|
|
6
|
+
import { honeyFactoryAbi } from "@berachain/abis/honey/honeyFactory";
|
|
7
|
+
|
|
7
8
|
import { getTokenInformation } from "~/actions/tokens/getTokenInformation";
|
|
8
9
|
import type { TokenWithOrder } from "~/contexts/HoneyConfigProvider";
|
|
9
10
|
import type { TokenWithMetadata } from "~/types/dex";
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { type Address, formatUnits, type PublicClient } from "viem";
|
|
2
2
|
|
|
3
|
+
import { honeyFactoryAbi } from "@berachain/abis/honey/honeyFactory";
|
|
4
|
+
|
|
3
5
|
import type { Token } from "@berachain/graphql/pol/api";
|
|
4
6
|
|
|
5
|
-
import { honeyFactoryAbi } from "~/abi/honey/honeyFactory";
|
|
6
7
|
import { parseBaseArgs } from "~/utils/parseBaseArgs";
|
|
7
8
|
|
|
8
9
|
export interface CollateralRates {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { type Address, type PublicClient, parseUnits } from "viem";
|
|
2
2
|
|
|
3
|
-
import { honeyFactoryReaderAbi } from "
|
|
3
|
+
import { honeyFactoryReaderAbi } from "@berachain/abis/honey/honeyFactoryReader";
|
|
4
|
+
|
|
4
5
|
import type { TokenWithOrder } from "~/contexts/HoneyConfigProvider";
|
|
5
6
|
import type { Token } from "~/types/dex";
|
|
6
7
|
import { parseBaseArgs } from "~/utils/parseBaseArgs";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Address, PublicClient } from "viem";
|
|
2
2
|
|
|
3
|
-
import { honeyRootOracleAbi } from "
|
|
3
|
+
import { rootPriceOracleAbi as honeyRootOracleAbi } from "@berachain/abis/extras/rootPriceOracle";
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Gets the address of the Honey Pyth Oracle, which is called by the Honey Root Price Oracle to get the price of the collaterals
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { type Address, formatUnits, type PublicClient } from "viem";
|
|
2
2
|
|
|
3
|
-
import { collateralVaultAbi } from "
|
|
4
|
-
import { honeyFactoryAbi } from "
|
|
3
|
+
import { collateralVaultAbi } from "@berachain/abis/honey/collateralVault";
|
|
4
|
+
import { honeyFactoryAbi } from "@berachain/abis/honey/honeyFactory";
|
|
5
|
+
|
|
5
6
|
import type { BalanceToken, Token } from "~/types/dex";
|
|
6
7
|
import { parseBaseArgs } from "~/utils/parseBaseArgs";
|
|
7
8
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { type Address, type PublicClient, parseEther } from "viem";
|
|
2
2
|
|
|
3
|
-
import { honeyFactoryAbi } from "
|
|
3
|
+
import { honeyFactoryAbi } from "@berachain/abis/honey/honeyFactory";
|
|
4
|
+
|
|
4
5
|
import type { TokenWithOrder } from "~/contexts/HoneyConfigProvider";
|
|
5
6
|
import { CAP_LIMIT_BUFFER } from "~/utils/constants";
|
|
6
7
|
import { parseBaseArgs } from "~/utils/parseBaseArgs";
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { type Address, type PublicClient, parseEther } from "viem";
|
|
2
2
|
|
|
3
|
-
import { collateralVaultAbi } from "
|
|
4
|
-
import { honeyFactoryAbi } from "
|
|
3
|
+
import { collateralVaultAbi } from "@berachain/abis/honey/collateralVault";
|
|
4
|
+
import { honeyFactoryAbi } from "@berachain/abis/honey/honeyFactory";
|
|
5
|
+
|
|
5
6
|
import { parseBaseArgs } from "~/utils/parseBaseArgs";
|
|
6
7
|
|
|
7
8
|
/**
|
|
@@ -6,8 +6,9 @@ import {
|
|
|
6
6
|
parseUnits,
|
|
7
7
|
} from "viem";
|
|
8
8
|
|
|
9
|
-
import { honeyFactoryAbi } from "
|
|
10
|
-
import { pythWrapperAbi } from "
|
|
9
|
+
import { honeyFactoryAbi } from "@berachain/abis/honey/honeyFactory";
|
|
10
|
+
import { honeyFactoryPythWrapperAbi as pythWrapperAbi } from "@berachain/abis/honey/honeyFactoryPythWrapper";
|
|
11
|
+
|
|
11
12
|
import type { IHoneySwapState } from "~/hooks/honey/useHoneySwapState";
|
|
12
13
|
import type { TokenWithMetadata } from "~/types/dex";
|
|
13
14
|
import type { PythPriceFeedMap } from "~/types/honeySwap";
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { type PublicClient, parseUnits } from "viem";
|
|
2
2
|
|
|
3
|
-
import { honeyFactoryAbi } from "
|
|
4
|
-
import { honeyFactoryReaderAbi } from "
|
|
3
|
+
import { honeyFactoryAbi } from "@berachain/abis/honey/honeyFactory";
|
|
4
|
+
import { honeyFactoryReaderAbi } from "@berachain/abis/honey/honeyFactoryReader";
|
|
5
|
+
|
|
5
6
|
import type { Token } from "~/types/dex";
|
|
6
7
|
import { parseBaseArgs } from "~/utils/parseBaseArgs";
|
|
7
8
|
import type { PythLatestUpdates } from "./getPythLatestPrices";
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { type PublicClient, parseUnits } from "viem";
|
|
2
2
|
|
|
3
|
-
import { honeyFactoryAbi } from "
|
|
4
|
-
import { honeyFactoryReaderAbi } from "
|
|
3
|
+
import { honeyFactoryAbi } from "@berachain/abis/honey/honeyFactory";
|
|
4
|
+
import { honeyFactoryReaderAbi } from "@berachain/abis/honey/honeyFactoryReader";
|
|
5
|
+
|
|
5
6
|
import type { Token } from "~/types/dex";
|
|
6
7
|
import { parseBaseArgs } from "~/utils/parseBaseArgs";
|
|
7
8
|
import type { PythLatestUpdates } from "./getPythLatestPrices";
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { formatEther, type PublicClient } from "viem";
|
|
2
2
|
|
|
3
|
-
import { bgtAbi } from "
|
|
3
|
+
import { bgtAbi } from "@berachain/abis/pol/bgt";
|
|
4
|
+
|
|
4
5
|
import { assertPublicClient } from "~/errors/assert";
|
|
5
6
|
import { parseBaseArgs } from "~/utils/parseBaseArgs";
|
|
6
7
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { Address, PublicClient } from "viem";
|
|
2
2
|
|
|
3
|
-
import { lstStakerVaultAbi } from "
|
|
3
|
+
import { lstStakerVaultAbi } from "@berachain/abis/pol/lst/lstStakerVault";
|
|
4
|
+
|
|
4
5
|
import { assertPublicClient } from "~/errors/assert";
|
|
5
6
|
import type { TokenWithMetadata } from "~/types/dex";
|
|
6
7
|
import type { StakingConfig } from "~/types/staking";
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { type Address, formatUnits, type PublicClient, parseUnits } from "viem";
|
|
2
2
|
|
|
3
|
-
import { stakeBeraVaultAbi } from "
|
|
3
|
+
import { wberaStakerVaultAbi as stakeBeraVaultAbi } from "@berachain/abis/pol/wberaStakerVault";
|
|
4
|
+
|
|
4
5
|
import { assertPublicClient } from "~/errors/assert";
|
|
5
6
|
|
|
6
7
|
/**
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { Address, PublicClient } from "viem";
|
|
2
2
|
|
|
3
|
-
import { rewardVaultFactoryAbi } from "
|
|
3
|
+
import { rewardVaultFactoryAbi } from "@berachain/abis/pol/rewards/rewardVaultFactory";
|
|
4
|
+
|
|
4
5
|
import { upgradableBeaconAbi } from "~/abi/utils/upgradableBeacon";
|
|
5
6
|
import { assertAddress, assertDefined } from "~/errors/assert";
|
|
6
7
|
import { parseBaseArgs } from "~/utils/parseBaseArgs";
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { PublicClient } from "viem";
|
|
2
2
|
|
|
3
|
-
import { rewardVaultAbi } from "
|
|
3
|
+
import { rewardVaultAbi } from "@berachain/abis/pol/rewards/rewardVault";
|
|
4
|
+
|
|
4
5
|
import { assertPublicClient } from "~/errors/assert";
|
|
5
6
|
import { getRewardVaultBeaconImplementation } from "./getRewardVaultBeaconImplementation";
|
|
6
7
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { type Address, type PublicClient, zeroAddress } from "viem";
|
|
2
2
|
|
|
3
|
-
import { rewardVaultFactoryAbi } from "
|
|
3
|
+
import { rewardVaultFactoryAbi } from "@berachain/abis/pol/rewards/rewardVaultFactory";
|
|
4
|
+
|
|
4
5
|
import { parseBaseArgs } from "~/utils/parseBaseArgs";
|
|
5
6
|
|
|
6
7
|
export async function getRewardVaultFromToken({
|