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!: Update ClaimOwnership, LSP0 and LSP9 InterfaceId #298

Merged
merged 3 commits into from
Sep 5, 2022
Merged
Show file tree
Hide file tree
Changes from all 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
56 changes: 48 additions & 8 deletions constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ const INTERFACE_IDS = {
ERC1155: '0xd9b67a26',
ERC725X: '0x44c028fe',
ERC725Y: '0x714df77c',
LSP0ERC725Account: '0x9a3bfe88',
LSP0ERC725Account: '0xeb6be62e',
LSP1UniversalReceiver: '0x6bb56a14',
LSP1UniversalReceiverDelegate: '0xa245bbda',
LSP6KeyManager: '0xc403d48f',
LSP7DigitalAsset: '0x5fcaac27',
LSP8IdentifiableDigitalAsset: '0x49399145',
LSP9Vault: '0x8c1d44f6',
ClaimOwnership: '0xd225f160',
LSP9Vault: '0xfd4d5c50',
ClaimOwnership: '0xa375e9c6',
};

// ERC1271
Expand Down Expand Up @@ -69,22 +69,26 @@ const SupportedStandards = {
* @see https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-2-ERC725YJSONSchema.md
*/
const ERC725YKeys = {
LSP0: {
LSP1: {
// keccak256('LSP1UniversalReceiverDelegate')
LSP1UniversalReceiverDelegate:
'0x0cfc51aec37c55a4d0b1a65c6255c4bf2fbdf6277f3cc0730c45b828b6db8b47',
},
LSP3: {
SupportedStandards_LSP3: SupportedStandards.LSP3UniversalProfile,
// keccak256('LSP3Profile')
LSP3Profile: '0x5ef83ad9559033e6e941db7d7c495acdce616347d28e90c7ce47cbfcfcad3bc5',
},
LSP4: {
SupportedStandards_LSP4: SupportedStandards.LSP4DigitalAsset,
// keccak256('LSP4TokenName')
LSP4TokenName: '0xdeba1e292f8ba88238e10ab3c7f88bd4be4fac56cad5194b6ecceaf653468af1',
// keccak256('LSP4TokenSymbol')
LSP4TokenSymbol: '0x2f0a68ab07768e01943a599e73362a0e17a63a72e94dd2e384d2c1d4db932756',
// keccak256('LSP4Metadata')
LSP4Metadata: '0x9afb95cacc9f95858ec44aa8c3b685511002e30ae54415823f406128b85b238e',
// LSP4CreatorsMap:<address>
LSP4CreatorsMap: '0x6de85eaf5d982b4e5da00000',
// keccak256('"LSP4Creators[]')
'LSP4Creators[]': {
// use this key to get the number of elements in the array
Expand Down Expand Up @@ -119,6 +123,9 @@ const ERC725YKeys = {
// AddressPermissions:AllowedERC725YKeys:<address>
'AddressPermissions:AllowedERC725YKeys': '0x4b80742de2bf90b8b4850000',
},
LSP9: {
SupportedStandards_LSP9: SupportedStandards.LSP9Vault,
},
LSP10: {
// keccak256('LSP10VaultsMap')
LSP10VaultsMap: '0x192448c3c0f88c7f238c0000',
Expand Down Expand Up @@ -149,7 +156,7 @@ const BasicUPSetup_Schema = [
},
{
name: 'LSP1UniversalReceiverDelegate',
key: ERC725YKeys.LSP0['LSP1UniversalReceiverDelegate'],
key: ERC725YKeys.LSP1.LSP1UniversalReceiverDelegate,
keyType: 'Singleton',
valueContent: 'Address',
valueType: 'address',
Expand Down Expand Up @@ -207,6 +214,16 @@ const LSP1_TYPE_IDS = {
// ----------

const Errors = {
ClaimOwnership: {
'0x39351224': {
error: 'RenounceOwnershipAvailableAtBlockNumber(uint256)',
message: 'ClaimOwnership: Second renounce ownership call available after 100 block delay from the first call',
},
'0x43b248cd': {
error: 'CannotTransferOwnershipToSelf()',
message: 'ClaimOwnership: Cannot transfer ownership to address(this)',
},
},
LSP2: {
'0xb614e91e': {
error: 'InvalidABIEncodedArray(bytes,string)',
Expand Down Expand Up @@ -380,6 +397,15 @@ const EventSignatures = {
*/
OwnershipTransfered: '0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0',
},
ClaimOwnership: {
/**
* event RenounceOwnershipInitiated();
*
* signature = keccak256('RenounceOwnershipInitiated()')
*/
RenounceOwnershipInitiated:
'0X56272768d104766ae5e663c58927d0a9e47effb40b9a8f6644ac5dfbc9e56f84',
},
ERC725X: {
/**
* event ContractCreated(
Expand All @@ -405,11 +431,14 @@ const EventSignatures = {
},
ERC725Y: {
/**
* event DataChanged(bytes32 indexed key);
* event DataChanged(
* bytes32 indexed dataKey,
* bytes dataValue
* );
*
* signature = keccak256('DataChanged(bytes32)')
* signature = keccak256('DataChanged(bytes32,bytes)')
*/
DataChanged: '0xcdf4e344c0d23d4cdd0474039d176c55b19d531070dbe17856bfb993a5b5720b',
DataChanged: '0xece574603820d07bc9b91f2a932baadf4628aabcb8afba49776529c14a6104b2',
},
// ERC725Account
LSP0: {
Expand Down Expand Up @@ -517,6 +546,17 @@ const EventSignatures = {
*/
RevokedOperator: '17d5389f6ab6adb2647dfa0aa365c323d37adacc30b33a65310b6158ce1373d5',
},
LSP9: {
/**
* event ValueReceived(
* address indexed sender,
* uint256 indexed value
* );
*
* signature = keccak256('ValueReceived(address,uint256)')
*/
ValueReceived: '0x7e71433ddf847725166244795048ecf3e3f9f35628254ecbf736056664233493',
},
Helpers: {
/**
* event ReceivedERC777(
Expand Down
4 changes: 2 additions & 2 deletions contracts/Custom/IClaimOwnership.sol
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

bytes4 constant _INTERFACEID_CLAIM_OWNERSHIP = 0xd225f160;
bytes4 constant _INTERFACEID_CLAIM_OWNERSHIP = 0xa375e9c6;

interface IClaimOwnership {
event RenounceOwnershipInitiated();

function pendingOwner() external view returns (address);

function claimOwnership() external;
Expand Down
3 changes: 3 additions & 0 deletions contracts/Helpers/ERC165Interfaces.sol
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ contract CalculateLSPInterfaces {
type(IERC1271).interfaceId ^
type(ILSP1).interfaceId ^
OwnableUnset.owner.selector ^
OwnableUnset.renounceOwnership.selector ^
OwnableUnset.transferOwnership.selector ^
type(IClaimOwnership).interfaceId;

Expand Down Expand Up @@ -119,6 +120,7 @@ contract CalculateLSPInterfaces {
type(IERC725Y).interfaceId ^
type(ILSP1).interfaceId ^
OwnableUnset.owner.selector ^
OwnableUnset.renounceOwnership.selector ^
OwnableUnset.transferOwnership.selector ^
type(IClaimOwnership).interfaceId;

Expand All @@ -135,6 +137,7 @@ contract CalculateLSPInterfaces {
bytes4 interfaceId =
OwnableUnset.owner.selector ^
OwnableUnset.transferOwnership.selector ^
OwnableUnset.renounceOwnership.selector ^
type(IClaimOwnership).interfaceId;

require(
Expand Down
2 changes: 1 addition & 1 deletion contracts/LSP0ERC725Account/LSP0Constants.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
pragma solidity ^0.8.0;

// --- ERC165 interface ids
bytes4 constant _INTERFACEID_LSP0 = 0x9a3bfe88;
bytes4 constant _INTERFACEID_LSP0 = 0xeb6be62e;
bytes4 constant _INTERFACEID_ERC1271 = 0x1626ba7e;

// ERC1271 - Standard Signature Validation
Expand Down
2 changes: 1 addition & 1 deletion contracts/LSP9Vault/LSP9Constants.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
pragma solidity ^0.8.0;

// --- ERC165 interface ids
bytes4 constant _INTERFACEID_LSP9 = 0x8c1d44f6;
bytes4 constant _INTERFACEID_LSP9 = 0xfd4d5c50;

// --- ERC725Y Keys

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ describe("LSP1UniversalReceiverDelegateVault", () => {
const abi = lsp9Vault1.interface.encodeFunctionData(
"setData(bytes32,bytes)",
[
ERC725YKeys.LSP0.LSP1UniversalReceiverDelegate,
ERC725YKeys.LSP1.LSP1UniversalReceiverDelegate,
lsp1universalReceiverDelegateVault.address,
]
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ export const shouldBehaveLikeLSP7Mintable = (
[
ERC725YKeys.LSP6["AddressPermissions:Permissions"] +
URDTokenReentrant.address.substr(2),
ERC725YKeys.LSP0.LSP1UniversalReceiverDelegate,
ERC725YKeys.LSP1.LSP1UniversalReceiverDelegate,
],
[PERMISSIONS.CALL, URDTokenReentrant.address],
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ export const shouldBehaveLikeLSP8Mintable = (
[
ERC725YKeys.LSP6["AddressPermissions:Permissions"] +
URDTokenReentrant.address.substr(2),
ERC725YKeys.LSP0.LSP1UniversalReceiverDelegate,
ERC725YKeys.LSP1.LSP1UniversalReceiverDelegate,
],
[PERMISSIONS.CALL, URDTokenReentrant.address],
]
Expand Down
2 changes: 1 addition & 1 deletion tests/LSP9Vault/LSP9Vault.behaviour.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ export const shouldBehaveLikeLSP9 = (
await context.lsp9Vault
.connect(context.accounts.owner)
["setData(bytes32,bytes)"](
ERC725YKeys.LSP0.LSP1UniversalReceiverDelegate,
ERC725YKeys.LSP1.LSP1UniversalReceiverDelegate,
lsp1UniversalReceiverDelegateVaultSetter.address
);

Expand Down
2 changes: 1 addition & 1 deletion tests/UniversalProfile.behaviour.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ export const shouldBehaveLikeLSP3 = (
ERC725YKeys.LSP3.LSP3Profile,
ERC725YKeys.LSP12["LSP12IssuedAssets[]"].length,
...lsp12IssuedAssetsKeys,
ERC725YKeys.LSP0.LSP1UniversalReceiverDelegate,
ERC725YKeys.LSP1.LSP1UniversalReceiverDelegate,
];
let values = [
"0x6f357c6a820464ddfac1bec070cc14a8daf04129871d458f2ca94368aae8391311af6361696670733a2f2f516d597231564a4c776572673670456f73636468564775676f3339706136727963455a4c6a7452504466573834554178",
Expand Down
2 changes: 1 addition & 1 deletion tests/utils/fixtures.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ export async function setupProfileWithKeyManagerWithURD(
EOA.address.substring(2),
ERC725YKeys.LSP6["AddressPermissions:Permissions"] +
lsp1universalReceiverDelegateUP.address.substr(2),
ERC725YKeys.LSP0.LSP1UniversalReceiverDelegate,
ERC725YKeys.LSP1.LSP1UniversalReceiverDelegate,
],
[
ARRAY_LENGTH.TWO,
Expand Down