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

refactor: add lsp1 data in ownership function hooks #789

Merged
merged 6 commits into from
Nov 6, 2023
Merged
Show file tree
Hide file tree
Changes from 2 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
12 changes: 6 additions & 6 deletions contracts/LSP0ERC725Account/LSP0ERC725AccountCore.sol
YamenMerhi marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -543,7 +543,7 @@ abstract contract LSP0ERC725AccountCore is
// notify the pending owner through LSP1
pendingNewOwner.notifyUniversalReceiver(
_TYPEID_LSP0_OwnershipTransferStarted,
""
abi.encode(currentOwner, pendingNewOwner)
);

// reset the transfer ownership lock
Expand All @@ -563,7 +563,7 @@ abstract contract LSP0ERC725AccountCore is
// notify the pending owner through LSP1
pendingNewOwner.notifyUniversalReceiver(
_TYPEID_LSP0_OwnershipTransferStarted,
""
abi.encode(currentOwner, pendingNewOwner)
);

// reset the transfer ownership lock
Expand Down Expand Up @@ -605,13 +605,13 @@ abstract contract LSP0ERC725AccountCore is
// notify the previous owner if supports LSP1
previousOwner.notifyUniversalReceiver(
_TYPEID_LSP0_OwnershipTransferred_SenderNotification,
""
abi.encode(previousOwner, pendingOwnerAddress)
);

// notify the pending owner if supports LSP1
pendingOwnerAddress.notifyUniversalReceiver(
_TYPEID_LSP0_OwnershipTransferred_RecipientNotification,
""
abi.encode(previousOwner, pendingOwnerAddress)
);

// If msg.sender != pendingOwnerAddress & verifyAfter is true, Call {lsp20VerifyCallResult} on the new owner
Expand Down Expand Up @@ -644,7 +644,7 @@ abstract contract LSP0ERC725AccountCore is
if (owner() == address(0)) {
previousOwner.notifyUniversalReceiver(
_TYPEID_LSP0_OwnershipTransferred_SenderNotification,
""
abi.encode(accountOwner, address(0))
);
}
} else {
Expand All @@ -658,7 +658,7 @@ abstract contract LSP0ERC725AccountCore is
if (owner() == address(0)) {
previousOwner.notifyUniversalReceiver(
_TYPEID_LSP0_OwnershipTransferred_SenderNotification,
""
abi.encode(accountOwner, address(0))
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import {

// constants
import { LSP1_TYPE_IDS, LSP20_SUCCESS_VALUES, OPERATION_TYPES } from '../../constants';
import { abiCoder } from './..//utils/helpers';

export type LSP20TestContext = {
accounts: SignerWithAddress[];
Expand Down Expand Up @@ -237,7 +238,10 @@ export const shouldBehaveLikeLSP20 = (buildContext: () => Promise<LSP20TestConte
context.universalProfile.address,
0,
LSP1_TYPE_IDS.LSP0OwnershipTransferred_SenderNotification,
'0x',
abiCoder.encode(
['address', 'address'],
[newContractOwner.address, ethers.constants.AddressZero],
),
'0x',
);
});
Expand Down
5 changes: 4 additions & 1 deletion tests/UniversalProfile.behaviour.ts
Original file line number Diff line number Diff line change
Expand Up @@ -772,7 +772,10 @@ export const shouldBehaveLikeLSP3 = (
context.universalProfile.address,
0,
LSP1_TYPE_IDS.LSP0OwnershipTransferred_SenderNotification,
'0x',
abiCoder.encode(
['address', 'address'],
[newContractOwner.address, ethers.constants.AddressZero],
),
'0x',
);
});
Expand Down
Loading