Skip to content

Commit

Permalink
fix typo - remove one state variable
Browse files Browse the repository at this point in the history
  • Loading branch information
joaquim-verges committed May 11, 2022
1 parent 2be8cff commit b9a69f1
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 17 deletions.
5 changes: 2 additions & 3 deletions contracts/ByocFactory.sol
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ contract ByocFactory is IByocFactory, ERC2771Context, AccessControlEnumerable {
uint256 _value,
string memory publishMetadataUri
) external onlyUnpausedOrAdmin returns (address deployedAddress) {

deployer = _msgSender();

require(bytes(publishMetadataUri).length > 0, "No publish metadata");
Expand All @@ -68,7 +67,7 @@ contract ByocFactory is IByocFactory, ERC2771Context, AccessControlEnumerable {

deployedAddress = Create2.deploy(_value, salt, contractBytecode);

ThirdwebContract(deployedAddress).setPublisheMetadataUi(publishMetadataUri);
ThirdwebContract(deployedAddress).setPublishMetadataUri(publishMetadataUri);
require(
keccak256(bytes(ThirdwebContract(deployedAddress).getPublishMetadataUri())) ==
keccak256(bytes(publishMetadataUri)),
Expand All @@ -94,7 +93,7 @@ contract ByocFactory is IByocFactory, ERC2771Context, AccessControlEnumerable {
bytes32 salt = _salt == "" ? keccak256(abi.encodePacked(_msgSender(), block.number)) : _salt;
deployedAddress = Clones.cloneDeterministic(_implementation, salt);

ThirdwebContract(deployedAddress).setPublisheMetadataUi(publishMetadataUri);
ThirdwebContract(deployedAddress).setPublishMetadataUri(publishMetadataUri);
require(
keccak256(bytes(ThirdwebContract(deployedAddress).getPublishMetadataUri())) ==
keccak256(bytes(publishMetadataUri)),
Expand Down
15 changes: 3 additions & 12 deletions contracts/ThirdwebContract.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,10 @@ interface IDeployer {
contract ThirdwebContract {
/// @dev The publish metadata of the contract of which this contract is an instance.
string private publishMetadataUri;

/// @dev The address of the thirdweb factory.
address private factory;

/// @dev Address of the contract deployer.
address private deployer;

constructor() {
factory = msg.sender;
deployer = IDeployer(msg.sender).deployer();
}

Expand All @@ -26,17 +21,13 @@ contract ThirdwebContract {
}

/// @dev Initializes the publish metadata and at deploy time.
function setPublisheMetadataUi(string memory uri) external {
function setPublishMetadataUri(string memory uri) external {
require(bytes(publishMetadataUri).length == 0, "Published metadata already initialized");
publishMetadataUri = uri;
}

/// @dev Returns msg.sender, if caller is not thirdweb factory. Returns the intended msg.sender if caller is factory.
function _thirdwebMsgSender() internal view returns (address sender) {
if (msg.sender == factory) {
sender = deployer;
} else {
sender = msg.sender;
}
function _contractDeployer() internal view returns (address) {
return deployer;
}
}
4 changes: 2 additions & 2 deletions docs/ThirdwebContract.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ function getPublishMetadataUri() external view returns (string)
|---|---|---|
| _0 | string | undefined

### setPublisheMetadataUi
### setPublishMetadataUri

```solidity
function setPublisheMetadataUi(string uri) external nonpayable
function setPublishMetadataUri(string uri) external nonpayable
```


Expand Down

0 comments on commit b9a69f1

Please sign in to comment.