diff --git a/core/contracts/AcreBitcoinDepositor.sol b/core/contracts/BitcoinDepositor.sol similarity index 98% rename from core/contracts/AcreBitcoinDepositor.sol rename to core/contracts/BitcoinDepositor.sol index 0c1ade254..c0de3cd37 100644 --- a/core/contracts/AcreBitcoinDepositor.sol +++ b/core/contracts/BitcoinDepositor.sol @@ -11,7 +11,7 @@ import "@keep-network/tbtc-v2/contracts/integrator/AbstractTBTCDepositor.sol"; import {stBTC} from "./stBTC.sol"; -/// @title Acre Bitcoin Depositor contract. +/// @title Bitcoin Depositor contract. /// @notice The contract integrates Acre staking with tBTC minting. /// User who wants to stake BTC in Acre should submit a Bitcoin transaction /// to the most recently created off-chain ECDSA wallets of the tBTC Bridge @@ -35,10 +35,7 @@ import {stBTC} from "./stBTC.sol"; /// Depositor address. After tBTC is minted to the Depositor, on the stake /// finalization tBTC is staked in Acre and stBTC shares are emitted /// to the staker. -contract AcreBitcoinDepositor is - AbstractTBTCDepositor, - Ownable2StepUpgradeable -{ +contract BitcoinDepositor is AbstractTBTCDepositor, Ownable2StepUpgradeable { using SafeERC20 for IERC20; /// @notice State of the stake request. @@ -146,7 +143,7 @@ contract AcreBitcoinDepositor is _disableInitializers(); } - /// @notice Acre Bitcoin Depositor contract initializer. + /// @notice Bitcoin Depositor contract initializer. /// @param bridge tBTC Bridge contract instance. /// @param tbtcVault tBTC Vault contract instance. /// @param _tbtcToken tBTC token contract instance. diff --git a/core/contracts/test/AcreBitcoinDepositorHarness.sol b/core/contracts/test/BitcoinDepositorHarness.sol similarity index 96% rename from core/contracts/test/AcreBitcoinDepositorHarness.sol rename to core/contracts/test/BitcoinDepositorHarness.sol index 47f61d9d3..41e8791fc 100644 --- a/core/contracts/test/AcreBitcoinDepositorHarness.sol +++ b/core/contracts/test/BitcoinDepositorHarness.sol @@ -2,7 +2,7 @@ /* solhint-disable func-name-mixedcase */ pragma solidity ^0.8.21; -import {AcreBitcoinDepositor} from "../AcreBitcoinDepositor.sol"; +import {BitcoinDepositor} from "../BitcoinDepositor.sol"; import {MockBridge, MockTBTCVault} from "@keep-network/tbtc-v2/contracts/test/TestTBTCDepositor.sol"; import {IBridge} from "@keep-network/tbtc-v2/contracts/integrator/IBridge.sol"; import {IBridgeTypes} from "@keep-network/tbtc-v2/contracts/integrator/IBridge.sol"; diff --git a/core/contracts/test/upgrades/AcreBitcoinDepositorV2.sol b/core/contracts/test/upgrades/BitcoinDepositorV2.sol similarity index 97% rename from core/contracts/test/upgrades/AcreBitcoinDepositorV2.sol rename to core/contracts/test/upgrades/BitcoinDepositorV2.sol index ad82e9f5b..106629430 100644 --- a/core/contracts/test/upgrades/AcreBitcoinDepositorV2.sol +++ b/core/contracts/test/upgrades/BitcoinDepositorV2.sol @@ -11,14 +11,11 @@ import "@keep-network/tbtc-v2/contracts/integrator/AbstractTBTCDepositor.sol"; import {stBTC} from "../../stBTC.sol"; -/// @title AcreBitcoinDepositorV2 -/// @dev This is a contract used to test Acre Bitcoin Depositor upgradeability. -/// It is a copy of AcreBitcoinDepositor contract with some differences +/// @title BitcoinDepositorV2 +/// @dev This is a contract used to test Bitcoin Depositor upgradeability. +/// It is a copy of BitcoinDepositor contract with some differences /// marked with `TEST:` comments. -contract AcreBitcoinDepositorV2 is - AbstractTBTCDepositor, - Ownable2StepUpgradeable -{ +contract BitcoinDepositorV2 is AbstractTBTCDepositor, Ownable2StepUpgradeable { using SafeERC20 for IERC20; /// @notice State of the stake request. diff --git a/core/deploy/03_deploy_acre_bitcoin_depositor.ts b/core/deploy/03_deploy_bitcoin_depositor.ts similarity index 71% rename from core/deploy/03_deploy_acre_bitcoin_depositor.ts rename to core/deploy/03_deploy_bitcoin_depositor.ts index f2063d5c1..7de26abcb 100644 --- a/core/deploy/03_deploy_acre_bitcoin_depositor.ts +++ b/core/deploy/03_deploy_bitcoin_depositor.ts @@ -12,8 +12,8 @@ const func: DeployFunction = async (hre: HardhatRuntimeEnvironment) => { const tbtc = await deployments.get("TBTC") const stbtc = await deployments.get("stBTC") - const [, acreBitcoinDepositorDeployment] = await helpers.upgrades.deployProxy( - "AcreBitcoinDepositor", + const [, deployment] = await helpers.upgrades.deployProxy( + "BitcoinDepositor", { factoryOpts: { signer: deployer, @@ -31,15 +31,9 @@ const func: DeployFunction = async (hre: HardhatRuntimeEnvironment) => { }, ) - if ( - acreBitcoinDepositorDeployment.transactionHash && - hre.network.tags.etherscan - ) { - await waitForTransaction( - hre, - acreBitcoinDepositorDeployment.transactionHash, - ) - await helpers.etherscan.verify(acreBitcoinDepositorDeployment) + if (deployment.transactionHash && hre.network.tags.etherscan) { + await waitForTransaction(hre, deployment.transactionHash) + await helpers.etherscan.verify(deployment) } // TODO: Add Tenderly verification @@ -47,5 +41,5 @@ const func: DeployFunction = async (hre: HardhatRuntimeEnvironment) => { export default func -func.tags = ["AcreBitcoinDepositor"] +func.tags = ["BitcoinDepositor"] func.dependencies = ["TBTC", "stBTC"] diff --git a/core/deploy/23_transfer_ownership_acre_bitcoin_depositor.ts b/core/deploy/23_transfer_ownership_bitcoin_depositor.ts similarity index 73% rename from core/deploy/23_transfer_ownership_acre_bitcoin_depositor.ts rename to core/deploy/23_transfer_ownership_bitcoin_depositor.ts index 30095cd05..b1214346d 100644 --- a/core/deploy/23_transfer_ownership_acre_bitcoin_depositor.ts +++ b/core/deploy/23_transfer_ownership_bitcoin_depositor.ts @@ -6,12 +6,10 @@ const func: DeployFunction = async (hre: HardhatRuntimeEnvironment) => { const { deployer, governance } = await getNamedAccounts() const { log } = deployments - log( - `transferring ownership of AcreBitcoinDepositor contract to ${governance}`, - ) + log(`transferring ownership of BitcoinDepositor contract to ${governance}`) await deployments.execute( - "AcreBitcoinDepositor", + "BitcoinDepositor", { from: deployer, log: true, waitConfirmations: 1 }, "transferOwnership", governance, @@ -19,7 +17,7 @@ const func: DeployFunction = async (hre: HardhatRuntimeEnvironment) => { if (hre.network.name !== "mainnet") { await deployments.execute( - "AcreBitcoinDepositor", + "BitcoinDepositor", { from: governance, log: true, waitConfirmations: 1 }, "acceptOwnership", ) @@ -28,6 +26,6 @@ const func: DeployFunction = async (hre: HardhatRuntimeEnvironment) => { export default func -func.tags = ["TransferOwnershipAcreBitcoinDepositor"] -func.dependencies = ["AcreBitcoinDepositor"] +func.tags = ["TransferOwnershipBitcoinDepositor"] +func.dependencies = ["BitcoinDepositor"] func.runAtTheEnd = true diff --git a/core/deployments/sepolia/AcreBitcoinDepositor.json b/core/deployments/sepolia/BitcoinDepositor.json similarity index 100% rename from core/deployments/sepolia/AcreBitcoinDepositor.json rename to core/deployments/sepolia/BitcoinDepositor.json diff --git a/core/test/AcreBitcoinDepositor.test.ts b/core/test/BitcoinDepositor.test.ts similarity index 99% rename from core/test/AcreBitcoinDepositor.test.ts rename to core/test/BitcoinDepositor.test.ts index a106d3a92..2c0fd02f7 100644 --- a/core/test/AcreBitcoinDepositor.test.ts +++ b/core/test/BitcoinDepositor.test.ts @@ -12,7 +12,7 @@ import type { StBTC, BridgeStub, TBTCVaultStub, - AcreBitcoinDepositor, + BitcoinDepositor, TestERC20, } from "../typechain" import { deployment } from "./helpers" @@ -30,7 +30,7 @@ async function fixture() { const { lastBlockTime } = helpers.time const { getNamedSigners, getUnnamedSigners } = helpers.signers -describe("AcreBitcoinDepositor", () => { +describe("BitcoinDepositor", () => { const defaultDepositDustThreshold = 1000000 // 1000000 satoshi = 0.01 BTC const defaultDepositTreasuryFeeDivisor = 2000 // 1/2000 = 0.05% = 0.0005 const defaultDepositTxMaxFee = 1000 // 1000 satoshi = 0.00001 BTC @@ -48,7 +48,7 @@ describe("AcreBitcoinDepositor", () => { const depositorFee = to1ePrecision(10, 10) // 10 satoshi const amountToStake = to1ePrecision(896501, 8) // 8965,01 satoshi - let bitcoinDepositor: AcreBitcoinDepositor + let bitcoinDepositor: BitcoinDepositor let tbtcBridge: BridgeStub let tbtcVault: TBTCVaultStub let stbtc: StBTC diff --git a/core/test/AcreBitcoinDepositor.upgrade.test.ts b/core/test/BitcoinDepositor.upgrade.test.ts similarity index 90% rename from core/test/AcreBitcoinDepositor.upgrade.test.ts rename to core/test/BitcoinDepositor.upgrade.test.ts index c447c74ce..46ea0155c 100644 --- a/core/test/AcreBitcoinDepositor.upgrade.test.ts +++ b/core/test/BitcoinDepositor.upgrade.test.ts @@ -8,10 +8,10 @@ import { beforeAfterSnapshotWrapper, deployment } from "./helpers" import { TestERC20, StBTC, - AcreBitcoinDepositor, + BitcoinDepositor, BridgeStub, TBTCVaultStub, - AcreBitcoinDepositorV2, + BitcoinDepositorV2, } from "../typechain" import { to1e18 } from "./utils" @@ -24,12 +24,12 @@ async function fixture() { return { tbtc, stbtc, bitcoinDepositor, tbtcBridge, tbtcVault } } -describe("AcreBitcoinDepositor contract upgrade", () => { +describe("BitcoinDepositor contract upgrade", () => { let tbtc: TestERC20 let tbtcBridge: BridgeStub let tbtcVault: TBTCVaultStub let stbtc: StBTC - let bitcoinDepositor: AcreBitcoinDepositor + let bitcoinDepositor: BitcoinDepositor let governance: HardhatEthersSigner before(async () => { @@ -40,7 +40,7 @@ describe("AcreBitcoinDepositor contract upgrade", () => { context("when upgrading to a valid contract", () => { const newVariable = 1n - let bitcoinDepositorV2: AcreBitcoinDepositorV2 + let bitcoinDepositorV2: BitcoinDepositorV2 let v1InitialParameters: { minStakeAmount: bigint depositorFeeDivisor: bigint @@ -59,8 +59,8 @@ describe("AcreBitcoinDepositor contract upgrade", () => { } const [upgradedDepositor] = await helpers.upgrades.upgradeProxy( - "AcreBitcoinDepositor", - "AcreBitcoinDepositorV2", + "BitcoinDepositor", + "BitcoinDepositorV2", { factoryOpts: { signer: governance }, proxyOpts: { @@ -72,8 +72,7 @@ describe("AcreBitcoinDepositor contract upgrade", () => { }, ) - bitcoinDepositorV2 = - upgradedDepositor as unknown as AcreBitcoinDepositorV2 + bitcoinDepositorV2 = upgradedDepositor as unknown as BitcoinDepositorV2 }) it("new instance should have the same address as the old one", async () => { diff --git a/core/test/helpers/context.ts b/core/test/helpers/context.ts index 0b32138e9..5d6f518ea 100644 --- a/core/test/helpers/context.ts +++ b/core/test/helpers/context.ts @@ -7,7 +7,7 @@ import type { BridgeStub, TestERC4626, TBTCVaultStub, - AcreBitcoinDepositor, + BitcoinDepositor, BitcoinRedeemer, TestTBTC, } from "../../typechain" @@ -17,9 +17,8 @@ export async function deployment() { await deployments.fixture() const stbtc: stBTC = await getDeployedContract("stBTC") - const bitcoinDepositor: AcreBitcoinDepositor = await getDeployedContract( - "AcreBitcoinDepositor", - ) + const bitcoinDepositor: BitcoinDepositor = + await getDeployedContract("BitcoinDepositor") const bitcoinRedeemer: BitcoinRedeemer = await getDeployedContract("BitcoinRedeemer") diff --git a/dapp/src/components/LiquidStakingTokenPopover.tsx b/dapp/src/components/LiquidStakingTokenPopover.tsx index b59b5b720..229a37ffa 100644 --- a/dapp/src/components/LiquidStakingTokenPopover.tsx +++ b/dapp/src/components/LiquidStakingTokenPopover.tsx @@ -10,7 +10,7 @@ import { IconButton, } from "@chakra-ui/react" import { SizeType } from "#/types" -import { useDocsDrawer, useWalletContext } from "#/hooks" +import { useDocsDrawer, useSharesBalance, useWalletContext } from "#/hooks" import { TextMd, TextSm } from "./shared/Typography" import Alert from "./shared/Alert" import { CurrencyBalance } from "./shared/CurrencyBalance" @@ -23,6 +23,7 @@ export function LiquidStakingTokenPopover({ }: LiquidStakingTokenPopoverProps) { const { isConnected } = useWalletContext() const { onOpen: openDocsDrawer } = useDocsDrawer() + const sharesBalance = useSharesBalance() return ( @@ -50,7 +51,7 @@ export function LiquidStakingTokenPopover({ Liquid staking token diff --git a/dapp/src/hooks/index.ts b/dapp/src/hooks/index.ts index f010fa303..55d00f180 100644 --- a/dapp/src/hooks/index.ts +++ b/dapp/src/hooks/index.ts @@ -17,4 +17,5 @@ export * from "./useInitApp" export * from "./useCurrencyConversion" export * from "./useDepositTelemetry" export * from "./useFetchBTCPriceUSD" +export * from "./useFetchBTCBalance" export * from "./useSize" diff --git a/dapp/src/hooks/store/index.ts b/dapp/src/hooks/store/index.ts index 20f33eb3c..ac22e8a41 100644 --- a/dapp/src/hooks/store/index.ts +++ b/dapp/src/hooks/store/index.ts @@ -1,2 +1,4 @@ export * from "./useAppDispatch" export * from "./useAppSelector" +export * from "./useEstimatedBTCBalance" +export * from "./useSharesBalance" diff --git a/dapp/src/hooks/store/useEstimatedBTCBalance.ts b/dapp/src/hooks/store/useEstimatedBTCBalance.ts new file mode 100644 index 000000000..b8ce0bb67 --- /dev/null +++ b/dapp/src/hooks/store/useEstimatedBTCBalance.ts @@ -0,0 +1,6 @@ +import { selectEstimatedBtcBalance } from "#/store/btc" +import { useAppSelector } from "./useAppSelector" + +export function useEstimatedBTCBalance() { + return useAppSelector(selectEstimatedBtcBalance) +} diff --git a/dapp/src/hooks/store/useSharesBalance.ts b/dapp/src/hooks/store/useSharesBalance.ts new file mode 100644 index 000000000..067e32e93 --- /dev/null +++ b/dapp/src/hooks/store/useSharesBalance.ts @@ -0,0 +1,6 @@ +import { selectSharesBalance } from "#/store/btc" +import { useAppSelector } from "./useAppSelector" + +export function useSharesBalance() { + return useAppSelector(selectSharesBalance) +} diff --git a/dapp/src/hooks/useFetchBTCBalance.ts b/dapp/src/hooks/useFetchBTCBalance.ts new file mode 100644 index 000000000..360135312 --- /dev/null +++ b/dapp/src/hooks/useFetchBTCBalance.ts @@ -0,0 +1,28 @@ +import { useEffect } from "react" +import { EthereumAddress } from "@acre-btc/sdk" +import { useAcreContext } from "#/acre-react/hooks" +import { logPromiseFailure } from "#/utils" +import { setEstimatedBtcBalance, setSharesBalance } from "#/store/btc" +import { useWalletContext } from "./useWalletContext" +import { useAppDispatch } from "./store" + +export function useFetchBTCBalance() { + const { acre, isInitialized } = useAcreContext() + const { ethAccount } = useWalletContext() + const dispatch = useAppDispatch() + + useEffect(() => { + const getBtcBalance = async () => { + if (!isInitialized || !ethAccount || !acre) return + + const chainIdentifier = EthereumAddress.from(ethAccount.address) + const sharesBalance = await acre.staking.sharesBalance(chainIdentifier) + const estimatedBitcoinBalance = + await acre.staking.estimatedBitcoinBalance(chainIdentifier) + + dispatch(setSharesBalance(sharesBalance)) + dispatch(setEstimatedBtcBalance(estimatedBitcoinBalance)) + } + logPromiseFailure(getBtcBalance()) + }, [acre, isInitialized, ethAccount, dispatch]) +} diff --git a/dapp/src/hooks/useInitApp.ts b/dapp/src/hooks/useInitApp.ts index bfa07283e..906bcd608 100644 --- a/dapp/src/hooks/useInitApp.ts +++ b/dapp/src/hooks/useInitApp.ts @@ -1,6 +1,7 @@ import { useSentry } from "./sentry" import { useInitializeAcreSdk } from "./useInitializeAcreSdk" import { useFetchBTCPriceUSD } from "./useFetchBTCPriceUSD" +import { useFetchBTCBalance } from "./useFetchBTCBalance" export function useInitApp() { // TODO: Let's uncomment when dark mode is ready @@ -8,4 +9,5 @@ export function useInitApp() { useSentry() useInitializeAcreSdk() useFetchBTCPriceUSD() + useFetchBTCBalance() } diff --git a/dapp/src/pages/OverviewPage/PositionDetails.tsx b/dapp/src/pages/OverviewPage/PositionDetails.tsx index d3441362f..db6eb4387 100644 --- a/dapp/src/pages/OverviewPage/PositionDetails.tsx +++ b/dapp/src/pages/OverviewPage/PositionDetails.tsx @@ -11,10 +11,12 @@ import { CurrencyBalanceWithConversion } from "#/components/shared/CurrencyBalan import { TextMd } from "#/components/shared/Typography" import { ACTION_FLOW_TYPES, ActionFlowType } from "#/types" import TransactionModal from "#/components/TransactionModal" +import { useEstimatedBTCBalance } from "#/hooks/store" import { LiquidStakingTokenPopover } from "#/components/LiquidStakingTokenPopover" import { useSize } from "#/hooks" export default function PositionDetails(props: CardProps) { + const estimatedBtcBalance = useEstimatedBTCBalance() const { ref, size } = useSize() const [actionFlowType, setActionFlowType] = useState< @@ -35,7 +37,7 @@ export default function PositionDetails(props: CardProps) { state.btc.usdPrice +export const selectEstimatedBtcBalance = (state: RootState): bigint => + state.btc.estimatedBtcBalance +export const selectSharesBalance = (state: RootState): bigint => + state.btc.sharesBalance +export const selectBtcUsdPrice = (state: RootState): number => + state.btc.usdPrice diff --git a/dapp/src/store/btc/btcSlice.ts b/dapp/src/store/btc/btcSlice.ts index 84468710d..a3e7ce9fc 100644 --- a/dapp/src/store/btc/btcSlice.ts +++ b/dapp/src/store/btc/btcSlice.ts @@ -2,11 +2,15 @@ import { PayloadAction, createSlice } from "@reduxjs/toolkit" import { fetchBTCPriceUSD } from "./btcThunk" type BtcState = { + estimatedBtcBalance: bigint + sharesBalance: bigint isLoadingPriceUSD: boolean usdPrice: number } const initialState: BtcState = { + estimatedBtcBalance: 0n, + sharesBalance: 0n, isLoadingPriceUSD: false, usdPrice: 0, } @@ -15,7 +19,14 @@ const initialState: BtcState = { export const btcSlice = createSlice({ name: "btc", initialState, - reducers: {}, + reducers: { + setSharesBalance(state, action: PayloadAction) { + state.sharesBalance = action.payload + }, + setEstimatedBtcBalance(state, action: PayloadAction) { + state.estimatedBtcBalance = action.payload + }, + }, extraReducers: (builder) => { builder.addCase(fetchBTCPriceUSD.pending, (state) => { state.isLoadingPriceUSD = true @@ -32,3 +43,5 @@ export const btcSlice = createSlice({ ) }, }) + +export const { setSharesBalance, setEstimatedBtcBalance } = btcSlice.actions diff --git a/dapp/src/store/devTools.ts b/dapp/src/store/devTools.ts new file mode 100644 index 000000000..1edd8dee7 --- /dev/null +++ b/dapp/src/store/devTools.ts @@ -0,0 +1,23 @@ +import { DevToolsEnhancerOptions } from "@reduxjs/toolkit" +import { encodeJSON } from "#/utils" + +function devToolsSanitizer(input: unknown): unknown { + switch (typeof input) { + // We can make use of encodeJSON instead of recursively looping through + // the input + case "bigint": + case "object": + // We only need to sanitize bigints and objects + // that may or may not contain them. + return JSON.parse(encodeJSON(input)) + default: + return input + } +} + +export const devTools = !import.meta.env.PROD + ? ({ + actionSanitizer: devToolsSanitizer, + stateSanitizer: devToolsSanitizer, + } as DevToolsEnhancerOptions) + : false diff --git a/dapp/src/store/index.ts b/dapp/src/store/index.ts index fc68092ae..3353ac94a 100644 --- a/dapp/src/store/index.ts +++ b/dapp/src/store/index.ts @@ -1,11 +1,12 @@ import { configureStore } from "@reduxjs/toolkit" import { middleware } from "./middleware" import { reducer } from "./reducer" +import { devTools } from "./devTools" export const store = configureStore({ reducer, middleware: (getDefaultMiddleware) => getDefaultMiddleware(middleware), - devTools: !import.meta.env.PROD, + devTools, }) export type RootState = ReturnType diff --git a/dapp/src/store/middleware.ts b/dapp/src/store/middleware.ts index 451fd90f1..80413c5ce 100644 --- a/dapp/src/store/middleware.ts +++ b/dapp/src/store/middleware.ts @@ -1 +1,8 @@ -export const middleware = {} +import { isPlain } from "@reduxjs/toolkit" + +export const middleware = { + serializableCheck: { + isSerializable: (value: unknown) => + isPlain(value) || typeof value === "bigint", + }, +} diff --git a/dapp/src/utils/index.ts b/dapp/src/utils/index.ts index cb7034c47..36f75497e 100644 --- a/dapp/src/utils/index.ts +++ b/dapp/src/utils/index.ts @@ -8,3 +8,4 @@ export * from "./time" export * from "./promise" export * from "./exchangeApi" export * from "./verifyDepositAddress" +export * from "./json" diff --git a/dapp/src/utils/json.ts b/dapp/src/utils/json.ts new file mode 100644 index 000000000..4214e25db --- /dev/null +++ b/dapp/src/utils/json.ts @@ -0,0 +1,13 @@ +/** + * Encode an unknown input as JSON, special-casing bigints and undefined. + * + * @param input an object, array, or primitive to encode as JSON + */ +export function encodeJSON(input: unknown) { + return JSON.stringify(input, (_, value: unknown) => { + if (typeof value === "bigint") { + return { B_I_G_I_N_T: value.toString() } + } + return value + }) +} diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 771014a36..ac58ef900 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -167,7 +167,7 @@ importers: version: 8.11.7(react-dom@18.2.0)(react@18.2.0) axios: specifier: ^1.6.7 - version: 1.6.7(debug@4.3.4) + version: 1.6.7 ethers: specifier: ^6.10.0 version: 6.10.0 @@ -474,7 +474,7 @@ packages: '@babel/traverse': 7.23.4 '@babel/types': 7.23.4 convert-source-map: 2.0.0 - debug: 4.3.4(supports-color@8.1.1) + debug: 4.3.4 gensync: 1.0.0-beta.2 json5: 2.2.3 semver: 6.3.1 @@ -1773,7 +1773,7 @@ packages: '@babel/helper-split-export-declaration': 7.22.6 '@babel/parser': 7.23.4 '@babel/types': 7.23.4 - debug: 4.3.4(supports-color@8.1.1) + debug: 4.3.4 globals: 11.12.0 transitivePeerDependencies: - supports-color @@ -3497,7 +3497,7 @@ packages: engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} dependencies: ajv: 6.12.6 - debug: 4.3.4(supports-color@8.1.1) + debug: 4.3.4 espree: 9.6.1 globals: 13.23.0 ignore: 5.3.0 @@ -4152,7 +4152,7 @@ packages: engines: {node: '>=10.10.0'} dependencies: '@humanwhocodes/object-schema': 2.0.1 - debug: 4.3.4(supports-color@8.1.1) + debug: 4.3.4 minimatch: 3.1.2 transitivePeerDependencies: - supports-color @@ -7329,7 +7329,7 @@ packages: '@typescript-eslint/type-utils': 6.12.0(eslint@8.54.0)(typescript@5.3.2) '@typescript-eslint/utils': 6.12.0(eslint@8.54.0)(typescript@5.3.2) '@typescript-eslint/visitor-keys': 6.12.0 - debug: 4.3.4(supports-color@8.1.1) + debug: 4.3.4 eslint: 8.54.0 graphemer: 1.4.0 ignore: 5.3.0 @@ -7374,7 +7374,7 @@ packages: '@typescript-eslint/types': 6.12.0 '@typescript-eslint/typescript-estree': 6.12.0(typescript@5.3.2) '@typescript-eslint/visitor-keys': 6.12.0 - debug: 4.3.4(supports-color@8.1.1) + debug: 4.3.4 eslint: 8.54.0 typescript: 5.3.2 transitivePeerDependencies: @@ -7425,7 +7425,7 @@ packages: dependencies: '@typescript-eslint/typescript-estree': 6.12.0(typescript@5.3.2) '@typescript-eslint/utils': 6.12.0(eslint@8.54.0)(typescript@5.3.2) - debug: 4.3.4(supports-color@8.1.1) + debug: 4.3.4 eslint: 8.54.0 ts-api-utils: 1.0.3(typescript@5.3.2) typescript: 5.3.2 @@ -7472,7 +7472,7 @@ packages: dependencies: '@typescript-eslint/types': 6.12.0 '@typescript-eslint/visitor-keys': 6.12.0 - debug: 4.3.4(supports-color@8.1.1) + debug: 4.3.4 globby: 11.1.0 is-glob: 4.0.3 semver: 7.5.4 @@ -8294,6 +8294,16 @@ packages: transitivePeerDependencies: - debug + /axios@1.6.7: + resolution: {integrity: sha512-/hDJGff6/c7u0hDkvkGxR/oy6CbCs8ziCsC7SqmhjfozqiJGc8Z11wrv9z9lYfY4K8l+H9TpjcMDX0xOZmx+RA==} + dependencies: + follow-redirects: 1.15.5 + form-data: 4.0.0 + proxy-from-env: 1.1.0 + transitivePeerDependencies: + - debug + dev: false + /axios@1.6.7(debug@4.3.4): resolution: {integrity: sha512-/hDJGff6/c7u0hDkvkGxR/oy6CbCs8ziCsC7SqmhjfozqiJGc8Z11wrv9z9lYfY4K8l+H9TpjcMDX0xOZmx+RA==} dependencies: @@ -8302,6 +8312,7 @@ packages: proxy-from-env: 1.1.0 transitivePeerDependencies: - debug + dev: true /axobject-query@3.2.1: resolution: {integrity: sha512-jsyHu61e6N4Vbz/v18DHwWYKK0bSWLqn47eeDSKPB7m8tqMHF9YJ+mhIk2lVteyZrY8tnSj/jHOv4YiTCuCJgg==} @@ -10236,6 +10247,17 @@ packages: dependencies: ms: 2.1.3 + /debug@4.3.4: + resolution: {integrity: sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==} + engines: {node: '>=6.0'} + peerDependencies: + supports-color: '*' + peerDependenciesMeta: + supports-color: + optional: true + dependencies: + ms: 2.1.2 + /debug@4.3.4(supports-color@8.1.1): resolution: {integrity: sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==} engines: {node: '>=6.0'} @@ -11484,7 +11506,7 @@ packages: ajv: 6.12.6 chalk: 4.1.2 cross-spawn: 7.0.3 - debug: 4.3.4(supports-color@8.1.1) + debug: 4.3.4 doctrine: 3.0.0 escape-string-regexp: 4.0.0 eslint-scope: 7.2.2 @@ -12294,6 +12316,16 @@ packages: dependencies: debug: 4.3.4(supports-color@8.1.1) + /follow-redirects@1.15.5: + resolution: {integrity: sha512-vSFWUON1B+yAw1VN4xMfxgn5fTUiaOzAJCKBwIIgT/+7CuGy9+r+5gITvP62j3RmaD5Ph65UaERdOSRGUzZtgw==} + engines: {node: '>=4.0'} + peerDependencies: + debug: '*' + peerDependenciesMeta: + debug: + optional: true + dev: false + /follow-redirects@1.15.5(debug@4.3.4): resolution: {integrity: sha512-vSFWUON1B+yAw1VN4xMfxgn5fTUiaOzAJCKBwIIgT/+7CuGy9+r+5gITvP62j3RmaD5Ph65UaERdOSRGUzZtgw==} engines: {node: '>=4.0'} @@ -12304,6 +12336,7 @@ packages: optional: true dependencies: debug: 4.3.4(supports-color@8.1.1) + dev: true /follow-redirects@1.5.10: resolution: {integrity: sha512-0V5l4Cizzvqt5D44aTXbFZz+FtyXV1vrDN6qrelxtfYQKW0KO0W2T/hkE8xvGa/540LkZlkaUjO4ailYTFtHVQ==} diff --git a/sdk/src/lib/contracts/bitcoin-depositor.ts b/sdk/src/lib/contracts/bitcoin-depositor.ts index 960bc4e1f..749f78b73 100644 --- a/sdk/src/lib/contracts/bitcoin-depositor.ts +++ b/sdk/src/lib/contracts/bitcoin-depositor.ts @@ -10,7 +10,7 @@ export type DecodedExtraData = { } /** - * Interface for communication with the AcreBitcoinDepositor on-chain contract. + * Interface for communication with the BitcoinDepositor on-chain contract. */ export interface BitcoinDepositor extends DepositorProxy { /** diff --git a/sdk/src/lib/ethereum/artifacts/sepolia/AcreBitcoinDepositor.json b/sdk/src/lib/ethereum/artifacts/sepolia/BitcoinDepositor.json similarity index 100% rename from sdk/src/lib/ethereum/artifacts/sepolia/AcreBitcoinDepositor.json rename to sdk/src/lib/ethereum/artifacts/sepolia/BitcoinDepositor.json diff --git a/sdk/src/lib/ethereum/bitcoin-depositor.ts b/sdk/src/lib/ethereum/bitcoin-depositor.ts index e5b33ca80..d968ee5b6 100644 --- a/sdk/src/lib/ethereum/bitcoin-depositor.ts +++ b/sdk/src/lib/ethereum/bitcoin-depositor.ts @@ -1,5 +1,5 @@ import { packRevealDepositParameters } from "@keep-network/tbtc-v2.ts" -import { AcreBitcoinDepositor as AcreBitcoinDepositorTypechain } from "@acre-btc/core/typechain/contracts/AcreBitcoinDepositor" +import { BitcoinDepositor as BitcoinDepositorTypechain } from "@acre-btc/core/typechain/contracts/BitcoinDepositor" import { ZeroAddress, dataSlice, @@ -24,7 +24,7 @@ import { import { Hex } from "../utils" import { EthereumNetwork } from "./network" -import SepoliaBitcoinDepositor from "./artifacts/sepolia/AcreBitcoinDepositor.json" +import SepoliaBitcoinDepositor from "./artifacts/sepolia/BitcoinDepositor.json" /** * Ethereum implementation of the BitcoinDepositor. @@ -32,8 +32,8 @@ import SepoliaBitcoinDepositor from "./artifacts/sepolia/AcreBitcoinDepositor.js class EthereumBitcoinDepositor // @ts-expect-error TODO: Figure out why type generated by typechain does not // satisfy the constraint `Contract`. Error: `Property '[internal]' is missing - // in type 'AcreBitcoinDepositor' but required in type 'Contract'`. - extends EthersContractWrapper + // in type 'BitcoinDepositor' but required in type 'Contract'`. + extends EthersContractWrapper implements BitcoinDepositor { constructor(config: EthersContractConfig, network: EthereumNetwork) { diff --git a/sdk/src/modules/staking/stake-initialization.ts b/sdk/src/modules/staking/stake-initialization.ts index 4d66a111c..869de4452 100644 --- a/sdk/src/modules/staking/stake-initialization.ts +++ b/sdk/src/modules/staking/stake-initialization.ts @@ -120,7 +120,7 @@ class StakeInitialization { */ #getStakeMessageTypedData() { const domain: Domain = { - name: "AcreBitcoinDepositor", + name: "BitcoinDepositor", version: "1", verifyingContract: this.#contracts.bitcoinDepositor.getChainIdentifier(), } diff --git a/sdk/test/lib/ethereum/eip712.test.ts b/sdk/test/lib/ethereum/eip712.test.ts index 5e342e0ac..7395d8497 100644 --- a/sdk/test/lib/ethereum/eip712.test.ts +++ b/sdk/test/lib/ethereum/eip712.test.ts @@ -7,7 +7,7 @@ import { const signMessageData = { domain: { - name: "AcreBitcoinDepositor", + name: "BitcoinDepositor", version: "1", verifyingContract: EthereumAddress.from( ethers.Wallet.createRandom().address, diff --git a/sdk/test/modules/staking.test.ts b/sdk/test/modules/staking.test.ts index 664e54767..6eaca2ead 100644 --- a/sdk/test/modules/staking.test.ts +++ b/sdk/test/modules/staking.test.ts @@ -171,7 +171,7 @@ describe("Staking", () => { it("should sign message", () => { expect(messageSigner.sign).toHaveBeenCalledWith( { - name: "AcreBitcoinDepositor", + name: "BitcoinDepositor", version: "1", verifyingContract: contracts.bitcoinDepositor.getChainIdentifier(),