@venusprotocol/venus-protocol 5.2.0-dev.3 → 6.0.0-dev.1

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.
Files changed (58) hide show
  1. package/README.md +10 -0
  2. package/artifacts/@openzeppelin/contracts/access/IAccessControl.sol/IAccessControl.dbg.json +1 -1
  3. package/artifacts/@openzeppelin/contracts/access/Ownable.sol/Ownable.dbg.json +1 -1
  4. package/artifacts/@openzeppelin/contracts/access/Ownable2Step.sol/Ownable2Step.dbg.json +1 -1
  5. package/artifacts/@openzeppelin/contracts/security/ReentrancyGuard.sol/ReentrancyGuard.dbg.json +4 -0
  6. package/artifacts/@openzeppelin/contracts/security/ReentrancyGuard.sol/ReentrancyGuard.json +10 -0
  7. package/artifacts/@openzeppelin/contracts/token/ERC20/IERC20.sol/IERC20.dbg.json +1 -1
  8. package/artifacts/@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol/IERC20Permit.dbg.json +1 -1
  9. package/artifacts/@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol/SafeERC20.dbg.json +1 -1
  10. package/artifacts/@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol/SafeERC20.json +2 -2
  11. package/artifacts/@openzeppelin/contracts/utils/Address.sol/Address.dbg.json +1 -1
  12. package/artifacts/@openzeppelin/contracts/utils/Address.sol/Address.json +2 -2
  13. package/artifacts/@openzeppelin/contracts/utils/Context.sol/Context.dbg.json +1 -1
  14. package/artifacts/@openzeppelin/contracts-upgradeable/access/Ownable2StepUpgradeable.sol/Ownable2StepUpgradeable.dbg.json +1 -1
  15. package/artifacts/@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol/OwnableUpgradeable.dbg.json +1 -1
  16. package/artifacts/@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol/Initializable.dbg.json +1 -1
  17. package/artifacts/@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol/PausableUpgradeable.dbg.json +1 -1
  18. package/artifacts/@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol/ReentrancyGuardUpgradeable.dbg.json +1 -1
  19. package/artifacts/@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol/IERC20Upgradeable.dbg.json +1 -1
  20. package/artifacts/@openzeppelin/contracts-upgradeable/token/ERC20/extensions/IERC20MetadataUpgradeable.sol/IERC20MetadataUpgradeable.dbg.json +1 -1
  21. package/artifacts/@openzeppelin/contracts-upgradeable/token/ERC20/extensions/IERC20PermitUpgradeable.sol/IERC20PermitUpgradeable.dbg.json +1 -1
  22. package/artifacts/@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol/SafeERC20Upgradeable.dbg.json +1 -1
  23. package/artifacts/@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol/SafeERC20Upgradeable.json +2 -2
  24. package/artifacts/@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol/AddressUpgradeable.dbg.json +1 -1
  25. package/artifacts/@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol/AddressUpgradeable.json +2 -2
  26. package/artifacts/@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol/ContextUpgradeable.dbg.json +1 -1
  27. package/artifacts/@openzeppelin/contracts-upgradeable/utils/math/SafeCastUpgradeable.sol/SafeCastUpgradeable.dbg.json +1 -1
  28. package/artifacts/@openzeppelin/contracts-upgradeable/utils/math/SafeCastUpgradeable.sol/SafeCastUpgradeable.json +2 -2
  29. package/artifacts/build-info/ce72ac5d71d669e214b3d20b850e1c74.json +1 -0
  30. package/artifacts/contracts/Governance/VTreasuryV8.sol/VTreasuryV8.dbg.json +4 -0
  31. package/artifacts/contracts/Governance/VTreasuryV8.sol/VTreasuryV8.json +200 -0
  32. package/contracts/Governance/VTreasuryV8.sol +101 -0
  33. package/deploy/007-deploy-VTreasuryV8.ts +36 -0
  34. package/deployments/bscmainnet.json +13822 -0
  35. package/deployments/bsctestnet.json +21256 -0
  36. package/deployments/ethereum/.chainId +1 -0
  37. package/deployments/ethereum/VTreasuryV8.json +329 -0
  38. package/deployments/ethereum/solcInputs/427921aed0a07e3af769b0b61644e89c.json +91 -0
  39. package/deployments/ethereum.json +200 -0
  40. package/deployments/sepolia/.chainId +1 -0
  41. package/deployments/sepolia/VTreasuryV8.json +329 -0
  42. package/deployments/sepolia/solcInputs/08b51a64331428e03a9b461fcf31d47c.json +87 -0
  43. package/deployments/sepolia/solcInputs/332645575b586c0b893584ac8a9a94fc.json +87 -0
  44. package/deployments/sepolia/solcInputs/427921aed0a07e3af769b0b61644e89c.json +91 -0
  45. package/deployments/sepolia.json +200 -0
  46. package/dist/deploy/007-deploy-VTreasuryV8.d.ts +3 -0
  47. package/dist/deploy/007-deploy-VTreasuryV8.js +27 -0
  48. package/dist/hardhat.config.js +33 -0
  49. package/dist/typechain/contracts/Governance/VTreasuryV8.d.ts +190 -0
  50. package/dist/typechain/contracts/Governance/VTreasuryV8.js +3 -0
  51. package/dist/typechain/contracts/Governance/index.d.ts +1 -0
  52. package/dist/typechain/factories/contracts/Governance/VTreasuryV8__factory.d.ts +170 -0
  53. package/dist/typechain/factories/contracts/Governance/VTreasuryV8__factory.js +229 -0
  54. package/dist/typechain/factories/contracts/Governance/index.d.ts +1 -0
  55. package/dist/typechain/factories/contracts/Governance/index.js +3 -1
  56. package/dist/typechain/index.d.ts +2 -0
  57. package/dist/typechain/index.js +6 -4
  58. package/package.json +1 -1
