-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Expand file tree
/
Copy pathProxies.t.sol
More file actions
49 lines (36 loc) · 1.22 KB
/
Proxies.t.sol
File metadata and controls
49 lines (36 loc) · 1.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import {Test} from "forge-std/Test.sol";
import "../../contracts/Proxies.sol";
contract ProxiesTest is Test {
function test_ShouldTrackProxiedCallsToImpl1AndImpl2AsSeparate() public {
Impl1 impl1 = new Impl1();
Impl2 impl2 = new Impl2();
Proxy proxy1 = new Proxy(address(impl1));
Proxy proxy2 = new Proxy(address(impl2));
Impl1 i1 = Impl1(address(proxy1));
Impl2 i2 = Impl2(address(proxy2));
// emit log("Calling Proxy -> Impl1");
i1.one();
// emit log("Calling Proxy -> Impl2");
i2.two();
// emit log("Calling Impl1");
impl1.one();
}
function test_ShouldTrackProxiedCallsToImpl1AsSeparateWithDifferentProxyChains()
public
{
// We use the same impl but different proxy chains
Impl1 impl1 = new Impl1();
Proxy proxy1 = new Proxy(address(impl1));
Proxy proxy2 = new Proxy(address(impl1));
// We use a proxy in front of proxy1
Proxy2 proxy11 = new Proxy2(address(impl1), address(proxy1));
Impl1 i1 = Impl1(address(proxy11));
Impl1 i2 = Impl1(address(proxy2));
// emit log("Calling Proxy2 -> Proxy -> Impl1");
i1.one();
// emit log("Calling Proxy1 -> Impl1");
i2.one();
}
}