Skip to content

Commit

Permalink
Merge pull request #41 from sushiswap/fix/add-missing-events
Browse files Browse the repository at this point in the history
Add missing events
  • Loading branch information
levx-me committed Aug 29, 2021
2 parents fe02825 + 3349c32 commit a5649a6
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 5 deletions.
20 changes: 17 additions & 3 deletions contracts/TokenFactory.sol
Original file line number Diff line number Diff line change
Expand Up @@ -112,44 +112,58 @@ contract TokenFactory is ProxyFactory, Ownable, ITokenFactory {
// This function should be called with a proper param by a multi-sig `owner`
function setBaseURI721(string memory uri) external override onlyOwner {
baseURI721 = uri;

emit SetBaseURI721(uri);
}

// This function should be called with a proper param by a multi-sig `owner`
function setBaseURI1155(string memory uri) external override onlyOwner {
baseURI1155 = uri;

emit SetBaseURI1155(uri);
}

// This function should be called by a multi-sig `owner`, not an EOA
function setProtocolFeeRecipient(address protocolFeeRecipient) external override onlyOwner {
require(protocolFeeRecipient != address(0), "SHOYU: INVALID_FEE_RECIPIENT");

_protocolFeeRecipient = protocolFeeRecipient;

emit SetProtocolFeeRecipient(protocolFeeRecipient);
}

// This function should be called by a multi-sig `owner`, not an EOA
function setOperationalFeeRecipient(address operationalFeeRecipient) external override onlyOwner {
require(operationalFeeRecipient != address(0), "SHOYU: INVALID_RECIPIENT");

_operationalFeeRecipient = operationalFeeRecipient;

emit SetOperationalFeeRecipient(operationalFeeRecipient);
}

// This function should be called by a multi-sig `owner`, not an EOA
function setOperationalFee(uint8 operationalFee) external override onlyOwner {
require(operationalFee <= MAX_OPERATIONAL_FEE, "SHOYU: INVALID_FEE");

_operationalFee = operationalFee;

emit SetOperationalFee(operationalFee);
}

// This function should be called by a multi-sig `owner`, not an EOA
function setDeployerWhitelisted(address deployer, bool whitelisted) external override onlyOwner {
isDeployerWhitelisted[deployer] = whitelisted;

emit SetDeployerWhitelisted(deployer, whitelisted);
}

// This function should be called by a multi-sig `owner`, not an EOA
function setStrategyWhitelisted(address strategy, bool whitelisted) external override onlyOwner {
require(strategy != address(0), "SHOYU: INVALID_ADDRESS");

isStrategyWhitelisted[strategy] = whitelisted;

emit SetStrategyWhitelisted(strategy, whitelisted);
}

// This function should be called by a multi-sig `owner`, not an EOA
Expand Down Expand Up @@ -244,7 +258,7 @@ contract TokenFactory is ProxyFactory, Ownable, ITokenFactory {
}

function isNFT721(address query) external view override returns (bool result) {
if(query == address(0)) return false;
if (query == address(0)) return false;
for (uint256 i = _targets721.length; i >= 1; i--) {
if (_isProxy(_targets721[i - 1], query)) {
return true;
Expand Down Expand Up @@ -278,7 +292,7 @@ contract TokenFactory is ProxyFactory, Ownable, ITokenFactory {
}

function isNFT1155(address query) external view override returns (bool result) {
if(query == address(0)) return false;
if (query == address(0)) return false;
for (uint256 i = _targets1155.length; i >= 1; i--) {
if (_isProxy(_targets1155[i - 1], query)) {
return true;
Expand Down Expand Up @@ -313,7 +327,7 @@ contract TokenFactory is ProxyFactory, Ownable, ITokenFactory {
}

function isSocialToken(address query) external view override returns (bool result) {
if(query == address(0)) return false;
if (query == address(0)) return false;
for (uint256 i = _targetsSocialToken.length; i >= 1; i--) {
if (_isProxy(_targetsSocialToken[i - 1], query)) {
return true;
Expand Down
4 changes: 4 additions & 0 deletions contracts/base/BaseNFT1155.sol
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,14 @@ abstract contract BaseNFT1155 is ERC1155Initializable, OwnableInitializable, IBa

function setURI(uint256 id, string memory newURI) external override onlyOwner {
_uris[id] = newURI;

emit SetURI(id, newURI);
}

function setBaseURI(string memory baseURI) external override onlyOwner {
_baseURI = baseURI;

emit SetBaseURI(baseURI);
}

function mint(
Expand Down
4 changes: 4 additions & 0 deletions contracts/base/BaseNFT721.sol
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,14 @@ abstract contract BaseNFT721 is ERC721Initializable, OwnableInitializable, IBase

function setTokenURI(uint256 id, string memory newURI) external override onlyOwner {
_uris[id] = newURI;

emit SetTokenURI(id, newURI);
}

function setBaseURI(string memory uri) external override onlyOwner {
__baseURI = uri;

emit SetBaseURI(uri);
}

function parkTokenIds(uint256 toTokenId) external override {
Expand Down
2 changes: 2 additions & 0 deletions contracts/interfaces/IBaseNFT1155.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import "@openzeppelin/contracts/token/ERC1155/extensions/IERC1155MetadataURI.sol
import "./IOwnable.sol";

interface IBaseNFT1155 is IERC1155, IERC1155MetadataURI, IOwnable {
event SetURI(uint256 indexed id, string uri);
event SetBaseURI(string uri);
event Burn(uint256 indexed tokenId, uint256 amount, uint256 indexed label, bytes32 data);

function PERMIT_TYPEHASH() external view returns (bytes32);
Expand Down
5 changes: 3 additions & 2 deletions contracts/interfaces/IBaseNFT721.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@ import "@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol";
import "./IOwnable.sol";

interface IBaseNFT721 is IERC721, IERC721Metadata, IOwnable {
event Burn(uint256 indexed tokenId, uint256 indexed label, bytes32 data);

event SetTokenURI(uint256 indexed tokenId, string uri);
event SetBaseURI(string uri);
event ParkTokenIds(uint256 toTokenId);
event Burn(uint256 indexed tokenId, uint256 indexed label, bytes32 data);

function PERMIT_TYPEHASH() external view returns (bytes32);

Expand Down
7 changes: 7 additions & 0 deletions contracts/interfaces/ITokenFactory.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@
pragma solidity >=0.5.0;

interface ITokenFactory {
event SetBaseURI721(string uri);
event SetBaseURI1155(string uri);
event SetProtocolFeeRecipient(address recipient);
event SetOperationalFee(uint8 fee);
event SetOperationalFeeRecipient(address recipient);
event SetDeployerWhitelisted(address deployer, bool whitelisted);
event SetStrategyWhitelisted(address strategy, bool whitelisted);
event UpgradeNFT721(address newTarget);
event UpgradeNFT1155(address newTarget);
event UpgradeSocialToken(address newTarget);
Expand Down

0 comments on commit a5649a6

Please sign in to comment.