Skip to content

Commit

Permalink
Merge pull request #317 from pods-finance/develop
Browse files Browse the repository at this point in the history
Added ProxyDeployer to mocked contracts
  • Loading branch information
Robsonsjre authored Feb 8, 2022
2 parents f97fbbc + e92bf05 commit df74caf
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions contracts/mocks/ProxyDeployer.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
pragma solidity 0.6.12;

interface IOwnable {
function transferOwnership(address owner) external;
}

contract ProxyDeployer {
event Deployed(address indexed deployer, address contractAddress, bytes32 salt);

function deploy(bytes32 salt, bytes memory bytecode) public returns (address addr) {
assembly {
addr := create2(0, add(bytecode, 0x20), mload(bytecode), salt)
}
emit Deployed(msg.sender, addr, salt);
}

function deployOwnable(bytes32 salt, bytes memory bytecode) public returns (address addr) {
addr = deploy(salt, bytecode);
IOwnable(addr).transferOwnership(msg.sender);
}
}

0 comments on commit df74caf

Please sign in to comment.