Skip to content

Commit 5af6527

Browse files
remove context from ThirdwebContract, fix override
1 parent 5a4f013 commit 5af6527

File tree

4 files changed

+13
-12
lines changed

4 files changed

+13
-12
lines changed

contracts/ByocFactory.sol

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,11 +112,11 @@ contract ByocFactory is IByocFactory, ERC2771Context, AccessControlEnumerable, T
112112
emit Paused(_pause);
113113
}
114114

115-
function _msgSender() internal view virtual override(Context, ERC2771Context, ExecutionContext) returns (address sender) {
115+
function _msgSender() internal view virtual override(Context, ERC2771Context) returns (address sender) {
116116
return ERC2771Context._msgSender();
117117
}
118118

119-
function _msgData() internal view virtual override(Context, ERC2771Context, ExecutionContext) returns (bytes calldata) {
119+
function _msgData() internal view virtual override(Context, ERC2771Context) returns (bytes calldata) {
120120
return ERC2771Context._msgData();
121121
}
122122
}

contracts/ThirdwebContract.sol

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import "./feature/Ownable.sol";
55
import "./feature/ExecutionContext.sol";
66
import "./feature/ContractMetadata.sol";
77

8-
contract ThirdwebContract is ExecutionContext, Ownable, ContractMetadata {
8+
contract ThirdwebContract is Ownable, ContractMetadata {
99
struct ThirdwebInfo {
1010
string publishMetadataUri;
1111
string contractURI;
@@ -22,20 +22,21 @@ contract ThirdwebContract is ExecutionContext, Ownable, ContractMetadata {
2222

2323
/// @dev Initializes the publish metadata and contract metadata at deploy time.
2424
function setThirdwebInfo(ThirdwebInfo memory _thirdwebInfo) external {
25-
require(bytes(publishMetadataUri).length == 0, "Already initialized");
25+
require(bytes(publishMetadataUri).length == 0, "Published metadata already initialized");
26+
require(owner == address(0), "Owner already initialized");
2627

2728
publishMetadataUri = _thirdwebInfo.publishMetadataUri;
2829
contractURI = _thirdwebInfo.contractURI;
2930
owner = _thirdwebInfo.owner;
3031
}
3132

32-
/// @dev Returns whether owner can be set in the given execution context.
33+
/// @dev Returns whether owner can be set
3334
function _canSetOwner() internal virtual override returns (bool) {
34-
return _msgSender() == owner;
35+
return msg.sender == owner;
3536
}
3637

37-
/// @dev Returns whether contract metadata can be set in the given execution context.
38+
/// @dev Returns whether contract metadata can be set
3839
function _canSetContractURI() internal virtual override returns (bool) {
39-
return _msgSender() == owner;
40+
return msg.sender == owner;
4041
}
4142
}

contracts/feature/ContractMetadata.sol

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ import "./interface/IContractMetadata.sol";
55

66
abstract contract ContractMetadata is IContractMetadata {
77
/// @dev Contract level metadata.
8-
string public contractURI;
8+
string public override contractURI;
99

1010
/// @dev Lets a contract admin set the URI for contract-level metadata.
11-
function setContractURI(string calldata _uri) external {
11+
function setContractURI(string calldata _uri) external override {
1212
require(_canSetContractURI(), "Not authorized");
1313
contractURI = _uri;
1414
}

contracts/feature/Ownable.sol

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ import "./interface/IOwnable.sol";
55

66
abstract contract Ownable is IOwnable {
77
/// @dev Owner of the contract (purpose: OpenSea compatibility)
8-
address public owner;
8+
address public override owner;
99

1010
/// @dev Lets a contract admin set a new owner for the contract. The new owner must be a contract admin.
11-
function setOwner(address _newOwner) public {
11+
function setOwner(address _newOwner) public override {
1212
require(_canSetOwner(), "Not authorized");
1313

1414
address _prevOwner = owner;

0 commit comments

Comments
 (0)