PancakeSwap
Launch App
中文
中文
  • PancakeSwap 介绍
    • 入门指南 (BSC)
      • 创建钱包
      • 获取 BEP-20 代币
      • 在没有中心化交易所账户的情况下使用PancakeSwap
      • 连接钱包
    • 入门指南 (Aptos)
      • 创建钱包
      • 获取 Aptos 代币
      • Cake 跨链指南
      • 在 PancakeSwap 连接钱包
      • Aptos 常见问题解答
    • V3/V2 迁移
      • 如何进行迁移?
      • v3 的 APR 是怎么计算的?
      • 常见问题解答
      • V2 迁移
        • 迁移到 MasterChef v2
        • MasterChef v2
          • 农场列表
        • CAKE 糖浆池
    • 审计报告
    • veCAKE 退场计划
      • 质押 CAKE 赎回
    • 路线图
    • 需要帮助?点我
      • 故障排除指南
      • 常见问题解答
      • 什么是授权操作?
      • 如何修复 MetaMask 上卡住的交易
      • 来自币安学院的指南
  • 产品
    • 🔄交易
      • 代币兑换
      • 如何进行交易
      • 交易手续费和路由设置
      • 流动性资金池
      • 添加/移除流动性
      • 交易 FAQ
      • 做市商整合
      • 智能路由 (V2)
        • 如何通过智能路由进行交易?
      • Zap
        • Zap- 一键添加流动性 (V2)
      • 稳定币兑换
        • 如何使用稳定币兑换
      • 限价單交易 & 时间加权平均价格 (TWAP)
        • 如何使用限价单?
        • 如何使用时间加权平均价格(TWAP)?
        • 限价单 FAQ(旧)
    • 🚜农场
      • 如何使用农场
        • 如何使用农场 (旧版农场页面)
      • APR/ROI/IL 计算器
      • 农场 FAQ
      • 在 Aptos 链上参与农场
        • Aptos链 农场 FAQ
      • 跨链农场
        • 跨链农场 FAQ
      • bCAKE
        • 如何使用新的 bCAKE ?
        • 迁移指南
        • bCAKE FAQ
        • V2 (已弃用)
          • 如何使用 bCAKE?
    • 🔷veCAKE
      • 什么是 veCAKE?
      • 如何获得 veCAKE?
      • 从 CAKE 糖浆池迁移
      • 每周赚取 CAKE
        • 每周赚取 CAKE FAQ
      • Gauges Voting
        • Gauge Voting FAQ
      • 贿选 (投票激励)
      • veCAKE 管理协议
      • 为项目激励流动性
      • 将你的 veCAKE 跨链
      • veCAKE FAQ
    • 🍯糖浆池-质押 CAKE
      • 其他糖浆池
        • 糖浆池 FAQ 与排错指南
      • CAKE 糖浆池
        • 如何使用灵活质押糖浆池
        • 如何使用锁仓质押糖浆池
        • CAKE 糖浆池 FAQ
    • 🧑‍⚖️农场竞拍
    • 💹收入分成
      • 如何参与?
      • 收入分成 FAQ
    • 🛍️IFO (初次农场发行)
      • 如何参加 IFO
      • 如何参与跨链 IFO?
      • FAQ
      • iCAKE
      • 合约详情
    • 🌉跨链
      • EVM 链之间跨链
      • EVM 链与 Aptos 之间跨链
      • 跨链 FAQ
      • Wormhole Bridge Guide
      • 虫洞跨链桥 FAQ
    • 🤝简单赚币
      • 如何使用简单赚币
      • 简单赚币 FAQ
      • 条款和条件
    • 💧流动权益质押整合
      • 如何进行流动权益质押?
      • WBETH
        • WBETH FAQ
      • SnBNB
        • SnBNB FAQ
    • 🟪永续合约交易
      • 什么是永续合约交易
      • 永续合约交易 V2
        • 我应该如何使用它?
        • Dumb 模式
          • Dumb 模式指南
        • Degen Mode
          • Degen 模式动态费用
        • MADBTCUSD
          • MADBTCUSD FAQ
        • 永续合约 V2 术语表
        • 外汇交易
        • 永续合约交易 FAQ
          • Arbitrum
            • ALP 糖浆池 (Arbitrum)
              • ALP 购买&出售手续费
        • 交易奖励计划
          • Arbitrum
        • 支持的区块链、模式和交易对
      • 永续合约交易 V1
        • 永续合约 V1 术语表
        • 我应该如何使用它?
        • 永续合约 V1 FAQ
    • 🎮游戏平台
      • 📒品牌工具套件
      • 🎓Pancake Mayer
      • 🛡️Pancake Protectors 游戏
        • FAQ
    • 🎯PancakeSwap 任务平台
      • 准备工作
      • 如何参与并完成一个任务
      • 奖励
    • 🧈交易返利
      • 如何参与
        • 顶级交易者交易返利活动
        • CAKE 锁仓用户交易返利活动
      • 交易返利 FAQ
    • 🔮预测
      • 如何使用预测功能
      • AI 预测
      • 预测功能 FAQ
      • 预测功能故障排除
      • 预测 Telegram 小程序
    • 🎟️彩票 v2
      • 如何玩转彩票v2
      • 彩票 FAQ
    • 🍯糖浆彩票
      • 如何玩转糖浆彩票
      • 糖浆彩票抽奖延迟说明
      • 糖浆彩票 FAQ
    • 🖼️NFT市场
      • 🖼️NFT 个人资料系统
        • 如何设置 NFT 个人资料?
        • 战队
    • 💳购买加密货币
    • 🌐PancakeSwap 迷你小程序
      • 如何使用 PancakeSwap 迷你小程序
      • 迷你小程序常见问题解答
      • ⛓️PancakeSwap CEDEFI 整合
    • 📈信息站
    • 🖥️PancakeSwap 私人 RPC
    • 🔔通知服务
    • PancakeSwap v4
      • v4 FAQ
    • 💸期权
      • 期权入门
      • CLAMM 期权
      • 期权 FAQ
  • 治理&代币经济
    • CAKE 代币经济模型
      • CAKE 的总量上限
    • 🗳️投票(旧)
    • 治理(新)
      • 如何投票
        • 如何使用SafePal钱包进行投票
      • vCAKE
  • 生态系统&合作伙伴关系
    • 联盟计划
      • 联盟仪表板&返佣链接
      • 佣金结构及支付详情
      • 联盟计划规则和指南
      • 条款及细则
    • 大使计划
      • 👥社区管理
      • 🌎社区翻译者
      • ❓大使计划 FAQs
    • 品牌和标志
    • 联系我们
      • 客户服务
      • 社交媒体与社区
    • 💼商务合作
      • ⛽Vecake-Gauges
      • 🧑‍🌾初次农场发行- IFO
      • 🥞糖浆池和农场
      • 🖼️NFT 交易市场
      • ❓商务合作常见 FAQ
  • 给开发者们
    • 为项目做出贡献
      • 代码库概览
    • Bug 赏金
    • 智能合约 (EVM)
      • veCAKE & Gauge Voting
      • PancakeSwap 交易相关
        • v3 相关合约
          • PancakeV3Factory
          • 智能路由 V3
            • V3 兑换路由
            • V2 兑换路由
            • StableSwap 路由
          • 非同质化仓位
          • Pancake V3 池子
        • v2 相关合约
          • Factory v2
          • 路由 V2
        • Stable Swap
          • Stableswap 路由
          • StableSwap 池子
      • 主厨合约
        • 主厨合约 V3
      • 糖浆池
        • 可初始化的 SmartChef
        • 池子部署器
      • CAKE 糖浆池
      • IFO
      • 预测
      • 彩票
        • 彩票合约
      • 糖浆彩票
      • 农场助推器 (bCAKE)
      • IFO 投入上限(iCAKE)
      • 跨链农场
      • CAKE 跨链
      • Market Maker Pool
    • 智能合约 (Aptos)
      • PancakeSwap 交易相关
        • V2
          • 兑换核心 V2
          • V2 路由
      • 主厨合约
      • 糖浆池
      • IFO
      • Utils
    • API
      • Subgraph
    • 私人 RPC 节点
  • 团队
    • 厨房团队
    • 成为一名大厨
      • Solidity Engineer (Contract)
      • Frontend Engineer (Contract)
      • 产品设计师(UX/I)
      • 商务开发经理
      • 前端工程师
      • Solidity 工程师
      • 开发运维工程师
  • 联系我们
    • 客户服务
    • 社交媒体与社区
  • 代币分发 (🚧)
  • 参考资料
    • Old Tokenomics
      • CAKE Tokenomics v1
      • Controlling CAKE supply v1
    • 如何通过BscScan使用农场
