wighawag / hardhat-deploy

hardhat deployment plugin
MIT License
1.2k stars 296 forks source link

Contract with linked contract dependencies is failing to be deployed by hardhat-deploy #114

Closed David-Kneel closed 3 years ago

David-Kneel commented 3 years ago

Description

I was automating the deployment of my hardhat project and got a problem recently with using already deployed contract at a given address. Here more specifically: https://github.com/TachyonicFinance/faster-than-light/blob/hardhat-deploy/deploy/04_deploy_yieldfarming.js#L15

Expected behavior

yarn run deploy hardhat deploys correctly with the following output:

❯ yarn run deploy hardhat
yarn run v1.22.10
$ node --require esm node_modules/.bin/hardhat deploy --network hardhat
Nothing to compile
deploying "Timestamp" (tx: 0xcd376bf49d14bda8c65a0ed38a085a89aea355bf31553aa94f75b98a24787b4b)...: deployed at 0x5FbDB2315678afecb367f032d93F642f64180aa3 with 83249 gas
deploying "ABDKMathQuad" (tx: 0xac3f6fdd52285baa54c8aeb6776f9aa7e3653d12c2073baab61c2eafdd35cce5)...: deployed at 0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512 with 2855609 gas
deploying "RewardCalculator" (tx: 0x9946d3adaabf5f8c7cd13b199b5a38f8c9acfb33cae8b1804a928ddde8ebf4b1)...: deployed at 0x9fE46736679d2D9a65F0992F2272dE9f3c7fa6e0 with 470216 gas
deploying "ERC20Mock" (tx: 0xf39facf9ce3d5ed78e1e63778466419c2d911f446867fadf65d71b0c90d84e3c)...: deployed at 0xCf7Ed3AccA5a467e9e704C703E8D87F634fB0Fc9 with 708427 gas
{
  address: '0xCf7Ed3AccA5a467e9e704C703E8D87F634fB0Fc9',
  abi: [
    {
      inputs: [Array],
      stateMutability: 'payable',
      type: 'constructor'
    },
    {
      anonymous: false,
      inputs: [Array],
      name: 'Approval',
      type: 'event'
    },
    {
      anonymous: false,
      inputs: [Array],
      name: 'Transfer',
      type: 'event'
    },
    {
      inputs: [Array],
      name: 'allowance',
      outputs: [Array],
      stateMutability: 'view',
      type: 'function'
    },
    {
      inputs: [Array],
      name: 'approve',
      outputs: [Array],
      stateMutability: 'nonpayable',
      type: 'function'
    },
    {
      inputs: [Array],
      name: 'balanceOf',
      outputs: [Array],
      stateMutability: 'view',
      type: 'function'
    },
    {
      inputs: [],
      name: 'decimals',
      outputs: [Array],
      stateMutability: 'view',
      type: 'function'
    },
    {
      inputs: [Array],
      name: 'decreaseAllowance',
      outputs: [Array],
      stateMutability: 'nonpayable',
      type: 'function'
    },
    {
      inputs: [Array],
      name: 'increaseAllowance',
      outputs: [Array],
      stateMutability: 'nonpayable',
      type: 'function'
    },
    {
      inputs: [],
      name: 'name',
      outputs: [Array],
      stateMutability: 'view',
      type: 'function'
    },
    {
      inputs: [],
      name: 'symbol',
      outputs: [Array],
      stateMutability: 'view',
      type: 'function'
    },
    {
      inputs: [],
      name: 'totalSupply',
      outputs: [Array],
      stateMutability: 'view',
      type: 'function'
    },
    {
      inputs: [Array],
      name: 'transfer',
      outputs: [Array],
      stateMutability: 'nonpayable',
      type: 'function'
    },
    {
      inputs: [Array],
      name: 'transferFrom',
      outputs: [Array],
      stateMutability: 'nonpayable',
      type: 'function'
    }
  ],
  transactionHash: '0xf39facf9ce3d5ed78e1e63778466419c2d911f446867fadf65d71b0c90d84e3c',
  receipt: {
    to: null,
    from: '0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266',
    contractAddress: '0xCf7Ed3AccA5a467e9e704C703E8D87F634fB0Fc9',
    transactionIndex: 0,
    gasUsed: '708427',
    logsBloom: '0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000001000000000000000000000008000000000000000000000000000000000000000000000000020000000000000100000800000000000000000000000010000000000000000008000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000200000000000000000000000002000000000000000000020000000000000000000000000000000000000000000000000000000000000000000',
    blockHash: '0xefd2b51d0214ab4107e5efe8a510efa8f17b091c20714b38a631f072a382dcfc',
    transactionHash: '0xf39facf9ce3d5ed78e1e63778466419c2d911f446867fadf65d71b0c90d84e3c',
    logs: [ [Object] ],
    blockNumber: 4,
    cumulativeGasUsed: '708427',
    status: 1,
    byzantium: true
  },
  args: [
    'ERC20Mock name',
    'ERC20Mock symbol',
    '0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266',
    1000
  ],
  bytecode: '0x608060405260405162000dd538038062000dd583398101604081905262000026916200029e565b8351849084906200003f9060039060208501906200014d565b508051620000559060049060208401906200014d565b5050506200006a82826200007460201b60201c565b50505050620003e5565b6001600160a01b038216620000a65760405162461bcd60e51b81526004016200009d906200032d565b60405180910390fd5b620000b46000838362000148565b8060026000828254620000c891906200036d565b90915550506001600160a01b03821660009081526020819052604081208054839290620000f79084906200036d565b90915550506040516001600160a01b038316906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906200013c90859062000364565b60405180910390a35050565b505050565b8280546200015b9062000392565b90600052602060002090601f0160209004810192826200017f5760008555620001ca565b82601f106200019a57805160ff1916838001178555620001ca565b82800160010185558215620001ca579182015b82811115620001ca578251825591602001919060010190620001ad565b50620001d8929150620001dc565b5090565b5b80821115620001d85760008155600101620001dd565b600082601f83011262000204578081fd5b81516001600160401b0380821115620002215762000221620003cf565b6040516020601f8401601f1916820181018381118382101715620002495762000249620003cf565b604052838252858401810187101562000260578485fd5b8492505b8383101562000283578583018101518284018201529182019162000264565b838311156200029457848185840101525b5095945050505050565b60008060008060808587031215620002b4578384fd5b84516001600160401b0380821115620002cb578586fd5b620002d988838901620001f3565b95506020870151915080821115620002ef578485fd5b50620002fe87828801620001f3565b604087015190945090506001600160a01b03811681146200031d578283fd5b6060959095015193969295505050565b6020808252601f908201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604082015260600190565b90815260200190565b600082198211156200038d57634e487b7160e01b81526011600452602481fd5b500190565b600281046001821680620003a757607f821691505b60208210811415620003c957634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052604160045260246000fd5b6109e080620003f56000396000f3fe608060405234801561001057600080fd5b50600436106100a95760003560e01c80633950935111610071578063395093511461012957806370a082311461013c57806395d89b411461014f578063a457c2d714610157578063a9059cbb1461016a578063dd62ed3e1461017d576100a9565b806306fdde03146100ae578063095ea7b3146100cc57806318160ddd146100ec57806323b872dd14610101578063313ce56714610114575b600080fd5b6100b6610190565b6040516100c391906106df565b60405180910390f35b6100df6100da3660046106ab565b610222565b6040516100c391906106d4565b6100f461023f565b6040516100c39190610913565b6100df61010f366004610670565b610245565b61011c6102e5565b6040516100c3919061091c565b6100df6101373660046106ab565b6102ea565b6100f461014a36600461061d565b610339565b6100b6610358565b6100df6101653660046106ab565b610367565b6100df6101783660046106ab565b6103e2565b6100f461018b36600461063e565b6103f6565b60606003805461019f90610959565b80601f01602080910402602001604051908101604052809291908181526020018280546101cb90610959565b80156102185780601f106101ed57610100808354040283529160200191610218565b820191906000526020600020905b8154815290600101906020018083116101fb57829003601f168201915b5050505050905090565b600061023661022f610421565b8484610425565b50600192915050565b60025490565b60006102528484846104d9565b6001600160a01b038416600090815260016020526040812081610273610421565b6001600160a01b03166001600160a01b03168152602001908152602001600020549050828110156102bf5760405162461bcd60e51b81526004016102b6906107fd565b60405180910390fd5b6102da856102cb610421565b6102d58685610942565b610425565b506001949350505050565b601290565b60006102366102f7610421565b848460016000610305610421565b6001600160a01b03908116825260208083019390935260409182016000908120918b16815292529020546102d5919061092a565b6001600160a01b0381166000908152602081905260409020545b919050565b60606004805461019f90610959565b60008060016000610376610421565b6001600160a01b03908116825260208083019390935260409182016000908120918816815292529020549050828110156103c25760405162461bcd60e51b81526004016102b6906108ce565b6103d86103cd610421565b856102d58685610942565b5060019392505050565b60006102366103ef610421565b84846104d9565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b3390565b6001600160a01b03831661044b5760405162461bcd60e51b81526004016102b69061088a565b6001600160a01b0382166104715760405162461bcd60e51b81526004016102b690610775565b6001600160a01b0380841660008181526001602090815260408083209487168084529490915290819020849055517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925906104cc908590610913565b60405180910390a3505050565b6001600160a01b0383166104ff5760405162461bcd60e51b81526004016102b690610845565b6001600160a01b0382166105255760405162461bcd60e51b81526004016102b690610732565b610530838383610601565b6001600160a01b038316600090815260208190526040902054818110156105695760405162461bcd60e51b81526004016102b6906107b7565b6105738282610942565b6001600160a01b0380861660009081526020819052604080822093909355908516815290812080548492906105a990849061092a565b92505081905550826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040516105f39190610913565b60405180910390a350505050565b505050565b80356001600160a01b038116811461035357600080fd5b60006020828403121561062e578081fd5b61063782610606565b9392505050565b60008060408385031215610650578081fd5b61065983610606565b915061066760208401610606565b90509250929050565b600080600060608486031215610684578081fd5b61068d84610606565b925061069b60208501610606565b9150604084013590509250925092565b600080604083850312156106bd578182fd5b6106c683610606565b946020939093013593505050565b901515815260200190565b6000602080835283518082850152825b8181101561070b578581018301518582016040015282016106ef565b8181111561071c5783604083870101525b50601f01601f1916929092016040019392505050565b60208082526023908201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260408201526265737360e81b606082015260800190565b60208082526022908201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604082015261737360f01b606082015260800190565b60208082526026908201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604082015265616c616e636560d01b606082015260800190565b60208082526028908201527f45524332303a207472616e7366657220616d6f756e74206578636565647320616040820152676c6c6f77616e636560c01b606082015260800190565b60208082526025908201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604082015264647265737360d81b606082015260800190565b60208082526024908201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646040820152637265737360e01b606082015260800190565b60208082526025908201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604082015264207a65726f60d81b606082015260800190565b90815260200190565b60ff91909116815260200190565b6000821982111561093d5761093d610994565b500190565b60008282101561095457610954610994565b500390565b60028104600182168061096d57607f821691505b6020821081141561098e57634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fdfea2646970667358221220cbaafeac146df2734c7029b424a6d61c77260578c30f85c31f0b912ec9fd807264736f6c63430008000033',
  deployedBytecode: '0x608060405234801561001057600080fd5b50600436106100a95760003560e01c80633950935111610071578063395093511461012957806370a082311461013c57806395d89b411461014f578063a457c2d714610157578063a9059cbb1461016a578063dd62ed3e1461017d576100a9565b806306fdde03146100ae578063095ea7b3146100cc57806318160ddd146100ec57806323b872dd14610101578063313ce56714610114575b600080fd5b6100b6610190565b6040516100c391906106df565b60405180910390f35b6100df6100da3660046106ab565b610222565b6040516100c391906106d4565b6100f461023f565b6040516100c39190610913565b6100df61010f366004610670565b610245565b61011c6102e5565b6040516100c3919061091c565b6100df6101373660046106ab565b6102ea565b6100f461014a36600461061d565b610339565b6100b6610358565b6100df6101653660046106ab565b610367565b6100df6101783660046106ab565b6103e2565b6100f461018b36600461063e565b6103f6565b60606003805461019f90610959565b80601f01602080910402602001604051908101604052809291908181526020018280546101cb90610959565b80156102185780601f106101ed57610100808354040283529160200191610218565b820191906000526020600020905b8154815290600101906020018083116101fb57829003601f168201915b5050505050905090565b600061023661022f610421565b8484610425565b50600192915050565b60025490565b60006102528484846104d9565b6001600160a01b038416600090815260016020526040812081610273610421565b6001600160a01b03166001600160a01b03168152602001908152602001600020549050828110156102bf5760405162461bcd60e51b81526004016102b6906107fd565b60405180910390fd5b6102da856102cb610421565b6102d58685610942565b610425565b506001949350505050565b601290565b60006102366102f7610421565b848460016000610305610421565b6001600160a01b03908116825260208083019390935260409182016000908120918b16815292529020546102d5919061092a565b6001600160a01b0381166000908152602081905260409020545b919050565b60606004805461019f90610959565b60008060016000610376610421565b6001600160a01b03908116825260208083019390935260409182016000908120918816815292529020549050828110156103c25760405162461bcd60e51b81526004016102b6906108ce565b6103d86103cd610421565b856102d58685610942565b5060019392505050565b60006102366103ef610421565b84846104d9565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b3390565b6001600160a01b03831661044b5760405162461bcd60e51b81526004016102b69061088a565b6001600160a01b0382166104715760405162461bcd60e51b81526004016102b690610775565b6001600160a01b0380841660008181526001602090815260408083209487168084529490915290819020849055517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925906104cc908590610913565b60405180910390a3505050565b6001600160a01b0383166104ff5760405162461bcd60e51b81526004016102b690610845565b6001600160a01b0382166105255760405162461bcd60e51b81526004016102b690610732565b610530838383610601565b6001600160a01b038316600090815260208190526040902054818110156105695760405162461bcd60e51b81526004016102b6906107b7565b6105738282610942565b6001600160a01b0380861660009081526020819052604080822093909355908516815290812080548492906105a990849061092a565b92505081905550826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040516105f39190610913565b60405180910390a350505050565b505050565b80356001600160a01b038116811461035357600080fd5b60006020828403121561062e578081fd5b61063782610606565b9392505050565b60008060408385031215610650578081fd5b61065983610606565b915061066760208401610606565b90509250929050565b600080600060608486031215610684578081fd5b61068d84610606565b925061069b60208501610606565b9150604084013590509250925092565b600080604083850312156106bd578182fd5b6106c683610606565b946020939093013593505050565b901515815260200190565b6000602080835283518082850152825b8181101561070b578581018301518582016040015282016106ef565b8181111561071c5783604083870101525b50601f01601f1916929092016040019392505050565b60208082526023908201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260408201526265737360e81b606082015260800190565b60208082526022908201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604082015261737360f01b606082015260800190565b60208082526026908201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604082015265616c616e636560d01b606082015260800190565b60208082526028908201527f45524332303a207472616e7366657220616d6f756e74206578636565647320616040820152676c6c6f77616e636560c01b606082015260800190565b60208082526025908201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604082015264647265737360d81b606082015260800190565b60208082526024908201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646040820152637265737360e01b606082015260800190565b60208082526025908201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604082015264207a65726f60d81b606082015260800190565b90815260200190565b60ff91909116815260200190565b6000821982111561093d5761093d610994565b500190565b60008282101561095457610954610994565b500390565b60028104600182168061096d57607f821691505b6020821081141561098e57634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fdfea2646970667358221220cbaafeac146df2734c7029b424a6d61c77260578c30f85c31f0b912ec9fd807264736f6c63430008000033'
}
deploying "YieldFarming" (tx: 0x4f3dad2d1295e365005ffce7f5b38a2079c9bf1c6ec32d0a8b0372e4658bffd4)...: deployed at 0xDc64a140Aa3E981100a9becA4E685f962f0cF6C9 with 3609520 gas
Done in 7.99s.

