Skip to content

Commit bf7b8d7

Browse files
Krishang NadgaudaKrishang Nadgauda
authored andcommitted
use caller, not publisher, for registry.add
1 parent 7db0967 commit bf7b8d7

File tree

4 files changed

+89
-8
lines changed

4 files changed

+89
-8
lines changed

contracts/ByocFactory.sol

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -90,12 +90,15 @@ contract ByocFactory is IByocFactory, ERC2771Context, Multicall, AccessControlEn
9090
uint256 _value,
9191
string memory publishMetadataUri
9292
) external onlyUnpausedOrAdmin returns (address deployedAddress) {
93+
94+
address caller = _msgSender();
95+
9396
bytes32 salt = _salt == ""
94-
? keccak256(abi.encodePacked(_msgSender(), block.number, _implementation, _initializeData))
95-
: keccak256(abi.encodePacked(_msgSender(), _salt));
97+
? keccak256(abi.encodePacked(caller, block.number, _implementation, _initializeData))
98+
: keccak256(abi.encodePacked(caller, _salt));
9699

97100
address computedContractAddress = Clones.predictDeterministicAddress(_implementation, salt, address(this));
98-
getContractDeployer[computedContractAddress] = _msgSender();
101+
getContractDeployer[computedContractAddress] = caller;
99102

100103
deployedAddress = Clones.cloneDeterministic(_implementation, salt);
101104

@@ -106,14 +109,14 @@ contract ByocFactory is IByocFactory, ERC2771Context, Multicall, AccessControlEn
106109
"Not a thirdweb contract"
107110
);
108111

109-
registry.add(_publisher, deployedAddress);
112+
registry.add(caller, deployedAddress);
110113

111114
if (_initializeData.length > 0) {
112115
// slither-disable-next-line unused-return
113116
Address.functionCallWithValue(deployedAddress, _initializeData, _value);
114117
}
115118

116-
emit ContractDeployed(_msgSender(), _publisher, deployedAddress);
119+
emit ContractDeployed(caller, _publisher, deployedAddress);
117120
}
118121

119122
/*///////////////////////////////////////////////////////////////

docs/ByocFactory.md

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,16 +81,21 @@ Deploys a clone pointing to an implementation of a published contract.
8181
|---|---|---|
8282
| deployedAddress | address | undefined
8383

84-
### deployer
84+
### getContractDeployer
8585

8686
```solidity
87-
function deployer() external view returns (address)
87+
function getContractDeployer(address) external view returns (address)
8888
```
8989

9090

9191

92-
*Empty var used in deployment.*
92+
*contract address deployed through the factory => deployer*
9393

94+
#### Parameters
95+
96+
| Name | Type | Description |
97+
|---|---|---|
98+
| _0 | address | undefined
9499

95100
#### Returns
96101

@@ -244,6 +249,28 @@ function isTrustedForwarder(address forwarder) external view returns (bool)
244249
|---|---|---|
245250
| _0 | bool | undefined
246251

252+
### multicall
253+
254+
```solidity
255+
function multicall(bytes[] data) external nonpayable returns (bytes[] results)
256+
```
257+
258+
259+
260+
*Receives and executes a batch of function calls on this contract.*
261+
262+
#### Parameters
263+
264+
| Name | Type | Description |
265+
|---|---|---|
266+
| data | bytes[] | undefined
267+
268+
#### Returns
269+
270+
| Name | Type | Description |
271+
|---|---|---|
272+
| results | bytes[] | undefined
273+
247274
### renounceRole
248275

249276
```solidity

docs/IContractDeployer.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# IContractDeployer
2+
3+
4+
5+
6+
7+
8+
9+
10+
11+
## Methods
12+
13+
### getContractDeployer
14+
15+
```solidity
16+
function getContractDeployer(address _contract) external view returns (address)
17+
```
18+
19+
20+
21+
22+
23+
#### Parameters
24+
25+
| Name | Type | Description |
26+
|---|---|---|
27+
| _contract | address | undefined
28+
29+
#### Returns
30+
31+
| Name | Type | Description |
32+
|---|---|---|
33+
| _0 | address | undefined
34+
35+
36+
37+

docs/ThirdwebContract.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,3 +46,17 @@ function setPublishMetadataUri(string uri) external nonpayable
4646

4747

4848

49+
## Errors
50+
51+
### ThirdwebContract_MetadataAlreadyInitialized
52+
53+
```solidity
54+
error ThirdwebContract_MetadataAlreadyInitialized()
55+
```
56+
57+
58+
59+
60+
61+
62+

0 commit comments

Comments
 (0)