Skip to content

Commit

Permalink
Merge branch 'main' into show-errors
Browse files Browse the repository at this point in the history
  • Loading branch information
r-czajkowski authored Apr 16, 2024
2 parents 7dcae5e + d265ef5 commit 664f8d4
Show file tree
Hide file tree
Showing 17 changed files with 2,211 additions and 4,688 deletions.
1,337 changes: 0 additions & 1,337 deletions sdk/src/lib/ethereum/artifacts/sepolia/BitcoinDepositor.json

This file was deleted.

1,642 changes: 0 additions & 1,642 deletions sdk/src/lib/ethereum/artifacts/sepolia/stBTC.json

This file was deleted.

4 changes: 2 additions & 2 deletions sdk/src/lib/ethereum/bitcoin-depositor.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { packRevealDepositParameters } from "@keep-network/tbtc-v2.ts"
import { BitcoinDepositor as BitcoinDepositorTypechain } from "@acre-btc/contracts/typechain/contracts/BitcoinDepositor"
import SepoliaBitcoinDepositor from "@acre-btc/contracts/deployments/sepolia/BitcoinDepositor.json"

import {
ZeroAddress,
dataSlice,
Expand All @@ -24,8 +26,6 @@ import {
import { Hex } from "../utils"
import { EthereumNetwork } from "./network"

import SepoliaBitcoinDepositor from "./artifacts/sepolia/BitcoinDepositor.json"

/**
* Ethereum implementation of the BitcoinDepositor.
*/
Expand Down
44 changes: 25 additions & 19 deletions sdk/src/lib/ethereum/contract.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
import {
EthersContractConfig as _EthersContractConfig,
EthersContractDeployment,
} from "@keep-network/tbtc-v2.ts/dist/src/lib/ethereum/adapter"
import {
Contract as EthersContract,
getAddress,
Expand All @@ -10,7 +6,20 @@ import {
} from "ethers"
import { EthereumAddress } from "./address"

export { EthersContractDeployment }
/**
* Contract deployment artifact.
* @see [hardhat-deploy#Deployment](https://github.com/wighawag/hardhat-deploy/blob/0c969e9a27b4eeff9f5ccac7e19721ef2329eed2/types.ts#L358)}
*/
export interface EthersContractDeployment {
/**
* Address of the deployed contract.
*/
address: string
/**
* Contract's ABI.
*/
abi: unknown[]
}

/**
* Use `VoidSigner` from `ethers` if you want to initialize the Ethereum Acre
Expand All @@ -21,10 +30,17 @@ export type EthereumSigner = Signer | VoidSigner
/**
* Represents a config set required to connect an Ethereum contract.
*/
export interface EthersContractConfig
// We want to omit the `signerOrProvider` because it points to ethers v5. We
// use ethers v6 in Acre SDK.
extends Omit<_EthersContractConfig, "signerOrProvider"> {
export interface EthersContractConfig {
/**
* Address of the Ethereum contract as a 0x-prefixed hex string.
* Optional parameter, if not provided the value will be resolved from the
* contract artifact.
*/
address?: string
/**
* Signer - will return a Contract which will act on behalf of that signer.
* The signer will sign all contract transactions.
*/
signer: EthereumSigner
}

Expand All @@ -37,13 +53,6 @@ export class EthersContractWrapper<T extends EthersContract> {
*/
protected readonly instance: T

/**
* Number of a block within which the contract was deployed. Value is read
* from the contract deployment artifact. It can be overwritten by setting a
* {@link EthersContractConfig.deployedAtBlockNumber} property.
*/
protected readonly deployedAtBlockNumber: number

/**
* Address of this contract instance.
*/
Expand All @@ -61,9 +70,6 @@ export class EthersContractWrapper<T extends EthersContract> {
) as T

this.#address = contractAddress

this.deployedAtBlockNumber =
config.deployedAtBlockNumber ?? deployment.receipt.blockNumber
}

/**
Expand Down
3 changes: 2 additions & 1 deletion sdk/src/lib/ethereum/stbtc.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { StBTC as StBTCTypechain } from "@acre-btc/contracts/typechain/contracts/StBTC"
import stBTC from "./artifacts/sepolia/stBTC.json"
import stBTC from "@acre-btc/contracts/deployments/sepolia/stBTC.json"

import {
EthersContractConfig,
EthersContractDeployment,
Expand Down
Loading

0 comments on commit 664f8d4

Please sign in to comment.