Skip to content

Conversation

@V00D00-child
Copy link
Member

@V00D00-child V00D00-child commented May 21, 2025

Promised Outcomes

Overview

This document will provide an overview of the MetaMask Promised Outcomes feature. We can extend an ERC-7715 permission response to enforce promises made by the dapp regarding the outcomes of the granted permissions without relying solely on the dapp's honesty.

Providing Promised outcomes

When constructing a permission request for the wallet, the dApp can attach promisedOutcomes. The promisedOutcomes field is an array of objects, each representing a promised outcome. The type field specifies the kind of outcome being promised, and the data field contains type-specific details.

Some potential types of promised outcomes:

  • exact-transfer: Promises an exact transfer of a specific asset amount to a recipient.
  • event-emission: Promises that a specific event will be emitted with certain parameters.
  • custom: Allows for open-ended custom promises with wallet-interpreted logic.

Wallet Responsibilities

Upon receiving a PermissionsRequest with promisedOutcomes, the wallet should:

  1. Interpret the promisedOutcomes and generate corresponding enforcement caveats.
  2. Present the assured outcomes to the user for approval and the requested permissions.
  3. If approved, include the enforcement caveats in the PermissionsContext returned to the dapp.

The wallet should strive to enforce the promised outcomes as closely as possible, with a caveat enforcer with an afterHook. Additionally, that wallet may run a runtime simulation to guarantee the promised outcomes further.

POC e2e

For POC e2e, we will use the exact-transfer type to enforce a promise that the dApp will transfer a specific asset(ie, mock GATOR token) amount to a recipient(ie, the account the user chooses that is granting the permission).

Anytime the dApp redeems the permission, they are required to transfer X amount of GATOR tokens. This keeps the POC simple as we expand on the feature to make it more flexible.

Changes

  • Add docs for MetaMask Promised Outcomes feature.
  • Render the PromisedOutcomes on the permission request confirmation
  • Define the PromisedOutcomes type interface exposed to dApps attached to the permission request. This new field is optional.
  • Parse the promisedOutcomes[] field to the correct promised outcomes types and throw an error if the type is not supported. For the POC, we will only allow the exact-transfer type.
  • Build exact-transfer caveats and attach them to the delegation that will be signed.
  • Create the mock ERC20 GATOR token and deploy to testnet.
  • Redeem the grant permission and show that the user account has increased by X GATOR tokens.

UI

outcomes

Mental models

EVM UserOp State transition(UserOp submitted by dApp on behalf of the user delegator account)

infra-1

infra-2

Native token stream permission with not PromisedOutcomes

native-token-stream-permission-no-outcomes

@V00D00-child V00D00-child changed the title feat: Add MetaMask Promised Outcomes [DRAFT] feat: Add MetaMask Promised Outcomes May 21, 2025
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