@venusprotocol/venus-periphery 1.0.0
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/LICENSE +11 -0
- package/README.md +131 -0
- package/artifacts/build-info/3cc16515983b4ebd468ee3d5a8f0ac53.json +1 -0
- package/artifacts/hardhat-deploy/solc_0.8/openzeppelin/access/Ownable.sol/Ownable.dbg.json +4 -0
- package/artifacts/hardhat-deploy/solc_0.8/openzeppelin/access/Ownable.sol/Ownable.json +63 -0
- package/artifacts/hardhat-deploy/solc_0.8/openzeppelin/interfaces/draft-IERC1822.sol/IERC1822Proxiable.dbg.json +4 -0
- package/artifacts/hardhat-deploy/solc_0.8/openzeppelin/interfaces/draft-IERC1822.sol/IERC1822Proxiable.json +24 -0
- package/artifacts/hardhat-deploy/solc_0.8/openzeppelin/proxy/ERC1967/ERC1967Proxy.sol/ERC1967Proxy.dbg.json +4 -0
- package/artifacts/hardhat-deploy/solc_0.8/openzeppelin/proxy/ERC1967/ERC1967Proxy.sol/ERC1967Proxy.json +80 -0
- package/artifacts/hardhat-deploy/solc_0.8/openzeppelin/proxy/ERC1967/ERC1967Upgrade.sol/ERC1967Upgrade.dbg.json +4 -0
- package/artifacts/hardhat-deploy/solc_0.8/openzeppelin/proxy/ERC1967/ERC1967Upgrade.sol/ERC1967Upgrade.json +56 -0
- package/artifacts/hardhat-deploy/solc_0.8/openzeppelin/proxy/Proxy.sol/Proxy.dbg.json +4 -0
- package/artifacts/hardhat-deploy/solc_0.8/openzeppelin/proxy/Proxy.sol/Proxy.json +19 -0
- package/artifacts/hardhat-deploy/solc_0.8/openzeppelin/proxy/beacon/IBeacon.sol/IBeacon.dbg.json +4 -0
- package/artifacts/hardhat-deploy/solc_0.8/openzeppelin/proxy/beacon/IBeacon.sol/IBeacon.json +24 -0
- package/artifacts/hardhat-deploy/solc_0.8/openzeppelin/proxy/transparent/ProxyAdmin.sol/ProxyAdmin.dbg.json +4 -0
- package/artifacts/hardhat-deploy/solc_0.8/openzeppelin/proxy/transparent/ProxyAdmin.sol/ProxyAdmin.json +171 -0
- package/artifacts/hardhat-deploy/solc_0.8/openzeppelin/proxy/transparent/TransparentUpgradeableProxy.sol/TransparentUpgradeableProxy.dbg.json +4 -0
- package/artifacts/hardhat-deploy/solc_0.8/openzeppelin/proxy/transparent/TransparentUpgradeableProxy.sol/TransparentUpgradeableProxy.json +155 -0
- package/artifacts/hardhat-deploy/solc_0.8/openzeppelin/utils/Address.sol/Address.dbg.json +4 -0
- package/artifacts/hardhat-deploy/solc_0.8/openzeppelin/utils/Address.sol/Address.json +10 -0
- package/artifacts/hardhat-deploy/solc_0.8/openzeppelin/utils/Context.sol/Context.dbg.json +4 -0
- package/artifacts/hardhat-deploy/solc_0.8/openzeppelin/utils/Context.sol/Context.json +10 -0
- package/artifacts/hardhat-deploy/solc_0.8/openzeppelin/utils/StorageSlot.sol/StorageSlot.dbg.json +4 -0
- package/artifacts/hardhat-deploy/solc_0.8/openzeppelin/utils/StorageSlot.sol/StorageSlot.json +10 -0
- package/artifacts/hardhat-deploy/solc_0.8/proxy/OptimizedTransparentUpgradeableProxy.sol/OptimizedTransparentUpgradeableProxy.dbg.json +4 -0
- package/artifacts/hardhat-deploy/solc_0.8/proxy/OptimizedTransparentUpgradeableProxy.sol/OptimizedTransparentUpgradeableProxy.json +142 -0
- package/deployments/arbitrumone.json +5 -0
- package/deployments/arbitrumone_addresses.json +5 -0
- package/deployments/arbitrumsepolia.json +5 -0
- package/deployments/arbitrumsepolia_addresses.json +5 -0
- package/deployments/basemainnet.json +5 -0
- package/deployments/basemainnet_addresses.json +5 -0
- package/deployments/basesepolia.json +5 -0
- package/deployments/basesepolia_addresses.json +5 -0
- package/deployments/bscmainnet.json +5 -0
- package/deployments/bscmainnet_addresses.json +5 -0
- package/deployments/bsctestnet.json +5 -0
- package/deployments/bsctestnet_addresses.json +5 -0
- package/deployments/ethereum.json +5 -0
- package/deployments/ethereum_addresses.json +5 -0
- package/deployments/opbnbmainnet.json +5 -0
- package/deployments/opbnbmainnet_addresses.json +5 -0
- package/deployments/opbnbtestnet.json +5 -0
- package/deployments/opbnbtestnet_addresses.json +5 -0
- package/deployments/opmainnet.json +5 -0
- package/deployments/opmainnet_addresses.json +5 -0
- package/deployments/opsepolia.json +5 -0
- package/deployments/opsepolia_addresses.json +5 -0
- package/deployments/sepolia.json +5 -0
- package/deployments/sepolia_addresses.json +5 -0
- package/deployments/unichainmainnet.json +5 -0
- package/deployments/unichainmainnet_addresses.json +5 -0
- package/deployments/unichainsepolia.json +5 -0
- package/deployments/unichainsepolia_addresses.json +5 -0
- package/deployments/zksyncmainnet.json +5 -0
- package/deployments/zksyncmainnet_addresses.json +5 -0
- package/deployments/zksyncsepolia.json +5 -0
- package/deployments/zksyncsepolia_addresses.json +5 -0
- package/dist/hardhat.config.d.ts +15 -0
- package/dist/hardhat.config.js +407 -0
- package/dist/helpers/deploymentConfig.d.ts +112 -0
- package/dist/helpers/deploymentConfig.js +201 -0
- package/dist/helpers/deploymentUtils.d.ts +3 -0
- package/dist/helpers/deploymentUtils.js +21 -0
- package/dist/helpers/utils.d.ts +3 -0
- package/dist/helpers/utils.js +28 -0
- package/dist/type-extensions.d.ts +6 -0
- package/dist/type-extensions.js +3 -0
- package/dist/typechain/factories/ERC1967Proxy__factory.d.ts +45 -0
- package/dist/typechain/factories/ERC1967Proxy__factory.js +110 -0
- package/dist/typechain/factories/ERC1967Upgrade__factory.d.ts +18 -0
- package/dist/typechain/factories/ERC1967Upgrade__factory.js +64 -0
- package/dist/typechain/factories/IBeacon__factory.d.ts +18 -0
- package/dist/typechain/factories/IBeacon__factory.js +32 -0
- package/dist/typechain/factories/IERC1822Proxiable__factory.d.ts +18 -0
- package/dist/typechain/factories/IERC1822Proxiable__factory.js +32 -0
- package/dist/typechain/factories/OptimizedTransparentUpgradeableProxy__factory.d.ts +70 -0
- package/dist/typechain/factories/OptimizedTransparentUpgradeableProxy__factory.js +172 -0
- package/dist/typechain/factories/Ownable__factory.d.ts +42 -0
- package/dist/typechain/factories/Ownable__factory.js +71 -0
- package/dist/typechain/factories/ProxyAdmin__factory.d.ts +56 -0
- package/dist/typechain/factories/ProxyAdmin__factory.js +201 -0
- package/dist/typechain/factories/Proxy__factory.d.ts +11 -0
- package/dist/typechain/factories/Proxy__factory.js +27 -0
- package/dist/typechain/factories/TransparentUpgradeableProxy__factory.d.ts +70 -0
- package/dist/typechain/factories/TransparentUpgradeableProxy__factory.js +185 -0
- package/dist/typechain/index.d.ts +18 -0
- package/dist/typechain/index.js +21 -0
- package/package.json +128 -0
- package/typechain/ERC1967Proxy.d.ts +126 -0
- package/typechain/ERC1967Upgrade.d.ts +126 -0
- package/typechain/IBeacon.d.ts +101 -0
- package/typechain/IERC1822Proxiable.d.ts +101 -0
- package/typechain/OptimizedTransparentUpgradeableProxy.d.ts +248 -0
- package/typechain/Ownable.d.ts +181 -0
- package/typechain/Proxy.d.ts +78 -0
- package/typechain/ProxyAdmin.d.ts +357 -0
- package/typechain/TransparentUpgradeableProxy.d.ts +275 -0
- package/typechain/common.d.ts +35 -0
- package/typechain/factories/ERC1967Proxy__factory.ts +137 -0
- package/typechain/factories/ERC1967Upgrade__factory.ts +71 -0
- package/typechain/factories/IBeacon__factory.ts +36 -0
- package/typechain/factories/IERC1822Proxiable__factory.ts +39 -0
- package/typechain/factories/OptimizedTransparentUpgradeableProxy__factory.ts +213 -0
- package/typechain/factories/Ownable__factory.ts +75 -0
- package/typechain/factories/ProxyAdmin__factory.ts +215 -0
- package/typechain/factories/Proxy__factory.ts +28 -0
- package/typechain/factories/TransparentUpgradeableProxy__factory.ts +222 -0
- package/typechain/index.ts +22 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
Copyright 2022 Venus Protocol.
|
|
2
|
+
|
|
3
|
+
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
|
4
|
+
|
|
5
|
+
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
|
6
|
+
|
|
7
|
+
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
|
8
|
+
|
|
9
|
+
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
|
10
|
+
|
|
11
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
package/README.md
ADDED
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
# Overview
|
|
2
|
+
|
|
3
|
+
Venus Periphery is an extension of the Venus Protocol ecosystem that contains auxiliary smart contracts used for advanced interactions with the core protocol. These contracts enhance the protocol’s usability, composability, and integration with external systems.
|
|
4
|
+
|
|
5
|
+
# Contracts
|
|
6
|
+
|
|
7
|
+
The first major addition in this repository is the CollateralSwapper, a flexible module that enables users to swap their supplied collateral from one market to another directly within the Venus ecosystem.
|
|
8
|
+
|
|
9
|
+
# Development
|
|
10
|
+
|
|
11
|
+
## Prerequisites
|
|
12
|
+
|
|
13
|
+
- NodeJS - 20.x
|
|
14
|
+
- Solc - v0.8.25 (https://github.com/ethereum/solidity/releases/tag/v0.8.25)
|
|
15
|
+
|
|
16
|
+
## Installing
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
|
|
20
|
+
yarn install
|
|
21
|
+
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Run Tests
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
|
|
28
|
+
yarn test
|
|
29
|
+
|
|
30
|
+
npx hardhat coverage
|
|
31
|
+
|
|
32
|
+
REPORT_GAS=true npx hardhat test
|
|
33
|
+
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
- To run fork tests add FORK=true, FORKED_NETWORK and one ARCHIVE_NODE var in the .env file.
|
|
37
|
+
|
|
38
|
+
## Deployment
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
|
|
42
|
+
npx hardhat deploy
|
|
43
|
+
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
- This command will execute all the deployment scripts in `./deploy` directory - It will skip only deployment scripts which implement a `skip` condition - Here is example of a skip condition: - Skipping deployment script on `bsctestnet` network `func.skip = async (hre: HardhatRuntimeEnvironment) => hre.network.name !== "bsctestnet";`
|
|
47
|
+
- The default network will be `hardhat`
|
|
48
|
+
- Deployment to another network: - Make sure the desired network is configured in `hardhat.config.ts` - Add `MNEMONIC` variable in `.env` file - Execute deploy command by adding `--network <network_name>` in the deploy command above - E.g. `npx hardhat deploy --network bsctestnet`
|
|
49
|
+
- Execution of single or custom set of scripts is possible, if:
|
|
50
|
+
- In the deployment scripts you have added `tags` for example: - `func.tags = ["MockTokens"];`
|
|
51
|
+
- Once this is done, adding `--tags "<tag_name>,<tag_name>..."` to the deployment command will execute only the scripts containing the tags.
|
|
52
|
+
|
|
53
|
+
### Dry Run / Forked Deployments
|
|
54
|
+
|
|
55
|
+
To simulate what contracts would be deployed on a given network the deployment scripts support running on a forked network. To run the deployment scripts on a forked network the `HARDHAT_FORK_NETWORK` env variable needs to be set.
|
|
56
|
+
|
|
57
|
+
For example
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
HARDHAT_FORK_NETWORK=ethereum npx hardhat deploy
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### Deployed Contracts
|
|
64
|
+
|
|
65
|
+
Deployed contract abis and addresses are exported in the `deployments` directory. To create a summary export of all contracts deployed to a network run
|
|
66
|
+
|
|
67
|
+
```
|
|
68
|
+
$ yarn hardhat export --network <network-name> --export ./deployments/<network-name>.json
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## Source Code Verification
|
|
72
|
+
|
|
73
|
+
In order to verify the source code of already deployed contracts, run:
|
|
74
|
+
`npx hardhat etherscan-verify --network <network_name>`
|
|
75
|
+
|
|
76
|
+
Make sure you have added `ETHERSCAN_API_KEY` in `.env` file.
|
|
77
|
+
|
|
78
|
+
## Hardhat Commands
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
|
|
82
|
+
npx hardhat accounts
|
|
83
|
+
|
|
84
|
+
npx hardhat compile
|
|
85
|
+
|
|
86
|
+
npx hardhat clean
|
|
87
|
+
|
|
88
|
+
npx hardhat test
|
|
89
|
+
|
|
90
|
+
npx hardhat node
|
|
91
|
+
|
|
92
|
+
npx hardhat help
|
|
93
|
+
|
|
94
|
+
REPORT_GAS=true npx hardhat test
|
|
95
|
+
|
|
96
|
+
npx hardhat coverage
|
|
97
|
+
|
|
98
|
+
TS_NODE_FILES=true npx ts-node scripts/deploy.ts
|
|
99
|
+
|
|
100
|
+
npx eslint '**/*.{js,ts}'
|
|
101
|
+
|
|
102
|
+
npx eslint '**/*.{js,ts}' --fix
|
|
103
|
+
|
|
104
|
+
npx prettier '**/*.{json,sol,md}' --check
|
|
105
|
+
|
|
106
|
+
npx prettier '**/*.{json,sol,md}' --write
|
|
107
|
+
|
|
108
|
+
npx solhint 'contracts/**/*.sol'
|
|
109
|
+
|
|
110
|
+
npx solhint 'contracts/**/*.sol' --fix
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
MNEMONIC="<>" BSC_API_KEY="<>" npx hardhat run ./script/hardhat/deploy.ts --network testnet
|
|
115
|
+
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
## Documentation
|
|
119
|
+
|
|
120
|
+
Documentation is autogenerated using [solidity-docgen](https://github.com/OpenZeppelin/solidity-docgen).
|
|
121
|
+
|
|
122
|
+
They can be generated by running `yarn docgen`
|
|
123
|
+
|
|
124
|
+
# Links
|
|
125
|
+
|
|
126
|
+
- Website : https://venus.io
|
|
127
|
+
- Twitter : https://twitter.com/venusprotocol
|
|
128
|
+
- Telegram : https://t.me/venusprotocol
|
|
129
|
+
- Discord : https://discord.com/invite/pTQ9EBHYtF
|
|
130
|
+
- Github: https://github.com/VenusProtocol
|
|
131
|
+
- Youtube: https://www.youtube.com/@venusprotocolofficial
|