Faulty behavior

And yarn run deploy mumbai fails with the following output:

❯ yarn run deploy mumbai
yarn run v1.22.10
$ node --require esm node_modules/.bin/hardhat deploy --network mumbai
Nothing to compile
reusing "Timestamp" at 0x5b299fD70BeEeee5BA208a0C35d32a76e95B87e7
reusing "ABDKMathQuad" at 0xbe591BCB31407E9DF30127b5348A5Fa76765645E
reusing "RewardCalculator" at 0xCf4441dF00dEF1a7db5d084528eBd487DD68b5CF
Contract {
  interface: Interface {
    fragments: [
      [EventFragment],
      [EventFragment],
      [FunctionFragment],
      [FunctionFragment],
      [FunctionFragment],
      [FunctionFragment],
      [FunctionFragment],
      [FunctionFragment]
    ],
    _abiCoder: AbiCoder { coerceFunc: null },
    functions: {
      'allowance(address,address)': [FunctionFragment],
      'approve(address,uint256)': [FunctionFragment],
      'balanceOf(address)': [FunctionFragment],
      'totalSupply()': [FunctionFragment],
      'transfer(address,uint256)': [FunctionFragment],
      'transferFrom(address,address,uint256)': [FunctionFragment]
    },
    errors: {},
    events: {
      'Approval(address,address,uint256)': [EventFragment],
      'Transfer(address,address,uint256)': [EventFragment]
    },
    structs: {},
    deploy: ConstructorFragment {
      name: null,
      type: 'constructor',
      inputs: [],
      payable: false,
      stateMutability: 'nonpayable',
      gas: null,
      _isFragment: true
    },
    _isInterface: true
  },
  provider: EthersProviderWrapper {
    _isProvider: true,
    _events: [],
    _emitted: { block: -2 },
    formatter: Formatter { formats: [Object] },
    anyNetwork: false,
    _networkPromise: Promise { <pending> },
    _maxInternalBlockNumber: -1024,
    _lastBlockNumber: -2,
    _pollingInterval: 4000,
    _fastQueryDate: 0,
    connection: { url: 'http://localhost:8545' },
    _nextId: 42,
    _hardhatProvider: BackwardsCompatibilityProviderAdapter {
      _wrapped: AutomaticGasPriceProvider {
        _wrapped: AutomaticGasProvider {
          _wrapped: [AutomaticSenderProvider],
          _wrappedProvider: [AutomaticSenderProvider],
          _gasMultiplier: 1
        },
        _wrappedProvider: AutomaticGasProvider {
          _wrapped: [AutomaticSenderProvider],
          _wrappedProvider: [AutomaticSenderProvider],
          _gasMultiplier: 1
        }
      },
      _provider: AutomaticGasPriceProvider {
        _wrapped: AutomaticGasProvider {
          _wrapped: [AutomaticSenderProvider],
          _wrappedProvider: [AutomaticSenderProvider],
          _gasMultiplier: 1
        },
        _wrappedProvider: AutomaticGasProvider {
          _wrapped: [AutomaticSenderProvider],
          _wrappedProvider: [AutomaticSenderProvider],
          _gasMultiplier: 1
        }
      },
      sendAsync: [Function: bound sendAsync],
      send: [Function: bound send],
      _sendJsonRpcRequest: [Function: bound _sendJsonRpcRequest] AsyncFunction
    },
    _eventLoopCache: { detectNetwork: null }
  },
  signer: SignerWithAddress {
    _isSigner: true,
    address: '0x6DBe275d4008000b39E12AD374a59AeC31CF5274',
    _signer: JsonRpcSigner {
      _isSigner: true,
      provider: [EthersProviderWrapper],
      _address: '0x6DBe275d4008000b39E12AD374a59AeC31CF5274',
      _index: null
    },
    provider: EthersProviderWrapper {
      _isProvider: true,
      _events: [],
      _emitted: [Object],
      formatter: [Formatter],
      anyNetwork: false,
      _networkPromise: [Promise],
      _maxInternalBlockNumber: -1024,
      _lastBlockNumber: -2,
      _pollingInterval: 4000,
      _fastQueryDate: 0,
      connection: [Object],
      _nextId: 42,
      _hardhatProvider: BackwardsCompatibilityProviderAdapter {
        _wrapped: AutomaticGasPriceProvider {
          _wrapped: AutomaticGasProvider {
            _wrapped: [AutomaticSenderProvider],
            _wrappedProvider: [AutomaticSenderProvider],
            _gasMultiplier: 1
          },
          _wrappedProvider: AutomaticGasProvider {
            _wrapped: [AutomaticSenderProvider],
            _wrappedProvider: [AutomaticSenderProvider],
            _gasMultiplier: 1
          }
        },
        _provider: AutomaticGasPriceProvider {
          _wrapped: AutomaticGasProvider {
            _wrapped: [AutomaticSenderProvider],
            _wrappedProvider: [AutomaticSenderProvider],
            _gasMultiplier: 1
          },
          _wrappedProvider: AutomaticGasProvider {
            _wrapped: [AutomaticSenderProvider],
            _wrappedProvider: [AutomaticSenderProvider],
            _gasMultiplier: 1
          }
        },
        sendAsync: [Function: bound sendAsync],
        send: [Function: bound send],
        _sendJsonRpcRequest: [Function: bound _sendJsonRpcRequest] AsyncFunction
      },
      _eventLoopCache: [Object]
    }
  },
  callStatic: {
    'allowance(address,address)': [Function],
    'approve(address,uint256)': [Function],
    'balanceOf(address)': [Function],
    'totalSupply()': [Function],
    'transfer(address,uint256)': [Function],
    'transferFrom(address,address,uint256)': [Function],
    allowance: [Function],
    approve: [Function],
    balanceOf: [Function],
    totalSupply: [Function],
    transfer: [Function],
    transferFrom: [Function]
  },
  estimateGas: {
    'allowance(address,address)': [Function],
    'approve(address,uint256)': [Function],
    'balanceOf(address)': [Function],
    'totalSupply()': [Function],
    'transfer(address,uint256)': [Function],
    'transferFrom(address,address,uint256)': [Function],
    allowance: [Function],
    approve: [Function],
    balanceOf: [Function],
    totalSupply: [Function],
    transfer: [Function],
    transferFrom: [Function]
  },
  functions: {
    'allowance(address,address)': [Function],
    'approve(address,uint256)': [Function],
    'balanceOf(address)': [Function],
    'totalSupply()': [Function],
    'transfer(address,uint256)': [Function],
    'transferFrom(address,address,uint256)': [Function],
    allowance: [Function],
    approve: [Function],
    balanceOf: [Function],
    totalSupply: [Function],
    transfer: [Function],
    transferFrom: [Function]
  },
  populateTransaction: {
    'allowance(address,address)': [Function],
    'approve(address,uint256)': [Function],
    'balanceOf(address)': [Function],
    'totalSupply()': [Function],
    'transfer(address,uint256)': [Function],
    'transferFrom(address,address,uint256)': [Function],
    allowance: [Function],
    approve: [Function],
    balanceOf: [Function],
    totalSupply: [Function],
    transfer: [Function],
    transferFrom: [Function]
  },
  filters: {
    'Approval(address,address,uint256)': [Function],
    'Transfer(address,address,uint256)': [Function],
    Approval: [Function],
    Transfer: [Function]
  },
  _runningEvents: {},
  _wrappedEmits: {},
  address: '0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174',
  resolvedAddress: Promise { '0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174' },
  'allowance(address,address)': [Function],
  'approve(address,uint256)': [Function],
  'balanceOf(address)': [Function],
  'totalSupply()': [Function],
  'transfer(address,uint256)': [Function],
  'transferFrom(address,address,uint256)': [Function],
  allowance: [Function],
  approve: [Function],
  balanceOf: [Function],
  totalSupply: [Function],
  transfer: [Function],
  transferFrom: [Function]
}
An unexpected error occurred:

