Implement Delegate for linking wallets together
Motivation
The Delegate project (f.k.a. Delegate Cash) is a global registry where individual wallets can signal that another wallet should be delegated some rights from that wallet.
This is similar to the idea of visualizing ownership of a multi-signature wallet (NFT assets are "owned" directly by a specific address, but the true human "owners" are represented by other Ethereum addresses). Owners may wish to delegate their rights to another wallet, to ensure the NFT assets cannot be moved, but any perks/extras can be provably obtained by just those delegated wallets.
Honoring those delegation links will allow ChainStation to be able to make individual user's profile pages more complete (can include MoonCats not directly-held, but do represent), and allow claiming Treasures from non-vault wallets.
Requirements
- Add a utility function to query the Delegate registry, calling the
getIncomingDelegationsfunction. - On individual owners' public profile pages, after the page loads, call that utility function to get all delegations that are inbound to that address.
- If the delegation is for "all", or delegating roles from the MoonCatRescue, Acclimator, or JumpPort contracts, enumerate all MoonCats owned by the delegating address.
- If the delegation is for a specific token within the MoonCatRescue, Acclimator, or JumpPort contracts, check if that MoonCat is actually held in that specific contract, and owned by the delegating address. If so, add it to the list of enumerated MoonCats.
- For all the MoonCats found to be delegated to that address, add them to the list of MoonCats shown as part of that address' portfolio.
- Add a new filter to MoonCat grids that appear on Ethereum address profile pages, called "Ownership method", with options of "Any", "Directly-held", and "Delegated".
- Update the Treasures API endpoint to consider not only the addresses that have a valid SIWE session, but also those that have delegated ownership to those addresses.
- Update the "Favorite MoonCat" tidbit logic to allow the indicated MoonCat to be held in any of the linked wallets.