Skip to content

Commit

Permalink
Merge pull request #44 from rsksmart/add-lovell
Browse files Browse the repository at this point in the history
Add lovell network upgrade config
  • Loading branch information
marcos-iov authored Jun 6, 2024
2 parents 447e37d + 3c75a22 commit d7061fc
Show file tree
Hide file tree
Showing 5 changed files with 183 additions and 98 deletions.
14 changes: 11 additions & 3 deletions lib/precompiled-abi-forks-util.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ const iris300Precompiled = require("precompiled-iris300");
const hop400Precompiled = require("precompiled-hop400");
const precompiledFingerroot500 = require("precompiled-fingerroot500");
const precompiledArrowhead600 = require("precompiled-arrowhead600");
const precompiledLovell700 = require("precompiled-lovell700");

const ORCHID = 'orchid';
const WASABI = 'wasabi';
Expand All @@ -15,6 +16,7 @@ const HOP = 'hop';
const HOP401 = 'hop401';
const FINGERROOT = 'fingerroot';
const ARROWHEAD = 'arrowhead';
const LOVELL = 'lovell';

// Map to access the pre fork names of certain fork in constant time O(1)
const preForkMap = {
Expand All @@ -26,6 +28,7 @@ const preForkMap = {
[HOP401]: HOP,
[FINGERROOT]: HOP401,
[ARROWHEAD]: FINGERROOT,
[LOVELL]: ARROWHEAD
}

const cache = new Map();
Expand All @@ -39,13 +42,16 @@ const cache = new Map();
*/
const getBridge = (rskClient, forkName = '') => {

const { orchid, wasabi100, papyrus200, iris300, hop400, hop401, fingerroot500, arrowhead600 } = Runners.common.forks;
const { orchid, wasabi100, papyrus200, iris300, hop400, hop401, fingerroot500, arrowhead600, lovell700 } = Runners.common.forks;
if(cache.has(forkName)) {
return cache.get(forkName);
}

let bridge;
switch(forkName) {
case lovell700.name:
bridge = precompiledLovell700.bridge.build(rskClient);
break;
case arrowhead600.name:
bridge = precompiledArrowhead600.bridge.build(rskClient);
break;
Expand All @@ -70,7 +76,7 @@ const getBridge = (rskClient, forkName = '') => {
break;
default:
// return latest bridge
bridge = precompiledArrowhead600.bridge.build(rskClient);
bridge = precompiledLovell700.bridge.build(rskClient);
}
cache.set(forkName, bridge);
return bridge;
Expand All @@ -83,8 +89,10 @@ const getBridge = (rskClient, forkName = '') => {
*/
const getBridgeAbi = (forkName) => {

const { orchid, wasabi100, papyrus200, iris300, hop400, hop401, fingerroot500, arrowhead600 } = Runners.common.forks;
const { orchid, wasabi100, papyrus200, iris300, hop400, hop401, fingerroot500, arrowhead600, lovell700 } = Runners.common.forks;
switch(forkName) {
case lovell700.name:
return precompiledLovell700.bridge.abi;
case arrowhead600.name:
return precompiledArrowhead600.bridge.abi;
case fingerroot500.name:
Expand Down
Loading

0 comments on commit d7061fc

Please sign in to comment.