Adding Routers and Components - Step by Step Guide
Adding new routers and components to a Node must be done in the correct order. The following constraints apply:
A Node Owner cannot add a Router that is not whitelisted at the protocol level
A Node Owner cannot add a component unless both:
The component is whitelisted on a Router by the RegistryOwner
This specific Router has already been added to the Node by the owner
1. Protocol Owner Actions
// Must happen first - whitelist router at protocol level
registry.setRegistryType(routerAddress, RegistryType.ROUTER, true);
2. Registry Owner Actions
// Whitelist component on specific router
router.setWhitelistStatus(componentAddress, true);
3. Node Owner Actions
// First add router to node
node.addRouter(routerAddress);
// Then add component that uses that router
node.addComponent(
componentAddress, // component address
targetWeight, // e.g., 0.7 ether for 70%
maxDelta, // acceptable deviation
routerAddress // must match router added above
);
If steps are performed out of order:
Adding component before router: Reverts with
RouterNotApproved
Adding component before router whitelist: Reverts with
NotWhitelisted
Adding router before protocol whitelist: Reverts with
NotWhitelisted
Adding component before component whitelist: Reverts with
NotWhitelisted
Last updated