@@ -3,18 +3,26 @@ pragma solidity ^0.8.13;
3
3
4
4
import {Test, console} from "forge-std/Test.sol " ;
5
5
import {PythLazer} from "../src/PythLazer.sol " ;
6
+ import "@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol " ;
6
7
7
8
contract PythLazerTest is Test {
8
9
PythLazer public pythLazer;
10
+ address owner;
9
11
10
12
function setUp () public {
11
- pythLazer = new PythLazer ();
12
- pythLazer.initialize (address (1 ));
13
+ owner = address (1 );
14
+ PythLazer pythLazerImpl = new PythLazer ();
15
+ TransparentUpgradeableProxy proxy = new TransparentUpgradeableProxy (
16
+ address (pythLazerImpl),
17
+ owner,
18
+ abi.encodeWithSelector (PythLazer.initialize.selector , owner)
19
+ );
20
+ pythLazer = PythLazer (address (proxy));
13
21
}
14
22
15
23
function test_update_add_signer () public {
16
24
assert (! pythLazer.isValidSigner (address (2 )));
17
- vm.prank (address ( 1 ) );
25
+ vm.prank (owner );
18
26
pythLazer.updateTrustedSigner (address (2 ), block .timestamp + 1000 );
19
27
assert (pythLazer.isValidSigner (address (2 )));
20
28
skip (2000 );
@@ -23,19 +31,19 @@ contract PythLazerTest is Test {
23
31
24
32
function test_update_remove_signer () public {
25
33
assert (! pythLazer.isValidSigner (address (2 )));
26
- vm.prank (address ( 1 ) );
34
+ vm.prank (owner );
27
35
pythLazer.updateTrustedSigner (address (2 ), block .timestamp + 1000 );
28
36
assert (pythLazer.isValidSigner (address (2 )));
29
37
30
- vm.prank (address ( 1 ) );
38
+ vm.prank (owner );
31
39
pythLazer.updateTrustedSigner (address (2 ), 0 );
32
40
assert (! pythLazer.isValidSigner (address (2 )));
33
41
}
34
42
35
43
function test_verify () public {
36
44
// Prepare dummy update and signer
37
45
address trustedSigner = 0xb8d50f0bAE75BF6E03c104903d7C3aFc4a6596Da ;
38
- vm.prank (address ( 1 ) );
46
+ vm.prank (owner );
39
47
pythLazer.updateTrustedSigner (trustedSigner, 3000000000000000 );
40
48
bytes
41
49
memory update = hex "2a22999a9ee4e2a3df5affd0ad8c7c46c96d3b5ef197dd653bedd8f44a4b6b69b767fbc66341e80b80acb09ead98c60d169b9a99657ebada101f447378f227bffbc69d3d01003493c7d37500062cf28659c1e801010000000605000000000005f5e10002000000000000000001000000000000000003000104fff8 " ;
0 commit comments