@startuml
skinparam backgroundColor #ffffff00
skinparam DefaultFontColor #DodgerBlue
skinparam handwritten true
skinparam sequence {
ArrowColor LightSkyBlue
ActorBorderColor LightSkyBlue
LifeLineBorderColor LightSkyBlue
LifeLineBackgroundColor #A9DCDF
ParticipantBorderColor LightSkyBlue
ParticipantBackgroundColor DodgerBlue
ParticipantFontName Impact
ParticipantFontSize 17
ParticipantFontColor #A9DCDF
ActorBackgroundColor aqua
ActorFontColor LightSkyBlue
ActorFontSize 17
ActorFontName Impact
}
actor User
participant "Wallet" as A
participant "Aggregator API" as B
participant "Off-chain or on-chain Pair Data" as C
participant "Aggregator Router" as D
participant "Swap Router" as E
participant "Bridge" as F
User -> A: 进入 Swap & Bridge 界面,\n选择链和Token差
activate A
A -> B: /quote 接口寻找报价
activate B
B -> C: 查询相关 Pair 流动性数据
activate C
C -> B: 分析各个Swap\nPair 流动性、进行大单拆单、多\nPair 撮合
deactivate C
B -> A: 返回报价列表
deactivate B
A -> B: 选择报价,请求生成交易数据
activate B
B -> A: 构造 calldata 返回
deactivate B
A -> D: 提交 Aggregator Router 执行
activate D
D -> E: 根据 calldata 进行 swap 操作
activate E
E -> D: 划转 output token
deactivate E
D -> F: swap 完成,approve 给 bridge 合约,开始跨链
activate F
F -> D: 收到跨链资产,交由协议执行
deactivate F
D -> A: 链上执行成功
deactivate D
note over B: aggregator 后端会记录跨链相关交易\n,持续追踪状态
A -> B: 查询跨链状态
activate B
B -> A: 跨链成功,展示gas费协议费
deactivate B
A -> User: 流程结束
deactivate A
@enduml