unlock icon indicating copy to clipboard operation
unlock copied to clipboard

missing event for `setBaseTokenURI`

Open clemsos opened this issue 3 years ago • 1 comments

When using setBaseTokenURI on a lock we should fire a tokenURIUpdated(address lock, string newTokenURI) event so we can rebuild all keys URIs when it has changed

clemsos avatar Sep 19 '22 10:09 clemsos

Good catch! It would be fantastic if we had an easy way to do the following:

  • identify which (if any) smart contract function modifies the state and does not trigger an event
  • which event are trigger but do not have a handler in our subgraph

julien51 avatar Sep 19 '22 21:09 julien51

Just did it manually. Here are all functions that modifies state with their emitted events:

sig event(s) emitted
function addKeyGranter(address) KeyGranterAdded
function addLockManager(address) LockManagerAdded
function approve(address,uint256) Approval
function approveBeneficiary(address,uint256) returns (bool)
function burn(uint256) Transfer
function cancelAndRefund(uint256) CancelKey
function expireAndRefundFor(uint256,uint256) CancelKey
function extend(uint256,uint256,address,bytes) payable KeyExtended
function grantKeyExtension(uint256,uint256) KeyExtended
function grantKeys(address[],uint256[],address[]) returns (uint256[]) Transfer
function grantRole(bytes32,address)
function initialize(address,uint256,address,uint256,uint256,string),
function lendKey(address,address,uint256) Transfer
function mergeKeys(uint256,uint256,uint256) ExpirationChanged (x2)
function migrate(bytes)
function purchase(uint256[],address[],address[],address[],bytes[]) payable returns (uint256[]) Transfer
function renewMembershipFor(uint256,address) KeyExtended
function renounceLockManager() LockManagerRemoved
function renounceRole(bytes32,address)
function revokeKeyGranter(address) KeyGranterRemoved
function revokeRole(bytes32,address),
function safeTransferFrom(address,address,uint256) Transfer
function safeTransferFrom(address,address,uint256,bytes) Transfer
function setApprovalForAll(address,bool) ApprovalForAll
function setBaseTokenURI(string)
function setEventHooks(address,address,address,address,address)
function setExpirationDuration(uint256)
function setGasRefundValue(uint256)
function setKeyManagerOf(uint256,address) KeyManagerChanged
function setMaxKeysPerAddress(uint256)
function setMaxNumberOfKeys(uint256)
function setOwner(address) OwnershipTransferred
function setReferrerFee(address,uint256)
function shareKey(address,uint256,uint256) ExpireKey / Transfer
function transfer(uint256,address,uint256) returns (bool) Transfer
function transferFrom(address,address,uint256) Transfer
function unlendKey(address,uint256) Transfer
function updateBeneficiary(address)
function updateKeyPricing(uint256,address) PricingChanged
function updateLockName(string)
function updateLockSymbol(string)
function updateRefundPenalty(uint256,uint256) RefundPenaltyChanged
function updateSchemaVersion()
function updateTransferFee(uint256) TransferFeeChanged
function withdraw(address,uint256) Withdrawal

clemsos avatar Oct 06 '22 13:10 clemsos

So the list of functions that does NOT emit any events (but should) seems to be :

Lock params setter

metadata

  • [x] function setBaseTokenURI(string)
  • [x] function updateLockName(string)
  • [x] function updateLockSymbol(string)

keys properties

  • [x] function setExpirationDuration(uint256)
  • [x] function setMaxKeysPerAddress(uint256)
  • [x] function setMaxNumberOfKeys(uint256)

others

  • [ ] ~~function updateBeneficiary(address)~~ (concept of beneficiary removed on v12)
  • [x] function setReferrerFee(address,uint256) -- added in #10988
  • [x] function setGasRefundValue(uint256) -- added in #11152
  • [x] function setEventHooks(address,address,address,address,address)

With these other functions that can be left untouched

Internal / migration

  • [ ] function migrate(bytes)
  • [ ] function updateSchemaVersion()
  • [ ] ~~function approveBeneficiary(address,uint256) returns (bool)~~ (concept of beneficiary removed on v12)

OZ inheritance

  • [x] function grantRole(bytes32,address)
  • [x] function renounceRole(bytes32,address)
  • [x] function revokeRole(bytes32,address),
  • [x] function initialize(address,uint256,address,uint256,uint256,string)

clemsos avatar Oct 06 '22 13:10 clemsos

Most of these were done on v12 but we still have a few (updated the list here), so leaving this open for now

clemsos avatar Nov 10 '22 09:11 clemsos

closing this as we now have all state modifying functions emitting events

clemsos avatar Feb 28 '23 12:02 clemsos