mirror of
https://github.com/oceanprotocol/ocean.js.git
synced 2024-11-26 20:39:05 +01:00
general renaming in Pool
This commit is contained in:
parent
83b8d1dce3
commit
eb41dfc7ef
@ -169,7 +169,7 @@ export class Pool extends SmartContract {
|
|||||||
* @param {String} poolAddress
|
* @param {String} poolAddress
|
||||||
* @return {String}
|
* @return {String}
|
||||||
*/
|
*/
|
||||||
async getBaseToken(poolAddress: string): Promise<string> {
|
async getBasetoken(poolAddress: string): Promise<string> {
|
||||||
const pool = this.getContract(poolAddress)
|
const pool = this.getContract(poolAddress)
|
||||||
let result = null
|
let result = null
|
||||||
try {
|
try {
|
||||||
@ -599,7 +599,7 @@ export class Pool extends SmartContract {
|
|||||||
|
|
||||||
const maxPrice = amountsInOutMaxFee.maxPrice
|
const maxPrice = amountsInOutMaxFee.maxPrice
|
||||||
? await this.amountToUnits(
|
? await this.amountToUnits(
|
||||||
await this.getBaseToken(poolAddress),
|
await this.getBasetoken(poolAddress),
|
||||||
amountsInOutMaxFee.maxPrice
|
amountsInOutMaxFee.maxPrice
|
||||||
)
|
)
|
||||||
: MAX_UINT_256
|
: MAX_UINT_256
|
||||||
@ -686,7 +686,7 @@ export class Pool extends SmartContract {
|
|||||||
|
|
||||||
const maxPrice = amountsInOutMaxFee.maxPrice
|
const maxPrice = amountsInOutMaxFee.maxPrice
|
||||||
? this.amountToUnits(
|
? this.amountToUnits(
|
||||||
await this.getBaseToken(poolAddress),
|
await this.getBasetoken(poolAddress),
|
||||||
amountsInOutMaxFee.maxPrice
|
amountsInOutMaxFee.maxPrice
|
||||||
)
|
)
|
||||||
: MAX_UINT_256
|
: MAX_UINT_256
|
||||||
@ -755,7 +755,7 @@ export class Pool extends SmartContract {
|
|||||||
): Promise<G extends false ? TransactionReceipt : number> {
|
): Promise<G extends false ? TransactionReceipt : number> {
|
||||||
const pool = this.getContract(poolAddress)
|
const pool = this.getContract(poolAddress)
|
||||||
let result = null
|
let result = null
|
||||||
const tokenIn = await this.getBaseToken(poolAddress)
|
const tokenIn = await this.getBasetoken(poolAddress)
|
||||||
const maxSwap = await this.getMaxAddLiquidity(poolAddress, tokenIn)
|
const maxSwap = await this.getMaxAddLiquidity(poolAddress, tokenIn)
|
||||||
if (new Decimal(tokenAmountIn).greaterThan(maxSwap)) {
|
if (new Decimal(tokenAmountIn).greaterThan(maxSwap)) {
|
||||||
throw new Error(`tokenAmountOut is greater than ${maxSwap.toString()}`)
|
throw new Error(`tokenAmountOut is greater than ${maxSwap.toString()}`)
|
||||||
@ -803,7 +803,7 @@ export class Pool extends SmartContract {
|
|||||||
* @param {number} poolDecimals optional number of decimals of the poool
|
* @param {number} poolDecimals optional number of decimals of the poool
|
||||||
* @return {TransactionReceipt}
|
* @return {TransactionReceipt}
|
||||||
*/
|
*/
|
||||||
async exitswapPoolAmountIn<G extends boolean = false>(
|
async exitSwapPoolAmountIn<G extends boolean = false>(
|
||||||
account: string,
|
account: string,
|
||||||
poolAddress: string,
|
poolAddress: string,
|
||||||
poolAmountIn: string,
|
poolAmountIn: string,
|
||||||
@ -813,7 +813,7 @@ export class Pool extends SmartContract {
|
|||||||
): Promise<G extends false ? TransactionReceipt : number> {
|
): Promise<G extends false ? TransactionReceipt : number> {
|
||||||
const pool = this.getContract(poolAddress)
|
const pool = this.getContract(poolAddress)
|
||||||
let result = null
|
let result = null
|
||||||
const tokenOut = await this.getBaseToken(poolAddress)
|
const tokenOut = await this.getBasetoken(poolAddress)
|
||||||
|
|
||||||
const tokenAmountOut = await this.calcSingleOutGivenPoolIn(
|
const tokenAmountOut = await this.calcSingleOutGivenPoolIn(
|
||||||
poolAddress,
|
poolAddress,
|
||||||
@ -827,7 +827,7 @@ export class Pool extends SmartContract {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const minTokenOutFormatted = await this.amountToUnits(
|
const minTokenOutFormatted = await this.amountToUnits(
|
||||||
await this.getBaseToken(poolAddress),
|
await this.getBasetoken(poolAddress),
|
||||||
minTokenAmountOut,
|
minTokenAmountOut,
|
||||||
poolDecimals
|
poolDecimals
|
||||||
)
|
)
|
||||||
|
@ -215,8 +215,8 @@ describe('Pool unit test', () => {
|
|||||||
expect(await pool.getDenormalizedWeight(poolAddress, datatoken)).to.equal('5')
|
expect(await pool.getDenormalizedWeight(poolAddress, datatoken)).to.equal('5')
|
||||||
})
|
})
|
||||||
|
|
||||||
it('#getBaseToken - should return the baseToken address', async () => {
|
it('#getBasetoken - should return the baseToken address', async () => {
|
||||||
expect(await pool.getBaseToken(poolAddress)).to.equal(contracts.daiAddress)
|
expect(await pool.getBasetoken(poolAddress)).to.equal(contracts.daiAddress)
|
||||||
})
|
})
|
||||||
|
|
||||||
it('#getDatatoken - should return the datatoken address', async () => {
|
it('#getDatatoken - should return the datatoken address', async () => {
|
||||||
@ -301,11 +301,11 @@ describe('Pool unit test', () => {
|
|||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
it('#exitswapPoolAmountIn- user2 exit the pool receiving only DAI', async () => {
|
it('#exitSwapPoolAmountIn- user2 exit the pool receiving only DAI', async () => {
|
||||||
const BPTAmountIn = '0.5'
|
const BPTAmountIn = '0.5'
|
||||||
const minDAIOut = '0.5'
|
const minDAIOut = '0.5'
|
||||||
|
|
||||||
const tx = await pool.exitswapPoolAmountIn(
|
const tx = await pool.exitSwapPoolAmountIn(
|
||||||
user1,
|
user1,
|
||||||
poolAddress,
|
poolAddress,
|
||||||
BPTAmountIn,
|
BPTAmountIn,
|
||||||
@ -324,7 +324,7 @@ describe('Pool unit test', () => {
|
|||||||
const maxBTPIn = '0.5'
|
const maxBTPIn = '0.5'
|
||||||
const exactDAIOut = '1'
|
const exactDAIOut = '1'
|
||||||
|
|
||||||
const tx = await pool.exitswapPoolAmountIn(
|
const tx = await pool.exitSwapPoolAmountIn(
|
||||||
user1,
|
user1,
|
||||||
poolAddress,
|
poolAddress,
|
||||||
maxBTPIn,
|
maxBTPIn,
|
||||||
@ -673,8 +673,8 @@ describe('Pool unit test', () => {
|
|||||||
expect(await pool.getDenormalizedWeight(poolAddress, datatoken)).to.equal('5')
|
expect(await pool.getDenormalizedWeight(poolAddress, datatoken)).to.equal('5')
|
||||||
})
|
})
|
||||||
|
|
||||||
it('#getBaseToken - should return the baseToken address', async () => {
|
it('#getBasetoken - should return the baseToken address', async () => {
|
||||||
expect(await pool.getBaseToken(poolAddress)).to.equal(contracts.usdcAddress)
|
expect(await pool.getBasetoken(poolAddress)).to.equal(contracts.usdcAddress)
|
||||||
})
|
})
|
||||||
|
|
||||||
it('#getDatatoken - should return the datatoken address', async () => {
|
it('#getDatatoken - should return the datatoken address', async () => {
|
||||||
@ -758,11 +758,11 @@ describe('Pool unit test', () => {
|
|||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
it('#exitswapPoolAmountIn- user2 exit the pool receiving only USDC', async () => {
|
it('#exitSwapPoolAmountIn- user2 exit the pool receiving only USDC', async () => {
|
||||||
const BPTAmountIn = '0.5'
|
const BPTAmountIn = '0.5'
|
||||||
const minUSDCOut = '0.5'
|
const minUSDCOut = '0.5'
|
||||||
|
|
||||||
const tx = await pool.exitswapPoolAmountIn(
|
const tx = await pool.exitSwapPoolAmountIn(
|
||||||
user1,
|
user1,
|
||||||
poolAddress,
|
poolAddress,
|
||||||
BPTAmountIn,
|
BPTAmountIn,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user