Powered by GitBook
On this page

Was this helpful?

Last updated 1 year ago

Was this helpful?

Contract info

Contract name: pancake::router Contract address: c7efb4076dbe143cbcd98cfaaa929ecfc8f299203dfff63b95ccb6bfe19850fa::router

Admin Multi Sig: b11ccaed0056a75472539c2b0d9511c82fc6a36622bec7578216af5fe550dd0d

Types

Name
Type
Description

Entry Functions

Create Pair

Create the pool pair for swap.

Params

Name
Type
Descripton

Add Liquidity

Add liquidity to the pool.

Params

Remove Liquidity

Remove liquidity from the pool.

Params

Swap Exact Input

Swap exact amount of tokenX to tokenY.

Params

Swap Exact Output

Swap tokenX to exact amount of tokenY.

Params

Swap Exact Input Double Hop

Swap exact amount of tokenX to tokenZ using 2 pools (Pool XY and Pool YZ).

Params

Swap Exact Output Double Hop

Swap tokenX to exact amount of tokenZ using 2 pools (Pool XY and Pool YZ).

Params

Swap Exact Input Triple Hop

Swap exact amount of tokenX to tokenA using 3 pools (Pool XY, Pool YZ and Pool ZA).

Params

Swap Exact Output Triple Hop

