Skip to content

Commit

Permalink
fix: transfer only domains of root owner
Browse files Browse the repository at this point in the history
  • Loading branch information
JGiter committed Jul 4, 2023
1 parent 3ebbe3d commit a4cb498
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/utils/transfer-domains.ts
Expand Up @@ -27,6 +27,7 @@ export const transferDomain = async ({
chainId: ChainId;
dryRun?: boolean;
}) => {
const rootOwner = await signer.getAddress();
const logger = getLogger();
const { domainHierarchy, ensRegistry, domainReader } = await initDomains(
signer,
Expand Down Expand Up @@ -108,7 +109,13 @@ export const transferDomain = async ({
`${dryRun ? 'Would transfer' : 'Transferring'} ${domain} to new owner`
);
if (!dryRun) {
await (await ensRegistry.setOwner(domainHash, newOwner)).wait();
// only domains belonging to root owner will be tranferred. owners od other domains will be preserved
await (
await ensRegistry.setOwner(
domainHash,
owner === rootOwner ? newOwner : owner
)
).wait();
}
};

Expand Down

0 comments on commit a4cb498

Please sign in to comment.