From f25a7acea2aa8c41840cc14337afe0b670bbefaf Mon Sep 17 00:00:00 2001 From: faliah Date: Sat, 1 Apr 2023 17:57:04 +0100 Subject: [PATCH] All facets interface added --- contracts/interfaces/ICoreFacet.sol | 24 ++++ contracts/interfaces/IDMSFacet.sol | 128 ++++++++++++++++++ contracts/interfaces/IERC1155Facet.sol | 51 +++++++ contracts/interfaces/IERC20Facet.sol | 28 ++++ contracts/interfaces/IERC721Facet.sol | 43 ++++++ contracts/interfaces/IEtherFacet.sol | 7 + contracts/interfaces/IModuleData.sol | 7 +- contracts/interfaces/IModuleRegistryFacet.sol | 26 ++++ contracts/interfaces/IOwnershipFacet.sol | 5 + contracts/interfaces/IVaultSpawnerFacet.sol | 10 ++ 10 files changed, 328 insertions(+), 1 deletion(-) create mode 100644 contracts/interfaces/ICoreFacet.sol create mode 100644 contracts/interfaces/IDMSFacet.sol create mode 100644 contracts/interfaces/IERC1155Facet.sol create mode 100644 contracts/interfaces/IERC20Facet.sol create mode 100644 contracts/interfaces/IERC721Facet.sol create mode 100644 contracts/interfaces/IEtherFacet.sol create mode 100644 contracts/interfaces/IModuleRegistryFacet.sol create mode 100644 contracts/interfaces/IOwnershipFacet.sol create mode 100644 contracts/interfaces/IVaultSpawnerFacet.sol diff --git a/contracts/interfaces/ICoreFacet.sol b/contracts/interfaces/ICoreFacet.sol new file mode 100644 index 0000000..2947b28 --- /dev/null +++ b/contracts/interfaces/ICoreFacet.sol @@ -0,0 +1,24 @@ +pragma solidity 0.8.4; + +interface ICoreFacet { + struct Vault { + address vaultOwner; + address backupAddress; + uint256 vaultID; + uint256 lastPing; + uint256 pingWindow; + string[] modules; + } + + function ping() external; + + function transferBackup(address _newBackupAddress) external; + + function transferOwnership(address _newVaultOwner) external; + + function claimOwnership(address _newBackupAddress) external; + + function execute(address _target, bytes memory _data) external payable; + + function getVault() external view returns (Vault memory vault_); +} diff --git a/contracts/interfaces/IDMSFacet.sol b/contracts/interfaces/IDMSFacet.sol new file mode 100644 index 0000000..6069422 --- /dev/null +++ b/contracts/interfaces/IDMSFacet.sol @@ -0,0 +1,128 @@ +pragma solidity 0.8.4; + +interface IDMSFacet { + struct VaultInfo { + address owner; + uint256 weiBalance; + uint256 lastPing; + uint256 id; + address backup; + address[] inheritors; + } + + struct AllInheritorEtherAllocs { + address inheritor; + uint256 weiAlloc; + } + + struct AllocatedERC1155Tokens { + uint256 tokenID; + uint256 amount; + } + + struct AllAllocatedERC1155Tokens { + address token; + uint256 tokenID; + uint256 amount; + } + + struct AllocatedERC721Tokens { + address token; + uint256[] tokenIDs; + } + + struct AllocatedERC20Tokens { + address token; + uint256 amount; + } + + function inspectVault() external view returns (VaultInfo memory info); + + function allEtherAllocations() + external + view + returns (AllInheritorEtherAllocs[] memory eAllocs); + + function inheritorEtherAllocation( + address _inheritor + ) external view returns (uint256 _allocatedEther); + + function getAllocatedEther() external view returns (uint256); + + function getUnallocatedEther() external view returns (uint256 unallocated_); + + function etherBalance() external view returns (uint256); + + function getAllocatedERC20Tokens( + address _inheritor + ) external view returns (AllocatedERC20Tokens[] memory tAllocs); + + function inheritorERC20TokenAllocation( + address _inheritor, + address _token + ) external view returns (uint256); + + function getUnallocatedTokens( + address _token + ) external view returns (uint256 unallocated_); + + function getAllocatedERC721Tokens( + address _inheritor + ) external view returns (AllocatedERC721Tokens[] memory allocated); + + function getAllocatedERC721TokenIds( + address _inheritor, + address _token + ) external view returns (uint256[] memory); + + function getAllocatedERC721TokenAddresses( + address _inheritor + ) external view returns (address[] memory); + + function getAllocatedERC1155Tokens( + address _token, + address _inheritor + ) external view returns (AllocatedERC1155Tokens[] memory alloc_); + + function getAllAllocatedERC1155Tokens( + address _inheritor + ) external view returns (AllAllocatedERC1155Tokens[] memory alloc_); + + function getUnallocatedERC115Tokens( + address _token, + uint256 _tokenId + ) external view returns (uint256 remaining_); + + function addInheritors( + address[] calldata _newInheritors, + uint256[] calldata _weiShare + ) external; + + function removeInheritors(address[] calldata _inheritors) external; + + function allocateEther( + address[] calldata _inheritors, + uint256[] calldata _ethShares + ) external; + + function allocateERC20Tokens( + address token, + address[] calldata _inheritors, + uint256[] calldata _shares + ) external; + + function allocateERC721Tokens( + address token, + address[] calldata _inheritors, + uint256[] calldata _tokenIDs + ) external; + + function allocateERC1155Tokens( + address token, + address[] calldata _inheritors, + uint256[] calldata _tokenIDs, + uint256[] calldata _amounts + ) external; + + function claimAllAllocations() external; +} diff --git a/contracts/interfaces/IERC1155Facet.sol b/contracts/interfaces/IERC1155Facet.sol new file mode 100644 index 0000000..34811ce --- /dev/null +++ b/contracts/interfaces/IERC1155Facet.sol @@ -0,0 +1,51 @@ +pragma solidity 0.8.4; + +interface IERC1155Facet { + function depositERC1155Token( + address _token, + uint256 _tokenID, + uint256 _amount + ) external; + + function batchDepositERC1155Tokens( + address _token, + uint256[] calldata _tokenIDs, + uint256[] calldata _amounts + ) external; + + function withdrawERC1155Token( + address _token, + uint256 _tokenID, + uint256 _amount, + address _to + ) external; + + function batchWithdrawERC1155Token( + address _token, + uint256[] calldata _tokenIDs, + uint256[] calldata _amount, + address _to + ) external; + + function approveERC1155Token( + address _token, + address _to, + bool _approved + ) external; + + function onERC1155Received( + address, + address, + uint256, + uint256, + bytes memory + ) external pure returns (bytes4); + + function onERC1155BatchReceived( + address, + address, + uint256[] memory, + uint256[] memory, + bytes memory + ) external pure returns (bytes4); +} diff --git a/contracts/interfaces/IERC20Facet.sol b/contracts/interfaces/IERC20Facet.sol new file mode 100644 index 0000000..f84d580 --- /dev/null +++ b/contracts/interfaces/IERC20Facet.sol @@ -0,0 +1,28 @@ +pragma solidity 0.8.4; + +interface IERC20Facet { + function depositERC20Token(address _token, uint256 _amount) external; + + function depositERC20Tokens( + address[] calldata _tokens, + uint256[] calldata _amounts + ) external; + + function withdrawERC20Token( + address _token, + uint256 _amount, + address _to + ) external; + + function batchWithdrawERC20Token( + address[] calldata _tokens, + uint256[] calldata _amounts, + address _to + ) external; + + function approveERC20Token( + address _token, + address _to, + uint256 _amount + ) external; +} diff --git a/contracts/interfaces/IERC721Facet.sol b/contracts/interfaces/IERC721Facet.sol new file mode 100644 index 0000000..d918f86 --- /dev/null +++ b/contracts/interfaces/IERC721Facet.sol @@ -0,0 +1,43 @@ +pragma solidity 0.8.4; + +interface IERC721Facet { + function depositERC721Token(address _token, uint256 _tokenID) external; + + function depositERC721Tokens( + address _token, + uint256[] calldata _tokenIDs + ) external; + + function safeDepositERC721Token(address _token, uint256 _tokenID) external; + + function safeDepositERC721TokenAndCall( + address _token, + uint256 _tokenID, + bytes calldata data + ) external; + + function withdrawERC721Token( + address _token, + uint256 _tokenID, + address _to + ) external; + + function approveSingleERC721Token( + address _token, + address _to, + uint256 _tokenID + ) external; + + function approveAllERC721Token( + address _token, + address _to, + bool _approved + ) external; + + function onERC721Received( + address, + address, + uint256, + bytes memory + ) external pure returns (bytes4); +} diff --git a/contracts/interfaces/IEtherFacet.sol b/contracts/interfaces/IEtherFacet.sol new file mode 100644 index 0000000..0e81029 --- /dev/null +++ b/contracts/interfaces/IEtherFacet.sol @@ -0,0 +1,7 @@ +pragma solidity 0.8.4; + +interface IEtherFacet { + function depositEther(uint256 _amount) external payable; + + function withdrawEther(uint256 _amount, address _to) external; +} diff --git a/contracts/interfaces/IModuleData.sol b/contracts/interfaces/IModuleData.sol index aa8bdd3..c4ead9c 100644 --- a/contracts/interfaces/IModuleData.sol +++ b/contracts/interfaces/IModuleData.sol @@ -18,5 +18,10 @@ interface IModuleData { } function getActiveModules() external view returns (string[] memory); - function isActiveModule(string memory _name) external view returns (bool exists_); + + function isActiveModule( + string memory _name + ) external view returns (bool exists_); + + function downgradeVaultWithModule(string calldata _name) external; } diff --git a/contracts/interfaces/IModuleRegistryFacet.sol b/contracts/interfaces/IModuleRegistryFacet.sol new file mode 100644 index 0000000..e0bb55f --- /dev/null +++ b/contracts/interfaces/IModuleRegistryFacet.sol @@ -0,0 +1,26 @@ +pragma solidity 0.8.4; +import {IModuleData} from "./IModuleData.sol"; +import {IDiamondCut} from "./IDiamondCut.sol"; + +interface IModuleRegistryFacet { + function addModules( + IModuleData.ModuleData[] calldata _modules, + string[] calldata _names + ) external; + + function getModules( + string[] calldata _names + ) external view returns (IModuleData.ModuleData[] memory modules_); + + function getModule( + string calldata _name + ) external view returns (IModuleData.ModuleData memory module_); + + function getFacetCuts( + string memory _name + ) external view returns (IDiamondCut.FacetCut[] memory cuts_); + + function moduleExists( + string calldata _name + ) external view returns (bool exists_); +} diff --git a/contracts/interfaces/IOwnershipFacet.sol b/contracts/interfaces/IOwnershipFacet.sol new file mode 100644 index 0000000..c52ba0a --- /dev/null +++ b/contracts/interfaces/IOwnershipFacet.sol @@ -0,0 +1,5 @@ +pragma solidity 0.8.4; + +interface IOwnershipFacet { + function owner() external view returns (address owner_); +} diff --git a/contracts/interfaces/IVaultSpawnerFacet.sol b/contracts/interfaces/IVaultSpawnerFacet.sol new file mode 100644 index 0000000..f0594ff --- /dev/null +++ b/contracts/interfaces/IVaultSpawnerFacet.sol @@ -0,0 +1,10 @@ +pragma solidity 0.8.4; + +interface IVaultSpawnerFacet { + function createVault( + address _vaultOwner, + uint256 _startingBal, + address _backupAddress, + uint256 _backupDelay + ) external payable returns (address addr); +}