ProjectOpenSea / operator-filter-registry

MIT License
312 stars 93 forks source link

Operator Filter Registry Initializer Not Working When Upgrading #68

Closed dev-hvstle closed 1 year ago

dev-hvstle commented 1 year ago

How can I upgrade my NFT smart contract to implement Operator Filter Registry? I know there's they release an upgradeable OFR, but it requires to be initialized. I'm just wondering how are you going to initialize it when you already deployed the smart contract and you're just upgrading it?

operatorfilterer commented 1 year ago

The initialize methods are meant to configure the contract to use the registry, but they don't set any contract state that is not configurable outside of initialization.

If you are upgrading your contract to use the registry, the owner() of the contract can register on behalf of the upgradeable contract by interacting with the Operator Filter Registry directly, or the contract itself can include a one-time method to register itself as it would in the constructor: https://github.com/ProjectOpenSea/operator-filter-registry/blob/main/src/upgradeable/OperatorFiltererUpgradeable.sol#L23

Feel free to reopen with more questions.