Swap tokenX to exact amount of tokenA using 3 pools (Pool XY, Pool YZ and Pool ZA).

Swap Exact Input Quadruple Hop

Swap exact amount of tokenX to tokenB using 3 pools (Pool XY, Pool YZ, Pool ZA and Pool AB).

Swap Exact Output Quadruple Hop

Swap tokenX to exact amount of tokenB using 3 pools (Pool XY, Pool YZ, Pool ZA and Pool AB).

Public Functions

Swap Exact X to Y

Swap exact amount of tokenX to tokenY.

Input Values

Return Values

Swap X to Exact Y

Swap tokenX to the exact amount of tokenY.

Input Values

Return Values

Get Amount In

The amount required in order to the the output amount.

Input Values

Return Values

Name
Type
Description
Name
Type
Description
Name
Type
Description
Name
Type
Description
Name
Type
Description
Name
Type
Description
Name
Type
Description
Name
Type
Description
Name
Type
Description
Name
Type
Description
Name
Type
Description
Type
Description
Name
Type
Description
Position
Type
Description
Name
Type
Description
Type
public entry fun add_liquidity<X, Y>(
    sender: &signer,
    amount_x_desired: u64,
    amount_y_desired: u64,
    amount_x_min: u64,
    amount_y_min: u64,
)

sender

signer

The sender's signer when calling the function.

amount_x_desired

u64

The amount of tokenX you'd like to provide as liquidity.

amount_y_desired

u64

The amount of tokenY you'd like to provide as liquidity.

amount_x_min

u64

The minimum amount of tokenX to provide (slippage impact).

amount_y_min

u64

The minimum amount of tokenY to provide (slippage impact).

public entry fun remove_liquidity<X, Y>(
    sender: &signer,
    liquidity: u64,
    amount_x_min: u64,
    amount_y_min: u64
)

sender

signer

The sender's signer when calling the function.

liquidity

u64

The amount of LP Tokens to remove.

amount_x_min

u64

The minimum amount of tokenX to remove (slippage impact).

amount_y_min

u64

The minimum amount of tokenY to remove (slippage impact).

public entry fun swap_exact_input<X, Y>(
    sender: &signer,
    x_in: u64,
    y_min_out: u64,
)

sender

signer

The sender's signer when calling the function.

