mirror of
https://github.com/oceanprotocol/ocean.js.git
synced 2024-11-26 20:39:05 +01:00
general renaming in SideStaking
This commit is contained in:
parent
eb41dfc7ef
commit
efc4b8b521
@ -20,15 +20,15 @@ export class SideStaking extends SmartContract {
|
||||
datatokenAddress: string
|
||||
): Promise<string> {
|
||||
const sideStaking = this.getContract(ssAddress)
|
||||
let result = null
|
||||
let supply = null
|
||||
try {
|
||||
result = await sideStaking.methods
|
||||
supply = await sideStaking.methods
|
||||
.getDatatokenCirculatingSupply(datatokenAddress)
|
||||
.call()
|
||||
} catch (e) {
|
||||
LoggerInstance.error(`ERROR: Failed to get: ${e.message}`)
|
||||
}
|
||||
return result.toString()
|
||||
return supply.toString()
|
||||
}
|
||||
|
||||
/**
|
||||
@ -44,11 +44,11 @@ export class SideStaking extends SmartContract {
|
||||
): Promise<string> {
|
||||
try {
|
||||
const sideStaking = this.getContract(ssAddress)
|
||||
let result = null
|
||||
result = await sideStaking.methods
|
||||
let supply = null
|
||||
supply = await sideStaking.methods
|
||||
.getDatatokenCurrentCirculatingSupply(datatokenAddress)
|
||||
.call()
|
||||
return result.toString()
|
||||
return supply.toString()
|
||||
} catch (e) {
|
||||
LoggerInstance.error(`ERROR: Failed to get: ${e.message}`)
|
||||
}
|
||||
@ -65,13 +65,13 @@ export class SideStaking extends SmartContract {
|
||||
datatokenAddress: string
|
||||
): Promise<string> {
|
||||
const sideStaking = this.getContract(ssAddress)
|
||||
let result = null
|
||||
let address = null
|
||||
try {
|
||||
result = await sideStaking.methods.getPublisherAddress(datatokenAddress).call()
|
||||
address = await sideStaking.methods.getPublisherAddress(datatokenAddress).call()
|
||||
} catch (e) {
|
||||
LoggerInstance.error(`ERROR: Failed to get: ${e.message}`)
|
||||
}
|
||||
return result
|
||||
return address
|
||||
}
|
||||
|
||||
/**
|
||||
@ -80,15 +80,15 @@ export class SideStaking extends SmartContract {
|
||||
* @param {String} datatokenAddress datatokenAddress
|
||||
* @return {String}
|
||||
*/
|
||||
async getBaseToken(ssAddress: string, datatokenAddress: string): Promise<string> {
|
||||
async getBasetoken(ssAddress: string, datatokenAddress: string): Promise<string> {
|
||||
const sideStaking = this.getContract(ssAddress)
|
||||
let result = null
|
||||
let address = null
|
||||
try {
|
||||
result = await sideStaking.methods.getBaseTokenAddress(datatokenAddress).call()
|
||||
address = await sideStaking.methods.getBaseTokenAddress(datatokenAddress).call()
|
||||
} catch (e) {
|
||||
LoggerInstance.error(`ERROR: Failed to get: ${e.message}`)
|
||||
}
|
||||
return result
|
||||
return address
|
||||
}
|
||||
|
||||
/**
|
||||
@ -99,13 +99,13 @@ export class SideStaking extends SmartContract {
|
||||
*/
|
||||
async getPoolAddress(ssAddress: string, datatokenAddress: string): Promise<string> {
|
||||
const sideStaking = this.getContract(ssAddress)
|
||||
let result = null
|
||||
let address = null
|
||||
try {
|
||||
result = await sideStaking.methods.getPoolAddress(datatokenAddress).call()
|
||||
address = await sideStaking.methods.getPoolAddress(datatokenAddress).call()
|
||||
} catch (e) {
|
||||
LoggerInstance.error(`ERROR: Failed to get: ${e.message}`)
|
||||
}
|
||||
return result
|
||||
return address
|
||||
}
|
||||
|
||||
/**
|
||||
@ -114,18 +114,18 @@ export class SideStaking extends SmartContract {
|
||||
* @param {String} datatokenAddress datatokenAddress
|
||||
* @return {String}
|
||||
*/
|
||||
async getBaseTokenBalance(
|
||||
async getBasetokenBalance(
|
||||
ssAddress: string,
|
||||
datatokenAddress: string
|
||||
): Promise<string> {
|
||||
const sideStaking = this.getContract(ssAddress)
|
||||
let result = null
|
||||
let balance = null
|
||||
try {
|
||||
result = await sideStaking.methods.getBaseTokenBalance(datatokenAddress).call()
|
||||
balance = await sideStaking.methods.getBaseTokenBalance(datatokenAddress).call()
|
||||
} catch (e) {
|
||||
LoggerInstance.error(`ERROR: Failed to get: ${e.message}`)
|
||||
}
|
||||
return result
|
||||
return balance
|
||||
}
|
||||
|
||||
/**
|
||||
@ -141,14 +141,14 @@ export class SideStaking extends SmartContract {
|
||||
tokenDecimals?: number
|
||||
): Promise<string> {
|
||||
const sideStaking = this.getContract(ssAddress)
|
||||
let result = null
|
||||
let balance = null
|
||||
try {
|
||||
result = await sideStaking.methods.getDatatokenBalance(datatokenAddress).call()
|
||||
balance = await sideStaking.methods.getDatatokenBalance(datatokenAddress).call()
|
||||
} catch (e) {
|
||||
LoggerInstance.error(`ERROR: Failed to get: ${e.message}`)
|
||||
}
|
||||
result = await this.unitsToAmount(datatokenAddress, result, tokenDecimals)
|
||||
return result
|
||||
balance = await this.unitsToAmount(datatokenAddress, balance, tokenDecimals)
|
||||
return balance
|
||||
}
|
||||
|
||||
/**
|
||||
@ -157,15 +157,15 @@ export class SideStaking extends SmartContract {
|
||||
* @param {String} datatokenAddress datatokenAddress
|
||||
* @return {String} end block for vesting amount
|
||||
*/
|
||||
async getvestingEndBlock(ssAddress: string, datatokenAddress: string): Promise<string> {
|
||||
async getVestingEndBlock(ssAddress: string, datatokenAddress: string): Promise<string> {
|
||||
const sideStaking = this.getContract(ssAddress)
|
||||
let result = null
|
||||
let block = null
|
||||
try {
|
||||
result = await sideStaking.methods.getvestingEndBlock(datatokenAddress).call()
|
||||
block = await sideStaking.methods.getvestingEndBlock(datatokenAddress).call()
|
||||
} catch (e) {
|
||||
LoggerInstance.error(`ERROR: Failed to get: ${e.message}`)
|
||||
}
|
||||
return result
|
||||
return block
|
||||
}
|
||||
|
||||
/**
|
||||
@ -175,20 +175,20 @@ export class SideStaking extends SmartContract {
|
||||
* @param {number} tokenDecimals optional number of decimals of the token
|
||||
* @return {String}
|
||||
*/
|
||||
async getvestingAmount(
|
||||
async getVestingAmount(
|
||||
ssAddress: string,
|
||||
datatokenAddress: string,
|
||||
tokenDecimals?: number
|
||||
): Promise<string> {
|
||||
const sideStaking = this.getContract(ssAddress)
|
||||
let result = null
|
||||
let amount = null
|
||||
try {
|
||||
result = await sideStaking.methods.getvestingAmount(datatokenAddress).call()
|
||||
amount = await sideStaking.methods.getvestingAmount(datatokenAddress).call()
|
||||
} catch (e) {
|
||||
LoggerInstance.error(`ERROR: Failed to get: ${e.message}`)
|
||||
}
|
||||
result = await this.unitsToAmount(datatokenAddress, result, tokenDecimals)
|
||||
return result
|
||||
amount = await this.unitsToAmount(datatokenAddress, amount, tokenDecimals)
|
||||
return amount
|
||||
}
|
||||
|
||||
/**
|
||||
@ -197,18 +197,18 @@ export class SideStaking extends SmartContract {
|
||||
* @param {String} datatokenAddress datatokenAddress
|
||||
* @return {String}
|
||||
*/
|
||||
async getvestingLastBlock(
|
||||
async getVestingLastBlock(
|
||||
ssAddress: string,
|
||||
datatokenAddress: string
|
||||
): Promise<string> {
|
||||
const sideStaking = this.getContract(ssAddress)
|
||||
let result = null
|
||||
let block = null
|
||||
try {
|
||||
result = await sideStaking.methods.getvestingLastBlock(datatokenAddress).call()
|
||||
block = await sideStaking.methods.getvestingLastBlock(datatokenAddress).call()
|
||||
} catch (e) {
|
||||
LoggerInstance.error(`ERROR: Failed to get: ${e.message}`)
|
||||
}
|
||||
return result
|
||||
return block
|
||||
}
|
||||
|
||||
/**
|
||||
@ -218,20 +218,20 @@ export class SideStaking extends SmartContract {
|
||||
* @param {number} tokenDecimals optional number of decimals of the token
|
||||
* @return {String}
|
||||
*/
|
||||
async getvestingAmountSoFar(
|
||||
async getVestingAmountSoFar(
|
||||
ssAddress: string,
|
||||
datatokenAddress: string,
|
||||
tokenDecimals?: number
|
||||
): Promise<string> {
|
||||
const sideStaking = this.getContract(ssAddress)
|
||||
let result = null
|
||||
let amount = null
|
||||
try {
|
||||
result = await sideStaking.methods.getvestingAmountSoFar(datatokenAddress).call()
|
||||
amount = await sideStaking.methods.getvestingAmountSoFar(datatokenAddress).call()
|
||||
} catch (e) {
|
||||
LoggerInstance.error(`ERROR: Failed to get: ${e.message}`)
|
||||
}
|
||||
result = await this.unitsToAmount(datatokenAddress, result, tokenDecimals)
|
||||
return result
|
||||
amount = await this.unitsToAmount(datatokenAddress, amount, tokenDecimals)
|
||||
return amount
|
||||
}
|
||||
|
||||
/** Send vested tokens available to the publisher address, can be called by anyone
|
||||
@ -248,7 +248,7 @@ export class SideStaking extends SmartContract {
|
||||
estimateGas?: G
|
||||
): Promise<G extends false ? TransactionReceipt : number> {
|
||||
const sideStaking = this.getContract(ssAddress)
|
||||
let result = null
|
||||
let vesting = null
|
||||
|
||||
const estGas = await calculateEstimatedGas(
|
||||
account,
|
||||
@ -258,7 +258,7 @@ export class SideStaking extends SmartContract {
|
||||
if (estimateGas) return estGas
|
||||
|
||||
try {
|
||||
result = await sideStaking.methods.getVesting(datatokenAddress).send({
|
||||
vesting = await sideStaking.methods.getVesting(datatokenAddress).send({
|
||||
from: account,
|
||||
gas: estGas + 1,
|
||||
gasPrice: await this.getFairGasPrice()
|
||||
@ -266,7 +266,7 @@ export class SideStaking extends SmartContract {
|
||||
} catch (e) {
|
||||
LoggerInstance.error('ERROR: Failed to join swap pool amount out')
|
||||
}
|
||||
return result
|
||||
return vesting
|
||||
}
|
||||
|
||||
/** Send vested tokens available to the publisher address, can be called by anyone
|
||||
@ -285,7 +285,7 @@ export class SideStaking extends SmartContract {
|
||||
estimateGas?: G
|
||||
): Promise<G extends false ? TransactionReceipt : number> {
|
||||
const sideStaking = this.getContract(ssAddress)
|
||||
let result = null
|
||||
let fee = null
|
||||
|
||||
const estGas = await calculateEstimatedGas(
|
||||
account,
|
||||
@ -297,7 +297,7 @@ export class SideStaking extends SmartContract {
|
||||
if (estimateGas) return estGas
|
||||
|
||||
try {
|
||||
result = await sideStaking.methods
|
||||
fee = await sideStaking.methods
|
||||
.setPoolSwapFee(datatokenAddress, poolAddress, swapFee)
|
||||
.send({
|
||||
from: account,
|
||||
@ -307,7 +307,7 @@ export class SideStaking extends SmartContract {
|
||||
} catch (e) {
|
||||
LoggerInstance.error('ERROR: Failed to join swap pool amount out')
|
||||
}
|
||||
return result
|
||||
return fee
|
||||
}
|
||||
|
||||
/**
|
||||
@ -317,12 +317,12 @@ export class SideStaking extends SmartContract {
|
||||
*/
|
||||
public async getRouter(ssAddress: string): Promise<string> {
|
||||
const sideStaking = this.getContract(ssAddress)
|
||||
let result = null
|
||||
let router = null
|
||||
try {
|
||||
result = await sideStaking.methods.router().call()
|
||||
router = await sideStaking.methods.router().call()
|
||||
} catch (e) {
|
||||
LoggerInstance.error(`ERROR: Failed to get Router address: ${e.message}`)
|
||||
}
|
||||
return result
|
||||
return router
|
||||
}
|
||||
}
|
||||
|
@ -193,9 +193,9 @@ describe('SideStaking unit test', () => {
|
||||
).to.equal(web3.utils.toWei(BASE_TOKEN_LIQUIDITY.toString()))
|
||||
})
|
||||
|
||||
it('#getBaseToken - should get baseToken address', async () => {
|
||||
it('#getBasetoken - should get baseToken address', async () => {
|
||||
expect(
|
||||
await sideStaking.getBaseToken(contracts.sideStakingAddress, datatoken)
|
||||
await sideStaking.getBasetoken(contracts.sideStakingAddress, datatoken)
|
||||
).to.equal(contracts.daiAddress)
|
||||
})
|
||||
|
||||
@ -211,9 +211,9 @@ describe('SideStaking unit test', () => {
|
||||
).to.equal(factoryOwner)
|
||||
})
|
||||
|
||||
it('#getBaseTokenBalance ', async () => {
|
||||
it('#getBasetokenBalance ', async () => {
|
||||
expect(
|
||||
await sideStaking.getBaseTokenBalance(contracts.sideStakingAddress, datatoken)
|
||||
await sideStaking.getBasetokenBalance(contracts.sideStakingAddress, datatoken)
|
||||
).to.equal('0')
|
||||
})
|
||||
|
||||
@ -232,21 +232,21 @@ describe('SideStaking unit test', () => {
|
||||
)
|
||||
})
|
||||
|
||||
it('#getvestingAmount ', async () => {
|
||||
it('#getVestingAmount ', async () => {
|
||||
expect(
|
||||
await sideStaking.getvestingAmount(contracts.sideStakingAddress, datatoken)
|
||||
await sideStaking.getVestingAmount(contracts.sideStakingAddress, datatoken)
|
||||
).to.equal('0')
|
||||
})
|
||||
|
||||
it('#getvestingLastBlock ', async () => {
|
||||
it('#getVestingLastBlock ', async () => {
|
||||
expect(
|
||||
await sideStaking.getvestingLastBlock(contracts.sideStakingAddress, datatoken)
|
||||
await sideStaking.getVestingLastBlock(contracts.sideStakingAddress, datatoken)
|
||||
).to.equal(initialBlock.toString())
|
||||
})
|
||||
|
||||
it('#getvestingAmountSoFar ', async () => {
|
||||
it('#getVestingAmountSoFar ', async () => {
|
||||
expect(
|
||||
await sideStaking.getvestingAmountSoFar(contracts.sideStakingAddress, datatoken)
|
||||
await sideStaking.getVestingAmountSoFar(contracts.sideStakingAddress, datatoken)
|
||||
).to.equal('0')
|
||||
})
|
||||
|
||||
@ -325,11 +325,11 @@ describe('SideStaking unit test', () => {
|
||||
)
|
||||
})
|
||||
|
||||
it('#exitswapPoolAmountIn- user1 exit the pool receiving only DAI', async () => {
|
||||
it('#exitSwapPoolAmountIn- user1 exit the pool receiving only DAI', async () => {
|
||||
const BPTAmountIn = '0.5'
|
||||
const minDAIOut = '0.5'
|
||||
|
||||
const tx = await pool.exitswapPoolAmountIn(
|
||||
const tx = await pool.exitSwapPoolAmountIn(
|
||||
user1,
|
||||
poolAddress,
|
||||
BPTAmountIn,
|
||||
@ -391,9 +391,9 @@ describe('SideStaking unit test', () => {
|
||||
expect(await datatokenContract.methods.balanceOf(user1).call()).to.equal('0')
|
||||
})
|
||||
|
||||
it('#getBaseTokenBalance ', async () => {
|
||||
it('#getBasetokenBalance ', async () => {
|
||||
expect(
|
||||
await sideStaking.getBaseTokenBalance(contracts.sideStakingAddress, datatoken)
|
||||
await sideStaking.getBasetokenBalance(contracts.sideStakingAddress, datatoken)
|
||||
).to.equal('0')
|
||||
})
|
||||
|
||||
@ -412,21 +412,21 @@ describe('SideStaking unit test', () => {
|
||||
)
|
||||
})
|
||||
|
||||
it('#getvestingAmount ', async () => {
|
||||
it('#getVestingAmount ', async () => {
|
||||
expect(
|
||||
await sideStaking.getvestingAmount(contracts.sideStakingAddress, datatoken)
|
||||
await sideStaking.getVestingAmount(contracts.sideStakingAddress, datatoken)
|
||||
).to.equal('0')
|
||||
})
|
||||
|
||||
it('#getvestingLastBlock ', async () => {
|
||||
it('#getVestingLastBlock ', async () => {
|
||||
expect(
|
||||
await sideStaking.getvestingLastBlock(contracts.sideStakingAddress, datatoken)
|
||||
await sideStaking.getVestingLastBlock(contracts.sideStakingAddress, datatoken)
|
||||
).to.equal(initialBlock.toString())
|
||||
})
|
||||
|
||||
it('#getvestingAmountSoFar ', async () => {
|
||||
it('#getVestingAmountSoFar ', async () => {
|
||||
expect(
|
||||
await sideStaking.getvestingAmountSoFar(contracts.sideStakingAddress, datatoken)
|
||||
await sideStaking.getVestingAmountSoFar(contracts.sideStakingAddress, datatoken)
|
||||
).to.equal('0')
|
||||
})
|
||||
|
||||
@ -501,11 +501,11 @@ describe('SideStaking unit test', () => {
|
||||
)
|
||||
})
|
||||
|
||||
it('#exitswapPoolAmountIn- user1 exit the pool receiving only USDC', async () => {
|
||||
it('#exitSwapPoolAmountIn- user1 exit the pool receiving only USDC', async () => {
|
||||
const BPTAmountIn = '0.5'
|
||||
const minUSDCOut = '0.5'
|
||||
|
||||
const tx = await pool.exitswapPoolAmountIn(
|
||||
const tx = await pool.exitSwapPoolAmountIn(
|
||||
user1,
|
||||
poolAddress,
|
||||
BPTAmountIn,
|
||||
|
Loading…
x
Reference in New Issue
Block a user