Skip to content

Commit

Permalink
BASE integration (#139)
Browse files Browse the repository at this point in the history
* Add BASE constants

* Add testnet constants

* Add base testnet default scoreFunctionId

* Add BASE mainnet constants

* Version bump

* Add build
  • Loading branch information
Mihajlo-Pavlovic authored Jul 5, 2024
1 parent aa79da9 commit 43cb7d4
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 6 deletions.
17 changes: 16 additions & 1 deletion constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ const BLOCKCHAINS = {
hubContract: '0xD2bA102A0b11944d00180eE8136208ccF87bC39A',
gasPriceOracleLink: 'https://blockscout.chiadochain.net/api/v1/gas-price-oracle',
},
'base:84532': {
hubContract: '0x6C861Cb69300C34DfeF674F7C00E734e840C29C0',
rpc: 'https://sepolia.base.org',
},
},
testnet: {
'otp:20430': {
Expand All @@ -50,6 +54,10 @@ const BLOCKCHAINS = {
hubContract: '0xC06210312C9217A0EdF67453618F5eB96668679A',
gasPriceOracleLink: 'https://blockscout.chiadochain.net/api/v1/gas-price-oracle',
},
'base:84532': {
hubContract: '0x144eDa5cbf8926327cb2cceef168A121F0E4A299',
rpc: 'https://sepolia.base.org',
},
},
mainnet: {
'otp:2043': {
Expand All @@ -61,12 +69,16 @@ const BLOCKCHAINS = {
hubContract: '0xbEF14fc04F870c2dD65c13Df4faB6ba01A9c746b',
gasPriceOracleLink: 'https://api.gnosisscan.io/api?module=proxy&action=eth_gasPrice',
},
'base:8453': {
hubContract: '0xaBfcf2ad1718828E7D3ec20435b0d0b5EAfbDf2c',
rpc: 'https://mainnet.base.org',
},
},
};

const INCENTIVE_TYPE = {
NEUROWEB: 'Neuroweb',
}
};

const BLOCKCHAINS_RENAME_PAIRS = {
hardhat1: 'hardhat1:31337',
Expand Down Expand Up @@ -171,14 +183,17 @@ const DEFAULT_PROXIMITY_SCORE_FUNCTIONS_PAIR_IDS = {
devnet: {
'otp:2160': 2,
'gnosis:10200': 2,
'base:84532': 2,
},
testnet: {
'otp:20430': 2,
'gnosis:10200': 2,
'base:84532': 2,
},
mainnet: {
'otp:2043': 2,
'gnosis:100': 2,
'base:8453': 2,
},
};

Expand Down
2 changes: 1 addition & 1 deletion dist/dkg.min.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "dkg.js",
"version": "6.4.0",
"version": "6.5.0",
"description": "Javascript library for interaction with the OriginTrail Decentralized Knowledge Graph",
"main": "index.js",
"scripts": {
Expand Down
4 changes: 3 additions & 1 deletion services/blockchain-service/blockchain-service-base.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ class BlockchainServiceBase {

if (blockchain.name.startsWith('otp')) {
gasPrice = await web3Instance.eth.getGasPrice();
} else if (blockchain.name.startsWith('base')) {
gasPrice = await web3Instance.eth.getGasPrice();
} else if (blockchain.name.startsWith('gnosis')) {
const response = await axios.get(blockchain.gasPriceOracleLink);
if (blockchain.name.split(':')[1] === '100') {
Expand Down Expand Up @@ -810,7 +812,7 @@ class BlockchainServiceBase {
const web3Instance = await this.getWeb3Instance(blockchain);
try {
let gasPrice;
if (blockchain.name.startsWith('otp')) {
if (blockchain.name.startsWith('otp') || blockchain.name.startsWith('base')) {
gasPrice = await web3Instance.eth.getGasPrice();
} else if (blockchain.name.startsWith('gnosis')) {
const response = await axios.get(blockchain.gasPriceOracleLink);
Expand Down

0 comments on commit 43cb7d4

Please sign in to comment.