x_in

u64

Payable amount of input tokenX.

y_min_out

u64

The minimum amount tokenY to receive.

public entry fun swap_exact_output<X, Y>(
    sender: &signer,
    y_out: u64,
    x_max_in: u64,
)

sender

signer

The sender's signer when calling the function.

y_out

u64

Payable amount of output tokenY.

x_max_in

u64

The maximum amount tokenX to input.

public entry fun swap_exact_input_doublehop<X, Y, Z>(
    sender: &signer,
    x_in: u64,
    z_min_out: u64,
)

sender

signer

The sender's signer when calling the function.

x_in

u64

Payable amount of input tokenX.

z_min_out

u64

The minimum amount tokenZ to receive.

public entry fun swap_exact_output_doublehop<X, Y, Z>(
    sender: &signer,
    z_out: u64,
    x_max_in: u64,
)

sender

signer

The sender's signer when calling the function.

z_out

u64

Payable amount of output tokenZ.

x_max_in

u64

The maximum amount tokenX to input.

public entry fun swap_exact_input_triplehop<X, Y, Z, A>(
    sender: &signer,
    x_in: u64,
    a_min_out: u64,
) 

sender

signer

The sender's signer when calling the function.

x_in

u64

Payable amount of input tokenX.

a_min_out

u64

The minimum amount tokenA to receive.

public entry fun swap_exact_output_triplehop<X, Y, Z, A>(
    sender: &signer,
    a_out: u64,
    x_max_in: u64,
) 

sender

signer

The sender's signer when calling the function.

a_out

u64

Payable amount of output tokenA.

x_max_in

u64

The maximum amount tokenX to input.

public entry fun swap_exact_input_quadruplehop<X, Y, Z, A, B>(
    sender: &signer,
    x_in: u64,
    b_min_out: u64,
)

sender

signer

The sender's signer when calling the function.

x_in

u64

Payable amount of input tokenX.

b_min_out

u64

The minimum amount tokenB to receive.

public entry fun swap_exact_output_quadruplehop<X, Y, Z, A, B>(
    sender: &signer,
    b_out: u64,
    x_max_in: u64,
)

sender

signer

The sender's signer when calling the function.

b_out

u64

Payable amount of output tokenB.

x_max_in

u64

The maximum amount tokenX to input.

public fun swap_exact_x_to_y_direct_external<X, Y>(x_in: coin::Coin<X>): coin::Coin<Y> 

x_in

coin::Coin

The coin resource of tokenX that the user will swap.

coin::Coin

The coin resource of tokenY that the user will receive.

public fun swap_x_to_exact_y_direct_external<X, Y>(x_in: coin::Coin<X>, y_out_amount:u64): (coin::Coin<X>, coin::Coin<Y>)

x_in

coin::Coin

The coin resource of tokenX that the user will swap.

y_out_amount

u64

The expected amount of tokenY that user will receive.

0

coin::Coin

The coin resource of tokenX that the user will swap.

1

coin::Coin

The coin resource of tokenY that user will receive.

public fun get_amount_in<X, Y>(y_out_amount: u64): u64

y_out_amount

u64

The amount of tokenY that user will receive.

u64

The amount of tokenX required to get the amount of tokenY.

  1. 给开发者们
  2. 智能合约 (Aptos)
  3. PancakeSwap 交易相关
  4. V2

V2 路由

Router v2

Previous兑换核心 V2Next主厨合约
  • Contract info
  • Types
  • Entry Functions
  • Create Pair
  • Add Liquidity
  • Remove Liquidity
  • Swap Exact Input
  • Swap Exact Output
  • Swap Exact Input Double Hop
  • Swap Exact Output Double Hop
  • Swap Exact Input Triple Hop
  • Swap Exact Output Triple Hop
  • Swap Exact Input Quadruple Hop
  • Swap Exact Output Quadruple Hop
  • Public Functions
  • Get Amount In

X

type address

The coin type address of token X in the pair.

Y

type address

The coin type address of token Y in the pair.

public entry fun create_pair<X, Y>(sender: &signer)

sender

signer

The sender's signer when calling the function.

View on Aptos Explorer