-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* chore: update nft supply cap & fix supplyLogic contract size Signed-off-by: GopherJ <[email protected]> * feat(para-proxy): adds diamond loupe interfaces (#294) * chore: update ape ir Signed-off-by: GopherJ <[email protected]> * feat: improve pool upgrade script Signed-off-by: GopherJ <[email protected]> * fix: configurator tests Signed-off-by: GopherJ <[email protected]> * chore: add libraries Signed-off-by: GopherJ <[email protected]> * chore: cleanup mintableLogic, apeStakingLogic deployment Signed-off-by: GopherJ <[email protected]> * chore: cleanup Signed-off-by: GopherJ <[email protected]> Signed-off-by: GopherJ <[email protected]> Co-authored-by: Walid <[email protected]>
- Loading branch information
1 parent
6e0dbb9
commit 8afdb27
Showing
16 changed files
with
425 additions
and
336 deletions.
There are no files selected for viewing
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,45 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.0; | ||
|
||
/******************************************************************************\ | ||
* EIP-2535 Diamonds: https://eips.ethereum.org/EIPS/eip-2535 | ||
/******************************************************************************/ | ||
|
||
// interfaces that are compatible with Diamond proxy loupe functions | ||
interface IParaProxyInterfaces { | ||
/// These functions are expected to be called frequently | ||
/// by tools. | ||
|
||
struct Implementation { | ||
address implAddress; | ||
bytes4[] functionSelectors; | ||
} | ||
|
||
/// @notice Gets all facet addresses and their four byte function selectors. | ||
/// @return facets_ Implementation | ||
function facets() external view returns (Implementation[] memory facets_); | ||
|
||
/// @notice Gets all the function selectors supported by a specific facet. | ||
/// @param _facet The facet address. | ||
/// @return facetFunctionSelectors_ | ||
function facetFunctionSelectors(address _facet) | ||
external | ||
view | ||
returns (bytes4[] memory facetFunctionSelectors_); | ||
|
||
/// @notice Get all the facet addresses used by a diamond. | ||
/// @return facetAddresses_ | ||
function facetAddresses() | ||
external | ||
view | ||
returns (address[] memory facetAddresses_); | ||
|
||
/// @notice Gets the facet that supports the given selector. | ||
/// @dev If facet is not found return address(0). | ||
/// @param _functionSelector The function selector. | ||
/// @return facetAddress_ The facet address. | ||
function facetAddress(bytes4 _functionSelector) | ||
external | ||
view | ||
returns (address facetAddress_); | ||
} |
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
93 changes: 93 additions & 0 deletions
93
contracts/protocol/libraries/paraspace-upgradeability/ParaProxyInterfaces.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,93 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.0; | ||
/******************************************************************************\ | ||
* EIP-2535 Diamonds: https://eips.ethereum.org/EIPS/eip-2535 | ||
/******************************************************************************/ | ||
|
||
import {IParaProxyInterfaces} from "../../../interfaces/IParaProxyInterfaces.sol"; | ||
import {IERC165} from "../../../dependencies/openzeppelin/contracts/IERC165.sol"; | ||
import {ParaProxyLib} from "./lib/ParaProxyLib.sol"; | ||
|
||
// The EIP-2535 Diamond standard requires these functions. | ||
|
||
contract ParaProxyInterfaces is IParaProxyInterfaces, IERC165 { | ||
//////////////////////////////////////////////////////////////////// | ||
/// These functions are expected to be called frequently by tools. | ||
// Facet == Implementtion | ||
|
||
/// @notice Gets all facets and their selectors. | ||
/// @return facets_ Implementation | ||
function facets() | ||
external | ||
view | ||
override | ||
returns (Implementation[] memory facets_) | ||
{ | ||
ParaProxyLib.ProxyStorage storage ds = ParaProxyLib.diamondStorage(); | ||
uint256 numFacets = ds.implementationAddresses.length; | ||
facets_ = new Implementation[](numFacets); | ||
for (uint256 i; i < numFacets; i++) { | ||
address facetAddress_ = ds.implementationAddresses[i]; | ||
facets_[i].implAddress = facetAddress_; | ||
facets_[i].functionSelectors = ds | ||
.implementationFunctionSelectors[facetAddress_] | ||
.functionSelectors; | ||
} | ||
} | ||
|
||
/// @notice Gets all the function selectors provided by a facet. | ||
/// @param _facet The facet address. | ||
/// @return facetFunctionSelectors_ | ||
function facetFunctionSelectors(address _facet) | ||
external | ||
view | ||
override | ||
returns (bytes4[] memory facetFunctionSelectors_) | ||
{ | ||
ParaProxyLib.ProxyStorage storage ds = ParaProxyLib.diamondStorage(); | ||
facetFunctionSelectors_ = ds | ||
.implementationFunctionSelectors[_facet] | ||
.functionSelectors; | ||
} | ||
|
||
/// @notice Get all the facet addresses used by a diamond. | ||
/// @return facetAddresses_ | ||
function facetAddresses() | ||
external | ||
view | ||
override | ||
returns (address[] memory facetAddresses_) | ||
{ | ||
ParaProxyLib.ProxyStorage storage ds = ParaProxyLib.diamondStorage(); | ||
facetAddresses_ = ds.implementationAddresses; | ||
} | ||
|
||
/// @notice Gets the facet that supports the given selector. | ||
/// @dev If facet is not found return address(0). | ||
/// @param _functionSelector The function selector. | ||
/// @return facetAddress_ The facet address. | ||
function facetAddress(bytes4 _functionSelector) | ||
external | ||
view | ||
override | ||
returns (address facetAddress_) | ||
{ | ||
ParaProxyLib.ProxyStorage storage ds = ParaProxyLib.diamondStorage(); | ||
facetAddress_ = ds | ||
.selectorToImplAndPosition[_functionSelector] | ||
.implAddress; | ||
} | ||
|
||
// This implements ERC-165. | ||
function supportsInterface(bytes4 _interfaceId) | ||
external | ||
view | ||
override | ||
returns (bool) | ||
{ | ||
ParaProxyLib.ProxyStorage storage ds = ParaProxyLib.diamondStorage(); | ||
|
||
return (type(IParaProxyInterfaces).interfaceId == _interfaceId || | ||
ds.supportedInterfaces[_interfaceId]); | ||
} | ||
} |
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
Oops, something went wrong.