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, XAppConnectionManager__factory,
UpgradeBeaconController, UpgradeBeaconController,
UpgradeBeaconController__factory, UpgradeBeaconController__factory,
ValidatorManager, OutboxMultisigValidatorManager,
ValidatorManager__factory, OutboxMultisigValidatorManager__factory,
InboxMultisigValidatorManager,
InboxMultisigValidatorManager__factory,
Outbox, Outbox,
Outbox__factory, Outbox__factory,
Inbox, Inbox,
@ -18,9 +20,10 @@ import { ChainName, ProxiedAddress } from '../types';
export type CoreContractAddresses = { export type CoreContractAddresses = {
upgradeBeaconController: types.Address; upgradeBeaconController: types.Address;
xAppConnectionManager: types.Address; xAppConnectionManager: types.Address;
validatorManager: types.Address;
outbox: ProxiedAddress; outbox: ProxiedAddress;
inboxes: Partial<Record<ChainName, ProxiedAddress>>; inboxes: Partial<Record<ChainName, ProxiedAddress>>;
outboxMultisigValidatorManager: types.Address;
inboxMultisigValidatorManagers: Partial<Record<ChainName, types.Address>>;
}; };
export class CoreContracts extends AbacusAppContracts<CoreContractAddresses> { export class CoreContracts extends AbacusAppContracts<CoreContractAddresses> {
@ -32,6 +35,17 @@ export class CoreContracts extends AbacusAppContracts<CoreContractAddresses> {
return Inbox__factory.connect(inbox.proxy, this.connection); 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 { get outbox(): Outbox {
return Outbox__factory.connect( return Outbox__factory.connect(
this.addresses.outbox.proxy, this.addresses.outbox.proxy,
@ -39,9 +53,9 @@ export class CoreContracts extends AbacusAppContracts<CoreContractAddresses> {
); );
} }
get validatorManager(): ValidatorManager { get outboxMultisigValidatorManager(): OutboxMultisigValidatorManager {
return ValidatorManager__factory.connect( return OutboxMultisigValidatorManager__factory.connect(
this.addresses.validatorManager, this.addresses.outboxMultisigValidatorManager,
this.connection, this.connection,
); );
} }

Loading…
Cancel
Save