Skip to content

Instantly share code, notes, and snippets.

@doublesharp
Created February 5, 2022 23:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save doublesharp/95c804aa35e5d18dec78b4e1bd94cfeb to your computer and use it in GitHub Desktop.
Save doublesharp/95c804aa35e5d18dec78b4e1bd94cfeb to your computer and use it in GitHub Desktop.
BoredApeYachtClubOwner
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