@layerzerolabs/lz-evm-protocol-v2 2.0.19-rc.0 → 2.0.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/artifacts/contracts/proxy/TransparentUpgradeableProxy.sol/TransparentUpgradeableProxy.json
ADDED
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
{
|
|
2
|
+
"_format": "hh-sol-artifact-1",
|
|
3
|
+
"contractName": "TransparentUpgradeableProxy",
|
|
4
|
+
"sourceName": "contracts/proxy/TransparentUpgradeableProxy.sol",
|
|
5
|
+
"abi": [
|
|
6
|
+
{
|
|
7
|
+
"inputs": [
|
|
8
|
+
{
|
|
9
|
+
"internalType": "address",
|
|
10
|
+
"name": "_logic",
|
|
11
|
+
"type": "address"
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
"internalType": "address",
|
|
15
|
+
"name": "admin_",
|
|
16
|
+
"type": "address"
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
"internalType": "bytes",
|
|
20
|
+
"name": "_data",
|
|
21
|
+
"type": "bytes"
|
|
22
|
+
}
|
|
23
|
+
],
|
|
24
|
+
"stateMutability": "payable",
|
|
25
|
+
"type": "constructor"
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
"inputs": [],
|
|
29
|
+
"name": "AdminAccessDenied",
|
|
30
|
+
"type": "error"
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"anonymous": false,
|
|
34
|
+
"inputs": [
|
|
35
|
+
{
|
|
36
|
+
"indexed": false,
|
|
37
|
+
"internalType": "address",
|
|
38
|
+
"name": "previousAdmin",
|
|
39
|
+
"type": "address"
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
"indexed": false,
|
|
43
|
+
"internalType": "address",
|
|
44
|
+
"name": "newAdmin",
|
|
45
|
+
"type": "address"
|
|
46
|
+
}
|
|
47
|
+
],
|
|
48
|
+
"name": "AdminChanged",
|
|
49
|
+
"type": "event"
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
"anonymous": false,
|
|
53
|
+
"inputs": [
|
|
54
|
+
{
|
|
55
|
+
"indexed": true,
|
|
56
|
+
"internalType": "address",
|
|
57
|
+
"name": "beacon",
|
|
58
|
+
"type": "address"
|
|
59
|
+
}
|
|
60
|
+
],
|
|
61
|
+
"name": "BeaconUpgraded",
|
|
62
|
+
"type": "event"
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
"anonymous": false,
|
|
66
|
+
"inputs": [
|
|
67
|
+
{
|
|
68
|
+
"indexed": true,
|
|
69
|
+
"internalType": "address",
|
|
70
|
+
"name": "implementation",
|
|
71
|
+
"type": "address"
|
|
72
|
+
}
|
|
73
|
+
],
|
|
74
|
+
"name": "Upgraded",
|
|
75
|
+
"type": "event"
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
"stateMutability": "payable",
|
|
79
|
+
"type": "fallback"
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
"inputs": [],
|
|
83
|
+
"name": "admin",
|
|
84
|
+
"outputs": [
|
|
85
|
+
{
|
|
86
|
+
"internalType": "address",
|
|
87
|
+
"name": "admin_",
|
|
88
|
+
"type": "address"
|
|
89
|
+
}
|
|
90
|
+
],
|
|
91
|
+
"stateMutability": "nonpayable",
|
|
92
|
+
"type": "function"
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
"inputs": [
|
|
96
|
+
{
|
|
97
|
+
"internalType": "address",
|
|
98
|
+
"name": "newAdmin",
|
|
99
|
+
"type": "address"
|
|
100
|
+
}
|
|
101
|
+
],
|
|
102
|
+
"name": "changeAdmin",
|
|
103
|
+
"outputs": [],
|
|
104
|
+
"stateMutability": "nonpayable",
|
|
105
|
+
"type": "function"
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
"inputs": [],
|
|
109
|
+
"name": "implementation",
|
|
110
|
+
"outputs": [
|
|
111
|
+
{
|
|
112
|
+
"internalType": "address",
|
|
113
|
+
"name": "implementation_",
|
|
114
|
+
"type": "address"
|
|
115
|
+
}
|
|
116
|
+
],
|
|
117
|
+
"stateMutability": "nonpayable",
|
|
118
|
+
"type": "function"
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
"inputs": [
|
|
122
|
+
{
|
|
123
|
+
"internalType": "address",
|
|
124
|
+
"name": "newImplementation",
|
|
125
|
+
"type": "address"
|
|
126
|
+
}
|
|
127
|
+
],
|
|
128
|
+
"name": "upgradeTo",
|
|
129
|
+
"outputs": [],
|
|
130
|
+
"stateMutability": "nonpayable",
|
|
131
|
+
"type": "function"
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
"inputs": [
|
|
135
|
+
{
|
|
136
|
+
"internalType": "address",
|
|
137
|
+
"name": "newImplementation",
|
|
138
|
+
"type": "address"
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
"internalType": "bytes",
|
|
142
|
+
"name": "data",
|
|
143
|
+
"type": "bytes"
|
|
144
|
+
}
|
|
145
|
+
],
|
|
146
|
+
"name": "upgradeToAndCall",
|
|
147
|
+
"outputs": [],
|
|
148
|
+
"stateMutability": "payable",
|
|
149
|
+
"type": "function"
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
"stateMutability": "payable",
|
|
153
|
+
"type": "receive"
|
|
154
|
+
}
|
|
155
|
+
],
|
|
156
|
+
"bytecode": "0x608060405260405162000fb438038062000fb4833981016040819052620000269162000473565b828162000036828260006200009a565b5062000066905060017fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d610462000553565b60008051602062000f6d8339815191521462000086576200008662000575565b6200009182620000cc565b505050620005de565b620000a5836200013e565b600082511180620000b35750805b15620000c757620000c5838362000180565b505b505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6200010e60008051602062000f6d833981519152546001600160a01b031690565b604080516001600160a01b03928316815291841660208301520160405180910390a16200013b81620001b1565b50565b62000149816200024f565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b6060620001a8838360405180606001604052806027815260200162000f8d60279139620002e6565b90505b92915050565b6001600160a01b0381166200021c5760405162461bcd60e51b815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b8060008051602062000f6d8339815191525b80546001600160a01b0319166001600160a01b039290921691909117905550565b6001600160a01b0381163b620002be5760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b606482015260840162000213565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc6200022e565b6060600080856001600160a01b0316856040516200030591906200058b565b600060405180830381855af49150503d806000811462000342576040519150601f19603f3d011682016040523d82523d6000602084013e62000347565b606091505b5090925090506200035b8683838762000365565b9695505050505050565b60608315620003d9578251600003620003d1576001600160a01b0385163b620003d15760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640162000213565b5081620003e5565b620003e58383620003ed565b949350505050565b815115620003fe5781518083602001fd5b8060405162461bcd60e51b8152600401620002139190620005a9565b80516001600160a01b03811681146200043257600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b838110156200046a57818101518382015260200162000450565b50506000910152565b6000806000606084860312156200048957600080fd5b62000494846200041a565b9250620004a4602085016200041a565b60408501519092506001600160401b0380821115620004c257600080fd5b818601915086601f830112620004d757600080fd5b815181811115620004ec57620004ec62000437565b604051601f8201601f19908116603f0116810190838211818310171562000517576200051762000437565b816040528281528960208487010111156200053157600080fd5b620005448360208301602088016200044d565b80955050505050509250925092565b81810381811115620001ab57634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052600160045260246000fd5b600082516200059f8184602087016200044d565b9190910192915050565b6020815260008251806020840152620005ca8160408501602087016200044d565b601f01601f19169190910160400192915050565b61097f80620005ee6000396000f3fe60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146100a85780638f283970146100e6578063f851a440146101065761006d565b80633659cfe6146100755780634f1ef286146100955761006d565b3661006d5761006b61011b565b005b61006b61011b565b34801561008157600080fd5b5061006b6100903660046107f3565b610135565b61006b6100a336600461080e565b61017f565b3480156100b457600080fd5b506100bd6101f3565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100f257600080fd5b5061006b6101013660046107f3565b610231565b34801561011257600080fd5b506100bd61025e565b61012361028c565b61013361012e6102e2565b6102ec565b565b61013d610310565b73ffffffffffffffffffffffffffffffffffffffff1633036101775761017481604051806020016040528060008152506000610350565b50565b61017461011b565b610187610310565b73ffffffffffffffffffffffffffffffffffffffff1633036101eb576101e68383838080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525060019250610350915050565b505050565b6101e661011b565b60006101fd610310565b73ffffffffffffffffffffffffffffffffffffffff163303610226576102216102e2565b905090565b61022e61011b565b90565b610239610310565b73ffffffffffffffffffffffffffffffffffffffff163303610177576101748161037b565b6000610268610310565b73ffffffffffffffffffffffffffffffffffffffff16330361022657610221610310565b610294610310565b73ffffffffffffffffffffffffffffffffffffffff163303610133576040517ff0d4b23e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60006102216103dc565b3660008037600080366000845af43d6000803e80801561030b573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b5473ffffffffffffffffffffffffffffffffffffffff16919050565b61035983610404565b6000825111806103665750805b156101e6576103758383610451565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6103a4610310565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301520160405180910390a16101748161047d565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610334565b61040d8161058e565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b6060610476838360405180606001604052806027815260200161092360279139610659565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff8116610525576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9290921691909117905550565b73ffffffffffffffffffffffffffffffffffffffff81163b610632576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e747261637400000000000000000000000000000000000000606482015260840161051c565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610548565b60606000808573ffffffffffffffffffffffffffffffffffffffff168560405161068391906108b5565b600060405180830381855af49150503d80600081146106be576040519150601f19603f3d011682016040523d82523d6000602084013e6106c3565b606091505b50915091506106d4868383876106de565b9695505050505050565b6060831561077457825160000361076d5773ffffffffffffffffffffffffffffffffffffffff85163b61076d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161051c565b508161077e565b61077e8383610786565b949350505050565b8151156107965781518083602001fd5b806040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161051c91906108d1565b803573ffffffffffffffffffffffffffffffffffffffff811681146107ee57600080fd5b919050565b60006020828403121561080557600080fd5b610476826107ca565b60008060006040848603121561082357600080fd5b61082c846107ca565b9250602084013567ffffffffffffffff8082111561084957600080fd5b818601915086601f83011261085d57600080fd5b81358181111561086c57600080fd5b87602082850101111561087e57600080fd5b6020830194508093505050509250925092565b60005b838110156108ac578181015183820152602001610894565b50506000910152565b600082516108c7818460208701610891565b9190910192915050565b60208152600082518060208401526108f0816040850160208701610891565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a264697066735822122077144df0be47c9a6de1da981c26a5b43efc81bf743637b69867b5ccb514e568f64736f6c63430008160033b53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564",
|
|
157
|
+
"deployedBytecode": "0x60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146100a85780638f283970146100e6578063f851a440146101065761006d565b80633659cfe6146100755780634f1ef286146100955761006d565b3661006d5761006b61011b565b005b61006b61011b565b34801561008157600080fd5b5061006b6100903660046107f3565b610135565b61006b6100a336600461080e565b61017f565b3480156100b457600080fd5b506100bd6101f3565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100f257600080fd5b5061006b6101013660046107f3565b610231565b34801561011257600080fd5b506100bd61025e565b61012361028c565b61013361012e6102e2565b6102ec565b565b61013d610310565b73ffffffffffffffffffffffffffffffffffffffff1633036101775761017481604051806020016040528060008152506000610350565b50565b61017461011b565b610187610310565b73ffffffffffffffffffffffffffffffffffffffff1633036101eb576101e68383838080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525060019250610350915050565b505050565b6101e661011b565b60006101fd610310565b73ffffffffffffffffffffffffffffffffffffffff163303610226576102216102e2565b905090565b61022e61011b565b90565b610239610310565b73ffffffffffffffffffffffffffffffffffffffff163303610177576101748161037b565b6000610268610310565b73ffffffffffffffffffffffffffffffffffffffff16330361022657610221610310565b610294610310565b73ffffffffffffffffffffffffffffffffffffffff163303610133576040517ff0d4b23e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60006102216103dc565b3660008037600080366000845af43d6000803e80801561030b573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b5473ffffffffffffffffffffffffffffffffffffffff16919050565b61035983610404565b6000825111806103665750805b156101e6576103758383610451565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6103a4610310565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301520160405180910390a16101748161047d565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610334565b61040d8161058e565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b6060610476838360405180606001604052806027815260200161092360279139610659565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff8116610525576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9290921691909117905550565b73ffffffffffffffffffffffffffffffffffffffff81163b610632576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e747261637400000000000000000000000000000000000000606482015260840161051c565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610548565b60606000808573ffffffffffffffffffffffffffffffffffffffff168560405161068391906108b5565b600060405180830381855af49150503d80600081146106be576040519150601f19603f3d011682016040523d82523d6000602084013e6106c3565b606091505b50915091506106d4868383876106de565b9695505050505050565b6060831561077457825160000361076d5773ffffffffffffffffffffffffffffffffffffffff85163b61076d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161051c565b508161077e565b61077e8383610786565b949350505050565b8151156107965781518083602001fd5b806040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161051c91906108d1565b803573ffffffffffffffffffffffffffffffffffffffff811681146107ee57600080fd5b919050565b60006020828403121561080557600080fd5b610476826107ca565b60008060006040848603121561082357600080fd5b61082c846107ca565b9250602084013567ffffffffffffffff8082111561084957600080fd5b818601915086601f83011261085d57600080fd5b81358181111561086c57600080fd5b87602082850101111561087e57600080fd5b6020830194508093505050509250925092565b60005b838110156108ac578181015183820152602001610894565b50506000910152565b600082516108c7818460208701610891565b9190910192915050565b60208152600082518060208401526108f0816040850160208701610891565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a264697066735822122077144df0be47c9a6de1da981c26a5b43efc81bf743637b69867b5ccb514e568f64736f6c63430008160033",
|
|
158
|
+
"linkReferences": {},
|
|
159
|
+
"deployedLinkReferences": {}
|
|
160
|
+
}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
|
|
3
|
+
// OpenZeppelin Contracts v4.4.1 (proxy/transparent/TransparentUpgradeableProxy.sol)
|
|
4
|
+
|
|
5
|
+
pragma solidity ^0.8.0;
|
|
6
|
+
|
|
7
|
+
import { ERC1967Proxy } from "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol";
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* @author OpenZeppelin. Modified from https://github.com/OpenZeppelin/openzeppelin-contracts/blob/release-v4.4/contracts/proxy/transparent/TransparentUpgradeableProxy.sol
|
|
11
|
+
* to support custom errors.
|
|
12
|
+
* @dev This contract implements a proxy that is upgradeable by an admin.
|
|
13
|
+
*
|
|
14
|
+
* To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector
|
|
15
|
+
* clashing], which can potentially be used in an attack, this contract uses the
|
|
16
|
+
* https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two
|
|
17
|
+
* things that go hand in hand:
|
|
18
|
+
*
|
|
19
|
+
* 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if
|
|
20
|
+
* that call matches one of the admin functions exposed by the proxy itself.
|
|
21
|
+
* 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the
|
|
22
|
+
* implementation. If the admin tries to call a function on the implementation it will fail with an error indicating
|
|
23
|
+
* the proxy admin cannot fallback to the target implementation.
|
|
24
|
+
*
|
|
25
|
+
* These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing
|
|
26
|
+
* the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due
|
|
27
|
+
* to sudden errors when trying to call a function from the proxy implementation.
|
|
28
|
+
*
|
|
29
|
+
* Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way,
|
|
30
|
+
* you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.
|
|
31
|
+
*/
|
|
32
|
+
contract TransparentUpgradeableProxy is ERC1967Proxy {
|
|
33
|
+
/**
|
|
34
|
+
* @dev The proxy caller is the current admin, and can't fallback to the proxy target.
|
|
35
|
+
*/
|
|
36
|
+
error AdminAccessDenied();
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* @dev Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and
|
|
40
|
+
* optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.
|
|
41
|
+
*/
|
|
42
|
+
constructor(address _logic, address admin_, bytes memory _data) payable ERC1967Proxy(_logic, _data) {
|
|
43
|
+
assert(_ADMIN_SLOT == bytes32(uint256(keccak256("eip1967.proxy.admin")) - 1));
|
|
44
|
+
_changeAdmin(admin_);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* @dev Modifier used internally that will delegate the call to the implementation unless the sender is the admin.
|
|
49
|
+
*/
|
|
50
|
+
modifier ifAdmin() {
|
|
51
|
+
if (msg.sender == _getAdmin()) {
|
|
52
|
+
_;
|
|
53
|
+
} else {
|
|
54
|
+
_fallback();
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* @dev Returns the current admin.
|
|
60
|
+
*
|
|
61
|
+
* NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}.
|
|
62
|
+
*
|
|
63
|
+
* TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the
|
|
64
|
+
* https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.
|
|
65
|
+
* `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`
|
|
66
|
+
*/
|
|
67
|
+
function admin() external ifAdmin returns (address admin_) {
|
|
68
|
+
admin_ = _getAdmin();
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* @dev Returns the current implementation.
|
|
73
|
+
*
|
|
74
|
+
* NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}.
|
|
75
|
+
*
|
|
76
|
+
* TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the
|
|
77
|
+
* https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.
|
|
78
|
+
* `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`
|
|
79
|
+
*/
|
|
80
|
+
function implementation() external ifAdmin returns (address implementation_) {
|
|
81
|
+
implementation_ = _implementation();
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* @dev Changes the admin of the proxy.
|
|
86
|
+
*
|
|
87
|
+
* Emits an {AdminChanged} event.
|
|
88
|
+
*
|
|
89
|
+
* NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.
|
|
90
|
+
*/
|
|
91
|
+
function changeAdmin(address newAdmin) external virtual ifAdmin {
|
|
92
|
+
_changeAdmin(newAdmin);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* @dev Upgrade the implementation of the proxy.
|
|
97
|
+
*
|
|
98
|
+
* NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.
|
|
99
|
+
*/
|
|
100
|
+
function upgradeTo(address newImplementation) external ifAdmin {
|
|
101
|
+
_upgradeToAndCall(newImplementation, bytes(""), false);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* @dev Upgrade the implementation of the proxy, and then call a function from the new implementation as specified
|
|
106
|
+
* by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the
|
|
107
|
+
* proxied contract.
|
|
108
|
+
*
|
|
109
|
+
* NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.
|
|
110
|
+
*/
|
|
111
|
+
function upgradeToAndCall(address newImplementation, bytes calldata data) external payable ifAdmin {
|
|
112
|
+
_upgradeToAndCall(newImplementation, data, true);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* @dev Returns the current admin.
|
|
117
|
+
*/
|
|
118
|
+
function _admin() internal view virtual returns (address) {
|
|
119
|
+
return _getAdmin();
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* @dev Makes sure the admin cannot access the fallback function. See {Proxy-_beforeFallback}.
|
|
124
|
+
*/
|
|
125
|
+
function _beforeFallback() internal virtual override {
|
|
126
|
+
if (msg.sender == _getAdmin()) {
|
|
127
|
+
revert AdminAccessDenied();
|
|
128
|
+
}
|
|
129
|
+
super._beforeFallback();
|
|
130
|
+
}
|
|
131
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@layerzerolabs/lz-evm-protocol-v2",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.20",
|
|
4
4
|
"license": "LZBL-1.2",
|
|
5
5
|
"files": [
|
|
6
6
|
"artifacts/contracts/**/!(*.dbg).json",
|
|
@@ -30,6 +30,5 @@
|
|
|
30
30
|
"default": [
|
|
31
31
|
"v2"
|
|
32
32
|
]
|
|
33
|
-
}
|
|
34
|
-
"stableVersion": "2.0.18"
|
|
33
|
+
}
|
|
35
34
|
}
|