2
2
pragma solidity ^ 0.8.0 ;
3
3
4
4
// Target contracts
5
- import { ByocRegistry } from "contracts/ByocRegistry .sol " ;
6
- import "contracts/interfaces/IByocRegistry .sol " ;
5
+ import { ContractPublisher } from "contracts/ContractPublisher .sol " ;
6
+ import "contracts/interfaces/IContractPublisher .sol " ;
7
7
import "contracts/TWRegistry.sol " ;
8
8
9
9
// Test helpers
@@ -18,7 +18,7 @@ contract MockCustomContract {
18
18
}
19
19
}
20
20
21
- contract IByocRegistryData {
21
+ contract IContractPublisherData {
22
22
/// @dev Emitted when the registry is paused.
23
23
event Paused (bool isPaused );
24
24
@@ -29,7 +29,7 @@ contract IByocRegistryData {
29
29
event ContractPublished (
30
30
address indexed operator ,
31
31
address indexed publisher ,
32
- IByocRegistry .CustomContractInstance publishedContract
32
+ IContractPublisher .CustomContractInstance publishedContract
33
33
);
34
34
35
35
/// @dev Emitted when a contract is unpublished.
@@ -42,8 +42,8 @@ contract IByocRegistryData {
42
42
event RemovedContractToPublicList (address indexed publisher , string indexed contractId );
43
43
}
44
44
45
- contract ByocRegistryTest is BaseTest , IByocRegistryData {
46
- ByocRegistry internal byoc;
45
+ contract ContractPublisherTest is BaseTest , IContractPublisherData {
46
+ ContractPublisher internal byoc;
47
47
TWRegistry internal twRegistry;
48
48
49
49
address internal publisher;
@@ -55,7 +55,7 @@ contract ByocRegistryTest is BaseTest, IByocRegistryData {
55
55
function setUp () public override {
56
56
super .setUp ();
57
57
58
- byoc = ByocRegistry (byocRegistry );
58
+ byoc = ContractPublisher (contractPublisher );
59
59
twRegistry = TWRegistry (registry);
60
60
61
61
publisher = getActor (0 );
@@ -74,7 +74,10 @@ contract ByocRegistryTest is BaseTest, IByocRegistryData {
74
74
contractId
75
75
);
76
76
77
- IByocRegistry.CustomContractInstance memory customContract = byoc.getPublishedContract (publisher, contractId);
77
+ IContractPublisher.CustomContractInstance memory customContract = byoc.getPublishedContract (
78
+ publisher,
79
+ contractId
80
+ );
78
81
79
82
assertEq (customContract.contractId, contractId);
80
83
assertEq (customContract.publishMetadataUri, publishMetadataUri);
@@ -97,7 +100,10 @@ contract ByocRegistryTest is BaseTest, IByocRegistryData {
97
100
contractId
98
101
);
99
102
100
- IByocRegistry.CustomContractInstance memory customContract = byoc.getPublishedContract (publisher, contractId);
103
+ IContractPublisher.CustomContractInstance memory customContract = byoc.getPublishedContract (
104
+ publisher,
105
+ contractId
106
+ );
101
107
102
108
assertEq (customContract.contractId, contractId);
103
109
assertEq (customContract.publishMetadataUri, publishMetadataUri);
@@ -144,13 +150,14 @@ contract ByocRegistryTest is BaseTest, IByocRegistryData {
144
150
vm.prank (publisher);
145
151
byoc.approveOperator (operator, true );
146
152
147
- IByocRegistry.CustomContractInstance memory expectedCustomContract = IByocRegistry.CustomContractInstance ({
148
- contractId: contractId,
149
- publishTimestamp: 100 ,
150
- publishMetadataUri: publishMetadataUri,
151
- bytecodeHash: keccak256 (type (MockCustomContract).creationCode),
152
- implementation: address (0 )
153
- });
153
+ IContractPublisher.CustomContractInstance memory expectedCustomContract = IContractPublisher
154
+ .CustomContractInstance ({
155
+ contractId: contractId,
156
+ publishTimestamp: 100 ,
157
+ publishMetadataUri: publishMetadataUri,
158
+ bytecodeHash: keccak256 (type (MockCustomContract).creationCode),
159
+ implementation: address (0 )
160
+ });
154
161
155
162
vm.expectEmit (true , true , true , true );
156
163
emit ContractPublished (operator, publisher, expectedCustomContract);
@@ -181,7 +188,10 @@ contract ByocRegistryTest is BaseTest, IByocRegistryData {
181
188
vm.prank (publisher);
182
189
byoc.unpublishContract (publisher, contractId);
183
190
184
- IByocRegistry.CustomContractInstance memory customContract = byoc.getPublishedContract (publisher, contractId);
191
+ IContractPublisher.CustomContractInstance memory customContract = byoc.getPublishedContract (
192
+ publisher,
193
+ contractId
194
+ );
185
195
186
196
assertEq (customContract.contractId, "" );
187
197
assertEq (customContract.publishMetadataUri, "" );
@@ -207,7 +217,10 @@ contract ByocRegistryTest is BaseTest, IByocRegistryData {
207
217
vm.prank (operator);
208
218
byoc.unpublishContract (publisher, contractId);
209
219
210
- IByocRegistry.CustomContractInstance memory customContract = byoc.getPublishedContract (publisher, contractId);
220
+ IContractPublisher.CustomContractInstance memory customContract = byoc.getPublishedContract (
221
+ publisher,
222
+ contractId
223
+ );
211
224
212
225
assertEq (customContract.contractId, "" );
213
226
assertEq (customContract.publishMetadataUri, "" );
0 commit comments