Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/of 327 remove platform and application fees from contracts #139

Open
wants to merge 11 commits into
base: staging
Choose a base branch
from
1 change: 0 additions & 1 deletion .github/CODEOWNERS

This file was deleted.

21 changes: 20 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -184,13 +184,32 @@ update:; make \
# update
update-ERC721FactoryFacet:; forge script scripts/facet/ERC721FactoryFacet.s.sol:Update --rpc-url $(rpc) --broadcast $(verbose) $(legacy) $(slow)
update-ERC20FactoryFacet:; forge script scripts/facet/ERC20FactoryFacet.s.sol:Update --rpc-url $(rpc) --broadcast $(verbose) $(legacy) $(slow)
update-ERC721LazyDropFacet:; forge script scripts/facet/ERC721LazyDropFacet.s.sol:Update --rpc-url $(rpc) --broadcast $(verbose) $(legacy) $(slow)
update-RewardsFacet:; forge script scripts/facet/RewardsFacet.s.sol:Update --rpc-url $(rpc) --broadcast $(verbose) $(legacy) $(slow)

# Remove application and platform fees
# Updates all effected facet contracts with specific script for SettingsFacet
# Redeploys Token contracts to remove fee logic from minting
# Date (not run yet)
update-removeApplicationAndPlatformFees:; make \
update-SettingsFacet-removeAppAndPlatformFees \
update-ERC721FactoryFacet \
update-ERC20FactoryFacet \
update-RewardsFacet \
update-ERC721LazyDropFacet \
deploy-ERC20Base \
deploy-ERC721Base \
deploy-ERC721Badge \
deploy-ERC721LazyMint

update-SettingsFacet-removeAppAndPlatformFees:; forge script scripts/facet/SettingsFacet.s.sol:Update_Remove_Platform_and_Application_Fees --rpc-url $(rpc) --broadcast $(verbose) $(legacy) $(slow)

# Add badge minting functionality
# Date 20.05.24
# updates ERC721RewardFacet to update mintERC721 function and add mintBadge and batchMintBadge functions
# deploys and registers RewardsFacet contract
# PR #126 https://github.com/open-format/contracts/pull/126
update-RewardsFacet:; forge script scripts/facet/RewardsFacet.s.sol:Update_Add_badgeMintingFunctionality --rpc-url $(rpc) --broadcast $(verbose) $(legacy) $(slow)
update-RewardsFacet-add-badgeMintingFunctionality:; forge script scripts/facet/RewardsFacet.s.sol:Update_Add_badgeMintingFunctionality --rpc-url $(rpc) --broadcast $(verbose) $(legacy) $(slow)

# Add ERC721Badge contract
# Date 14.05.24
Expand Down
31 changes: 31 additions & 0 deletions scripts/facet/ERC721LazyDropFacet.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,34 @@ contract Deploy is Script, Utils {
exportContractDeployment(CONTRACT_NAME, address(erc721LazyDropFacet), block.number);
}
}

