Created
February 5, 2022 23:19
-
-
Save doublesharp/95c804aa35e5d18dec78b4e1bd94cfeb to your computer and use it in GitHub Desktop.
BoredApeYachtClubOwner
This file contains hidden or 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
pragma solidity ^0.8.11; | |
import '@openzeppelin/contracts/access/Ownable.sol'; | |
interface IBoredApeYachtClub { | |
function withdraw() external; | |
function function setProvenanceHash(string memory provenanceHash) external; | |
function setBaseURI(string memory baseURI) external; | |
} | |
contract BoredApeYachtClubOwner is IBoredApeYachtClub, Ownable { | |
// the BAYC contract | |
address private immutable bayc; | |
// pass in the BAYC address, then transfer ownership to this contract | |
constructor(address _bayc) public { | |
bayc = _bayc; | |
} | |
/* | |
* Withdraws the BoredApeYachtClub contract, then again from this contract to the caller | |
*/ | |
function withdraw() external override onlyOwner { | |
// call withdraw | |
bayc.withdraw(); | |
// now withdraw again from this contract | |
uint balance = address(this).balance; | |
msg.sender.transfer(balance); | |
} | |
/* | |
* Update provenance once it's calculated | |
*/ | |
function setProvenanceHash(string memory provenanceHash) external override onlyOwner { | |
bayc.setProvenanceHash(provenanceHash); | |
} | |
/* | |
* Update the base URI for the token metadata | |
*/ | |
function setBaseURI(string memory baseURI) external override onlyOwner { | |
bayc.setBaseURI(baseURI); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment