Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: Swap Authorization Form #43

Open
kamescg opened this issue Dec 1, 2024 · 0 comments
Open

Feature: Swap Authorization Form #43

kamescg opened this issue Dec 1, 2024 · 0 comments
Labels

Comments

@kamescg
Copy link
Contributor

kamescg commented Dec 1, 2024

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.

@kamescg kamescg added the feature label Dec 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant