Error deploying a smart contract to interact with Compound

Trying to deploy a smart contract that communicates with Compound on Rinkeby and am stuck at deployment

:computer: Environment
Truffle v5.1.56 (core: 5.1.56)
Solidity v0.5.16 (solc-js)
Node v12.19.0
Web3.js v1.2.9

:memo:Details

:1234: Code to reproduce
Here is my the constructor code in the DeFi project

   contract MyDeFiProject {
        ComptrollerInterface public comptroller;
        PriceOracleInterface public priceOracle;
        constructor(
            address _comptroller,
            address _priceOracle
        ) {
            comptroller = ComptrollerInterface(_comptroller);
            priceOracle = PriceOracleInterface(_priceOracle);
        }
1 Like

value = undefined, so maybe you can print the parameter comptrollerAddress out to check what is it.

1 Like

can I print that if I don’t use Hardhat?? I have tried to confirm the addresses, to countercheck whether the ones I have provided are correct and I can only find the comptroller address for rinkeby, but not the priceoracle address for the same chain

1 Like

actually both addresses are correct so I do not understand what’s going on

1 Like

Just print in your deploying script, so it does not matter whether you use Hardhat.

in your 2_deploy_contracts.js

module.exports = function (deployer, network) {
    xxx
    console.log("network", network);           <<<------ print at here
    console.log("comptrollerAddress", comptrollerAddress);   <<<------ print at here
    console.log("priceOracle", priceOracleProxy);    <<<------ print at here
    deployer.deploy(xxx);
}
1 Like