-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
bypass all fail cases of fulfillment
- Loading branch information
Showing
15 changed files
with
27,938 additions
and
26,530 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.20; | ||
|
||
import {IERC721Receiver} from "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol"; | ||
import {IJBOperatorStore} from "@jbx-protocol/juice-contracts-v3/contracts/interfaces/IJBOperatorStore.sol"; | ||
import {IJBProjects} from "@jbx-protocol/juice-contracts-v3/contracts/interfaces/IJBProjects.sol"; | ||
import {JBOperations} from "@jbx-protocol/juice-contracts-v3/contracts/libraries/JBOperations.sol"; | ||
import {JBOperatorData} from "@jbx-protocol/juice-contracts-v3/contracts/structs/JBOperatorData.sol"; | ||
import {DefifaDeployer} from "./DefifaDeployer.sol"; | ||
|
||
/// @notice A contract that can be sent a project to be burned, while still allowing defifa permissions. | ||
contract DefifaProjectOwner is IERC721Receiver { | ||
/// @notice The contract where operator permissions are stored. | ||
IJBOperatorStore public operatorStore; | ||
|
||
/// @notice The contract from which project are minted. | ||
IJBProjects public projects; | ||
|
||
/// @notice The Defifa deployer. | ||
DefifaDeployer public deployer; | ||
|
||
/// @param _operatorStore The contract where operator permissions are stored. | ||
/// @param _projects The contract from which project are minted. | ||
/// @param _deployer The Defifa deployer which will receive permissions to set splits. | ||
constructor(IJBOperatorStore _operatorStore, IJBProjects _projects, DefifaDeployer _deployer) { | ||
operatorStore = _operatorStore; | ||
projects = _projects; | ||
deployer = _deployer; | ||
} | ||
|
||
/// @notice Give the defifa deployer permission to set splits on this contract's behalf. | ||
function onERC721Received(address _operator, address _from, uint256 _tokenId, bytes calldata _data) | ||
external | ||
returns (bytes4) | ||
{ | ||
_data; | ||
_from; | ||
_operator; | ||
|
||
// Make sure the 721 received is the JBProjects contract. | ||
if (msg.sender != address(projects)) revert(); | ||
|
||
// Set the correct permission. | ||
uint256[] memory _permissionIndexes = new uint256[](1); | ||
_permissionIndexes[0] = JBOperations.SET_SPLITS; | ||
|
||
// Give the defifa deployer contract permission to set splits on this contract's behalf. | ||
operatorStore.setOperator( | ||
JBOperatorData({operator: address(deployer), domain: _tokenId, permissionIndexes: _permissionIndexes}) | ||
); | ||
|
||
return IERC721Receiver.onERC721Received.selector; | ||
} | ||
} |
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
30,307 changes: 14,402 additions & 15,905 deletions
30,307
out/DefifaDeployer.sol/DefifaDeployer.json
Large diffs are not rendered by default.
Oops, something went wrong.
Oops, something went wrong.