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

Add instructions for enrolling watcher in da-bridge demo #515

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
1 change: 1 addition & 0 deletions packages/contracts-da-bridge/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@ PRIVATE_KEY=
GOERLI_DOMAIN=
AVAIL_DOMAIN=
AVAIL_UPDATER_ADDRESS=
DA_BRIDGE_WATCHER_ADDRESS=
OPTIMISTIC_SECONDS=
DA_BRIDGE_PALLET_ID=
13 changes: 13 additions & 0 deletions packages/contracts-da-bridge/contracts/script/DeployDemo.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,15 @@ contract DeployDABridgeRouter is Script {
uint256 localDomain;
uint256 remoteDomain;
address remoteUpdater;
address daBridgeWatcher;
uint256 optimisticSeconds;
bytes32 daBridgePalletId;

function loadEnvVars() public {
localDomain = vm.envUint("GOERLI_DOMAIN");
remoteDomain = vm.envUint("AVAIL_DOMAIN");
remoteUpdater = vm.envAddress("AVAIL_UPDATER_ADDRESS");
daBridgeWatcher = vm.envAddress("DA_BRIDGE_WATCHER_ADDRESS");
optimisticSeconds = vm.envUint("OPTIMISTIC_SECONDS");
daBridgePalletId = vm.envBytes32("DA_BRIDGE_PALLET_ID");
}
Expand All @@ -38,11 +40,22 @@ contract DeployDABridgeRouter is Script {
);

XAppConnectionManager manager = new XAppConnectionManager();

// Entity to with permission to set home, enroll replica, and set
// watcher permissions is contract owner (deployer by default).
manager.setHome(address(home));
manager.ownerEnrollReplica(address(replica), uint32(remoteDomain));
manager.setWatcherPermission(
daBridgeWatcher,
uint32(remoteDomain),
true
);

DABridgeRouter router = new DABridgeRouter();
router.initialize(address(manager), uint32(remoteDomain));

// Entity to with permission to enroll remote router is contract owner
// (deployer by default).
router.enrollRemoteRouter(uint32(remoteDomain), daBridgePalletId);

vm.stopBroadcast();
Expand Down