mirror of
https://github.com/oceanprotocol/ocean.js.git
synced 2024-11-26 20:39:05 +01:00
fix opfee and DataToken naming
This commit is contained in:
parent
7ff158a98e
commit
6c9746a8ad
@ -166,10 +166,10 @@ The process of creating and deploying the ERC20 datatokens has been automated by
|
||||
|
||||
```Javascript
|
||||
const Web3 = require("web3");
|
||||
const { Ocean, DataTokens } = require("@oceanprotocol/lib");
|
||||
const { Ocean, Datatokens } = require("@oceanprotocol/lib");
|
||||
|
||||
const { factoryABI } = require("@oceanprotocol/contracts/artifacts/DTFactory.json");
|
||||
const { datatokensABI } = require("@oceanprotocol/contracts/artifacts/DataTokenTemplate.json");
|
||||
const { datatokensABI } = require("@oceanprotocol/contracts/artifacts/DatatokenTemplate.json");
|
||||
const { config, contracts, urls } = require("./config");
|
||||
|
||||
const init = async () => {
|
||||
@ -180,7 +180,7 @@ const init = async () => {
|
||||
const alice = accounts[0].id;
|
||||
console.log('Alice account address:', alice)
|
||||
|
||||
const datatoken = new DataTokens(
|
||||
const datatoken = new Datatokens(
|
||||
contracts.DTFactory,
|
||||
factoryABI,
|
||||
datatokensABI,
|
||||
|
@ -342,7 +342,7 @@ ocean.exchange.getAllExchangesSwaps(account: string): Promise<FixedPriceSwap[]>;
|
||||
consume/start, stop, results, status, define-service
|
||||
|
||||
```Typescript
|
||||
ocean.compute.start(did: string, txId: string, tokenAddress: string, consumerAccount: Account, algorithmDid?: string, algorithmMeta?: MetadataAlgorithm, output?: Output, serviceIndex?: string, serviceType?: string, algorithmTransferTxId?: string, algorithmDataToken?: string): Promise<ComputeJob>;
|
||||
ocean.compute.start(did: string, txId: string, tokenAddress: string, consumerAccount: Account, algorithmDid?: string, algorithmMeta?: MetadataAlgorithm, output?: Output, serviceIndex?: string, serviceType?: string, algorithmTransferTxId?: string, algorithmDatatoken?: string): Promise<ComputeJob>;
|
||||
```
|
||||
|
||||
```Typescript
|
||||
|
@ -121,10 +121,10 @@ Now open the `marketplace.js` file in your text editor. Enter the following code
|
||||
|
||||
```Javascript
|
||||
const Web3 = require("web3");
|
||||
const { Ocean, DataTokens } = require("@oceanprotocol/lib");
|
||||
const { Ocean, Datatokens } = require("@oceanprotocol/lib");
|
||||
|
||||
const { factoryABI } = require("@oceanprotocol/contracts/artifacts/DTFactory.json");
|
||||
const { datatokensABI } = require("@oceanprotocol/contracts/artifacts/DataTokenTemplate.json");
|
||||
const { datatokensABI } = require("@oceanprotocol/contracts/artifacts/DatatokenTemplate.json");
|
||||
const { config, contracts, urls } = require("./config");
|
||||
|
||||
|
||||
@ -137,7 +137,7 @@ const init = async () => {
|
||||
const alice = accounts[0].id;
|
||||
console.log('Alice account address:', alice)
|
||||
|
||||
const datatoken = new DataTokens(
|
||||
const datatoken = new Datatokens(
|
||||
contracts.DTFactory,
|
||||
factoryABI,
|
||||
datatokensABI,
|
||||
|
@ -114,10 +114,10 @@ Now open the `index.js` file in your text editor. Enter the following code and s
|
||||
|
||||
```Javascript
|
||||
const Web3 = require("web3");
|
||||
const { Ocean, DataTokens } = require("@oceanprotocol/lib");
|
||||
const { Ocean, Datatokens } = require("@oceanprotocol/lib");
|
||||
|
||||
const { factoryABI } = require("@oceanprotocol/contracts/artifacts/DTFactory.json");
|
||||
const { datatokensABI } = require("@oceanprotocol/contracts/artifacts/DataTokenTemplate.json");
|
||||
const { datatokensABI } = require("@oceanprotocol/contracts/artifacts/DatatokenTemplate.json");
|
||||
const { config, contracts, urls } = require("./config");
|
||||
|
||||
|
||||
@ -130,7 +130,7 @@ const init = async () => {
|
||||
const alice = accounts[0].id;
|
||||
console.log('Alice account address:', alice)
|
||||
|
||||
const datatoken = new DataTokens(
|
||||
const datatoken = new Datatokens(
|
||||
contracts.DTFactory,
|
||||
factoryABI,
|
||||
datatokensABI,
|
||||
|
@ -568,7 +568,7 @@ export class Router {
|
||||
const estGas = await this.estGasUpdateOPFFee(address, newFee)
|
||||
|
||||
// Invoke createToken function of the contract
|
||||
const trxReceipt = await this.router.methods.updateOPFFee(newFee).send({
|
||||
const trxReceipt = await this.router.methods.updateOPFFee(newFee, newFee).send({
|
||||
from: address,
|
||||
gas: estGas + 1,
|
||||
gasPrice: await getFairGasPrice(this.web3)
|
||||
|
@ -68,7 +68,7 @@ export class Pool {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Alloance for both DataToken and Ocean
|
||||
* Get Alloance for both Datatoken and Ocean
|
||||
* @param {String } tokenAdress
|
||||
* @param {String} owner
|
||||
* @param {String} spender
|
||||
|
@ -58,7 +58,7 @@ export class SideStaking {
|
||||
* @param {String} datatokenAddress datatoken address
|
||||
* @return {String}
|
||||
*/
|
||||
async getDataTokenCirculatingSupply(
|
||||
async getDatatokenCirculatingSupply(
|
||||
ssAddress: string,
|
||||
datatokenAddress: string
|
||||
): Promise<string> {
|
||||
@ -66,7 +66,7 @@ export class SideStaking {
|
||||
let result = null
|
||||
try {
|
||||
result = await sideStaking.methods
|
||||
.getDataTokenCirculatingSupply(datatokenAddress)
|
||||
.getDatatokenCirculatingSupply(datatokenAddress)
|
||||
.call()
|
||||
} catch (e) {
|
||||
LoggerInstance.error(`ERROR: Failed to get: ${e.message}`)
|
||||
@ -81,7 +81,7 @@ export class SideStaking {
|
||||
* @param {String} datatokenAddress datatoken address
|
||||
* @return {String}
|
||||
*/
|
||||
async getDataTokenCurrentCirculatingSupply(
|
||||
async getDatatokenCurrentCirculatingSupply(
|
||||
ssAddress: string,
|
||||
datatokenAddress: string
|
||||
): Promise<string> {
|
||||
@ -89,7 +89,7 @@ export class SideStaking {
|
||||
const sideStaking = new this.web3.eth.Contract(this.ssAbi, ssAddress)
|
||||
let result = null
|
||||
result = await sideStaking.methods
|
||||
.getDataTokenCurrentCirculatingSupply(datatokenAddress)
|
||||
.getDatatokenCurrentCirculatingSupply(datatokenAddress)
|
||||
.call()
|
||||
return result.toString()
|
||||
} catch (e) {
|
||||
@ -184,7 +184,7 @@ export class SideStaking {
|
||||
const sideStaking = new this.web3.eth.Contract(this.ssAbi, ssAddress)
|
||||
let result = null
|
||||
try {
|
||||
result = await sideStaking.methods.getDataTokenBalance(datatokenAddress).call()
|
||||
result = await sideStaking.methods.getDatatokenBalance(datatokenAddress).call()
|
||||
} catch (e) {
|
||||
LoggerInstance.error(`ERROR: Failed to get: ${e.message}`)
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ export class Datatoken {
|
||||
public nft: Nft
|
||||
|
||||
/**
|
||||
* Instantiate ERC20 DataTokens
|
||||
* Instantiate ERC20 Datatokens
|
||||
* @param {AbiItem | AbiItem[]} datatokensAbi
|
||||
* @param {Web3} web3
|
||||
*/
|
||||
@ -1216,7 +1216,7 @@ export class Datatoken {
|
||||
return roles
|
||||
}
|
||||
|
||||
/** Returns the DataToken capital
|
||||
/** Returns the Datatoken capital
|
||||
* @param {String} dtAddress Datatoken adress
|
||||
* @return {Promise<string>}
|
||||
*/
|
||||
|
@ -129,12 +129,12 @@ describe('Router unit test', () => {
|
||||
})
|
||||
|
||||
it('#getCurrentOPFFee - should return actual OPF Fee', async () => {
|
||||
const opfFee = 1e15
|
||||
const opfFee = 0
|
||||
expect(await router.getCurrentOPFFee()).to.equal(opfFee.toString())
|
||||
})
|
||||
|
||||
it('#updateOPFFee - should update opf fee if Router Owner', async () => {
|
||||
const opfFee = 1e15
|
||||
const opfFee = 0
|
||||
expect(await router.getCurrentOPFFee()).to.equal(opfFee.toString())
|
||||
const newOPFFee = 1e14
|
||||
await router.updateOPFFee(contracts.accounts[0], 1e14)
|
||||
|
@ -196,17 +196,17 @@ describe('SideStaking unit test', () => {
|
||||
)
|
||||
})
|
||||
|
||||
it('#getDataTokenCirculatingSupply - should get datatoken supply in circulation (vesting amount excluded)', async () => {
|
||||
it('#getDatatokenCirculatingSupply - should get datatoken supply in circulation (vesting amount excluded)', async () => {
|
||||
expect(
|
||||
await sideStaking.getDataTokenCirculatingSupply(
|
||||
await sideStaking.getDatatokenCirculatingSupply(
|
||||
contracts.sideStakingAddress,
|
||||
erc20Token
|
||||
)
|
||||
).to.equal(web3.utils.toWei('12000'))
|
||||
})
|
||||
it('#getDataTokenCurrentCirculatingSupply - should get datatoken supply in circulation ', async () => {
|
||||
it('#getDatatokenCurrentCirculatingSupply - should get datatoken supply in circulation ', async () => {
|
||||
expect(
|
||||
await sideStaking.getDataTokenCurrentCirculatingSupply(
|
||||
await sideStaking.getDatatokenCurrentCirculatingSupply(
|
||||
contracts.sideStakingAddress,
|
||||
erc20Token
|
||||
)
|
||||
|
Loading…
x
Reference in New Issue
Block a user