@@ -96,35 +96,41 @@ func (s *ClientTestSuite) SetupTest() {
96
96
_ , err = rpc .WaitReceipt (context .Background (), rpcCli .L1 , tx )
97
97
s .Nil (err )
98
98
99
- decimal , err := rpcCli .TaikoToken .Decimals (nil )
100
- s .Nil (err )
101
-
102
99
// Increase allowance for AssignmentHook and TaikoL1
103
- opts , err = bind .NewKeyedTransactorWithChainID (l1ProverPrivKey , rpcCli .L1ChainID )
104
- s .Nil (err )
105
-
106
- bigInt := new (big.Int ).Exp (big .NewInt (1_000_000_000 ), new (big.Int ).SetUint64 (uint64 (decimal )), nil )
107
- _ , err = rpcCli .TaikoToken .Approve (
108
- opts ,
109
- common .HexToAddress (os .Getenv ("ASSIGNMENT_HOOK_ADDRESS" )),
110
- bigInt ,
111
- )
112
- s .Nil (err )
113
-
114
- _ , err = rpcCli .TaikoToken .Approve (
115
- opts ,
116
- common .HexToAddress (os .Getenv ("TAIKO_L1_ADDRESS" )),
117
- bigInt ,
118
- )
119
- s .Nil (err )
120
-
121
- _ , err = rpc .WaitReceipt (context .Background (), rpcCli .L1 , tx )
122
- s .Nil (err )
100
+ s .setAllowance (l1ProverPrivKey )
101
+ s .setAllowance (ownerPrivKey )
123
102
}
124
103
s .Nil (rpcCli .L1 .CallContext (context .Background (), & s .testnetL1SnapshotID , "evm_snapshot" ))
125
104
s .NotEmpty (s .testnetL1SnapshotID )
126
105
}
127
106
107
+ func (s * ClientTestSuite ) setAllowance (key * ecdsa.PrivateKey ) {
108
+ decimal , err := s .RPCClient .TaikoToken .Decimals (nil )
109
+ s .Nil (err )
110
+
111
+ bigInt := new (big.Int ).Exp (big .NewInt (1_000_000_000 ), new (big.Int ).SetUint64 (uint64 (decimal )), nil )
112
+
113
+ opts , err := bind .NewKeyedTransactorWithChainID (key , s .RPCClient .L1ChainID )
114
+ s .Nil (err )
115
+
116
+ _ , err = s .RPCClient .TaikoToken .Approve (
117
+ opts ,
118
+ common .HexToAddress (os .Getenv ("ASSIGNMENT_HOOK_ADDRESS" )),
119
+ bigInt ,
120
+ )
121
+ s .Nil (err )
122
+
123
+ tx , err := s .RPCClient .TaikoToken .Approve (
124
+ opts ,
125
+ common .HexToAddress (os .Getenv ("TAIKO_L1_ADDRESS" )),
126
+ bigInt ,
127
+ )
128
+ s .Nil (err )
129
+
130
+ _ , err = rpc .WaitReceipt (context .Background (), s .RPCClient .L1 , tx )
131
+ s .Nil (err )
132
+ }
133
+
128
134
func (s * ClientTestSuite ) setAddress (ownerPrivKey * ecdsa.PrivateKey , name [32 ]byte , address common.Address ) {
129
135
var (
130
136
salt = RandomHash ()
0 commit comments