Skip to content

Feature: Swap Authorization Form #43

Description

@kamescg

Context

The Universal wallet uses the MetaMask Delegation Framework for handling wallet delegations, authorizations and intents. The framework includes 20+ enforcer smart contract modules for dictating transaction execution capabilities.

The unique approach lends itself towards wallet level swap intents i.e. action authorizations.

Similar to the ERC-7683 standard proposed by Uniswap and Across.

As an aside, the Universal Wallet has an experimental ticket for integrating the two systems.

Scope

Create a swap form that lets user construct an Authorization Action, as described by the Delegation Classification System, to swap Token A for Token B.

The swap form should include fields to set token in/out amounts and fill deadlines. Similar to how swaps work on Uniswap.

Required Enforcers:

Core Logic

Use ERC20BalanceGteEnforcer.sol to define the swap ratio for Token A and Token B.

Example:

  • I have 1,000 USDC
  • I want 500 aUSDC

Conditions:

  • ERC20BalanceGteEnforcer: USDC balance >= 500
  • ERC20BalanceGteEnforcer: aUSDC balance >= 499.50

Result:

  • Authorization to swap 500 USDC for a minimum of 499.50 aUSDC

Supporting Logic

Use the LimitedCallsEnforcer to limit execution to 1 redemption.

Use TimestampEnforcer.sol or BlockNumberEnforcer.sol enforcers to set a fill deadline i.e. 10 mins or less.

Outcome

The swap authorizations do not need to execute.

For now the authorizations can be saved in apps/api-delegations service and later broadcast to a filler/solver network.

The delegation type should be SwapAuthorization and added to the Delegations Classification System.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions