-
Notifications
You must be signed in to change notification settings - Fork 51
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!: replace ValueReceived
with UniversalReceiver
#759
Conversation
👋 Hello ⛽📊 Gas Benchmark ReportDeployment Costs
Runtime CostsUniversalProfile owned by an 🔑 EOA🔀
|
execute scenarios - UP owned by 🔑 EOA |
⛽ Gas Usage |
---|---|
Transfer 1 LYX to an EOA without data | 37537 (0 ) |
Transfer 1 LYX to a UP without data | 46236 (9,597 📈❌) |
Transfer 1 LYX to an EOA with 256 bytes of data | 42198 (0 ) |
Transfer 1 LYX to a UP with 256 bytes of data | 54425 (9,570 📈❌) |
Transfer 0.1 LYX to 3x EOA without data | 70862 (0 ) |
Transfer 0.1 LYX to 3x UP without data | 104471 (28,791 📈❌) |
Transfer 0.1 LYX to 3x EOA with 256 bytes of data | 84838 (12 📈❌) |
Transfer 0.1 LYX to 3x UPs with 256 bytes of data | 129031 (28,674 📈❌) |
🗄️ setData
scenarios
setData scenarios - UP owned by 🔑 EOA |
⛽ Gas Usage |
---|---|
Set a 20 bytes long value | 49971 (0 ) |
Set a 60 bytes long value | 95293 (0 ) |
Set a 160 bytes long value | 164465 (0 ) |
Set a 300 bytes long value | 279700 (12 📈❌) |
Set a 600 bytes long value | 484160 (36 📈❌) |
Change the value of a data key already set | 32859 (0 ) |
Remove the value of a data key already set | 27333 (0 ) |
Set 2 data keys of 20 bytes long value | 78454 (12 📈❌) |
Set 2 data keys of 100 bytes long value | 260618 (0 ) |
Set 3 data keys of 20 bytes long value | 105171 (0 ) |
Change the value of three data keys already set of 20 bytes long value | 45471 (0 ) |
Remove the value of three data keys already set | 41360 (0 ) |
🗄️ Tokens
scenarios
Tokens scenarios - UP owned by 🔑 EOA |
⛽ Gas Usage |
---|---|
Minting a LSP7Token to a UP (No Delegate) from an EOA | 92641 (659 📈❌) |
Minting a LSP7Token to an EOA from an EOA | 59289 (0 ) |
Transferring an LSP7Token from a UP to another UP (No Delegate) | 101410 (1,318 📈❌) |
Minting a LSP8Token to a UP (No Delegate) from an EOA | 159581 (659 📈❌) |
Minting a LSP8Token to an EOA from an EOA | 126229 (0 ) |
Transferring an LSP8Token from a UP to another UP (No Delegate) | 150217 (1,318 📈❌) |
UniversalProfile owned by a 🔒📄 LSP6KeyManager
🔀 execute
scenarios
execute scenarios |
👑 main controller | 🛃 restricted controller |
---|---|---|
LYX transfer --> to an EOA | 66244 (-42 📉✅) | 77036 (-43 📉✅) |
LYX transfer --> to a UP | 80589 (13,021 📈❌) | 95567 (16,017 📈❌) |
LSP7 token transfer --> to an EOA | 119027 (963 📈❌) | 133718 (963 📈❌) |
LSP7 token transfer --> to a UP | 254424 (1,929 📈❌) | 269115 (1,929 📈❌) |
LSP8 NFT transfer --> to an EOA | 183270 (963 📈❌) | 197938 (963 📈❌) |
LSP8 NFT transfer --> to a UP | 301914 (1,929 📈❌) | 316582 (1,929 📈❌) |
🗄️ setData
scenarios
setData scenarios |
👑 main controller | 🛃 restricted controller |
---|---|---|
Update Profile details (LSP3Profile Metadata) | 68853 (-53 📉✅) | 78852 (-53 📉✅) |
Add a new controller with permission to SET_DATA + 3x allowed data keys: AddressPermissions[] + AddressPermissions[index] + AddressPermissions:Permissions:<controller> + AddressPermissions:AllowedERC725YDataKeys:<controller ) |
212252 (-53 📉✅) | 222317 (-53 📉✅) |
Update permissions of previous controller. Allow it now to SUPER_SETDATA |
53740 (-53 📉✅) | 56723 (-53 📉✅) |
Remove a controller: 1. decrease AddressPermissions[] Array length 2. remove the controller address at AddressPermissions[index] 3. set "0x" for the controller permissions under AddressPermissions:Permissions: |
80673 (-43 📉✅) | 91898 (-42 📉✅) |
Write 5x new LSP12 Issued Assets | 68406 (-53 📉✅) | 103010 (-53 📉✅) |
Update 3x data keys (first 3) | 127694 (-53 📉✅) | 161775 (-53 📉✅) |
Update 3x data keys (middle 3) | 107782 (-53 📉✅) | 145929 (-53 📉✅) |
Update 3x data keys (last 3) | 127694 (-53 📉✅) | 171262 (-53 📉✅) |
Set 2 x new data keys + add 3x new controllers | 816141 (-53 📉✅) | 877688 (-53 📉✅) |
Changes to gas cost
🧾 Summary (10% most significant diffs)
Full diff report 👇
|
…contracts into reactOnNativeToken
067b9b2
to
27185d6
Compare
7864d7a
to
335288a
Compare
335288a
to
55264ce
Compare
55264ce
to
dc75b7a
Compare
5317c98
to
d4c5703
Compare
d4c5703
to
5fe6bde
Compare
|
||
const amountTransferred = 20; | ||
|
||
const transferFunctionSignature = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggest to use Typechain for this:
TransferExtension__factory.interface.encodeFunctionData("transferFunction(uint256)", argument)
).to.not.be.reverted; | ||
}); | ||
|
||
it('should revert with custom error `CannotRegisterEOAsAsAssets` if its a typeId of LSP7/LSP8', async () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice test 👌
}); | ||
}); | ||
|
||
describe('when NOT sending any `msg.value`', () => { | ||
it('should NOT emit a `ValueReceived` event', async () => { | ||
it('should NOT emit a `UniversalReceiver` event', async () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tests that test "something must not happen" are great. Super nice! 👌
@@ -559,6 +594,148 @@ export const shouldBehaveLikeLSP3 = ( | |||
}); | |||
}); | |||
}); | |||
|
|||
describe('when setting a UniversalReceiverDelegate for typeId of LYX receiving', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion
describe('when setting a UniversalReceiverDelegate for typeId of LYX receiving', () => { | |
describe('when setting a UniversalReceiverDelegate for typeId `LSP0ValueReceived`', () => { |
to: context.universalProfile.address, | ||
}); | ||
|
||
expect(tx).to.not.emit(context.universalProfile, 'UniversalReceiver'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
amazing, great not test 👌
We wil implement the suggested changes for the tests in a separate PR |
What does this PR introduce?
♻️ Refactor
receive
,fallback
and theuniversalReceiver
function.LSP17
to optionally forward value inLSP0
andLSP9
PR Checklist
npm run lint
&&npm run lint:solidity
(solhint)npm run format
(prettier)npm run build
npm run test