Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

V4 barge #1608

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions .env.barge
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
NEXT_PUBLIC_METADATACACHE_URI="http://localhost:5000"
NEXT_PUBLIC_SUBGRAPH_URI="http://localhost:9000"
NEXT_RBAC_URL="http://localhost:3000"

#NEXT_PUBLIC_INFURA_PROJECT_ID="xxx"
#NEXT_PUBLIC_MARKET_FEE_ADDRESS="0xxx"
#NEXT_PUBLIC_PUBLISHER_MARKET_ORDER_FEE="1"
#NEXT_PUBLIC_PUBLISHER_MARKET_POOL_SWAP_FEE="1"
#NEXT_PUBLIC_PUBLISHER_MARKET_FIXED_SWAP_FEE="1"
#NEXT_PUBLIC_CONSUME_MARKET_ORDER_FEE="1"
#NEXT_PUBLIC_CONSUME_MARKET_POOL_SWAP_FEE="1"
#NEXT_PUBLIC_CONSUME_MARKET_FIXED_SWAP_FEE="1"



#NEXT_PUBLIC_PORTIS_ID="xxx"


#
# ADVANCED SETTINGS
#

# Toggle pricing options presented during price creation
#NEXT_PUBLIC_ALLOW_FIXED_PRICING="true"
#NEXT_PUBLIC_ALLOW_DYNAMIC_PRICING="true"
#NEXT_PUBLIC_ALLOW_FREE_PRICING="true"

# Privacy Preference Center
#NEXT_PUBLIC_PRIVACY_PREFERENCE_CENTER="true"
4 changes: 2 additions & 2 deletions app.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ module.exports = {

// List of chainIds which metadata cache queries will return by default.
// This preselects the Chains user preferences.
chainIds: [1, 137, 56, 246, 1285],
chainIds: [1, 137, 56, 246, 1285, 8996],

// List of all supported chainIds. Used to populate the Chains user preferences list.
chainIdsSupported: [1, 137, 56, 246, 1285, 3, 4, 80001, 1287],
chainIdsSupported: [1, 137, 56, 246, 1285, 3, 4, 80001, 1287, 8996],

infuraProjectId: process.env.NEXT_PUBLIC_INFURA_PROJECT_ID || 'xxx',

Expand Down
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@
"homepage": "https://market.oceanprotocol.com",
"scripts": {
"start": "npm run pregenerate && next dev -p 8000",
"start-local": "npm run pregenerate-local && next dev -p 8000",
"build": "npm run pregenerate && next build",
"build:static": "npm run build && next export",
"serve": "serve -s public/",
"pregenerate": "bash scripts/pregenerate.sh",
"pregenerate-local": "bash scripts/pregenerate-local.sh",
"test": "npm run pregenerate && npm run lint && npm run type-check && npm run jest",
"jest": "jest -c .jest/jest.config.js",
"jest:watch": "jest -c .jest/jest.config.js --watch",
Expand All @@ -19,6 +21,7 @@
"deploy:s3": "bash scripts/deploy-s3.sh",
"postinstall": "husky install",
"codegen:apollo": "apollo client:codegen --endpoint=https://v4.subgraph.ropsten.oceanprotocol.com/subgraphs/name/oceanprotocol/ocean-subgraph --target typescript --tsFileExtension=d.ts --outputFlat src/@types/subgraph/",
"codegen:apollo-local": "apollo client:codegen --endpoint=http://localhost:9000/subgraphs/name/oceanprotocol/ocean-subgraph --target typescript --tsFileExtension=d.ts --outputFlat src/@types/subgraph/",
"storybook": "cross-env NODE_ENV=test start-storybook -p 6006 --quiet",
"storybook:build": "cross-env NODE_ENV=test build-storybook"
},
Expand Down
10 changes: 10 additions & 0 deletions scripts/pregenerate-local.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/usr/bin/env bash

# Write out repo metadata
node ./scripts/write-repo-metadata > content/repo-metadata.json

# Generate Apollo typings
npm run codegen:apollo-local

# Fetch EVM networks metadata
node ./scripts/write-networks-metadata > content/networks-metadata.json
17 changes: 17 additions & 0 deletions scripts/write-networks-metadata.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,22 @@ const axios = require('axios')
const chainDataUrl = 'https://chainid.network/chains.json'

axios(chainDataUrl).then((response) => {
const development = {
name: 'Development',
chain: 'ETH',
icon: 'ethereum',
rpc: ['http://localhost:8545'],
faucets: [],
nativeCurrency: {
name: 'Ether',
symbol: 'ETH',
decimals: 18
},
shortName: 'eth',
chainId: 8996,
networkId: 8996,
slip44: 60
}
response.data.push(development)
process.stdout.write(JSON.stringify(response.data, null, ' '))
})
34 changes: 20 additions & 14 deletions src/@utils/ocean.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,25 @@
import { ConfigHelper, LoggerInstance, Config } from '@oceanprotocol/lib'
// import contractAddresses from '@oceanprotocol/contracts/artifacts/address.json'
import contractAddresses from '@oceanprotocol/contracts/artifacts/address.json'
import { AbiItem } from 'web3-utils/types'
import Web3 from 'web3'

export function getDevelopmentConfig(): Config {
return {
oceanTokenAddress: contractAddresses.development?.Ocean,
erc721FactoryAddress: contractAddresses.development?.ERC721Factory,
poolTemplateAddress: contractAddresses.development?.poolTemplate,
fixedRateExchangeAddress: contractAddresses.development?.FixedPrice,
dispenserAddress: contractAddresses.development?.Dispenser,
sideStakingAddress: contractAddresses.development?.Staking,
// metadataContractAddress: contractAddresses.development?.Metadata,
subgraphUri:
process.env.NEXT_PUBLIC_SUBGRAPH_URI ||
'https://v4.subgraph.rinkeby.oceanprotocol.com'
} as unknown as Config
}

export function getOceanConfig(network: string | number): Config {
const config = new ConfigHelper().getConfig(
let config = new ConfigHelper().getConfig(
network,
network === 'polygon' ||
network === 'moonbeamalpha' ||
Expand All @@ -16,21 +31,12 @@ export function getOceanConfig(network: string | number): Config {
? undefined
: process.env.NEXT_PUBLIC_INFURA_PROJECT_ID
) as Config
if (network === 8996) {
config = { ...config, ...getDevelopmentConfig() }
}
return config as Config
}

export function getDevelopmentConfig(): Config {
return {
// factoryAddress: contractAddresses.development?.DTFactory,
// poolFactoryAddress: contractAddresses.development?.BFactory,
// fixedRateExchangeAddress: contractAddresses.development?.FixedRateExchange,
// metadataContractAddress: contractAddresses.development?.Metadata,
// oceanTokenAddress: contractAddresses.development?.Ocean,
// There is no subgraph in barge so we hardcode the Rinkeby one for now
subgraphUri: 'https://v4.subgraph.rinkeby.oceanprotocol.com'
} as Config
}

export async function getOceanBalance(
accountId: string,
networkId: number,
Expand Down