-
Notifications
You must be signed in to change notification settings - Fork 39
defaultSender seems to override explicit address decleration #25
Comments
Hello @crazyrabbitLTC, thanks for the report! I made a simple project to test this but was unable to reproduce the bug. Could you share more details of your setup? This is what I tried: import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
contract MyToken is ERC20 {
constructor() public {
_mint(msg.sender, 100);
}
} const { accounts, defaultSender, contract, web3 } = require('@openzeppelin/test-environment');
const [ owner, other ] = accounts;
const MyToken = contract.fromArtifact('MyToken');
describe('MyToken', () => {
beforeEach(async () => {
this.token = await MyToken.new({ from: owner });
});
it('balance is ok', async () => {
const defaultSenderBalance = await this.token.balanceOf(defaultSender);
const ownerBalance = await this.token.balanceOf(owner);
const otherBalance = await this.token.balanceOf(other);
console.log(`defaultSenderBalance: ${defaultSenderBalance}`);
console.log(`ownerBalance: ${ownerBalance}`);
console.log(`otherBalance: ${otherBalance}`);
console.log(`defaultSender address: ${defaultSender}`);
console.log(`owner address: ${owner}`);
console.log(`deployer address: ${(await web3.eth.getTransaction(this.token.transactionHash)).from}`);
});
}); The previous script outputs
|
Hmm, that is strange. I'm AF(real computer) at the moment, but I'll get back to you on reproducing the bug. It came up for me when using |
I had the exact same issue when using a custom |
@ppoliani thanks for the report! Could you share more information about your setup? We were unable to reproduce the original error. |
I would assume that your contract is an upgradable contract that is Ownable. If that is the case, you would need to initialize the ownership after deploying it in the test environment.
|
Expected Behavior:
When creating a new instance of a contract:
I would expect that my instance has been created from
myAddress
, however it is still created bydefaultSender
.Desired behavior:
I would expect that if I provide an address from which to create a contract, it would create the contract with my provided address.
The text was updated successfully, but these errors were encountered: