Skip to content

Conversation

@jtakalai
Copy link

Use the SACD callback to update StreamRegistry when SACD permissions change

  • designed such that adding more (similar) integrations doesn't require any further changes to SACD or VehicleId, only to the specific module, plus misc integration specific contracts
    • "similar" meaning integrations that only need to know when the permissions change. More hooks to SACD may be needed for integrations that have other needs. This change (including the SACD change in the PR Composability: let the NFT asset react to permissions being set sacd#12 ) doesn't try to look into the future, only adding the minimal required for restoring the Streamr integration.
  • added complexity: deployment of a new StreamrSacdListener contract. Reason is: we add callbacks to the VehicleId NFT by address only. All modules in DimoRegistry share the same address, so if in the future we want to add more listeners that talk to different integration modules, they can't clash. An option to deploying a new contract is to add both address and selector as callbacks. This one is more readable, and not really more expensive either to deploy. There is one more hop when calling it, so the address+selector callback could be a gas optimization later.
  • added the deployment and setup of the StreamrSacdListener to deploy.ts as well as the test. This needs to be updated in production later (including SACD upgrade), should be straightforward.

…gistry when SACD permissions change

* designed such that adding more (similar) integrations doesn't require any further changes to SACD or VehicleId, only to the specific module, plus misc integration specific contracts
  * "similar" meaning integrations that only need to know when the permissions change. More hooks to SACD may be needed for integrations that have other needs. This change (including the SACD change in DIMO-Network/sacd#12 ) doesn't try to look into the future, only adding the minimal required for restoring the Streamr integration.
* added complexity: deployment of a new StreamrSacdListener contract. Reason is: we add callbacks to the VehicleId NFT by address only. All modules in DimoRegistry share the same address, so if in the future we want to add more listeners that talk to different integration modules, they can't clash. An option to deploying a new contract is to add both address and selector as callbacks. This one is more readable, and not really more expensive either to deploy. There is one more hop when calling it, so the address+selector callback could be a gas optimization later.
* added the deployment and setup of the StreamrSacdListener to deploy.ts as well as the test. This needs to be updated in production later (including SACD upgrade), should be straightforward.

contract StreamrSacdListener is ISacdListener {

uint256 private constant VEHICLE_SUBSCRIBE_LIVE_DATA_PERMISSION_BITMASK = 1 << 6;
Copy link
Member

@elffjs elffjs Apr 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately we use two bits for each permission. Getting the stream permission means your mask has

3 << 12

in it. @LorranSutter double check me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants