generated from BlossomLabs/web3-turbo-template
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
21 changed files
with
1,227 additions
and
161 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
1 change: 1 addition & 0 deletions
1
pkg/contracts/out/RegistryCommunityFacet.sol/RegistryCommunityFacet.json
Large diffs are not rendered by default.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
pkg/contracts/out/RegistryCommunityV0_0.sol/RegistryCommunityV0_0.json
Large diffs are not rendered by default.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
pkg/contracts/out/RegistryCommunityV0_1.sol/RegistryCommunityV0_1.json
Large diffs are not rendered by default.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
pkg/contracts/out/RegistryFactoryDiamond.sol/RegistryFactoryDiamond.json
Large diffs are not rendered by default.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
pkg/contracts/out/RegistryFactoryFacet.sol/RegistryFactoryFacet.json
Large diffs are not rendered by default.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
pkg/contracts/out/RegistryFactoryV0_0.sol/RegistryFactoryV0_0.json
Large diffs are not rendered by default.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
pkg/contracts/out/RegistryFactoryV0_1.sol/RegistryFactoryV0_1.json
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
// SPDX-License-Identifier: AGPL-3.0-only | ||
pragma solidity ^0.8.19; | ||
|
||
import {BaseDiamond} from "@src/diamonds/BaseDiamond.sol"; | ||
import {LibDiamond} from "@src/diamonds/libraries/LibDiamond.sol"; | ||
|
||
import {IRegistry} from "allo-v2-contracts/core/interfaces/IRegistry.sol"; | ||
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; | ||
import {ISafe} from "@src/interfaces/ISafe.sol"; | ||
import {FAllo} from "@src/interfaces/FAllo.sol"; | ||
import {Metadata} from "allo-v2-contracts/core/libraries/Metadata.sol"; | ||
|
||
/*|--------------------------------------------|*/ | ||
/*| STRUCTS/ENUMS |*/ | ||
/*|--------------------------------------------|*/ | ||
|
||
/// @dev Initialize parameters for the contract | ||
/// @param _allo The Allo contract address | ||
/// @param _gardenToken The token used to stake in the community | ||
/// @param _registerStakeAmount The amount of tokens required to register a member | ||
/// @param _communityFee The fee charged to the community for each registration | ||
/// @param _nonce The nonce used to create new strategy clones | ||
/// @param _registryFactory The address of the registry factory | ||
/// @param _feeReceiver The address that receives the community fee | ||
/// @param _metadata The covenant IPFS hash of the community | ||
/// @param _councilSafe The council safe contract address | ||
/// @param _communityName The community name | ||
/// @param _isKickEnabled Enable or disable the kick feature | ||
struct RegistryCommunityInitializeParamsV0_0 { | ||
address _allo; | ||
IERC20 _gardenToken; | ||
uint256 _registerStakeAmount; | ||
uint256 _communityFee; | ||
uint256 _nonce; | ||
address _registryFactory; | ||
address _feeReceiver; | ||
Metadata _metadata; | ||
address payable _councilSafe; | ||
string _communityName; | ||
bool _isKickEnabled; | ||
string covenantIpfsHash; | ||
} | ||
|
||
struct Member { | ||
address member; | ||
uint256 stakedAmount; | ||
bool isRegistered; | ||
} | ||
|
||
struct Strategies { | ||
address[] strategies; | ||
} | ||
struct RoleData { | ||
mapping(address => bool) members; | ||
bytes32 adminRole; | ||
} | ||
abstract contract StorageCommunityDiamond is BaseDiamond { | ||
/*|--------------------------------------------|*/ | ||
/*| CONSTANTS & IMMUTABLE |*/ | ||
/*|--------------------------------------------|*/ | ||
|
||
/*|--------------------------------------------|*/ | ||
/*| STORAGE |*/ | ||
/*|--------------------------------------------|*/ | ||
|
||
uint8 private _initialized; // || SLOT 0 | ||
bool private _initializing; // || SLOT 0 | ||
uint256[50] private __gap1; // || SLOT 1 | ||
address public _owner; // || SLOT 51 | ||
uint256[49] private __gap2; // || SLOT 52 | ||
uint256 private _status; // || SLOT 101 | ||
uint256[49] private __gap3; // || SLOT 102 | ||
uint256[50] private __gap4; // || SLOT 151 | ||
mapping(bytes32 => RoleData) private _roles; // || SLOT 201 | ||
uint256[49] private __gap5; // || SLOT 202 | ||
|
||
uint256 public registerStakeAmount; // || SLOT 251 | ||
uint256 public communityFee; // || SLOT 252 | ||
uint256 public cloneNonce; // || SLOT 253 | ||
bytes32 public profileId; // || SLOT 254 | ||
bool public isKickEnabled; // || SLOT 255 | ||
address public feeReceiver; // || SLOT 255 | ||
address public registryFactory; // || SLOT 256 | ||
address public collateralVaultTemplate; // || SLOT 257 | ||
address public strategyTemplate; // || SLOT 258 | ||
address payable public pendingCouncilSafe; // || SLOT 259 | ||
IRegistry public registry; // || SLOT 260 | ||
IERC20 public gardenToken; // || SLOT 261 | ||
ISafe public councilSafe; // || SLOT 262 | ||
FAllo public allo; // || SLOT 263 | ||
string public communityName; // || SLOT 264 | ||
string public covenantIpfsHash; // || SLOT 265 | ||
mapping(address => bool) public enabledStrategies; // || SLOT 266 | ||
mapping(address => mapping(address => uint256)) public memberPowerInStrategy; // || SLOT 267 | ||
mapping(address => Member) public addressToMemberInfo; // || SLOT 268 | ||
mapping(address => address[]) public strategiesByMember; // || SLOT 269 | ||
mapping(address => mapping(address => bool)) public memberActivatedInStrategies; // || SLOT 270 | ||
address[] public initialMembers; // || SLOT 271 | ||
uint256[50] private __gap6; // || SLOT 272 | ||
/*|--------------------------------------------|*/ | ||
/*| STORAGE |*/ | ||
/*|--------------------------------------------|*/ | ||
} |
45 changes: 45 additions & 0 deletions
45
pkg/contracts/src/diamonds/facets/RegistryCommunityFacet.sol
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
// SPDX-License-Identifier: AGPL-3.0-only | ||
pragma solidity ^0.8.19; | ||
|
||
import {LibDiamond} from "@src/diamonds/libraries/LibDiamond.sol"; | ||
|
||
import {RegistryCommunityV0_1 } from "@src/RegistryCommunity/RegistryCommunityV0_1.sol"; | ||
import {ProxyOwnableUpgrader} from "@src/ProxyOwnableUpgrader.sol"; | ||
import {ERC1967Proxy} from "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol"; | ||
import {Clone} from "allo-v2-contracts/core/libraries/Clone.sol"; | ||
|
||
|
||
contract RegistryCommunityFacet is RegistryCommunityV0_1 { | ||
|
||
// AUDIT: acknowledged upgradeable contract hat does not protect initialize functions, | ||
// slither-disable-next-line unprotected-upgrade | ||
function initializeV2( | ||
address _owner, | ||
address _strategyTemplate, | ||
address _collateralVaultTemplate | ||
) public reinitializer(2) onlyOwner { | ||
_revertZeroAddress(_owner); | ||
_revertZeroAddress(_strategyTemplate); | ||
_revertZeroAddress(_collateralVaultTemplate); | ||
|
||
transferOwnership(_owner); | ||
|
||
strategyTemplate = _strategyTemplate; | ||
collateralVaultTemplate = _collateralVaultTemplate; | ||
//TODO emit event reinitialized | ||
} | ||
|
||
|
||
function VERSION() public pure override returns (string memory) { | ||
return "0.1"; | ||
} | ||
|
||
// This implements ERC-165. | ||
function supportsInterface(bytes4 _interfaceId) public view override virtual returns (bool) { | ||
LibDiamond.DiamondStorage storage ds = LibDiamond.diamondStorage(); | ||
return ds.supportedInterfaces[_interfaceId]; | ||
} | ||
|
||
|
||
uint256[50] private __gap; | ||
} |
Oops, something went wrong.