Error: ERROR processing /home/david/Workspaces/Tachyonic/faster-than-light/deploy/04_deploy_yieldfarming.js:
Error: invalid address (argument="address", value=undefined, code=INVALID_ARGUMENT, version=address/5.3.0) (argument=null, value=undefined, code=INVALID_ARGUMENT, version=abi/5.3.0)
    at Logger.makeError (/home/david/Workspaces/Tachyonic/faster-than-light/node_modules/hardhat-deploy/node_modules/@ethersproject/logger/src.ts/index.ts:213:28)
    at Logger.throwError (/home/david/Workspaces/Tachyonic/faster-than-light/node_modules/hardhat-deploy/node_modules/@ethersproject/logger/src.ts/index.ts:225:20)
    at Logger.throwArgumentError (/home/david/Workspaces/Tachyonic/faster-than-light/node_modules/hardhat-deploy/node_modules/@ethersproject/logger/src.ts/index.ts:229:21)
    at AddressCoder.Coder._throwError (/home/david/Workspaces/Tachyonic/faster-than-light/node_modules/hardhat-deploy/node_modules/@ethersproject/abi/src.ts/coders/abstract-coder.ts:68:16)
    at AddressCoder.encode (/home/david/Workspaces/Tachyonic/faster-than-light/node_modules/hardhat-deploy/node_modules/@ethersproject/abi/src.ts/coders/address.ts:22:18)
    at /home/david/Workspaces/Tachyonic/faster-than-light/node_modules/hardhat-deploy/node_modules/@ethersproject/abi/src.ts/coders/array.ts:71:19
    at Array.forEach (<anonymous>)
    at pack (/home/david/Workspaces/Tachyonic/faster-than-light/node_modules/hardhat-deploy/node_modules/@ethersproject/abi/src.ts/coders/array.ts:54:12)
    at ArrayCoder.encode (/home/david/Workspaces/Tachyonic/faster-than-light/node_modules/hardhat-deploy/node_modules/@ethersproject/abi/src.ts/coders/array.ts:208:16)
    at /home/david/Workspaces/Tachyonic/faster-than-light/node_modules/hardhat-deploy/node_modules/@ethersproject/abi/src.ts/coders/array.ts:62:19
    at DeploymentsManager.executeDeployScripts (/home/david/Workspaces/Tachyonic/faster-than-light/node_modules/hardhat-deploy/src/DeploymentsManager.ts:1009:19)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
wighawag commented 3 years ago

it seems one of the address you pass are undefined when using the mumbai network

By the way, the type at line https://github.com/TachyonicFinance/faster-than-light/blob/c537207168057b0999e730d002fca9a1f344ef16/deploy/04_deploy_yieldfarming.js#L15 is an ethers contract while the type at line https://github.com/TachyonicFinance/faster-than-light/blob/c537207168057b0999e730d002fca9a1f344ef16/deploy/04_deploy_yieldfarming.js#L22 is a deployment object

both have an address field so your script is fine here, but this might bite you if you assume one or the other

Also for contract already deployed (maybe by someone else) instead of hardcoding the address in the code you can add them to the deployment folder manually. then you can use deployments.get like you did the deployment yourself

David-Kneel commented 3 years ago

I will close the issue for now because it really looks the problem is at my end. Thank you very much for your kind meaningful help!