Skip to content

Commit

Permalink
refactor!: move each TS constants & Types into their respective packages
Browse files Browse the repository at this point in the history
  • Loading branch information
CJ42 committed Feb 9, 2024
1 parent e4aadd7 commit b957bfa
Show file tree
Hide file tree
Showing 50 changed files with 901 additions and 400 deletions.
410 changes: 10 additions & 400 deletions constants.ts

Large diffs are not rendered by default.

204 changes: 204 additions & 0 deletions gas_benchmark_result.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,204 @@
{
"deployment_costs": {
"UniversalProfile": 3169287,
"KeyManager": 3660073,
"LSP1DelegateUP": 1637972,
"LSP7Mintable": 2408573,
"LSP8Mintable": 2842437
},
"runtime_costs": {
"EOA_owner": {
"execute": {
"case_1": {
"description": "Transfer 1 LYX to an EOA without data",
"gas_cost": 37572
},
"case_2": {
"description": "Transfer 1 LYX to a UP without data",
"gas_cost": 46265
},
"case_3": {
"description": "Transfer 1 LYX to an EOA with 256 bytes of data",
"gas_cost": 42233
},
"case_4": {
"description": "Transfer 1 LYX to a UP with 256 bytes of data",
"gas_cost": 57198
},
"case_5": {
"description": "Transfer 0.1 LYX to 3x EOA without data",
"gas_cost": 70898
},
"case_6": {
"description": "Transfer 0.1 LYX to 3x UP without data",
"gas_cost": 104489
},
"case_7": {
"description": "Transfer 0.1 LYX to 3x EOA with 256 bytes of data",
"gas_cost": 84886
},
"case_8": {
"description": "Transfer 0.1 LYX to 3x UPs with 256 bytes of data",
"gas_cost": 137245
}
},
"setData": {
"case_1": {
"description": "Set a 20 bytes long value",
"gas_cost": 49921
},
"case_2": {
"description": "Set a 60 bytes long value",
"gas_cost": 95243
},
"case_3": {
"description": "Set a 160 bytes long value",
"gas_cost": 164415
},
"case_4": {
"description": "Set a 300 bytes long value",
"gas_cost": 279284
},
"case_5": {
"description": "Set a 600 bytes long value",
"gas_cost": 486680
},
"case_6": {
"description": "Change the value of a data key already set",
"gas_cost": 32809
},
"case_7": {
"description": "Remove the value of a data key already set",
"gas_cost": 27283
},
"case_8": {
"description": "Set 2 data keys of 20 bytes long value",
"gas_cost": 78440
},
"case_9": {
"description": "Set 2 data keys of 100 bytes long value",
"gas_cost": 260604
},
"case_10": {
"description": "Set 3 data keys of 20 bytes long value",
"gas_cost": 105104
},
"case_11": {
"description": "Change the value of three data keys already set of 20 bytes long value",
"gas_cost": 45416
},
"case_12": {
"description": "Remove the value of three data keys already set",
"gas_cost": 41325
}
},
"tokens": {
"case_1": {
"description": "Minting a LSP7Token to a UP (No Delegate) from an EOA",
"gas_cost": 93114
},
"case_2": {
"description": "Minting a LSP7Token to an EOA from an EOA",
"gas_cost": 59390
},
"case_3": {
"description": "Transferring an LSP7Token from a UP to another UP (No Delegate)",
"gas_cost": 102367
},
"case_4": {
"description": "Minting a LSP8Token to a UP (No Delegate) from an EOA ",
"gas_cost": 160165
},
"case_5": {
"description": "Minting a LSP8Token to an EOA from an EOA ",
"gas_cost": 126442
},
"case_6": {
"description": "Transferring an LSP8Token from a UP to another UP (No Delegate)",
"gas_cost": 151147
}
}
},
"KeyManager_owner": {
"execute": {
"case_1": {
"description": "LYX transfer --> to an EOA",
"main_controller": 64365,
"restricted_controller": 75316
},
"case_2": {
"description": "LYX transfer --> to a UP",
"main_controller": 78508,
"restricted_controller": 93410
},
"case_3": {
"description": "LSP7 token transfer --> to an EOA",
"main_controller": 116872,
"restricted_controller": 131622
},
"case_4": {
"description": "LSP7 token transfer --> to a UP",
"main_controller": 250518,
"restricted_controller": 265268
},
"case_5": {
"description": "LSP8 NFT transfer --> to an EOA",
"main_controller": 181045,
"restricted_controller": 195795
},
"case_6": {
"description": "LSP8 NFT transfer --> to a UP",
"main_controller": 297893,
"restricted_controller": 312643
}
},
"setData": {
"case_1": {
"description": "Update Profile details (LSP3Profile Metadata)",
"main_controller": 67264,
"restricted_controller": 77286
},
"case_2": {
"description": "Add a new controller with permission to `SET_DATA` + 3x allowed data keys: <br/> `AddressPermissions[]` <br/> + `AddressPermissions[index]` <br/> + `AddressPermissions:Permissions:<controller>` <br/> + `AddressPermissions:AllowedERC725YDataKeys:<controller`)",
"main_controller": 209516,
"restricted_controller": 219673
},
"case_3": {
"description": "Update permissions of previous controller. Allow it now to `SUPER_SETDATA`",
"main_controller": 52292,
"restricted_controller": 55298
},
"case_4": {
"description": "Remove a controller: <br/> 1. decrease `AddressPermissions[]` Array length <br/> 2. remove the controller address at `AddressPermissions[index]` <br/> 3. set \"0x\" for the controller permissions under AddressPermissions:Permissions:<controller-address>",
"main_controller": 78765,
"restricted_controller": 90064
},
"case_5": {
"description": "Write 5x new LSP12 Issued Assets",
"main_controller": 66959,
"restricted_controller": 101586
},
"case_6": {
"description": "Update 3x data keys (first 3)",
"main_controller": 125411,
"restricted_controller": 159515
},
"case_7": {
"description": "Update 3x data keys (middle 3)",
"main_controller": 105499,
"restricted_controller": 143669
},
"case_8": {
"description": "Update 3x data keys (last 3)",
"main_controller": 125411,
"restricted_controller": 169002
},
"case_9": {
"description": "Set 2 x new data keys + add 3x new controllers",
"main_controller": 810121,
"restricted_controller": 871921
}
}
}
}
}
44 changes: 44 additions & 0 deletions packages/LSP0ERC725Account/constants.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
// ERC165 Interface ID
// ----------
export const INTERFACE_ID_LSP0ERC725Account = '0x24871b3d';

