Add inbox / outbox multisig validator managers to core contracts

pull/334/head
Trevor Porter 3 years ago
parent a8766ae239
commit 74cc8e8dd7
  1. 26
      typescript/sdk/src/core/contracts.ts

@ -3,8 +3,10 @@ import {
XAppConnectionManager__factory,
UpgradeBeaconController,
UpgradeBeaconController__factory,
ValidatorManager,
ValidatorManager__factory,
OutboxMultisigValidatorManager,
OutboxMultisigValidatorManager__factory,
InboxMultisigValidatorManager,
InboxMultisigValidatorManager__factory,
Outbox,
Outbox__factory,
Inbox,
@ -18,9 +20,10 @@ import { ChainName, ProxiedAddress } from '../types';
export type CoreContractAddresses = {
upgradeBeaconController: types.Address;
xAppConnectionManager: types.Address;
validatorManager: types.Address;
outbox: ProxiedAddress;
inboxes: Partial<Record<ChainName, ProxiedAddress>>;
outboxMultisigValidatorManager: types.Address;
inboxMultisigValidatorManagers: Partial<Record<ChainName, types.Address>>;
};
export class CoreContracts extends AbacusAppContracts<CoreContractAddresses> {
@ -32,6 +35,17 @@ export class CoreContracts extends AbacusAppContracts<CoreContractAddresses> {
return Inbox__factory.connect(inbox.proxy, this.connection);
}
inboxMultisigValidatorManager(chain: ChainName): InboxMultisigValidatorManager {
const inboxMultisigValidatorManager = this.addresses.inboxMultisigValidatorManagers[chain];
if (!inboxMultisigValidatorManager) {
throw new Error(`No inboxMultisigValidatorManager for ${chain}`);
}
return InboxMultisigValidatorManager__factory.connect(
inboxMultisigValidatorManager,
this.connection,
);
}
get outbox(): Outbox {
return Outbox__factory.connect(
this.addresses.outbox.proxy,
@ -39,9 +53,9 @@ export class CoreContracts extends AbacusAppContracts<CoreContractAddresses> {
);
}
get validatorManager(): ValidatorManager {
return ValidatorManager__factory.connect(
this.addresses.validatorManager,
get outboxMultisigValidatorManager(): OutboxMultisigValidatorManager {
return OutboxMultisigValidatorManager__factory.connect(
this.addresses.outboxMultisigValidatorManager,
this.connection,
);
}

Loading…
Cancel
Save