mirror of
https://github.com/oceanprotocol/ocean.js.git
synced 2024-11-26 20:39:05 +01:00
refactor dai and usdc constants
This commit is contained in:
parent
757a6136b0
commit
9200be874b
@ -12,7 +12,8 @@ import {
|
|||||||
NftFactory,
|
NftFactory,
|
||||||
NftCreateData,
|
NftCreateData,
|
||||||
Pool,
|
Pool,
|
||||||
unitsToAmount
|
unitsToAmount,
|
||||||
|
ZERO_ADDRESS
|
||||||
} from '../../../../src'
|
} from '../../../../src'
|
||||||
import {
|
import {
|
||||||
PoolCreationParams,
|
PoolCreationParams,
|
||||||
@ -35,6 +36,9 @@ describe('Pool unit test', () => {
|
|||||||
let daiContract: Contract
|
let daiContract: Contract
|
||||||
let usdcContract: Contract
|
let usdcContract: Contract
|
||||||
|
|
||||||
|
const DAI_AMOUNT = 2000
|
||||||
|
const USDC_AMOUNT = 10000
|
||||||
|
|
||||||
before(async () => {
|
before(async () => {
|
||||||
const accounts = await web3.eth.getAccounts()
|
const accounts = await web3.eth.getAccounts()
|
||||||
factoryOwner = accounts[0]
|
factoryOwner = accounts[0]
|
||||||
@ -47,46 +51,50 @@ describe('Pool unit test', () => {
|
|||||||
|
|
||||||
// initialize Pool instance
|
// initialize Pool instance
|
||||||
pool = new Pool(web3)
|
pool = new Pool(web3)
|
||||||
assert(pool != null)
|
|
||||||
|
|
||||||
daiContract = new web3.eth.Contract(MockERC20.abi as AbiItem[], contracts.daiAddress)
|
daiContract = new web3.eth.Contract(MockERC20.abi as AbiItem[], contracts.daiAddress)
|
||||||
|
|
||||||
usdcContract = new web3.eth.Contract(
|
usdcContract = new web3.eth.Contract(
|
||||||
MockERC20.abi as AbiItem[],
|
MockERC20.abi as AbiItem[],
|
||||||
contracts.usdcAddress
|
contracts.usdcAddress
|
||||||
)
|
)
|
||||||
|
|
||||||
await approve(
|
await approve(
|
||||||
web3,
|
web3,
|
||||||
factoryOwner,
|
factoryOwner,
|
||||||
contracts.daiAddress,
|
contracts.daiAddress,
|
||||||
contracts.erc721FactoryAddress,
|
contracts.erc721FactoryAddress,
|
||||||
'2000'
|
DAI_AMOUNT.toString()
|
||||||
)
|
)
|
||||||
|
|
||||||
|
assert(
|
||||||
|
parseInt(
|
||||||
|
await allowance(
|
||||||
|
web3,
|
||||||
|
contracts.daiAddress,
|
||||||
|
factoryOwner,
|
||||||
|
contracts.erc721FactoryAddress
|
||||||
|
)
|
||||||
|
) >= DAI_AMOUNT
|
||||||
|
)
|
||||||
|
|
||||||
await approve(
|
await approve(
|
||||||
web3,
|
web3,
|
||||||
factoryOwner,
|
factoryOwner,
|
||||||
contracts.usdcAddress,
|
contracts.usdcAddress,
|
||||||
contracts.erc721FactoryAddress,
|
contracts.erc721FactoryAddress,
|
||||||
'10000'
|
USDC_AMOUNT.toString()
|
||||||
)
|
)
|
||||||
|
|
||||||
let allowCheck = await allowance(
|
assert(
|
||||||
web3,
|
parseInt(
|
||||||
contracts.daiAddress,
|
await allowance(
|
||||||
factoryOwner,
|
web3,
|
||||||
contracts.erc721FactoryAddress
|
contracts.usdcAddress,
|
||||||
|
factoryOwner,
|
||||||
|
contracts.erc721FactoryAddress
|
||||||
|
)
|
||||||
|
) >= USDC_AMOUNT
|
||||||
)
|
)
|
||||||
|
|
||||||
assert(parseInt(allowCheck) >= 2000)
|
|
||||||
allowCheck = await allowance(
|
|
||||||
web3,
|
|
||||||
contracts.usdcAddress,
|
|
||||||
factoryOwner,
|
|
||||||
contracts.erc721FactoryAddress
|
|
||||||
)
|
|
||||||
assert(parseInt(allowCheck) >= 10000)
|
|
||||||
|
|
||||||
await amountToUnits(web3, contracts.usdcAddress, '20')
|
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('Test a pool with DAI (18 Decimals)', () => {
|
describe('Test a pool with DAI (18 Decimals)', () => {
|
||||||
@ -107,7 +115,7 @@ describe('Pool unit test', () => {
|
|||||||
minter: factoryOwner,
|
minter: factoryOwner,
|
||||||
paymentCollector: user2,
|
paymentCollector: user2,
|
||||||
mpFeeAddress: factoryOwner,
|
mpFeeAddress: factoryOwner,
|
||||||
feeToken: '0x0000000000000000000000000000000000000000',
|
feeToken: ZERO_ADDRESS,
|
||||||
cap: '1000000',
|
cap: '1000000',
|
||||||
feeAmount: '0',
|
feeAmount: '0',
|
||||||
name: 'ERC20B1',
|
name: 'ERC20B1',
|
||||||
@ -557,7 +565,7 @@ describe('Pool unit test', () => {
|
|||||||
minter: factoryOwner,
|
minter: factoryOwner,
|
||||||
paymentCollector: user2,
|
paymentCollector: user2,
|
||||||
mpFeeAddress: factoryOwner,
|
mpFeeAddress: factoryOwner,
|
||||||
feeToken: '0x0000000000000000000000000000000000000000',
|
feeToken: ZERO_ADDRESS,
|
||||||
cap: '1000000',
|
cap: '1000000',
|
||||||
feeAmount: '0',
|
feeAmount: '0',
|
||||||
name: 'ERC20B1',
|
name: 'ERC20B1',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user