// ERC1271
// ----------

/**
* @dev values returned by the `isValidSignature` function of the ERC1271 standard.
* Can be used to check if a signature is valid or not.
*/
export const ERC1271_VALUES = {
SUCCESS_VALUE: '0x1626ba7e',
FAIL_VALUE: '0xffffffff',
};

/**
* @dev list of ERC725X operation types.
* @see https://github.com/ERC725Alliance/ERC725/blob/develop/docs/ERC-725.md#execute
*/
export const OPERATION_TYPES = {
CALL: 0,
CREATE: 1,
CREATE2: 2,
STATICCALL: 3,
DELEGATECALL: 4,
};

export const LSP0_TYPE_IDS = {
// keccak256('LSP0ValueReceived')
LSP0ValueReceived: '0x9c4705229491d365fb5434052e12a386d6771d976bea61070a8c694e8affea3d',

// keccak256('LSP0OwnershipTransferStarted')
LSP0OwnershipTransferStarted:
'0xe17117c9d2665d1dbeb479ed8058bbebde3c50ac50e2e65619f60006caac6926',

// keccak256('LSP0OwnershipTransferred_SenderNotification')
LSP0OwnershipTransferred_SenderNotification:
'0xa4e59c931d14f7c8a7a35027f92ee40b5f2886b9fdcdb78f30bc5ecce5a2f814',

// keccak256('LSP0OwnershipTransferred_RecipientNotification')
LSP0OwnershipTransferred_RecipientNotification:
'0xceca317f109c43507871523e82dc2a3cc64dfa18f12da0b6db14f6e23f995538',
};
1 change: 1 addition & 0 deletions packages/LSP0ERC725Account/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './constants';
13 changes: 13 additions & 0 deletions packages/LSP0ERC725Account/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,19 @@
"description": "Package for the LSP0ERC725Account standard",
"license": "Apache-2.0",
"author": "",
"type": "module",
"main": "./dist/index.cjs",
"module": "./dist/index.mjs",
"typings": "./dist/index.d.ts",
"exports": {
".": {
"require": "./dist/index.cjs",
"import": "./dist/index.mjs",
"types": "./dist/index.d.ts"
},
"./artifacts/*": "./artifacts/*",
"./package.json": "./package.json"
},
"keywords": [
"LUKSO",
"LSP",
Expand Down
10 changes: 10 additions & 0 deletions packages/LSP10ReceivedVaults/constants.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
export const LSP10DataKeys = {
// keccak256('LSP10VaultsMap') + bytes2(0)
LSP10VaultsMap: '0x192448c3c0f88c7f238c0000',

// keccak256('LSP10Vaults[]')
'LSP10Vaults[]': {
length: '0x55482936e01da86729a45d2b87a6b1d3bc582bea0ec00e38bdb340e3af6f9f06',
index: '0x55482936e01da86729a45d2b87a6b1d3',
},
};
1 change: 1 addition & 0 deletions packages/LSP10ReceivedVaults/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './constants';
13 changes: 13 additions & 0 deletions packages/LSP10ReceivedVaults/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,19 @@
"description": "Package for the LSP10 Received Vaults standard",
"license": "Apache-2.0",
"author": "",
"type": "module",
"main": "./dist/index.cjs",
"module": "./dist/index.mjs",
"typings": "./dist/index.d.ts",
"exports": {
".": {
"require": "./dist/index.cjs",
"import": "./dist/index.mjs",
"types": "./dist/index.d.ts"
},
"./artifacts/*": "./artifacts/*",
"./package.json": "./package.json"
},
"keywords": [
"LUKSO",
"LSP",
Expand Down
10 changes: 10 additions & 0 deletions packages/LSP12IssuedAssets/constants.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
export const LSP12DataKeys = {
// LSP12IssuedAssetsMap:<address> + bytes2(0)
LSP12IssuedAssetsMap: '0x74ac2555c10b9349e78f0000',

// keccak256('LSP12IssuedAssets[]')
'LSP12IssuedAssets[]': {
length: '0x7c8c3416d6cda87cd42c71ea1843df28ac4850354f988d55ee2eaa47b6dc05cd',
index: '0x7c8c3416d6cda87cd42c71ea1843df28',
},
};
1 change: 1 addition & 0 deletions packages/LSP12IssuedAssets/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './constants';
13 changes: 13 additions & 0 deletions packages/LSP12IssuedAssets/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,19 @@
"description": "Package for the LSP12 Issued Assets standard",
"license": "Apache-2.0",
"author": "",
"type": "module",
"main": "./dist/index.cjs",
"module": "./dist/index.mjs",
"typings": "./dist/index.d.ts",
"exports": {
".": {
"require": "./dist/index.cjs",
"import": "./dist/index.mjs",
"types": "./dist/index.d.ts"
},
"./artifacts/*": "./artifacts/*",
"./package.json": "./package.json"
},
"keywords": [
"LUKSO",
"LSP",
Expand Down
15 changes: 15 additions & 0 deletions packages/LSP14Ownable2Step/constants.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
export const INTERFACE_ID_LSP14 = '0x94be5999';

export const LSP14_TYPE_IDS = {
// keccak256('LSP14OwnershipTransferStarted')
LSP14OwnershipTransferStarted:
'0xee9a7c0924f740a2ca33d59b7f0c2929821ea9837ce043ce91c1823e9c4e52c0',

// keccak256('LSP14OwnershipTransferred_SenderNotification')
LSP14OwnershipTransferred_SenderNotification:
'0xa124442e1cc7b52d8e2ede2787d43527dc1f3ae0de87f50dd03e27a71834f74c',

// keccak256('LSP14OwnershipTransferred_RecipientNotification')
LSP14OwnershipTransferred_RecipientNotification:
'0xe32c7debcb817925ba4883fdbfc52797187f28f73f860641dab1a68d9b32902c',
};
1 change: 1 addition & 0 deletions packages/LSP14Ownable2Step/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './constants';
13 changes: 13 additions & 0 deletions packages/LSP14Ownable2Step/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,19 @@
"description": "Package for the LSP14 Ownable 2 Step standard",
"license": "Apache-2.0",
"author": "",
"type": "module",
"main": "./dist/index.cjs",
"module": "./dist/index.mjs",
"typings": "./dist/index.d.ts",
"exports": {
".": {
"require": "./dist/index.cjs",
"import": "./dist/index.mjs",
"types": "./dist/index.d.ts"
},
"./artifacts/*": "./artifacts/*",
"./package.json": "./package.json"
},
"keywords": [
"LUKSO",
"LSP",
Expand Down
7 changes: 7 additions & 0 deletions packages/LSP17ContractExtension/constants.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export const INTERFACE_ID_LSP17Extendable = '0xa918fa6b';
export const INTERFACE_ID_LSP17Extension = '0xcee78b40';

export const LSP17DataKeys = {
// bytes10(keccak256('LSP17Extension')) + bytes2(0)
LSP17ExtensionPrefix: '0xcee78b4094da860110960000',
};
1 change: 1 addition & 0 deletions packages/LSP17ContractExtension/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './constants';
Loading

0 comments on commit b957bfa

Please sign in to comment.