@@ -0,0 +1,4 @@
1
+ {
2
+ "_format": "hh-sol-dbg-1",
3
+ "buildInfo": "../../../build-info/ce72ac5d71d669e214b3d20b850e1c74.json"
4
+ }
@@ -0,0 +1,200 @@
1
+ {
2
+ "_format": "hh-sol-artifact-1",
3
+ "contractName": "VTreasuryV8",
4
+ "sourceName": "contracts/Governance/VTreasuryV8.sol",
5
+ "abi": [
6
+ {
7
+ "inputs": [],
8
+ "name": "ZeroAddressNotAllowed",
9
+ "type": "error"
10
+ },
11
+ {
12
+ "anonymous": false,
13
+ "inputs": [
14
+ {
15
+ "indexed": true,
16
+ "internalType": "address",
17
+ "name": "previousOwner",
18
+ "type": "address"
19
+ },
20
+ {
21
+ "indexed": true,
22
+ "internalType": "address",
23
+ "name": "newOwner",
24
+ "type": "address"
25
+ }
26
+ ],
27
+ "name": "OwnershipTransferStarted",
28
+ "type": "event"
29
+ },
30
+ {
31
+ "anonymous": false,
32
+ "inputs": [
33
+ {
34
+ "indexed": true,
35
+ "internalType": "address",
36
+ "name": "previousOwner",
37
+ "type": "address"
38
+ },
39
+ {
40
+ "indexed": true,
41
+ "internalType": "address",
42
+ "name": "newOwner",
43
+ "type": "address"
44
+ }
45
+ ],
46
+ "name": "OwnershipTransferred",
47
+ "type": "event"
48
+ },
49
+ {
50
+ "anonymous": false,
51
+ "inputs": [
52
+ {
53
+ "indexed": false,
54
+ "internalType": "uint256",
55
+ "name": "withdrawAmount",
56
+ "type": "uint256"
57
+ },
58
+ {
59
+ "indexed": true,
60
+ "internalType": "address",
61
+ "name": "withdrawAddress",
62
+ "type": "address"
63
+ }
64
+ ],
65
+ "name": "WithdrawTreasuryNative",
66
+ "type": "event"
67
+ },
68
+ {
69
+ "anonymous": false,
70
+ "inputs": [
71
+ {
72
+ "indexed": true,
73
+ "internalType": "address",
74
+ "name": "tokenAddress",
75
+ "type": "address"
76
+ },
77
+ {
78
+ "indexed": false,
79
+ "internalType": "uint256",
80
+ "name": "withdrawAmount",
81
+ "type": "uint256"
82
+ },
83
+ {
84
+ "indexed": true,
85
+ "internalType": "address",
86
+ "name": "withdrawAddress",
87
+ "type": "address"
88
+ }
89
+ ],
90
+ "name": "WithdrawTreasuryToken",
91
+ "type": "event"
92
+ },
93
+ {
94
+ "stateMutability": "payable",
95
+ "type": "fallback"
96
+ },
97
+ {
98
+ "inputs": [],
99
+ "name": "acceptOwnership",
100
+ "outputs": [],
101
+ "stateMutability": "nonpayable",
102
+ "type": "function"
103
+ },
104
+ {
105
+ "inputs": [],
106
+ "name": "owner",
107
+ "outputs": [
108
+ {
109
+ "internalType": "address",
110
+ "name": "",
111
+ "type": "address"
112
+ }
113
+ ],
114
+ "stateMutability": "view",
115
+ "type": "function"
116
+ },
117
+ {
118
+ "inputs": [],
119
+ "name": "pendingOwner",
120
+ "outputs": [
121
+ {
122
+ "internalType": "address",
123
+ "name": "",
124
+ "type": "address"
125
+ }
126
+ ],
127
+ "stateMutability": "view",
128
+ "type": "function"
129
+ },
130
+ {
131
+ "inputs": [],
132
+ "name": "renounceOwnership",
133
+ "outputs": [],
134
+ "stateMutability": "nonpayable",
135
+ "type": "function"
136
+ },
137
+ {
138
+ "inputs": [
139
+ {
140
+ "internalType": "address",
141
+ "name": "newOwner",
142
+ "type": "address"
143
+ }
144
+ ],
145
+ "name": "transferOwnership",
146
+ "outputs": [],
147
+ "stateMutability": "nonpayable",
148
+ "type": "function"
149
+ },
150
+ {
151
+ "inputs": [
152
+ {
153
+ "internalType": "uint256",
154
+ "name": "withdrawAmount",
155
+ "type": "uint256"
156
+ },
157
+ {
158
+ "internalType": "address payable",
159
+ "name": "withdrawAddress",
160
+ "type": "address"
161
+ }
162
+ ],
163
+ "name": "withdrawTreasuryNative",
164
+ "outputs": [],
165
+ "stateMutability": "payable",
166
+ "type": "function"
167
+ },
168
+ {
169
+ "inputs": [
170
+ {
171
+ "internalType": "address",
172
+ "name": "tokenAddress",
173
+ "type": "address"
174
+ },
175
+ {
176
+ "internalType": "uint256",
177
+ "name": "withdrawAmount",
178
+ "type": "uint256"
179
+ },
180
+ {
181
+ "internalType": "address",
182
+ "name": "withdrawAddress",
183
+ "type": "address"
184
+ }
185
+ ],
186
+ "name": "withdrawTreasuryToken",
187
+ "outputs": [],
188
+ "stateMutability": "nonpayable",
189
+ "type": "function"
190
+ },
191
+ {
192
+ "stateMutability": "payable",
193
+ "type": "receive"
194
+ }
195
+ ],
196
+ "bytecode": "0x608060405234801561001057600080fd5b5061001a33610024565b6001600255610090565b600180546001600160a01b031916905561003d81610040565b50565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b610a8e8061009f6000396000f3fe60806040526004361061006e5760003560e01c80638da5cb5b1161004b5780638da5cb5b146100c1578063e30c3978146100f7578063f2fde38b14610115578063fed7036e1461013557005b8063715018a61461007757806374c17a351461008c57806379ba5097146100ac57005b3661007557005b005b34801561008357600080fd5b50610075610148565b34801561009857600080fd5b506100756100a7366004610914565b61015c565b3480156100b857600080fd5b506100756102c0565b3480156100cd57600080fd5b506000546001600160a01b03165b6040516001600160a01b03909116815260200160405180910390f35b34801561010357600080fd5b506001546001600160a01b03166100db565b34801561012157600080fd5b50610075610130366004610956565b61033a565b61007561014336600461097a565b6103ab565b610150610507565b61015a6000610561565b565b610164610507565b61016c61057a565b610175836105d1565b61017e816105d1565b600082116101d35760405162461bcd60e51b815260206004820152601f60248201527f7769746864726177416d6f756e74206d757374206e6f74206265207a65726f0060448201526064015b60405180910390fd5b6040516370a0823160e01b815230600482015282906000906001600160a01b038616906370a0823190602401602060405180830381865afa15801561021c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061024091906109aa565b90508084111561024e578091505b6102626001600160a01b03861684846105f8565b826001600160a01b0316856001600160a01b03167f6d043f5c542a67e836c8f8bdf640d0de840c85d79c130dcbda8d42c9c056980c846040516102a791815260200190565b60405180910390a350506102bb6001600255565b505050565b60015433906001600160a01b0316811461032e5760405162461bcd60e51b815260206004820152602960248201527f4f776e61626c6532537465703a2063616c6c6572206973206e6f7420746865206044820152683732bb9037bbb732b960b91b60648201526084016101ca565b61033781610561565b50565b610342610507565b600180546001600160a01b0383166001600160a01b031990911681179091556103736000546001600160a01b031690565b6001600160a01b03167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a350565b6103b3610507565b6103bb61057a565b6103c4816105d1565b600082116104145760405162461bcd60e51b815260206004820152601f60248201527f7769746864726177416d6f756e74206d757374206e6f74206265207a65726f0060448201526064016101ca565b814780821115610422578091505b6000836001600160a01b03168360405160006040518083038185875af1925050503d806000811461046f576040519150601f19603f3d011682016040523d82523d6000602084013e610474565b606091505b50509050806104b35760405162461bcd60e51b815260206004820152600b60248201526a10d85b1b0819985a5b195960aa1b60448201526064016101ca565b836001600160a01b03167f41448dfa44379fc602c636f8939b0b1b598c481af871c76fbdd8bdfcdaf30dfa846040516104ee91815260200190565b60405180910390a25050506105036001600255565b5050565b6000546001600160a01b0316331461015a5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016101ca565b600180546001600160a01b03191690556103378161064a565b60028054036105cb5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016101ca565b60028055565b6001600160a01b038116610337576040516342bcdf7f60e11b815260040160405180910390fd5b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b1790526102bb90849061069a565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60006106ef826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b031661076f9092919063ffffffff16565b905080516000148061071057508080602001905181019061071091906109c3565b6102bb5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016101ca565b606061077e8484600085610786565b949350505050565b6060824710156107e75760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016101ca565b600080866001600160a01b031685876040516108039190610a09565b60006040518083038185875af1925050503d8060008114610840576040519150601f19603f3d011682016040523d82523d6000602084013e610845565b606091505b509150915061085687838387610861565b979650505050505050565b606083156108d05782516000036108c9576001600160a01b0385163b6108c95760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016101ca565b508161077e565b61077e83838151156108e55781518083602001fd5b8060405162461bcd60e51b81526004016101ca9190610a25565b6001600160a01b038116811461033757600080fd5b60008060006060848603121561092957600080fd5b8335610934816108ff565b925060208401359150604084013561094b816108ff565b809150509250925092565b60006020828403121561096857600080fd5b8135610973816108ff565b9392505050565b6000806040838503121561098d57600080fd5b82359150602083013561099f816108ff565b809150509250929050565b6000602082840312156109bc57600080fd5b5051919050565b6000602082840312156109d557600080fd5b8151801515811461097357600080fd5b60005b83811015610a005781810151838201526020016109e8565b50506000910152565b60008251610a1b8184602087016109e5565b9190910192915050565b6020815260008251806020840152610a448160408501602087016109e5565b601f01601f1916919091016040019291505056fea264697066735822122093d87330f42b9bcbf754eefc1d04b5e948eb71f5034a7230cd66aec48234e18264736f6c63430008140033",
197
+ "deployedBytecode": "0x60806040526004361061006e5760003560e01c80638da5cb5b1161004b5780638da5cb5b146100c1578063e30c3978146100f7578063f2fde38b14610115578063fed7036e1461013557005b8063715018a61461007757806374c17a351461008c57806379ba5097146100ac57005b3661007557005b005b34801561008357600080fd5b50610075610148565b34801561009857600080fd5b506100756100a7366004610914565b61015c565b3480156100b857600080fd5b506100756102c0565b3480156100cd57600080fd5b506000546001600160a01b03165b6040516001600160a01b03909116815260200160405180910390f35b34801561010357600080fd5b506001546001600160a01b03166100db565b34801561012157600080fd5b50610075610130366004610956565b61033a565b61007561014336600461097a565b6103ab565b610150610507565b61015a6000610561565b565b610164610507565b61016c61057a565b610175836105d1565b61017e816105d1565b600082116101d35760405162461bcd60e51b815260206004820152601f60248201527f7769746864726177416d6f756e74206d757374206e6f74206265207a65726f0060448201526064015b60405180910390fd5b6040516370a0823160e01b815230600482015282906000906001600160a01b038616906370a0823190602401602060405180830381865afa15801561021c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061024091906109aa565b90508084111561024e578091505b6102626001600160a01b03861684846105f8565b826001600160a01b0316856001600160a01b03167f6d043f5c542a67e836c8f8bdf640d0de840c85d79c130dcbda8d42c9c056980c846040516102a791815260200190565b60405180910390a350506102bb6001600255565b505050565b60015433906001600160a01b0316811461032e5760405162461bcd60e51b815260206004820152602960248201527f4f776e61626c6532537465703a2063616c6c6572206973206e6f7420746865206044820152683732bb9037bbb732b960b91b60648201526084016101ca565b61033781610561565b50565b610342610507565b600180546001600160a01b0383166001600160a01b031990911681179091556103736000546001600160a01b031690565b6001600160a01b03167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a350565b6103b3610507565b6103bb61057a565b6103c4816105d1565b600082116104145760405162461bcd60e51b815260206004820152601f60248201527f7769746864726177416d6f756e74206d757374206e6f74206265207a65726f0060448201526064016101ca565b814780821115610422578091505b6000836001600160a01b03168360405160006040518083038185875af1925050503d806000811461046f576040519150601f19603f3d011682016040523d82523d6000602084013e610474565b606091505b50509050806104b35760405162461bcd60e51b815260206004820152600b60248201526a10d85b1b0819985a5b195960aa1b60448201526064016101ca565b836001600160a01b03167f41448dfa44379fc602c636f8939b0b1b598c481af871c76fbdd8bdfcdaf30dfa846040516104ee91815260200190565b60405180910390a25050506105036001600255565b5050565b6000546001600160a01b0316331461015a5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016101ca565b600180546001600160a01b03191690556103378161064a565b60028054036105cb5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016101ca565b60028055565b6001600160a01b038116610337576040516342bcdf7f60e11b815260040160405180910390fd5b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b1790526102bb90849061069a565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60006106ef826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b031661076f9092919063ffffffff16565b905080516000148061071057508080602001905181019061071091906109c3565b6102bb5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016101ca565b606061077e8484600085610786565b949350505050565b6060824710156107e75760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016101ca565b600080866001600160a01b031685876040516108039190610a09565b60006040518083038185875af1925050503d8060008114610840576040519150601f19603f3d011682016040523d82523d6000602084013e610845565b606091505b509150915061085687838387610861565b979650505050505050565b606083156108d05782516000036108c9576001600160a01b0385163b6108c95760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016101ca565b508161077e565b61077e83838151156108e55781518083602001fd5b8060405162461bcd60e51b81526004016101ca9190610a25565b6001600160a01b038116811461033757600080fd5b60008060006060848603121561092957600080fd5b8335610934816108ff565b925060208401359150604084013561094b816108ff565b809150509250925092565b60006020828403121561096857600080fd5b8135610973816108ff565b9392505050565b6000806040838503121561098d57600080fd5b82359150602083013561099f816108ff565b809150509250929050565b6000602082840312156109bc57600080fd5b5051919050565b6000602082840312156109d557600080fd5b8151801515811461097357600080fd5b60005b83811015610a005781810151838201526020016109e8565b50506000910152565b60008251610a1b8184602087016109e5565b9190910192915050565b6020815260008251806020840152610a448160408501602087016109e5565b601f01601f1916919091016040019291505056fea264697066735822122093d87330f42b9bcbf754eefc1d04b5e948eb71f5034a7230cd66aec48234e18264736f6c63430008140033",
198
+ "linkReferences": {},
199
+ "deployedLinkReferences": {}
200
+ }
@@ -0,0 +1,101 @@
1
+ pragma solidity 0.8.20;
2
+
3
+ import { SafeERC20, IERC20 } from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
4
+ import { Ownable2Step } from "@openzeppelin/contracts/access/Ownable2Step.sol";
5
+ import { ReentrancyGuard } from "@openzeppelin/contracts/security/ReentrancyGuard.sol";
6
+
7
+ /**
8
+ * @title VTreasuryV8
9
+ * @author Venus
10
+ * @notice Protocol treasury that holds tokens owned by Venus
11
+ */
12
+ contract VTreasuryV8 is Ownable2Step, ReentrancyGuard {
13
+ using SafeERC20 for IERC20;
14
+
15
+ // WithdrawTreasuryToken Event
16
+ event WithdrawTreasuryToken(address indexed tokenAddress, uint256 withdrawAmount, address indexed withdrawAddress);
17
+
18
+ // WithdrawTreasuryNative Event
19
+ event WithdrawTreasuryNative(uint256 withdrawAmount, address indexed withdrawAddress);
20
+
21
+ /// @notice Thrown if the supplied address is a zero address where it is not allowed
22
+ error ZeroAddressNotAllowed();
23
+
24
+ /**
25
+ * @notice To receive Native when msg.data is not empty
26
+ */
27
+ fallback() external payable {}
28
+
29
+ /**
30
+ * @notice To receive Native when msg.data is empty
31
+ */
32
+ receive() external payable {}
33
+
34
+ /**
35
+ * @notice Withdraw Treasury Tokens, Only owner call it
36
+ * @param tokenAddress The address of treasury token
37
+ * @param withdrawAmount The withdraw amount to owner
38
+ * @param withdrawAddress The withdraw address
39
+ * @custom:error ZeroAddressNotAllowed thrown when token or withdrawAddress is zero.
40
+ */
41
+ function withdrawTreasuryToken(
42
+ address tokenAddress,
43
+ uint256 withdrawAmount,
44
+ address withdrawAddress
45
+ ) external onlyOwner nonReentrant {
46
+ ensureNonzeroAddress(tokenAddress);
47
+ ensureNonzeroAddress(withdrawAddress);
48
+ require(withdrawAmount > 0, "withdrawAmount must not be zero");
49
+
50
+ uint256 actualWithdrawAmount = withdrawAmount;
51
+ // Get Treasury Token Balance
52
+ uint256 treasuryBalance = IERC20(tokenAddress).balanceOf(address(this));
53
+
54
+ // Check Withdraw Amount
55
+ if (withdrawAmount > treasuryBalance) {
56
+ // Update actualWithdrawAmount
57
+ actualWithdrawAmount = treasuryBalance;
58
+ }
59
+
60
+ // Transfer Token to withdrawAddress
61
+ IERC20(tokenAddress).safeTransfer(withdrawAddress, actualWithdrawAmount);
62
+
63
+ emit WithdrawTreasuryToken(tokenAddress, actualWithdrawAmount, withdrawAddress);
64
+ }
65
+
66
+ /**
67
+ * @notice Withdraw Treasury Native, Only owner call it
68
+ * @param withdrawAmount The withdraw amount to owner
69
+ * @param withdrawAddress The withdraw address
70
+ * @custom:error ZeroAddressNotAllowed thrown when withdrawAddress is zero.
71
+ */
72
+ function withdrawTreasuryNative(
73
+ uint256 withdrawAmount,
74
+ address payable withdrawAddress
75
+ ) external payable onlyOwner nonReentrant {
76
+ ensureNonzeroAddress(withdrawAddress);
77
+ require(withdrawAmount > 0, "withdrawAmount must not be zero");
78
+ uint256 actualWithdrawAmount = withdrawAmount;
79
+ // Get Treasury Native Balance
80
+ uint256 nativeBalance = address(this).balance;
81
+
82
+ // Check Withdraw Amount
83
+ if (withdrawAmount > nativeBalance) {
84
+ // Update actualWithdrawAmount
85
+ actualWithdrawAmount = nativeBalance;
86
+ }
87
+ // Transfer the native token to withdrawAddress
88
+ (bool sent, ) = withdrawAddress.call{ value: actualWithdrawAmount }("");
89
+ require(sent, "Call failed");
90
+ emit WithdrawTreasuryNative(actualWithdrawAmount, withdrawAddress);
91
+ }
92
+
93
+ /// @notice Checks if the provided address is nonzero, reverts otherwise
94
+ /// @param address_ Address to check
95
+ /// @custom:error ZeroAddressNotAllowed is thrown if the provided address is a zero address
96
+ function ensureNonzeroAddress(address address_) internal pure {
97
+ if (address_ == address(0)) {
98
+ revert ZeroAddressNotAllowed();
99
+ }
100
+ }
101
+ }
@@ -0,0 +1,36 @@
1
+ import { ethers } from "hardhat";
2
+ import { DeployFunction } from "hardhat-deploy/types";
3
+ import { HardhatRuntimeEnvironment } from "hardhat/types";
4
+
5
+ interface AdminAccounts {
6
+ [key: string]: string;
7
+ }
8
+ const acmAdminAccount: AdminAccounts = {
9
+ sepolia: "0x94fa6078b6b8a26f0b6edffbe6501b22a10470fb", // SEPOLIA MULTISIG
10
+ ethereum: "0x285960C5B22fD66A736C7136967A3eB15e93CC67", // ETHEREUM MULTISIG
11
+ };
12
+
13
+ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
14
+ const { deployments, getNamedAccounts } = hre;
15
+ const { deploy } = deployments;
16
+ const { deployer } = await getNamedAccounts();
17
+ const deployerSigner = await hre.ethers.getSigner(deployer);
18
+
19
+ const treasuryInstance = await deploy("VTreasuryV8", {
20
+ from: deployer,
21
+ args: [],
22
+ log: true,
23
+ autoMine: true,
24
+ });
25
+
26
+ console.log("Transferring owner to venus admin account");
27
+ const adminAccount: string = acmAdminAccount[hre.network.name];
28
+ const VTreasuryV8 = await ethers.getContractAt("VTreasuryV8", treasuryInstance.address);
29
+ const tx = await VTreasuryV8.connect(deployerSigner).transferOwnership(adminAccount);
30
+ tx.wait();
31
+ console.log("Ownership Transffered to: ", await VTreasuryV8.owner());
32
+ };
33
+
34
+ func.tags = ["VTreasuryV8"];
35
+
36
+ export default func;