首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往
您找到你想要的搜索结果了吗?
是的
没有找到

剖析DeFi交易产品之UniswapV4:Swap

在 PoolManager 合约里,要完成交易流程,会涉及到 lock()、swap()、settle()、take() 四个函数。...第四步,执行 take() 函数,取回所得的代币。 最后,lock() 函数完成,返回结果。 而如果是跨池交易的话,则需要在 Router 层面确定好交易路径,然后根据路径执行多次 swap。...而不管中间经过了多少次 swap,最后,只需要完成一次 settle 操作,即支付 A,也只需要执行一次 take 操作,即取回最后所得的 C。...the entire input/output and haven't reached the price limit while (state.amountSpecifiedRemaining !...); 之后,执行当前这步的具体计算: // compute values to swap to the target tick, price limit, or point where input/output

25110
领券