mirror of
https://github.com/oceanprotocol/ocean.js.git
synced 2024-11-26 20:39:05 +01:00
rename erc20 to datatoken in SideStaking test
This commit is contained in:
parent
e97c88e00e
commit
36986aa928
@ -34,8 +34,8 @@ describe('SideStaking unit test', () => {
|
|||||||
let pool: Pool
|
let pool: Pool
|
||||||
let sideStaking: SideStaking
|
let sideStaking: SideStaking
|
||||||
let poolAddress: string
|
let poolAddress: string
|
||||||
let erc20Token: string
|
let datatoken: string
|
||||||
let erc20Contract: Contract
|
let datatokenContract: Contract
|
||||||
let daiContract: Contract
|
let daiContract: Contract
|
||||||
let usdcContract: Contract
|
let usdcContract: Contract
|
||||||
|
|
||||||
@ -161,12 +161,12 @@ describe('SideStaking unit test', () => {
|
|||||||
)
|
)
|
||||||
|
|
||||||
initialBlock = await web3.eth.getBlockNumber()
|
initialBlock = await web3.eth.getBlockNumber()
|
||||||
erc20Token = txReceipt.events.TokenCreated.returnValues.newTokenAddress
|
datatoken = txReceipt.events.TokenCreated.returnValues.newTokenAddress
|
||||||
poolAddress = txReceipt.events.NewPool.returnValues.poolAddress
|
poolAddress = txReceipt.events.NewPool.returnValues.poolAddress
|
||||||
|
|
||||||
erc20Contract = new web3.eth.Contract(ERC20Template.abi as AbiItem[], erc20Token)
|
datatokenContract = new web3.eth.Contract(ERC20Template.abi as AbiItem[], datatoken)
|
||||||
// user1 has no dt1
|
// user1 has no dt1
|
||||||
expect(await erc20Contract.methods.balanceOf(user1).call()).to.equal('0')
|
expect(await datatokenContract.methods.balanceOf(user1).call()).to.equal('0')
|
||||||
})
|
})
|
||||||
|
|
||||||
it('#getRouter - should get Router address', async () => {
|
it('#getRouter - should get Router address', async () => {
|
||||||
@ -179,7 +179,7 @@ describe('SideStaking unit test', () => {
|
|||||||
expect(
|
expect(
|
||||||
await sideStaking.getDatatokenCirculatingSupply(
|
await sideStaking.getDatatokenCirculatingSupply(
|
||||||
contracts.sideStakingAddress,
|
contracts.sideStakingAddress,
|
||||||
erc20Token
|
datatoken
|
||||||
)
|
)
|
||||||
).to.equal(web3.utils.toWei(BASE_TOKEN_LIQUIDITY.toString()))
|
).to.equal(web3.utils.toWei(BASE_TOKEN_LIQUIDITY.toString()))
|
||||||
})
|
})
|
||||||
@ -188,39 +188,39 @@ describe('SideStaking unit test', () => {
|
|||||||
expect(
|
expect(
|
||||||
await sideStaking.getDatatokenCurrentCirculatingSupply(
|
await sideStaking.getDatatokenCurrentCirculatingSupply(
|
||||||
contracts.sideStakingAddress,
|
contracts.sideStakingAddress,
|
||||||
erc20Token
|
datatoken
|
||||||
)
|
)
|
||||||
).to.equal(web3.utils.toWei(BASE_TOKEN_LIQUIDITY.toString()))
|
).to.equal(web3.utils.toWei(BASE_TOKEN_LIQUIDITY.toString()))
|
||||||
})
|
})
|
||||||
|
|
||||||
it('#getBaseToken - should get baseToken address', async () => {
|
it('#getBaseToken - should get baseToken address', async () => {
|
||||||
expect(
|
expect(
|
||||||
await sideStaking.getBaseToken(contracts.sideStakingAddress, erc20Token)
|
await sideStaking.getBaseToken(contracts.sideStakingAddress, datatoken)
|
||||||
).to.equal(contracts.daiAddress)
|
).to.equal(contracts.daiAddress)
|
||||||
})
|
})
|
||||||
|
|
||||||
it('#getPoolAddress - should get pool address', async () => {
|
it('#getPoolAddress - should get pool address', async () => {
|
||||||
expect(
|
expect(
|
||||||
await sideStaking.getPoolAddress(contracts.sideStakingAddress, erc20Token)
|
await sideStaking.getPoolAddress(contracts.sideStakingAddress, datatoken)
|
||||||
).to.equal(poolAddress)
|
).to.equal(poolAddress)
|
||||||
})
|
})
|
||||||
|
|
||||||
it('#getPublisherAddress - should get publisher address', async () => {
|
it('#getPublisherAddress - should get publisher address', async () => {
|
||||||
expect(
|
expect(
|
||||||
await sideStaking.getPublisherAddress(contracts.sideStakingAddress, erc20Token)
|
await sideStaking.getPublisherAddress(contracts.sideStakingAddress, datatoken)
|
||||||
).to.equal(factoryOwner)
|
).to.equal(factoryOwner)
|
||||||
})
|
})
|
||||||
|
|
||||||
it('#getBaseTokenBalance ', async () => {
|
it('#getBaseTokenBalance ', async () => {
|
||||||
expect(
|
expect(
|
||||||
await sideStaking.getBaseTokenBalance(contracts.sideStakingAddress, erc20Token)
|
await sideStaking.getBaseTokenBalance(contracts.sideStakingAddress, datatoken)
|
||||||
).to.equal('0')
|
).to.equal('0')
|
||||||
})
|
})
|
||||||
|
|
||||||
it('#getDatatokenBalance ', async () => {
|
it('#getDatatokenBalance ', async () => {
|
||||||
expect(
|
expect(
|
||||||
await (
|
await (
|
||||||
await sideStaking.getDatatokenBalance(contracts.sideStakingAddress, erc20Token)
|
await sideStaking.getDatatokenBalance(contracts.sideStakingAddress, datatoken)
|
||||||
).toString()
|
).toString()
|
||||||
).to.equal(
|
).to.equal(
|
||||||
new BigNumber(2)
|
new BigNumber(2)
|
||||||
@ -234,19 +234,19 @@ describe('SideStaking unit test', () => {
|
|||||||
|
|
||||||
it('#getvestingAmount ', async () => {
|
it('#getvestingAmount ', async () => {
|
||||||
expect(
|
expect(
|
||||||
await sideStaking.getvestingAmount(contracts.sideStakingAddress, erc20Token)
|
await sideStaking.getvestingAmount(contracts.sideStakingAddress, datatoken)
|
||||||
).to.equal('0')
|
).to.equal('0')
|
||||||
})
|
})
|
||||||
|
|
||||||
it('#getvestingLastBlock ', async () => {
|
it('#getvestingLastBlock ', async () => {
|
||||||
expect(
|
expect(
|
||||||
await sideStaking.getvestingLastBlock(contracts.sideStakingAddress, erc20Token)
|
await sideStaking.getvestingLastBlock(contracts.sideStakingAddress, datatoken)
|
||||||
).to.equal(initialBlock.toString())
|
).to.equal(initialBlock.toString())
|
||||||
})
|
})
|
||||||
|
|
||||||
it('#getvestingAmountSoFar ', async () => {
|
it('#getvestingAmountSoFar ', async () => {
|
||||||
expect(
|
expect(
|
||||||
await sideStaking.getvestingAmountSoFar(contracts.sideStakingAddress, erc20Token)
|
await sideStaking.getvestingAmountSoFar(contracts.sideStakingAddress, datatoken)
|
||||||
).to.equal('0')
|
).to.equal('0')
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -258,7 +258,7 @@ describe('SideStaking unit test', () => {
|
|||||||
|
|
||||||
const tokenInOutMarket: TokenInOutMarket = {
|
const tokenInOutMarket: TokenInOutMarket = {
|
||||||
tokenIn: contracts.daiAddress,
|
tokenIn: contracts.daiAddress,
|
||||||
tokenOut: erc20Token,
|
tokenOut: datatoken,
|
||||||
marketFeeAddress: factoryOwner
|
marketFeeAddress: factoryOwner
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -275,7 +275,7 @@ describe('SideStaking unit test', () => {
|
|||||||
amountsInOutMaxFee
|
amountsInOutMaxFee
|
||||||
)
|
)
|
||||||
|
|
||||||
expect(await erc20Contract.methods.balanceOf(user1).call()).to.equal(
|
expect(await datatokenContract.methods.balanceOf(user1).call()).to.equal(
|
||||||
tx.events.LOG_SWAP.returnValues.tokenAmountOut
|
tx.events.LOG_SWAP.returnValues.tokenAmountOut
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
@ -284,7 +284,7 @@ describe('SideStaking unit test', () => {
|
|||||||
await approve(web3, user1, contracts.daiAddress, poolAddress, '100')
|
await approve(web3, user1, contracts.daiAddress, poolAddress, '100')
|
||||||
const tokenInOutMarket: TokenInOutMarket = {
|
const tokenInOutMarket: TokenInOutMarket = {
|
||||||
tokenIn: contracts.daiAddress,
|
tokenIn: contracts.daiAddress,
|
||||||
tokenOut: erc20Token,
|
tokenOut: datatoken,
|
||||||
marketFeeAddress: factoryOwner
|
marketFeeAddress: factoryOwner
|
||||||
}
|
}
|
||||||
const amountsInOutMaxFee: AmountsOutMaxFee = {
|
const amountsInOutMaxFee: AmountsOutMaxFee = {
|
||||||
@ -341,7 +341,7 @@ describe('SideStaking unit test', () => {
|
|||||||
expect(tx.events.LOG_EXIT[0].returnValues.tokenOut).to.equal(contracts.daiAddress)
|
expect(tx.events.LOG_EXIT[0].returnValues.tokenOut).to.equal(contracts.daiAddress)
|
||||||
|
|
||||||
// DTs were also unstaked in the same transaction (went to the staking contract)
|
// DTs were also unstaked in the same transaction (went to the staking contract)
|
||||||
expect(tx.events.LOG_EXIT[1].returnValues.tokenOut).to.equal(erc20Token)
|
expect(tx.events.LOG_EXIT[1].returnValues.tokenOut).to.equal(datatoken)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -383,24 +383,24 @@ describe('SideStaking unit test', () => {
|
|||||||
)
|
)
|
||||||
|
|
||||||
initialBlock = await web3.eth.getBlockNumber()
|
initialBlock = await web3.eth.getBlockNumber()
|
||||||
erc20Token = txReceipt.events.TokenCreated.returnValues.newTokenAddress
|
datatoken = txReceipt.events.TokenCreated.returnValues.newTokenAddress
|
||||||
poolAddress = txReceipt.events.NewPool.returnValues.poolAddress
|
poolAddress = txReceipt.events.NewPool.returnValues.poolAddress
|
||||||
|
|
||||||
erc20Contract = new web3.eth.Contract(ERC20Template.abi as AbiItem[], erc20Token)
|
datatokenContract = new web3.eth.Contract(ERC20Template.abi as AbiItem[], datatoken)
|
||||||
// user1 has no dt1
|
// user1 has no dt1
|
||||||
expect(await erc20Contract.methods.balanceOf(user1).call()).to.equal('0')
|
expect(await datatokenContract.methods.balanceOf(user1).call()).to.equal('0')
|
||||||
})
|
})
|
||||||
|
|
||||||
it('#getBaseTokenBalance ', async () => {
|
it('#getBaseTokenBalance ', async () => {
|
||||||
expect(
|
expect(
|
||||||
await sideStaking.getBaseTokenBalance(contracts.sideStakingAddress, erc20Token)
|
await sideStaking.getBaseTokenBalance(contracts.sideStakingAddress, datatoken)
|
||||||
).to.equal('0')
|
).to.equal('0')
|
||||||
})
|
})
|
||||||
|
|
||||||
it('#getDatatokenBalance ', async () => {
|
it('#getDatatokenBalance ', async () => {
|
||||||
expect(
|
expect(
|
||||||
await (
|
await (
|
||||||
await sideStaking.getDatatokenBalance(contracts.sideStakingAddress, erc20Token)
|
await sideStaking.getDatatokenBalance(contracts.sideStakingAddress, datatoken)
|
||||||
).toString()
|
).toString()
|
||||||
).to.equal(
|
).to.equal(
|
||||||
new BigNumber(2)
|
new BigNumber(2)
|
||||||
@ -414,19 +414,19 @@ describe('SideStaking unit test', () => {
|
|||||||
|
|
||||||
it('#getvestingAmount ', async () => {
|
it('#getvestingAmount ', async () => {
|
||||||
expect(
|
expect(
|
||||||
await sideStaking.getvestingAmount(contracts.sideStakingAddress, erc20Token)
|
await sideStaking.getvestingAmount(contracts.sideStakingAddress, datatoken)
|
||||||
).to.equal('0')
|
).to.equal('0')
|
||||||
})
|
})
|
||||||
|
|
||||||
it('#getvestingLastBlock ', async () => {
|
it('#getvestingLastBlock ', async () => {
|
||||||
expect(
|
expect(
|
||||||
await sideStaking.getvestingLastBlock(contracts.sideStakingAddress, erc20Token)
|
await sideStaking.getvestingLastBlock(contracts.sideStakingAddress, datatoken)
|
||||||
).to.equal(initialBlock.toString())
|
).to.equal(initialBlock.toString())
|
||||||
})
|
})
|
||||||
|
|
||||||
it('#getvestingAmountSoFar ', async () => {
|
it('#getvestingAmountSoFar ', async () => {
|
||||||
expect(
|
expect(
|
||||||
await sideStaking.getvestingAmountSoFar(contracts.sideStakingAddress, erc20Token)
|
await sideStaking.getvestingAmountSoFar(contracts.sideStakingAddress, datatoken)
|
||||||
).to.equal('0')
|
).to.equal('0')
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -439,7 +439,7 @@ describe('SideStaking unit test', () => {
|
|||||||
await approve(web3, user1, contracts.usdcAddress, poolAddress, '10')
|
await approve(web3, user1, contracts.usdcAddress, poolAddress, '10')
|
||||||
const tokenInOutMarket: TokenInOutMarket = {
|
const tokenInOutMarket: TokenInOutMarket = {
|
||||||
tokenIn: contracts.usdcAddress,
|
tokenIn: contracts.usdcAddress,
|
||||||
tokenOut: erc20Token,
|
tokenOut: datatoken,
|
||||||
marketFeeAddress: factoryOwner
|
marketFeeAddress: factoryOwner
|
||||||
}
|
}
|
||||||
const amountsInOutMaxFee: AmountsInMaxFee = {
|
const amountsInOutMaxFee: AmountsInMaxFee = {
|
||||||
@ -453,7 +453,7 @@ describe('SideStaking unit test', () => {
|
|||||||
tokenInOutMarket,
|
tokenInOutMarket,
|
||||||
amountsInOutMaxFee
|
amountsInOutMaxFee
|
||||||
)
|
)
|
||||||
expect(await erc20Contract.methods.balanceOf(user1).call()).to.equal(
|
expect(await datatokenContract.methods.balanceOf(user1).call()).to.equal(
|
||||||
tx.events.LOG_SWAP.returnValues.tokenAmountOut
|
tx.events.LOG_SWAP.returnValues.tokenAmountOut
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
@ -462,7 +462,7 @@ describe('SideStaking unit test', () => {
|
|||||||
await approve(web3, user1, contracts.usdcAddress, poolAddress, '100')
|
await approve(web3, user1, contracts.usdcAddress, poolAddress, '100')
|
||||||
const tokenInOutMarket: TokenInOutMarket = {
|
const tokenInOutMarket: TokenInOutMarket = {
|
||||||
tokenIn: contracts.usdcAddress,
|
tokenIn: contracts.usdcAddress,
|
||||||
tokenOut: erc20Token,
|
tokenOut: datatoken,
|
||||||
marketFeeAddress: factoryOwner
|
marketFeeAddress: factoryOwner
|
||||||
}
|
}
|
||||||
const amountsInOutMaxFee: AmountsOutMaxFee = {
|
const amountsInOutMaxFee: AmountsOutMaxFee = {
|
||||||
@ -517,7 +517,7 @@ describe('SideStaking unit test', () => {
|
|||||||
expect(tx.events.LOG_EXIT[0].returnValues.tokenOut).to.equal(contracts.usdcAddress)
|
expect(tx.events.LOG_EXIT[0].returnValues.tokenOut).to.equal(contracts.usdcAddress)
|
||||||
|
|
||||||
// DTs were also unstaked in the same transaction (went to the staking contract)
|
// DTs were also unstaked in the same transaction (went to the staking contract)
|
||||||
expect(tx.events.LOG_EXIT[1].returnValues.tokenOut).to.equal(erc20Token)
|
expect(tx.events.LOG_EXIT[1].returnValues.tokenOut).to.equal(datatoken)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user