最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

security - How is the Metamask Spender contract splitting the funds to the DS Proxy and the user? - Stack Overflow

programmeradmin4浏览0评论

Below is my understanding on how Metamask swap works:

  1. User approves the Metaswap contract for their tokens they wanna swap
  2. When the user proceeds to execute the Metamask swap it calls the _swap() function which transfers the approved user's token to the Spender:
  3. The user already provides the adapterId which makes a delegatecall to the Adapter (1InchRouter, etc) where the actual swap happens:
  4. The Adapter receives the swapped tokenOut which is "somehow" splits into the Metamask fees and sends the remaining to the user, DS Proxy which receives the fees:

I'm confused about the 4th step where is the logic for sending the funds to the suer and the DS Proxy? Also why is the result of the delegatecall not used in the Spender's swap()?

发布评论

评论列表(0)

  1. 暂无评论