gas saving, not enough yet

This commit is contained in:
Moon Man 2023-02-05 17:06:29 -05:00
parent da0a4a98f3
commit 7bc38210f6
1 changed files with 9 additions and 13 deletions

View File

@ -54,20 +54,20 @@ contract CurioERC1155Wrapper is ERC1155, ERC1155Metadata_URI, ERC1155Metadata, E
_setDefaultRoyalty(msg.sender, _defaultRoyalty);
}
function setDefaultRoyalty(address receiver, uint96 feeNumerator) public onlyOwner {
function setDefaultRoyalty(address receiver, uint96 feeNumerator) external onlyOwner {
_setDefaultRoyalty(receiver, feeNumerator);
}
function deleteDefaultRoyalty() public onlyOwner {
function deleteDefaultRoyalty() external onlyOwner {
_deleteDefaultRoyalty();
}
function setTokenRoyalty(uint256 _id, address receiver, uint96 feeNumerator) public onlyOwner {
function setTokenRoyalty(uint256 _id, address receiver, uint96 feeNumerator) external onlyOwner {
require(contracts[_id] != address(0), "token does not exist");
_setTokenRoyalty(_id, receiver, feeNumerator);
}
function resetTokenRoyalty(uint256 _id) public onlyOwner {
function resetTokenRoyalty(uint256 _id) external onlyOwner {
require(contracts[_id] != address(0), "token does not exist");
_resetTokenRoyalty(_id);
}
@ -133,12 +133,12 @@ contract CurioERC1155Wrapper is ERC1155, ERC1155Metadata_URI, ERC1155Metadata, E
@notice Destroy the contract
@dev Only if it hasn't been disabled
*/
function destroy() public onlyOwner whenPaused {
function destroy() external onlyOwner whenPaused {
require(destroyable, "destroy() has been disabled");
selfdestruct(payable(msg.sender));
}
function disableDestroy() public onlyOwner {
function disableDestroy() external onlyOwner {
destroyable = false;
}
@ -185,8 +185,7 @@ contract CurioERC1155Wrapper is ERC1155, ERC1155Metadata_URI, ERC1155Metadata, E
// mint
emit TransferSingle(msg.sender, address(0), msg.sender, _id, _quantity);
address _to = msg.sender;
if (_to.isContract()) {
if (msg.sender.isContract()) {
_doSafeTransferAcceptanceCheck(msg.sender, msg.sender, msg.sender, _id, _quantity, '');
}
}
@ -199,9 +198,6 @@ contract CurioERC1155Wrapper is ERC1155, ERC1155Metadata_URI, ERC1155Metadata, E
function wrapBatch(uint256[] calldata _ids, uint256[] calldata _quantities) external whenNotPaused {
require(_ids.length == _quantities.length, "ids and quantities must match");
address _to = msg.sender;
bool callerIsContract = _to.isContract();
for (uint256 i=0; i < _ids.length; ++i) {
uint256 _id = _ids[i];
uint256 _quantity = _quantities[i];
@ -218,13 +214,13 @@ contract CurioERC1155Wrapper is ERC1155, ERC1155Metadata_URI, ERC1155Metadata, E
balances[_id][msg.sender] += _quantity;
if (callerIsContract) {
if (msg.sender.isContract()) {
_doSafeTransferAcceptanceCheck(msg.sender, msg.sender, msg.sender, _id, _quantity, '');
}
}
// mint
emit TransferBatch(msg.sender, address(0), _to, _ids, _quantities);
emit TransferBatch(msg.sender, address(0), msg.sender, _ids, _quantities);
}
/**