Skip to content

[Feature] Allow for signatureless entitlements and call minting#15

Merged
jake-nyquist merged 2 commits intomainfrom
nyquist/hook-837-accept-entitlement-as-is
May 11, 2022
Merged

[Feature] Allow for signatureless entitlements and call minting#15
jake-nyquist merged 2 commits intomainfrom
nyquist/hook-837-accept-entitlement-as-is

Conversation

@jake-nyquist
Copy link
Contributor

No description provided.

@linear
Copy link

linear bot commented May 10, 2022

HOOK-837 accept entitlement as-is onErc721Received in the vault contract

In the future, we'd like to allow us or a third party to construct a 'proxy' contract which automatically bootstraps a vault and create a call option based on it. This could work in two possible ways:

A - proxy implementing onERC721Received:

 1 - find or create the vault

 2 - forwards the asset into the vault, imposing the entitlement

 3 - mints a call option based on the entitlement

B - proxy gets approved for the asset

  • use gas station network or other gas forwarder to allow protocol to pay gas for the following:
    • ExecTransfer function that does (A)

Scenario B is a growth-minded approach

To make this work, we need to perform two changes to the protocol.

HookERC721VaultImplV1.sol :

  • onERC721Received
    • Remove _setBeneficialOwner(from); and instead _setBeneficialOwner(entitlement.beneficialOwner);
    • Do not parse signature out of the calldata, only the packed entitlement
  • _verifyAndRegisterEntitlement :
    • refactor to split the validate signature and the impose enttitlement steps (both private)
    • make validateEntitlementSignature _validateEntitlementSignature (nit: style)
    • call only the impose entitlement function (i.e. no signature validation) onERC721Received.
  • Update the comments throughout (including the long one onERC721Received) to reflect the view that the holder of the asset should be trusted to set an entitlement because they could otherwise simply send the asset to an arbitrary EOA and then sign and set the entitlement from there
  • Implement a grantEntitlement function that can be called at any time by the beneficial owner without a signature. This will allow smart contracts to imposeEntitlements on assets they control.

HookCoveredCallImplV1.sol :

  • amend the mint with call method to accept an entitlement on a vault that is already in place so long as it matches exactly
  • Perhaps, simply don't check the signature in this case to allow for an "overridden method"… i.e. if entitlement on vault aready → verify match or fail, else → impose with signature or fail.

Copy link
Contributor Author

jake-nyquist commented May 10, 2022

Current dependencies on/for this PR:

This comment was auto-generated by Graphite.

@jake-nyquist jake-nyquist marked this pull request as ready for review May 11, 2022 19:58
@jake-nyquist jake-nyquist requested a review from regynald May 11, 2022 20:05

require(
expirationTime == vault.entitlementExpiration(),
"mintWithVault -- call contract must be the entitled operator"
Copy link
Contributor

Choose a reason for hiding this comment

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

Change require msg

@jake-nyquist jake-nyquist force-pushed the nyquist/hook-837-accept-entitlement-as-is branch from 1b9bbbf to 08ec250 Compare May 11, 2022 20:45
Copy link
Contributor Author

@jake-nyquist jake-nyquist left a comment

Choose a reason for hiding this comment

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

fixed in 08ec25

@jake-nyquist jake-nyquist merged commit 64bf950 into main May 11, 2022
@regynald regynald deleted the nyquist/hook-837-accept-entitlement-as-is branch May 31, 2022 22:27
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