10 部署PancakeSwap的Router合约报错

我已经部署了PancakeFactory合约,合约地址为:0x24253dfB14a21FeC015736224EBFf85Cc1F9c8D2,现在我部署PancakeRouter的时候报错

1_initial_migration.js中部署代码:

const PancakeRouter = artifacts.require("PancakeRouter");
const PancakeFactoryAddress = "0x24253dfB14a21FeC015736224EBFf85Cc1F9c8D2";
const WETH = {
    mainnet:'0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c',
    bsctest:'0xae13d989dac2f0debff460ac112a837c89baa7cd',
};

module.exports = (deployer, network) => {
    deployer.deploy(PancakeRouter, PancakeFactoryAddress, WETH[network]);
};

报错信息:

Starting migrations...
======================
> Network name:    'bsctest'
> Network id:      97
> Block gas limit: 29882814 (0x1c7f9be)

1_initial_migration.js
======================

   Deploying 'PancakeRouter'
   -------------------------
   > transaction hash:    0x213ccbbe1552526a1437e067485fc4ad2a13da12c1d1c6dbd55fd683c9b19f28

Error:  *** Deployment Failed ***

"PancakeRouter" -- Cannot create instance of PancakeRouter; no code at address 0x1D47bD5ecc47010809EBBE5d18adC25c2622CB8C.

    at /usr/local/lib/node_modules/truffle/build/webpack:/packages/deployer/src/deployment.js:365:1
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
    at Migration._deploy (/usr/local/lib/node_modules/truffle/build/webpack:/packages/migrate/Migration.js:68:1)
    at Migration._load (/usr/local/lib/node_modules/truffle/build/webpack:/packages/migrate/Migration.js:55:1)
    at Migration.run (/usr/local/lib/node_modules/truffle/build/webpack:/packages/migrate/Migration.js:171:1)
    at Object.runMigrations (/usr/local/lib/node_modules/truffle/build/webpack:/packages/migrate/index.js:150:1)
    at Object.runFrom (/usr/local/lib/node_modules/truffle/build/webpack:/packages/migrate/index.js:110:1)
    at Object.run (/usr/local/lib/node_modules/truffle/build/webpack:/packages/migrate/index.js:87:1)
    at runMigrations (/usr/local/lib/node_modules/truffle/build/webpack:/packages/core/lib/commands/migrate.js:269:1)
    at /usr/local/lib/node_modules/truffle/build/webpack:/packages/core/lib/commands/migrate.js:231:1
Truffle v5.1.60 (core: 5.1.60)
Node v14.15.1
请先 登录 后评论

1 个回答

Tiny熊
  擅长:智能合约,以太坊
请先 登录 后评论
  • 1 关注
  • 1 收藏,4568 浏览
  • wangwei123 提出于 2021-05-19 18:46