// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;
contract Factory {
// Returns the address of the newly deployed contract
function deploy(
address _owner,
uint _foo,
uint _salt
) public payable returns (address) {
return address(new TestContract{salt: bytes32(_salt)}(_owner, _foo));
}
}
contract TestContract {
address public owner;
uint public foo;
constructor(address _owner, uint _foo) payable {
owner = _owner;
foo = _foo;
}
function getBalance() public view returns (uint) {
return address(this).balance;
}
}
when I try to deploy the test contract using the factory contract the address I get is of another factory contract and not the test contract.
Can anyone tell me why is it not behaving properly or what I am doing wrong?
The At Address call function on remix is faulty.
It loads the incorrect contract.
I investigated the deployed contract on etherscan and the address was of the intended contract.