Skip to content

Commit

Permalink
Expose configureRoyalties to proxies
Browse files Browse the repository at this point in the history
  • Loading branch information
0xGh committed Dec 29, 2023
1 parent 32bf0e0 commit eb97354
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 6 deletions.
22 changes: 16 additions & 6 deletions contracts/ERC721BaselineImplementation.sol
Original file line number Diff line number Diff line change
Expand Up @@ -271,12 +271,7 @@ contract ERC721BaselineImplementation is ERC721Upgradeable, IERC721Baseline {
return (address(0), 0);
}

/**
* @inheritdoc IERC721Baseline
*/
function configureRoyalties(address payable receiver, uint16 bps) external {
this.requireAdmin(_msgSender());

function _configureRoyalties(address payable receiver, uint16 bps) internal {
ERC721BaselineStorage storage $ = _getStorage();

if (receiver != $._royaltiesReceiver) {
Expand All @@ -288,6 +283,21 @@ contract ERC721BaselineImplementation is ERC721Upgradeable, IERC721Baseline {
}
}

/**
* @inheritdoc IERC721Baseline
*/
function configureRoyalties(address payable receiver, uint16 bps) external {
this.requireAdmin(_msgSender());
_configureRoyalties(receiver, bps);
}

/**
* @inheritdoc IERC721Baseline
*/
function __configureRoyalties(address payable receiver, uint16 bps) external onlyProxy {
_configureRoyalties(receiver, bps);
}

/************************************************
* Internal ERC721 methods exposed to the proxy
************************************************/
Expand Down
10 changes: 10 additions & 0 deletions contracts/IERC721Baseline.sol
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,16 @@ interface IERC721Baseline is IERC721, IERC2981 {
*/
function configureRoyalties(address payable receiver, uint16 bps) external;

/**
* @notice Configures royalties receiver and bps for all the tokens.
* @dev Bps stants for basis points where 100 bps = 1%.
* This method is internal and only the proxy contract can call it.
*
* @param receiver address for the royalties receiver
* @param bps (basis points) royalties rate
*/
function __configureRoyalties(address payable receiver, uint16 bps) external;


/************************************************
* Internal ERC721 methods exposed to the proxy
Expand Down
4 changes: 4 additions & 0 deletions contracts/mocks/ERC721ProxyMock.sol
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ contract ERC721ProxyMock is ERC721Baseline {
baseline().__setBaseURI(baseURI);
}

function onlyProxy_configureRoyalties(address payable receiver, uint16 bps) external {
baseline().__configureRoyalties(receiver, bps);
}

function onlyProxy_mint(address to, uint256 tokenId) external returns (uint256 newBalance) {
baseline().__mint(to, tokenId);
return baseline().balanceOf(to);
Expand Down

0 comments on commit eb97354

Please sign in to comment.