diff --git a/packages/op-request-plugins/src/WstethAdapterPlugin.ts b/packages/op-request-plugins/src/WstethAdapterPlugin.ts index c97359082e..e9ccbf90d0 100644 --- a/packages/op-request-plugins/src/WstethAdapterPlugin.ts +++ b/packages/op-request-plugins/src/WstethAdapterPlugin.ts @@ -11,6 +11,8 @@ import { } from "@nocturne-xyz/core"; import { WstethAdapter__factory } from "@nocturne-xyz/contracts"; +const WETH_NAME = "weth"; +const WSTETH_NAME = "wsteth"; const WSTETH_ADAPTER_NAME = "wstethAdapter"; export interface WstethAdapterPluginMethods { @@ -47,16 +49,14 @@ export function WstethAdapterPlugin( ); } - const wethAddress = - this.config.erc20s.get(WSTETH_ADAPTER_NAME)?.address; + const wethAddress = this.config.erc20s.get(WETH_NAME)?.address; if (!wethAddress) { throw new Error( `Weth not supported on chain with id: ${this._op.chainId}` ); } - const wstethAddress = - this.config.erc20s.get(WSTETH_ADAPTER_NAME)?.address; + const wstethAddress = this.config.erc20s.get(WSTETH_NAME)?.address; if (!wstethAddress) { throw new Error( `Wsteth not supported on chain with id: ${this._op.chainId}` diff --git a/packages/op-request-plugins/test/utils.ts b/packages/op-request-plugins/test/utils.ts index cc781de9ad..531b2aafec 100644 --- a/packages/op-request-plugins/test/utils.ts +++ b/packages/op-request-plugins/test/utils.ts @@ -1,16 +1,17 @@ -import { loadNocturneConfigBuiltin } from "@nocturne-xyz/config"; +import { + NocturneConfig, + loadNocturneConfigBuiltin, +} from "@nocturne-xyz/config"; import { Asset, AssetTrait } from "@nocturne-xyz/core"; import { AssetType } from "@nocturne-xyz/core/src"; import { ethers } from "ethers"; -export const DUMMY_CONFIG = loadNocturneConfigBuiltin("example-network"); - export const WETH_ADDRESS = ethers.utils.getAddress( "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2" ); export const WSTETH_ADAPTER_ADDRESS = ethers.utils.getAddress( "0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0" -); // TODO: fill with real address +); export const WSTETH_ADDRESS = ethers.utils.getAddress( "0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0" ); @@ -27,3 +28,26 @@ export const shitcoin: Asset = { id: 0n, }; export const encodedShitcoin = AssetTrait.encode(shitcoin); + +const config = loadNocturneConfigBuiltin("example-network"); +config.erc20s.set("weth", { + address: WETH_ADDRESS, + globalCapWholeTokens: 100_000_000n, + maxDepositSizeWholeTokens: 100_000_000n, + resetWindowHours: 24n, + precision: 18n, + isGasAsset: true, +}); +config.erc20s.set("wsteth", { + address: WSTETH_ADDRESS, + globalCapWholeTokens: 100_000_000n, + maxDepositSizeWholeTokens: 100_000_000n, + resetWindowHours: 24n, + precision: 18n, + isGasAsset: false, +}); +config.protocolAllowlist.set("wstethAdapter", { + address: WSTETH_ADAPTER_ADDRESS, + functionSignatures: ["convert(uint256)"], +}); +export const DUMMY_CONFIG: NocturneConfig = config;