TellerHedgingManagerFactory.sol
1 pragma solidity >=0.6.0; 2 pragma experimental ABIEncoderV2; 3 4 import "../../deployment/Deployer.sol"; 5 import "../../deployment/ManagedContract.sol"; 6 import "./TellerHedgingManager.sol"; 7 8 contract TellerHedgingManagerFactory is ManagedContract { 9 10 address public tellerRehypothecationAddr; 11 12 address private deployerAddress; 13 14 event NewHedgingManager( 15 address indexed hedgingManager, 16 address indexed pool 17 ); 18 19 constructor(address _tellerRehypothecationAddr) public { 20 tellerRehypothecationAddr = _tellerRehypothecationAddr; 21 } 22 23 function initialize(Deployer deployer) override internal { 24 deployerAddress = address(deployer); 25 } 26 27 function getRemoteContractAddresses() external view returns (address trAddr) { 28 bytes memory data = abi.encodeWithSelector(bytes4(keccak256("tellerRehypothecationAddr()"))); 29 (, bytes memory returnedData) = getImplementation().staticcall(data); 30 trAddr = abi.decode(returnedData, (address)); 31 32 require(trAddr != address(0), "bad rehypothecation addr"); 33 } 34 35 function create(address _poolAddr) external returns (address) { 36 //cant use proxies unless all extenral addrs store here 37 require(deployerAddress != address(0), "bad deployer addr"); 38 address hdgMngr = address( 39 new TellerHedgingManager( 40 deployerAddress, 41 _poolAddr 42 ) 43 ); 44 /* 45 address proxyAddr = address( 46 new Proxy( 47 getOwner(), 48 hdgMngr 49 ) 50 ); 51 ManagedContract(proxyAddr).initializeAndLock(Deployer(deployerAddress));*/ 52 emit NewHedgingManager(hdgMngr, _poolAddr); 53 return hdgMngr; 54 } 55 }