MCPcopy
hub / github.com/Uniswap/v2-core / pairFixture

Function pairFixture

test/shared/fixtures.ts:30–45  ·  view source on GitHub ↗
(provider: Web3Provider, [wallet]: Wallet[])

Source from the content-addressed store, hash-verified

28}
29
30export async function pairFixture(provider: Web3Provider, [wallet]: Wallet[]): Promise<PairFixture> {
31 const { factory } = await factoryFixture(provider, [wallet])
32
33 const tokenA = await deployContract(wallet, ERC20, [expandTo18Decimals(10000)], overrides)
34 const tokenB = await deployContract(wallet, ERC20, [expandTo18Decimals(10000)], overrides)
35
36 await factory.createPair(tokenA.address, tokenB.address, overrides)
37 const pairAddress = await factory.getPair(tokenA.address, tokenB.address)
38 const pair = new Contract(pairAddress, JSON.stringify(UniswapV2Pair.abi), provider).connect(wallet)
39
40 const token0Address = (await pair.token0()).address
41 const token0 = tokenA.address === token0Address ? tokenA : tokenB
42 const token1 = tokenA.address === token0Address ? tokenB : tokenA
43
44 return { factory, token0, token1, pair }
45}

Callers

nothing calls this directly

Calls 2

expandTo18DecimalsFunction · 0.90
factoryFixtureFunction · 0.85

Tested by

no test coverage detected