Skip to content

Instantly share code, notes, and snippets.

@doublesharp
Created February 5, 2022 23:19

Revisions

  1. doublesharp created this gist Feb 5, 2022.
    46 changes: 46 additions & 0 deletions BoredApeYachtClubOwner.sol
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,46 @@

    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);
    }
    }