Skip to content

Commit

Permalink
Use new ownership fn util
Browse files Browse the repository at this point in the history
  • Loading branch information
yorhodes committed Oct 28, 2024
1 parent 411f376 commit 69d9060
Showing 1 changed file with 10 additions and 23 deletions.
33 changes: 10 additions & 23 deletions typescript/sdk/src/ism/EvmIsmModule.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,18 @@
import { ethers } from 'ethers';
import { Logger } from 'pino';

import {
DomainRoutingIsm__factory,
Ownable__factory,
} from '@hyperlane-xyz/core';
import { DomainRoutingIsm__factory } from '@hyperlane-xyz/core';
import {
Address,
Domain,
ProtocolType,
assert,
deepEquals,
eqAddress,
intersection,
rootLogger,
} from '@hyperlane-xyz/utils';

import { transferOwnershipTransactions } from '../contracts/contracts.js';
import { HyperlaneAddresses } from '../contracts/types.js';
import {
HyperlaneModule,
Expand Down Expand Up @@ -170,24 +167,14 @@ export class EvmIsmModule extends HyperlaneModule<
}

// Lastly, check if the resolved owner is different from the current owner
const provider = this.multiProvider.getProvider(this.chain);
const owner = await Ownable__factory.connect(
this.args.addresses.deployedIsm,
provider,
).owner();

// Return an ownership transfer transaction if required
if (!eqAddress(targetConfig.owner, owner)) {
updateTxs.push({
annotation: 'Transferring ownership of ownable ISM...',
chainId: this.domainId,
to: this.args.addresses.deployedIsm,
data: Ownable__factory.createInterface().encodeFunctionData(
'transferOwnership(address)',
[targetConfig.owner],
),
});
}
updateTxs.push(
...transferOwnershipTransactions(
this.domainId,
this.args.addresses.deployedIsm,
currentConfig,
targetConfig,
),
);

return updateTxs;
}
Expand Down

0 comments on commit 69d9060

Please sign in to comment.