frangio / hardhat-exposed

Automatically expose internal Solidity functions for smart contract testing.
82 stars 13 forks source link

Wrong import path if paths.root is defined in hardhat config #24

Closed emretepedev closed 1 year ago

emretepedev commented 1 year ago

I set the root path in my hardhat config. hardhat.config.ts

const config: HardhatUserConfig = {
  paths: {
    root: './src',
  },
  exposed: {
    prefix: 'x_',
  },
}

This is my Example contract. src/contracts/Example.sol

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

contract Example {
    address private foo = address(this);
}

But it seems the wrong path when importing the base contract. Expected src/contracts-exposed/Example.sol output:

import "../contracts/Example.sol";

contract X_Example is Example {
   // ...
}

Actual src/contracts-exposed/Example.sol output:

import "../../contracts/Example.sol"; // <--- wrong path here

contract X_Example is Example {
    // ...
}
emretepedev commented 1 year ago

Any update here?

I can't use this plugin because of this issue.

nicolasegimenez commented 1 year ago

You tried to change the prefix for "_"?

frangio commented 1 year ago

Fixed in 0de23e8b4c8f110042d4351c14e83c9567eefe20.