Skip to content

Commit

Permalink
Merge pull request #355 from moonstream-to/lib-diamond-rename
Browse files Browse the repository at this point in the history
Renaming LibDiamond -> LibDiamondMoonstream.
  • Loading branch information
kellan-simiotics authored Jan 25, 2024
2 parents 4edf654 + 875a4e7 commit 721464e
Show file tree
Hide file tree
Showing 18 changed files with 390 additions and 265 deletions.
4 changes: 2 additions & 2 deletions brownie-config.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
dependencies:
- "OpenZeppelin/[email protected]"
- "smartcontractkit/chainlink@1.13.3"
- "smartcontractkit/chainlink@2.1.1"

compiler:
solc:
remappings:
- "@openzeppelin-contracts=OpenZeppelin/[email protected]"
- "@openzeppelin/contracts=OpenZeppelin/[email protected]"
- "@chainlink=smartcontractkit/chainlink@1.13.3"
- "@chainlink=smartcontractkit/chainlink@2.1.1"
2 changes: 1 addition & 1 deletion contracts/Dropper/DropperFacet.sol
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import "./LibDropper.sol";
import "../interfaces/IERC721Mint.sol";
import "../interfaces/ITerminus.sol";
import "../diamond/security/DiamondReentrancyGuard.sol";
import "../diamond/libraries/LibDiamond.sol";
import {LibDiamondMoonstream as LibDiamond} from "../diamond/libraries/LibDiamondMoonstream.sol";
import "../diamond/libraries/LibSignatures.sol";
import {TerminusPermissions} from "../terminus/TerminusPermissions.sol";

Expand Down
2 changes: 1 addition & 1 deletion contracts/LootboxRandomness.sol
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

pragma solidity ^0.8.0;

import "@chainlink/contracts/src/v0.8/VRFConsumerBase.sol";
import "@chainlink/contracts/src/v0.8/vrf/VRFConsumerBase.sol";

abstract contract LootboxRandomness is VRFConsumerBase {
uint256 ChainlinkVRFFee;
Expand Down
9 changes: 5 additions & 4 deletions contracts/TokenDrainerFacet.sol
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,13 @@ import "@openzeppelin-contracts/contracts/token/ERC1155/IERC1155.sol";
import "@openzeppelin-contracts/contracts/token/ERC1155/IERC1155Receiver.sol";
import "@openzeppelin-contracts/contracts/token/ERC721/IERC721.sol";
import "@openzeppelin-contracts/contracts/token/ERC721/IERC721Receiver.sol";
import "./diamond/libraries/LibDiamond.sol";
import {LibDiamondMoonstream as LibDiamond} from "./diamond/libraries/LibDiamondMoonstream.sol";

contract TokenDrainerFacet {
function drainERC20(address tokenAddress, address receiverAddress)
external
{
function drainERC20(
address tokenAddress,
address receiverAddress
) external {
uint256 balance = IERC20(tokenAddress).balanceOf(address(this));
withdrawERC20(tokenAddress, balance, receiverAddress);
}
Expand Down
2 changes: 1 addition & 1 deletion contracts/crafting/facets/CraftingFacet.sol
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import "@openzeppelin-contracts/contracts/token/ERC721/utils/ERC721Holder.sol";
import {MockTerminus} from "../../mock/MockTerminus.sol";
import {MockErc20} from "../../mock/MockErc20.sol";
import "../libraries/LibCrafting.sol";
import "../../diamond/libraries/LibDiamond.sol";
import {LibDiamondMoonstream as LibDiamond} from "../../diamond/libraries/LibDiamondMoonstream.sol";
import "../../diamond/security/DiamondReentrancyGuard.sol";
import {TerminusPermissions} from "../../terminus/TerminusPermissions.sol";

Expand Down
2 changes: 1 addition & 1 deletion contracts/diamond/Diamond.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ pragma solidity ^0.8.0;
// Adapted from the Diamond 3 reference implementation by Nick Mudge:
// https://github.com/mudgen/diamond-3-hardhat

import {LibDiamond} from "./libraries/LibDiamond.sol";
import {LibDiamondMoonstream as LibDiamond} from "./libraries/LibDiamondMoonstream.sol";
import {IDiamondCut} from "./interfaces/IDiamondCut.sol";

contract Diamond {
Expand Down
2 changes: 1 addition & 1 deletion contracts/diamond/facets/DiamondCutFacet.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ pragma solidity ^0.8.0;
// https://github.com/mudgen/diamond-3-hardhat

import {IDiamondCut} from "../interfaces/IDiamondCut.sol";
import {LibDiamond} from "../libraries/LibDiamond.sol";
import {LibDiamondMoonstream as LibDiamond} from "../libraries/LibDiamondMoonstream.sol";

contract DiamondCutFacet is IDiamondCut {
/// @notice Add/replace/remove any number of functions and optionally execute
Expand Down
29 changes: 10 additions & 19 deletions contracts/diamond/facets/DiamondLoupeFacet.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ pragma solidity ^0.8.0;
// Adapted from the Diamond 3 reference implementation by Nick Mudge:
// https://github.com/mudgen/diamond-3-hardhat

import {LibDiamond} from "../libraries/LibDiamond.sol";
import {LibDiamondMoonstream as LibDiamond} from "../libraries/LibDiamondMoonstream.sol";
import {IDiamondLoupe} from "../interfaces/IDiamondLoupe.sol";
import {IERC165} from "../interfaces/IERC165.sol";

Expand Down Expand Up @@ -36,12 +36,9 @@ contract DiamondLoupeFacet is IDiamondLoupe, IERC165 {
/// @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_)
{
function facetFunctionSelectors(
address _facet
) external view override returns (bytes4[] memory facetFunctionSelectors_) {
LibDiamond.DiamondStorage storage ds = LibDiamond.diamondStorage();
facetFunctionSelectors_ = ds
.facetFunctionSelectors[_facet]
Expand All @@ -64,25 +61,19 @@ contract DiamondLoupeFacet is IDiamondLoupe, IERC165 {
/// @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_)
{
function facetAddress(
bytes4 _functionSelector
) external view override returns (address facetAddress_) {
LibDiamond.DiamondStorage storage ds = LibDiamond.diamondStorage();
facetAddress_ = ds
.selectorToFacetAndPosition[_functionSelector]
.facetAddress;
}

// This implements ERC-165.
function supportsInterface(bytes4 _interfaceId)
external
view
override
returns (bool)
{
function supportsInterface(
bytes4 _interfaceId
) external view override returns (bool) {
LibDiamond.DiamondStorage storage ds = LibDiamond.diamondStorage();
return ds.supportedInterfaces[_interfaceId];
}
Expand Down
2 changes: 1 addition & 1 deletion contracts/diamond/facets/OwnershipFacet.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import {LibDiamond} from "../libraries/LibDiamond.sol";
import {LibDiamondMoonstream as LibDiamond} from "../libraries/LibDiamondMoonstream.sol";
import {IERC173} from "../interfaces/IERC173.sol";

contract OwnershipFacet is IERC173 {
Expand Down
206 changes: 0 additions & 206 deletions contracts/diamond/libraries/LibDiamond.sol

This file was deleted.

Loading

0 comments on commit 721464e

Please sign in to comment.