@airdao/swap-router-contracts
Version:
Smart contracts for swapping on Astra Classic and CL
51 lines (40 loc) • 1.58 kB
text/typescript
import { Fixture } from 'ethereum-waffle'
import { constants, Contract, ContractTransaction, Wallet } from 'ethers'
import { waffle, ethers } from 'hardhat'
import { ISAMB, MockTimeSwapRouter02 } from '../typechain'
import completeFixture from './shared/completeFixture'
import { expect } from './shared/expect'
describe('PeripheryPaymentsExtended', function () {
let wallet: Wallet
const routerFixture: Fixture<{
samb: ISAMB
router: MockTimeSwapRouter02
}> = async (wallets, provider) => {
const { samb, router } = await completeFixture(wallets, provider)
return {
samb,
router,
}
}
let router: MockTimeSwapRouter02
let samb: ISAMB
let loadFixture: ReturnType<typeof waffle.createFixtureLoader>
before('create fixture loader', async () => {
;[wallet] = await (ethers as any).getSigners()
loadFixture = waffle.createFixtureLoader([wallet])
})
beforeEach('load fixture', async () => {
;({ samb, router } = await loadFixture(routerFixture))
})
describe('wrapETH', () => {
it('increases router SAMB balance by value amount', async () => {
const value = ethers.utils.parseEther('1')
const weth9BalancePrev = await samb.balanceOf(router.address)
await router.wrapAMB(value, { value })
const weth9BalanceCurrent = await samb.balanceOf(router.address)
expect(weth9BalanceCurrent.sub(weth9BalancePrev)).to.equal(value)
expect(await samb.balanceOf(wallet.address)).to.equal('0')
expect(await router.provider.getBalance(router.address)).to.equal('0')
})
})
})