@@ -20,16 +20,19 @@ contract CraftingTest is Test {
20
20
21
21
uint256 public imtblPrivateKey = 1 ;
22
22
uint256 public gameStudioPrivateKey = 2 ;
23
- uint256 public playerOnePrivateKey = 3 ;
24
- uint256 public signingAuthorityPrivateKey = 4 ;
23
+ uint256 public signingAuthorityPrivateKey = 3 ;
24
+ uint256 public playerPrivateKey = 4 ;
25
25
26
26
address public imtbl = vm.addr (imtblPrivateKey);
27
27
address public gameStudio = vm.addr (gameStudioPrivateKey);
28
- address public playerOne = vm.addr (playerOnePrivateKey);
29
28
address public signingAuthority = vm.addr (signingAuthorityPrivateKey);
29
+ address public player = vm.addr (playerPrivateKey);
30
30
31
31
address public proxyAddr;
32
32
33
+ string public multicallerName = "multicaller-name " ;
34
+ string public multicallerVersion = "multicaller-version " ;
35
+
33
36
function setUp () public {
34
37
DeployOperatorAllowlist deployScript = new DeployOperatorAllowlist ();
35
38
proxyAddr = deployScript.run (imtbl, imtbl, imtbl);
@@ -50,7 +53,7 @@ contract CraftingTest is Test {
50
53
);
51
54
52
55
// Deploy game studio's multicaller contract
53
- multicaller = new GuardedMulticaller (gameStudio, " multicaller " , " 1 " );
56
+ multicaller = new GuardedMulticaller (gameStudio, multicallerName, multicallerVersion );
54
57
assertTrue (multicaller.hasRole (multicaller.DEFAULT_ADMIN_ROLE (), gameStudio));
55
58
56
59
// Add multicaller to operator allowlist
@@ -95,24 +98,24 @@ contract CraftingTest is Test {
95
98
assertTrue (multicaller.isFunctionPermitted (address (game721), game721.safeMint.selector ));
96
99
assertTrue (multicaller.isFunctionPermitted (address (game1155), game1155.burnBatch.selector ));
97
100
98
- sigUtils = new SigUtils (" multicaller " , " 1 " , address (multicaller));
101
+ sigUtils = new SigUtils (multicallerName, multicallerVersion , address (multicaller));
99
102
}
100
103
101
104
function testCraft () public {
102
- // Game studio mints 10 of tokenID 1 on 1155 to user A
105
+ // Game studio mints 10 of tokenID 1 on 1155 to player
103
106
vm.prank (gameStudio);
104
- game1155.safeMint (playerOne , 1 , 10 , "" );
105
- assertTrue (game1155.balanceOf (playerOne , 1 ) == 10 );
107
+ game1155.safeMint (player , 1 , 10 , "" );
108
+ assertTrue (game1155.balanceOf (player , 1 ) == 10 );
106
109
107
- // Game studio mints 10 of tokenID 2 on 1155 to user A
110
+ // Game studio mints 10 of tokenID 2 on 1155 to player
108
111
vm.prank (gameStudio);
109
- game1155.safeMint (playerOne , 2 , 10 , "" );
110
- assertTrue (game1155.balanceOf (playerOne , 2 ) == 10 );
112
+ game1155.safeMint (player , 2 , 10 , "" );
113
+ assertTrue (game1155.balanceOf (player , 2 ) == 10 );
111
114
112
115
// Perform a craft using the Multicaller
113
116
// - burn 1 of 1155 tokenID 1
114
117
// - burn 2 of 1155 tokenID 2
115
- // - mint 1 721 to playerOne
118
+ // - mint 1 721 to player
116
119
117
120
bytes32 referenceID = keccak256 ("testCraft:1 " );
118
121
@@ -130,8 +133,8 @@ contract CraftingTest is Test {
130
133
values[0 ] = 1 ;
131
134
values[1 ] = 2 ;
132
135
133
- data[0 ] = abi.encodeWithSignature ("burnBatch(address,uint256[],uint256[]) " , playerOne , ids, values);
134
- data[1 ] = abi.encodeWithSignature ("safeMint(address,uint256) " , playerOne , 1 );
136
+ data[0 ] = abi.encodeWithSignature ("burnBatch(address,uint256[],uint256[]) " , player , ids, values);
137
+ data[1 ] = abi.encodeWithSignature ("safeMint(address,uint256) " , player , 1 );
135
138
136
139
uint256 deadline = block .timestamp + 10 ;
137
140
@@ -144,15 +147,15 @@ contract CraftingTest is Test {
144
147
vm.stopPrank ();
145
148
146
149
// Give multicaller approve to burn
147
- vm.startPrank (playerOne );
150
+ vm.startPrank (player );
148
151
game1155.setApprovalForAll (address (multicaller), true );
149
- assertTrue (game1155.isApprovedForAll (playerOne , address (multicaller)));
152
+ assertTrue (game1155.isApprovedForAll (player , address (multicaller)));
150
153
151
154
multicaller.execute (signingAuthority, referenceID, targets, data, deadline, signature);
152
155
vm.stopPrank ();
153
156
154
- assertTrue (game1155.balanceOf (playerOne , 1 ) == 9 );
155
- assertTrue (game1155.balanceOf (playerOne , 2 ) == 8 );
156
- assertTrue (game721.balanceOf (playerOne ) == 1 );
157
+ assertTrue (game1155.balanceOf (player , 1 ) == 9 );
158
+ assertTrue (game1155.balanceOf (player , 2 ) == 8 );
159
+ assertTrue (game721.balanceOf (player ) == 1 );
157
160
}
158
161
}
0 commit comments