mirror of
https://github.com/oceanprotocol/ocean.js.git
synced 2024-11-26 20:39:05 +01:00
update transfer and approve methods
This commit is contained in:
parent
6b0a47204c
commit
470eff51ad
@ -9,6 +9,8 @@ import {
|
||||
minAbi,
|
||||
sendTx
|
||||
} from '.'
|
||||
import { config } from 'process'
|
||||
import { Config } from '../config'
|
||||
|
||||
/**
|
||||
* Approve spender to spent amount tokens
|
||||
@ -21,6 +23,7 @@ import {
|
||||
*/
|
||||
export async function approve<G extends boolean = false>(
|
||||
web3: Web3,
|
||||
config: Config,
|
||||
account: string,
|
||||
tokenAddress: string,
|
||||
spender: string,
|
||||
@ -48,7 +51,8 @@ export async function approve<G extends boolean = false>(
|
||||
const trxReceipt = await sendTx(
|
||||
account,
|
||||
estGas + 1,
|
||||
this.web3,
|
||||
web3,
|
||||
config,
|
||||
tokenContract.methods.approve,
|
||||
spender,
|
||||
amountFormatted
|
||||
@ -66,6 +70,7 @@ export async function approve<G extends boolean = false>(
|
||||
*/
|
||||
export async function transfer<G extends boolean = false>(
|
||||
web3: Web3,
|
||||
config: Config,
|
||||
account: string,
|
||||
tokenAddress: string,
|
||||
recipient: string,
|
||||
@ -86,7 +91,8 @@ export async function transfer<G extends boolean = false>(
|
||||
const trxReceipt = await sendTx(
|
||||
account,
|
||||
estGas + 1,
|
||||
this.web3,
|
||||
web3,
|
||||
config,
|
||||
tokenContract.methods.transfer,
|
||||
recipient,
|
||||
amountFormatted
|
||||
|
@ -230,8 +230,8 @@ describe('Marketplace flow tests', async () => {
|
||||
|
||||
it('5.3 We send some OCEAN to consumer and staker accounts', async () => {
|
||||
/// ```Typescript
|
||||
transfer(web3, publisherAccount, addresses.Ocean, consumerAccount, '100')
|
||||
transfer(web3, publisherAccount, addresses.Ocean, stakerAccount, '100')
|
||||
transfer(web3, config, publisherAccount, addresses.Ocean, consumerAccount, '100')
|
||||
transfer(web3, config, publisherAccount, addresses.Ocean, stakerAccount, '100')
|
||||
}) ///
|
||||
/// ```
|
||||
|
||||
@ -282,6 +282,7 @@ describe('Marketplace flow tests', async () => {
|
||||
/// ```Typescript
|
||||
await approve(
|
||||
web3,
|
||||
config,
|
||||
publisherAccount,
|
||||
addresses.Ocean,
|
||||
addresses.ERC721Factory,
|
||||
@ -313,6 +314,7 @@ describe('Marketplace flow tests', async () => {
|
||||
it('6.2 Set metadata in the pool NFT', async () => {
|
||||
/// ```Typescript
|
||||
const nft = new Nft(web3)
|
||||
|
||||
/// ```
|
||||
/// Now we update the ddo and set the right did
|
||||
/// ```Typescript
|
||||
@ -355,7 +357,7 @@ describe('Marketplace flow tests', async () => {
|
||||
/// ```
|
||||
/// Before we call the contract we have to call `approve` so that the contract can move our tokens. This is standard when using any ERC20 Datatokens
|
||||
/// ```Typescript
|
||||
await approve(web3, stakerAccount, addresses.Ocean, poolAddress, '5', true)
|
||||
await approve(web3, config, stakerAccount, addresses.Ocean, poolAddress, '5', true)
|
||||
|
||||
/// ```
|
||||
/// Now we can make the contract call
|
||||
@ -404,7 +406,7 @@ describe('Marketplace flow tests', async () => {
|
||||
/// ```
|
||||
/// Before we call the contract we have to call `approve` so that the contract can move our tokens. This is standard when using any ERC20 Datatokens
|
||||
/// ```Typescript
|
||||
await approve(web3, consumerAccount, addresses.Ocean, poolAddress, '100')
|
||||
await approve(web3, config, consumerAccount, addresses.Ocean, poolAddress, '100')
|
||||
|
||||
const pool = new Pool(web3)
|
||||
const tokenInOutMarket: TokenInOutMarket = {
|
||||
@ -646,9 +648,10 @@ describe('Marketplace flow tests', async () => {
|
||||
/// ```
|
||||
/// Before we call the contract we have to call `approve` so that the contract can move our tokens. This is standard when using any ERC20 Datatokens
|
||||
/// ```Typescript
|
||||
await approve(web3, consumerAccount, addresses.Ocean, freAddress, '100')
|
||||
await approve(web3, config, consumerAccount, addresses.Ocean, freAddress, '100')
|
||||
await approve(
|
||||
web3,
|
||||
config,
|
||||
publisherAccount,
|
||||
freDatatokenAddress,
|
||||
freAddress,
|
||||
|
@ -88,6 +88,7 @@ describe('Publish tests', async () => {
|
||||
|
||||
await approve(
|
||||
web3,
|
||||
config,
|
||||
publisherAccount,
|
||||
addresses.MockDAI,
|
||||
addresses.ERC721Factory,
|
||||
|
@ -2,7 +2,7 @@ import { assert, expect } from 'chai'
|
||||
import { AbiItem } from 'web3-utils/types'
|
||||
import { deployContracts, Addresses } from '../../TestContractHandler'
|
||||
import ERC20Template from '@oceanprotocol/contracts/artifacts/contracts/templates/ERC20Template.sol/ERC20Template.json'
|
||||
import { web3 } from '../../config'
|
||||
import { getTestConfig, web3 } from '../../config'
|
||||
import {
|
||||
NftFactory,
|
||||
NftCreateData,
|
||||
@ -11,7 +11,8 @@ import {
|
||||
signHash,
|
||||
Nft,
|
||||
transfer,
|
||||
approve
|
||||
approve,
|
||||
Config
|
||||
} from '../../../src'
|
||||
import {
|
||||
ProviderFees,
|
||||
@ -30,6 +31,7 @@ describe('Nft Factory test', () => {
|
||||
let dtAddress: string
|
||||
let dtAddress2: string
|
||||
let nftAddress: string
|
||||
let config: Config
|
||||
|
||||
const DATA_TOKEN_AMOUNT = web3.utils.toWei('1')
|
||||
const FEE = '0.001'
|
||||
@ -66,6 +68,8 @@ describe('Nft Factory test', () => {
|
||||
dtParams.minter = nftOwner
|
||||
dtParams.paymentCollector = user2
|
||||
dtParams.mpFeeAddress = user1
|
||||
|
||||
config = await getTestConfig(web3)
|
||||
})
|
||||
|
||||
it('should deploy contracts', async () => {
|
||||
@ -146,6 +150,7 @@ describe('Nft Factory test', () => {
|
||||
|
||||
await transfer(
|
||||
web3,
|
||||
config,
|
||||
factoryOwner,
|
||||
contracts.daiAddress,
|
||||
nftOwner,
|
||||
@ -154,6 +159,7 @@ describe('Nft Factory test', () => {
|
||||
|
||||
await approve(
|
||||
web3,
|
||||
config,
|
||||
nftOwner,
|
||||
contracts.daiAddress,
|
||||
contracts.nftFactoryAddress,
|
||||
|
@ -2,14 +2,15 @@ import { assert, expect } from 'chai'
|
||||
import { AbiItem } from 'web3-utils/types'
|
||||
import { deployContracts, Addresses } from '../../TestContractHandler'
|
||||
import MockERC20 from '@oceanprotocol/contracts/artifacts/contracts/utils/mock/MockERC20Decimals.sol/MockERC20Decimals.json'
|
||||
import { web3 } from '../../config'
|
||||
import { getTestConfig, web3 } from '../../config'
|
||||
import {
|
||||
NftFactory,
|
||||
NftCreateData,
|
||||
Router,
|
||||
balance,
|
||||
approve,
|
||||
ZERO_ADDRESS
|
||||
ZERO_ADDRESS,
|
||||
Config
|
||||
} from '../../../src'
|
||||
import { DatatokenCreateParams, PoolCreationParams, Operation } from '../../../src/@types'
|
||||
|
||||
@ -21,6 +22,7 @@ describe('Router unit test', () => {
|
||||
let user2: string
|
||||
let contracts: Addresses
|
||||
let router: Router
|
||||
let config: Config
|
||||
|
||||
const NFT_NAME = '72120Bundle'
|
||||
const NFT_SYMBOL = '72Bundle'
|
||||
@ -73,6 +75,8 @@ describe('Router unit test', () => {
|
||||
ERC_PARAMS.minter = factoryOwner
|
||||
ERC_PARAMS.paymentCollector = user2
|
||||
ERC_PARAMS.mpFeeAddress = factoryOwner
|
||||
|
||||
config = await getTestConfig(web3)
|
||||
})
|
||||
|
||||
it('should deploy contracts', async () => {
|
||||
@ -80,6 +84,7 @@ describe('Router unit test', () => {
|
||||
|
||||
await approve(
|
||||
web3,
|
||||
config,
|
||||
factoryOwner,
|
||||
contracts.daiAddress,
|
||||
contracts.nftFactoryAddress,
|
||||
@ -132,7 +137,14 @@ describe('Router unit test', () => {
|
||||
.transfer(user1, web3.utils.toWei(DAI_AMOUNT))
|
||||
.send({ from: factoryOwner })
|
||||
|
||||
await approve(web3, user1, contracts.daiAddress, contracts.routerAddress, DAI_AMOUNT)
|
||||
await approve(
|
||||
web3,
|
||||
config,
|
||||
user1,
|
||||
contracts.daiAddress,
|
||||
contracts.routerAddress,
|
||||
DAI_AMOUNT
|
||||
)
|
||||
|
||||
// CREATE A FIRST POOL
|
||||
const poolParams: PoolCreationParams = {
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { assert, expect } from 'chai'
|
||||
import { deployContracts, Addresses } from '../../../TestContractHandler'
|
||||
import { web3 } from '../../../config'
|
||||
import { getTestConfig, web3 } from '../../../config'
|
||||
import {
|
||||
allowance,
|
||||
approve,
|
||||
@ -11,7 +11,8 @@ import {
|
||||
ZERO_ADDRESS,
|
||||
balance,
|
||||
transfer,
|
||||
decimals
|
||||
decimals,
|
||||
Config
|
||||
} from '../../../../src'
|
||||
import {
|
||||
PoolCreationParams,
|
||||
@ -31,6 +32,7 @@ describe('Pool unit test', () => {
|
||||
let poolAddress: string
|
||||
let datatoken: string
|
||||
let dtParams: DatatokenCreateParams
|
||||
let config: Config
|
||||
|
||||
const nftData: NftCreateData = {
|
||||
name: '72120Bundle',
|
||||
@ -49,6 +51,8 @@ describe('Pool unit test', () => {
|
||||
|
||||
nftData.owner = factoryOwner
|
||||
|
||||
config = await getTestConfig(web3)
|
||||
|
||||
dtParams = {
|
||||
templateIndex: 1,
|
||||
minter: factoryOwner,
|
||||
@ -71,6 +75,7 @@ describe('Pool unit test', () => {
|
||||
|
||||
await approve(
|
||||
web3,
|
||||
config,
|
||||
factoryOwner,
|
||||
contracts.daiAddress,
|
||||
contracts.nftFactoryAddress,
|
||||
@ -90,6 +95,7 @@ describe('Pool unit test', () => {
|
||||
|
||||
await approve(
|
||||
web3,
|
||||
config,
|
||||
factoryOwner,
|
||||
contracts.usdcAddress,
|
||||
contracts.nftFactoryAddress,
|
||||
@ -224,11 +230,11 @@ describe('Pool unit test', () => {
|
||||
})
|
||||
|
||||
it('#swapExactAmountIn - should swap', async () => {
|
||||
await transfer(web3, factoryOwner, contracts.daiAddress, user1, '1000')
|
||||
await transfer(web3, config, factoryOwner, contracts.daiAddress, user1, '1000')
|
||||
expect(await balance(web3, contracts.daiAddress, user1)).to.equal('1000')
|
||||
|
||||
expect(await balance(web3, datatoken, user1)).to.equal('0')
|
||||
await approve(web3, user1, contracts.daiAddress, poolAddress, '10')
|
||||
await approve(web3, config, user1, contracts.daiAddress, poolAddress, '10')
|
||||
|
||||
const tokenInOutMarket: TokenInOutMarket = {
|
||||
tokenIn: contracts.daiAddress,
|
||||
@ -256,7 +262,7 @@ describe('Pool unit test', () => {
|
||||
})
|
||||
|
||||
it('#swapExactAmountOut - should swap', async () => {
|
||||
await approve(web3, user1, contracts.daiAddress, poolAddress, '100')
|
||||
await approve(web3, config, user1, contracts.daiAddress, poolAddress, '100')
|
||||
expect(await balance(web3, contracts.daiAddress, user1)).to.equal('990')
|
||||
const tokenInOutMarket: TokenInOutMarket = {
|
||||
tokenIn: contracts.daiAddress,
|
||||
@ -280,7 +286,7 @@ describe('Pool unit test', () => {
|
||||
it('#joinswapExternAmountIn- user2 should add liquidity, receiving LP tokens', async () => {
|
||||
const daiAmountIn = '100'
|
||||
const minBPTOut = '0.1'
|
||||
await approve(web3, user1, contracts.daiAddress, poolAddress, '100', true)
|
||||
await approve(web3, config, user1, contracts.daiAddress, poolAddress, '100', true)
|
||||
expect(await allowance(web3, contracts.daiAddress, user1, poolAddress)).to.equal(
|
||||
'100'
|
||||
)
|
||||
@ -682,11 +688,11 @@ describe('Pool unit test', () => {
|
||||
})
|
||||
|
||||
it('#swapExactAmountIn - should swap', async () => {
|
||||
await transfer(web3, factoryOwner, contracts.usdcAddress, user1, '1000')
|
||||
await transfer(web3, config, factoryOwner, contracts.usdcAddress, user1, '1000')
|
||||
expect(await balance(web3, contracts.usdcAddress, user1)).to.equal('1000')
|
||||
|
||||
expect(await balance(web3, datatoken, user1)).to.equal('0')
|
||||
await approve(web3, user1, contracts.usdcAddress, poolAddress, '10')
|
||||
await approve(web3, config, user1, contracts.usdcAddress, poolAddress, '10')
|
||||
|
||||
const tokenInOutMarket: TokenInOutMarket = {
|
||||
tokenIn: contracts.usdcAddress,
|
||||
@ -714,7 +720,7 @@ describe('Pool unit test', () => {
|
||||
})
|
||||
|
||||
it('#swapExactAmountOut - should swap', async () => {
|
||||
await approve(web3, user1, contracts.usdcAddress, poolAddress, '100')
|
||||
await approve(web3, config, user1, contracts.usdcAddress, poolAddress, '100')
|
||||
expect(await balance(web3, contracts.usdcAddress, user1)).to.equal('990')
|
||||
const tokenInOutMarket: TokenInOutMarket = {
|
||||
tokenIn: contracts.usdcAddress,
|
||||
@ -739,7 +745,7 @@ describe('Pool unit test', () => {
|
||||
it('#joinswapExternAmountIn- user2 should add liquidity, receiving LP tokens', async () => {
|
||||
const usdcAmountIn = '100'
|
||||
const minBPTOut = '0.1'
|
||||
await approve(web3, user1, contracts.usdcAddress, poolAddress, '100', true)
|
||||
await approve(web3, config, user1, contracts.usdcAddress, poolAddress, '100', true)
|
||||
|
||||
const tx = await pool.joinswapExternAmountIn(
|
||||
user1,
|
||||
|
@ -4,7 +4,7 @@ import { Contract } from 'web3-eth-contract'
|
||||
import BigNumber from 'bignumber.js'
|
||||
import ERC20Template from '@oceanprotocol/contracts/artifacts/contracts/templates/ERC20Template.sol/ERC20Template.json'
|
||||
import { deployContracts, Addresses } from '../../../TestContractHandler'
|
||||
import { web3 } from '../../../config'
|
||||
import { web3, getTestConfig } from '../../../config'
|
||||
import {
|
||||
NftFactory,
|
||||
NftCreateData,
|
||||
@ -13,7 +13,8 @@ import {
|
||||
approve,
|
||||
transfer,
|
||||
balance,
|
||||
unitsToAmount
|
||||
unitsToAmount,
|
||||
Config
|
||||
} from '../../../../src'
|
||||
import { FreCreationParams, DatatokenCreateParams } from '../../../../src/@types'
|
||||
|
||||
@ -27,6 +28,7 @@ describe('Fixed Rate unit test', () => {
|
||||
let fixedRate: FixedRateExchange
|
||||
let dtAddress: string
|
||||
let dtContract: Contract
|
||||
let config: Config
|
||||
|
||||
const nftData: NftCreateData = {
|
||||
name: '72120Bundle',
|
||||
@ -60,6 +62,8 @@ describe('Fixed Rate unit test', () => {
|
||||
dtParams.minter = factoryOwner
|
||||
dtParams.paymentCollector = user2
|
||||
dtParams.mpFeeAddress = factoryOwner
|
||||
|
||||
config = await getTestConfig(web3)
|
||||
})
|
||||
|
||||
it('should deploy contracts', async () => {
|
||||
@ -197,10 +201,24 @@ describe('Fixed Rate unit test', () => {
|
||||
await dtContract.methods
|
||||
.mint(exchangeOwner, web3.utils.toWei('1000'))
|
||||
.send({ from: exchangeOwner })
|
||||
await approve(web3, exchangeOwner, dtAddress, contracts.fixedRateAddress, '1000')
|
||||
await approve(
|
||||
web3,
|
||||
config,
|
||||
exchangeOwner,
|
||||
dtAddress,
|
||||
contracts.fixedRateAddress,
|
||||
'1000'
|
||||
)
|
||||
// user1 gets 100 DAI so he can buy DTs
|
||||
await transfer(web3, exchangeOwner, contracts.daiAddress, user1, '100')
|
||||
await approve(web3, user1, contracts.daiAddress, contracts.fixedRateAddress, '100')
|
||||
await transfer(web3, config, exchangeOwner, contracts.daiAddress, user1, '100')
|
||||
await approve(
|
||||
web3,
|
||||
config,
|
||||
user1,
|
||||
contracts.daiAddress,
|
||||
contracts.fixedRateAddress,
|
||||
'100'
|
||||
)
|
||||
|
||||
// user1 has no dts but has 100 DAI
|
||||
expect(await balance(web3, dtAddress, user1)).to.equal('0')
|
||||
@ -236,7 +254,7 @@ describe('Fixed Rate unit test', () => {
|
||||
})
|
||||
|
||||
it('#sellDatatokens - user1 should sell some dt', async () => {
|
||||
await approve(web3, user1, dtAddress, contracts.fixedRateAddress, '100')
|
||||
await approve(web3, config, user1, dtAddress, contracts.fixedRateAddress, '100')
|
||||
const daiBalanceBefore = new BigNumber(
|
||||
await balance(web3, contracts.daiAddress, user1)
|
||||
)
|
||||
@ -506,10 +524,24 @@ describe('Fixed Rate unit test', () => {
|
||||
await dtContract.methods
|
||||
.mint(exchangeOwner, web3.utils.toWei('1000'))
|
||||
.send({ from: exchangeOwner })
|
||||
await approve(web3, exchangeOwner, dtAddress, contracts.fixedRateAddress, '1000')
|
||||
await approve(
|
||||
web3,
|
||||
config,
|
||||
exchangeOwner,
|
||||
dtAddress,
|
||||
contracts.fixedRateAddress,
|
||||
'1000'
|
||||
)
|
||||
// user1 gets 100 USDC so he can buy DTs
|
||||
await transfer(web3, exchangeOwner, contracts.usdcAddress, user1, '100')
|
||||
await approve(web3, user1, contracts.usdcAddress, contracts.fixedRateAddress, '100')
|
||||
await transfer(web3, config, exchangeOwner, contracts.usdcAddress, user1, '100')
|
||||
await approve(
|
||||
web3,
|
||||
config,
|
||||
user1,
|
||||
contracts.usdcAddress,
|
||||
contracts.fixedRateAddress,
|
||||
'100'
|
||||
)
|
||||
|
||||
// user1 has no dts but has 100 USDC
|
||||
expect(await balance(web3, dtAddress, user1)).to.equal('0')
|
||||
@ -549,7 +581,7 @@ describe('Fixed Rate unit test', () => {
|
||||
})
|
||||
|
||||
it('#sellDatatokens - user1 should sell some dt', async () => {
|
||||
await approve(web3, user1, dtAddress, contracts.fixedRateAddress, '10')
|
||||
await approve(web3, config, user1, dtAddress, contracts.fixedRateAddress, '10')
|
||||
const usdcBalanceBefore = new BigNumber(
|
||||
await balance(web3, contracts.usdcAddress, user1)
|
||||
)
|
||||
|
@ -5,7 +5,7 @@ import BigNumber from 'bignumber.js'
|
||||
import ERC20Template from '@oceanprotocol/contracts/artifacts/contracts/templates/ERC20Template.sol/ERC20Template.json'
|
||||
import MockERC20 from '@oceanprotocol/contracts/artifacts/contracts/utils/mock/MockERC20Decimals.sol/MockERC20Decimals.json'
|
||||
import { deployContracts, Addresses } from '../../../TestContractHandler'
|
||||
import { web3 } from '../../../config'
|
||||
import { getTestConfig, web3 } from '../../../config'
|
||||
import {
|
||||
allowance,
|
||||
amountToUnits,
|
||||
@ -15,7 +15,8 @@ import {
|
||||
Pool,
|
||||
SideStaking,
|
||||
unitsToAmount,
|
||||
ZERO_ADDRESS
|
||||
ZERO_ADDRESS,
|
||||
Config
|
||||
} from '../../../../src'
|
||||
import {
|
||||
DatatokenCreateParams,
|
||||
@ -38,6 +39,7 @@ describe('SideStaking unit test', () => {
|
||||
let datatokenContract: Contract
|
||||
let daiContract: Contract
|
||||
let usdcContract: Contract
|
||||
let config: Config
|
||||
|
||||
const VESTED_BLOCKS = 2500000
|
||||
const VESTING_AMOUNT = '10000'
|
||||
@ -74,6 +76,8 @@ describe('SideStaking unit test', () => {
|
||||
dtParams.minter = factoryOwner
|
||||
dtParams.paymentCollector = user2
|
||||
dtParams.mpFeeAddress = factoryOwner
|
||||
|
||||
config = await getTestConfig(web3)
|
||||
})
|
||||
|
||||
it('should deploy contracts', async () => {
|
||||
@ -94,6 +98,7 @@ describe('SideStaking unit test', () => {
|
||||
|
||||
await approve(
|
||||
web3,
|
||||
config,
|
||||
factoryOwner,
|
||||
contracts.daiAddress,
|
||||
contracts.nftFactoryAddress,
|
||||
@ -113,6 +118,7 @@ describe('SideStaking unit test', () => {
|
||||
|
||||
await approve(
|
||||
web3,
|
||||
config,
|
||||
factoryOwner,
|
||||
contracts.usdcAddress,
|
||||
contracts.nftFactoryAddress,
|
||||
@ -254,7 +260,7 @@ describe('SideStaking unit test', () => {
|
||||
await daiContract.methods
|
||||
.transfer(user1, web3.utils.toWei('1000'))
|
||||
.send({ from: factoryOwner })
|
||||
await approve(web3, user1, contracts.daiAddress, poolAddress, '10')
|
||||
await approve(web3, config, user1, contracts.daiAddress, poolAddress, '10')
|
||||
|
||||
const tokenInOutMarket: TokenInOutMarket = {
|
||||
tokenIn: contracts.daiAddress,
|
||||
@ -281,7 +287,7 @@ describe('SideStaking unit test', () => {
|
||||
})
|
||||
|
||||
it('#swapExactAmountOut - should swap', async () => {
|
||||
await approve(web3, user1, contracts.daiAddress, poolAddress, '100')
|
||||
await approve(web3, config, user1, contracts.daiAddress, poolAddress, '100')
|
||||
const tokenInOutMarket: TokenInOutMarket = {
|
||||
tokenIn: contracts.daiAddress,
|
||||
tokenOut: datatoken,
|
||||
@ -304,7 +310,7 @@ describe('SideStaking unit test', () => {
|
||||
it('#joinswapExternAmountIn- user1 should add liquidity, receiving LP tokens', async () => {
|
||||
const daiAmountIn = '100'
|
||||
const minBPTOut = '0.1'
|
||||
await approve(web3, user1, contracts.daiAddress, poolAddress, '100', true)
|
||||
await approve(web3, config, user1, contracts.daiAddress, poolAddress, '100', true)
|
||||
expect(await allowance(web3, contracts.daiAddress, user1, poolAddress)).to.equal(
|
||||
'100'
|
||||
)
|
||||
@ -436,7 +442,7 @@ describe('SideStaking unit test', () => {
|
||||
.transfer(user1, transferAmount)
|
||||
.send({ from: factoryOwner })
|
||||
|
||||
await approve(web3, user1, contracts.usdcAddress, poolAddress, '10')
|
||||
await approve(web3, config, user1, contracts.usdcAddress, poolAddress, '10')
|
||||
const tokenInOutMarket: TokenInOutMarket = {
|
||||
tokenIn: contracts.usdcAddress,
|
||||
tokenOut: datatoken,
|
||||
@ -459,7 +465,7 @@ describe('SideStaking unit test', () => {
|
||||
})
|
||||
|
||||
it('#swapExactAmountOut - should swap', async () => {
|
||||
await approve(web3, user1, contracts.usdcAddress, poolAddress, '100')
|
||||
await approve(web3, config, user1, contracts.usdcAddress, poolAddress, '100')
|
||||
const tokenInOutMarket: TokenInOutMarket = {
|
||||
tokenIn: contracts.usdcAddress,
|
||||
tokenOut: datatoken,
|
||||
@ -482,7 +488,7 @@ describe('SideStaking unit test', () => {
|
||||
it('#joinswapExternAmountIn- user1 should add liquidity, receiving LP tokens', async () => {
|
||||
const usdcAmountIn = '100'
|
||||
const minBPTOut = '0.1'
|
||||
await approve(web3, user1, contracts.usdcAddress, poolAddress, '100', true)
|
||||
await approve(web3, config, user1, contracts.usdcAddress, poolAddress, '100', true)
|
||||
|
||||
const tx = await pool.joinswapExternAmountIn(
|
||||
user1,
|
||||
|
Loading…
x
Reference in New Issue
Block a user