Skip to content

Commit

Permalink
🐛 put owner in init params instead msg.sender
Browse files Browse the repository at this point in the history
✨ setCouncilMembers func added
✨ setBasisStakedAmount func added
  • Loading branch information
kamikazebr committed Dec 27, 2023
1 parent 33b554e commit 2811fad
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
1 change: 1 addition & 0 deletions pkg/contracts/src/RegistryFactory.sol
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ contract RegistryFactory {
{
RegistryGardens gardenRegistry = new RegistryGardens();
params._nonce = nonce++;
params.owner = msg.sender;
gardenRegistry.initialize(params);
return address(gardenRegistry);
}
Expand Down
17 changes: 15 additions & 2 deletions pkg/contracts/src/RegistryGardens.sol
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ contract RegistryGardens is ReentrancyGuard {
uint256 _protocolFee;
uint256 _nonce;
Metadata _metadata;
address owner;
}

//TODO: can change to uint32 with optimized storage order
Expand Down Expand Up @@ -99,13 +100,21 @@ contract RegistryGardens is ReentrancyGuard {
gardenToken = params._gardenToken;
minimumStakeAmount = params._minimumStakeAmount;
protocolFee = params._protocolFee;
gardenOwner = msg.sender;
// gardenOwner = msg.sender; //@todo: RegistryFactory is the onwer of that contract, that need be able to change the owner
gardenOwner = params.owner; //@todo: check if address(0) is a valid owner
registry = IRegistry(allo.getRegistry());
address[] memory initialmembers = new address[](0);
profileId = registry.createProfile(params._nonce, communityName, params._metadata, msg.sender, initialmembers);
}

function setCouncilMembers(address[] memory _members) public {}
//@todo: maybe we want use ROLES instead fixed address that give mroe flexibility
//@todo: also who should be allowed to set the council members? the DAO? the garden owner?
function setCouncilMembers(address[] memory _members) public onlyGardenOwner{
for (uint256 i = 0; i < _members.length; i++) {
councilMembers[_members[i]] = true;
}
emit CouncilMemberSet(_members);
}

function addStrategy(address _newStrategy) public onlyRegistryMember {
if (enabledStrategies[_newStrategy]) {
Expand Down Expand Up @@ -179,6 +188,10 @@ contract RegistryGardens is ReentrancyGuard {
return minimumStakeAmount;
}

function setBasisStakedAmount(uint256 _newAmount) external onlyCouncilMember {
minimumStakeAmount = _newAmount;
}

function updateProtocolFee(uint256 _newProtocolFee) public {
if (!isCouncilMember(msg.sender)) {
revert("Must be in council safe");
Expand Down

0 comments on commit 2811fad

Please sign in to comment.