contract Update is Script, Utils {
function run() external {
uint256 deployerPrivateKey = vm.envUint("PRIVATE_KEY");
vm.startBroadcast(deployerPrivateKey);

// deploy
ERC721LazyDropFacet erc721LazyDropFacet = new ERC721LazyDropFacet();

// construct array of function selectors
bytes4[] memory selectors = new bytes4[](5);
selectors[0] = erc721LazyDropFacet.ERC721LazyDrop_getClaimCondition.selector;
selectors[1] = erc721LazyDropFacet.ERC721LazyDrop_verifyClaim.selector;
selectors[2] = erc721LazyDropFacet.ERC721LazyDrop_claim.selector;
selectors[3] = erc721LazyDropFacet.ERC721LazyDrop_setClaimCondition.selector;
selectors[4] = erc721LazyDropFacet.ERC721LazyDrop_removeClaimCondition.selector;

// construct and ADD facet cut
IDiamondWritableInternal.FacetCut[] memory cuts = new IDiamondWritableInternal.FacetCut[](1);
cuts[0] = IDiamondWritableInternal.FacetCut(
address(erc721LazyDropFacet), IDiamondWritableInternal.FacetCutAction.REPLACE, selectors
);

// add to registry
RegistryMock(payable(getContractDeploymentAddress("Registry"))).diamondCut(cuts, address(0), "");

vm.stopBroadcast();

exportContractDeployment(CONTRACT_NAME, address(erc721LazyDropFacet), block.number);
}
}
62 changes: 50 additions & 12 deletions scripts/facet/SettingsFacet.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,10 @@ contract Deploy is Script, Utils {
SettingsFacet settingsFacet = new SettingsFacet();

// construct array of function selectors
bytes4[] memory selectors = new bytes4[](7);
selectors[0] = settingsFacet.setApplicationFee.selector;
selectors[1] = settingsFacet.setAcceptedCurrencies.selector;
selectors[2] = settingsFacet.applicationFeeInfo.selector;
selectors[3] = settingsFacet.setCreatorAccess.selector;
selectors[4] = settingsFacet.hasCreatorAccess.selector;
selectors[5] = settingsFacet.platformFeeInfo.selector;
selectors[6] = settingsFacet.getGlobalsAddress.selector;
bytes4[] memory selectors = new bytes4[](3);
selectors[0] = settingsFacet.setCreatorAccess.selector;
selectors[1] = settingsFacet.hasCreatorAccess.selector;
selectors[2] = settingsFacet.getGlobalsAddress.selector;

// construct and ADD facet cut
IDiamondWritableInternal.FacetCut[] memory cuts = new IDiamondWritableInternal.FacetCut[](1);
Expand Down Expand Up @@ -82,15 +78,15 @@ contract Update_ExposeGlobals is Script, Utils {
// construct array of function selectors to replace
// keeping it neat having all selectors point to the latest deployment
bytes4[] memory replaceSelectors = new bytes4[](5);
replaceSelectors[0] = settingsFacet.setApplicationFee.selector;
replaceSelectors[1] = settingsFacet.setAcceptedCurrencies.selector;
replaceSelectors[2] = settingsFacet.applicationFeeInfo.selector;
replaceSelectors[0] = bytes4(keccak256(bytes("setApplicationFee(uint16,address)")));
replaceSelectors[1] = bytes4(keccak256(bytes("setAcceptedCurrencies(address[],bool[])")));
replaceSelectors[2] = bytes4(keccak256(bytes("applicationFeeInfo(uint256)")));
replaceSelectors[3] = settingsFacet.setCreatorAccess.selector;
replaceSelectors[4] = settingsFacet.hasCreatorAccess.selector;

// add globals
bytes4[] memory addSelectors = new bytes4[](2);
addSelectors[0] = settingsFacet.platformFeeInfo.selector;
addSelectors[0] = bytes4(keccak256(bytes("platformFeeInfo(uint256)")));
addSelectors[1] = settingsFacet.getGlobalsAddress.selector;

// construct REPLACE and ADD facet cuts
Expand All @@ -109,3 +105,45 @@ contract Update_ExposeGlobals is Script, Utils {
exportContractDeployment(CONTRACT_NAME, address(settingsFacet), block.number);
}
}

/**
* @dev updates settings facet to remove platform and application fee logic
*/
contract Update_Remove_Platform_and_Application_Fees is Script, Utils {
function run() external {
uint256 deployerPrivateKey = vm.envUint("PRIVATE_KEY");
vm.startBroadcast(deployerPrivateKey);

// deploy
SettingsFacet settingsFacet = new SettingsFacet();

// construct array of function selectors to remove
bytes4[] memory removeSelectors = new bytes4[](4);
removeSelectors[0] = bytes4(keccak256(bytes("platformFeeInfo(uint256)")));
removeSelectors[1] = bytes4(keccak256(bytes("setApplicationFee(uint16,address)")));
removeSelectors[2] = bytes4(keccak256(bytes("applicationFeeInfo(uint256)")));
removeSelectors[3] = bytes4(keccak256(bytes("setAcceptedCurrencies(address[],bool[])")));

// construct array of function selectors to replace
bytes4[] memory replaceSelectors = new bytes4[](3);
replaceSelectors[0] = settingsFacet.setCreatorAccess.selector;
replaceSelectors[1] = settingsFacet.hasCreatorAccess.selector;
replaceSelectors[2] = settingsFacet.getGlobalsAddress.selector;

// construct and perform facet cut
IDiamondWritableInternal.FacetCut[] memory cuts = new IDiamondWritableInternal.FacetCut[](2);
cuts[0] = IDiamondWritableInternal.FacetCut(
address(0), IDiamondWritableInternal.FacetCutAction.REMOVE, removeSelectors
);
cuts[1] = IDiamondWritableInternal.FacetCut(
address(settingsFacet), IDiamondWritableInternal.FacetCutAction.REPLACE, replaceSelectors
);

// add to registry
RegistryMock(payable(getContractDeploymentAddress("Registry"))).diamondCut(cuts, address(0), "");

vm.stopBroadcast();

exportContractDeployment(CONTRACT_NAME, address(settingsFacet), block.number);
}
}
31 changes: 0 additions & 31 deletions src/extensions/applicationFee/ApplicationFee.sol

This file was deleted.

50 changes: 0 additions & 50 deletions src/extensions/applicationFee/ApplicationFeeInternal.sol

This file was deleted.

61 changes: 0 additions & 61 deletions src/extensions/applicationFee/ApplicationFeeMock.sol

This file was deleted.

21 changes: 0 additions & 21 deletions src/extensions/applicationFee/ApplicationFeeStorage.sol

This file was deleted.

18 changes: 0 additions & 18 deletions src/extensions/applicationFee/IApplicationFee.sol

This file was deleted.

14 changes: 0 additions & 14 deletions src/extensions/platformFee/IPlatformFee.sol

This file was deleted.

14 changes: 0 additions & 14 deletions src/extensions/platformFee/PlatformFee.sol

This file was deleted.

15 changes: 0 additions & 15 deletions src/extensions/platformFee/PlatformFeeInternal.sol

This file was deleted.

Loading
Loading