addDsa will create new DSA and add it

This commit is contained in:
Thrilok Kumar 2020-08-26 22:16:54 +05:30
parent 6109d0c003
commit 4e423adf1a

View File

@ -5,6 +5,7 @@ pragma experimental ABIEncoderV2;
interface IndexInterface {
function master() external view returns (address);
function build(address _owner, uint accountVersion, address _origin) external returns (address _account);
}
contract Registry {
@ -19,6 +20,8 @@ contract Registry {
event LogUpdateInsureFee(address pool, uint newFee);
event LogAddPool(address indexed token, address indexed pool);
event LogRemovePool(address indexed token, address indexed pool);
event LogNewDSA(address indexed pool, address indexed dsa);
event LogRemoveDSA(address indexed pool, address indexed dsa);
IndexInterface public constant instaIndex = IndexInterface(0x2971AdFa57b20E5a416aE5a708A8655A9c74f723);
@ -134,13 +137,18 @@ contract Registry {
emit LogUpdateInsureFee(_pool, _newFee);
}
function enableDsa(address _pool, address _dsa) external isMaster {
function addDsa(address _pool) external isMaster {
require(isPool[_pool], "not-pool");
address _dsa = instaIndex.build(_pool, 1, address(this));
isDsa[_pool][_dsa] = true;
emit LogNewDSA(_pool, _dsa);
}
function disableDsa(address _pool, address _dsa) external isMaster {
function removeDsa(address _pool, address _dsa) external isMaster {
require(isPool[_pool], "not-pool");
require(isDsa[_pool][_dsa], "not-dsa-for-pool");
delete isDsa[_pool][_dsa];
emit LogRemoveDSA(_pool, _dsa);
}
constructor(address _chief) public {