storyprotocol / protocol-periphery-v1

Periphery contract for story protocol, mainnet repo
MIT License
28 stars 20 forks source link

Optimize Gas Usage by Removing Redundant License Registry Call #60

Closed sebsadface closed 1 month ago

sebsadface commented 1 month ago

Description and Context

Currently, the periphery contracts use an additional hasIpAttachedLicenseTerms call to the license registry to ensure idempotency when attaching a license (see LicensingHelper.sol for more details). This extra call introduces unnecessary gas costs when the IP does not already have the license attached.

Suggested Solution

To optimize gas usage, we propose wrapping the attachLicenseTerms() function in a try/catch block to handle the case where the license is not attached.

Definition of Done