Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
283 commits
Select commit Hold shift + click to select a range
3bf101d
fix: optimise var
web3rover Jan 17, 2025
9cf1da7
fix: fixed comments
web3rover Jan 17, 2025
f8500da
fix: fixed netspec comment
web3rover Jan 20, 2025
27267d8
fixup: pr comment
Debugger022 Jan 20, 2025
1b9b848
Merge pull request #245 from VenusProtocol/feat/capped-oracles
chechu Jan 24, 2025
eccc4b0
fix: wip - fix capping exchange rate
web3rover Jan 30, 2025
e22fe87
fix: implemented capped oracle for SFrxETHOracle
web3rover Jan 30, 2025
6a9616b
fix: fixed tests
web3rover Jan 30, 2025
bdb8550
fix: optimisation
web3rover Jan 30, 2025
518a8a3
fix: revert sfrxETH oracle
web3rover Jan 30, 2025
860b31b
fix: removed CappedOracle abstract contract
web3rover Feb 3, 2025
c39ce2c
fix: added check for invalid growth rate
web3rover Feb 3, 2025
5c93d9f
fix: use timelock as owner instead of guardian
web3rover Feb 11, 2025
ffd0493
feat: deployed contracts
web3rover Feb 13, 2025
c90a8c6
feat: redeployed contracts
web3rover Feb 14, 2025
2183ff5
feat: deployed redstone oracle
web3rover Feb 14, 2025
4e8f7e4
chore: relock
kkirka Feb 19, 2025
fb98116
chore: update yarn.lock file
Debugger022 Feb 19, 2025
d360542
feat: add script to deploy wstETH one jump oracle
Debugger022 Feb 19, 2025
265a6ee
feat: deployment files for wstETH one-jump oracle on zksync sepolia
Debugger022 Feb 19, 2025
3161bc7
feat: deployment files for wstETH one-jump oracle on zksync mainnet
Debugger022 Feb 19, 2025
6ec9ea8
feat: updating deployment files
Debugger022 Feb 19, 2025
3df4b08
feat: deployment files for oneJump oracle on base sepolia for wstETH
Debugger022 Feb 19, 2025
e1967d2
feat: deployment files for oneJump oracle on base mainnet for wstETH
Debugger022 Feb 19, 2025
fe0b114
feat: updating deployment files
Debugger022 Feb 19, 2025
1209171
Merge branch 'develop' into feat/berachain-deployment
chechu Feb 20, 2025
4a3e8c7
chore: add missing configuration for bera bartio
chechu Feb 20, 2025
385dc05
feat: updating deployment files
chechu Feb 20, 2025
2c38558
feat: add a custom ZkETH oracle
kkirka Feb 19, 2025
800f4df
feat: use governance timelocks for zksync
kkirka Feb 19, 2025
4780e91
feat: deploy ZkETH oracle for zksync mainnet and sepolia
kkirka Feb 19, 2025
5667a9f
feat: updating deployment files
kkirka Feb 20, 2025
6254078
fix: use cached price as exchange rate not final price
web3rover Feb 20, 2025
a6b156e
Merge pull request #272 from VenusProtocol/main
kkirka Feb 21, 2025
53a6ef9
Merge branch 'develop' into feat/VEN-3074
Debugger022 Feb 24, 2025
4dc0ab2
fix: updated var name
web3rover Feb 28, 2025
bfc7208
Merge pull request #249 from VenusProtocol/fix/capped-oracle
web3rover Feb 28, 2025
80cd2c0
feat: remove hardhat-gas-reporter, not compatible with smock 2.4.0
chechu Jan 14, 2025
c4065a1
Merge branch 'develop' into feat/transient-storage
chechu Feb 28, 2025
c5bebca
fix: added test for exchange rate cache and provide initial exchange …
web3rover Mar 3, 2025
035ec6e
fix: merge conflict
web3rover Mar 3, 2025
90f9a80
fix: fixed tests
web3rover Mar 3, 2025
21d8dd0
fix: optimisations
web3rover Mar 3, 2025
1123884
fix: removed constructor
web3rover Mar 3, 2025
a799480
Merge branch 'feat/transient-storage' of github.com:VenusProtocol/ora…
web3rover Mar 3, 2025
36a2b7e
fix: fixed lint
web3rover Mar 3, 2025
09739d2
fix: removed gasReporter
web3rover Mar 3, 2025
17be0ef
fix: remove gasreporter
web3rover Mar 3, 2025
d01408b
Merge branch 'develop' into feat/berachain-deployment
chechu Mar 4, 2025
420a6d3
docs: add audit report for ZkETHOracle
chechu Mar 5, 2025
b682c44
fix: ERC-01
web3rover Mar 5, 2025
0f552cc
fix: CTO-02
web3rover Mar 5, 2025
111b758
fix: CTO-03
web3rover Mar 5, 2025
d0b5c9a
fix: CTO-04
web3rover Mar 5, 2025
4f6d975
fix: VPB-04
web3rover Mar 5, 2025
c35811e
fix: VPB-03
web3rover Mar 5, 2025
73e0023
fix: [VPB-02] cache slot using erc-7201
Debugger022 Mar 5, 2025
bf58e9a
Merge pull request #270 from VenusProtocol/feat/VEN-3074
Debugger022 Mar 6, 2025
c8c74e9
chore(release): 2.13.0-dev.1 [skip ci]
toolsvenus Mar 6, 2025
6f77ab6
fix: CTO-07
chechu Mar 6, 2025
96f5284
fix: fixed ankrBNB deployment
web3rover Mar 7, 2025
3069ded
fix: update bnb oracles
web3rover Mar 7, 2025
e417976
fix: VPB-04
chechu Mar 7, 2025
caf262d
fix: VPB-02
chechu Mar 7, 2025
21f6448
fix: CTO-05
chechu Mar 7, 2025
7b2dcab
fix: CTO-01
chechu Mar 7, 2025
500b043
Merge branch 'develop' into feat/zksync-zketh
kkirka Mar 10, 2025
3b5aec6
chore: relock
kkirka Mar 10, 2025
91a66ab
fix: uupdated erc4626 oracles
web3rover Mar 10, 2025
a8f3690
fix: updated yearn markets
web3rover Mar 10, 2025
798d2f0
Merge pull request #269 from VenusProtocol/feat/zksync-zketh
kkirka Mar 10, 2025
5ebb718
chore(release): 2.13.0-dev.2 [skip ci]
toolsvenus Mar 10, 2025
e700465
fix: fixed one jump oracle scripts
web3rover Mar 10, 2025
26982e9
fix: fixed sfrax oracle
web3rover Mar 10, 2025
8a18ad2
fix: fixed pendle oracles
web3rover Mar 10, 2025
599f2b6
Merge branch 'develop' into feat/transient-storage
chechu Mar 10, 2025
21341d4
feat: allow caps on the ZkETHOracle
chechu Mar 10, 2025
2f9600f
refactor: remove unused pyth oracle files
Debugger022 Mar 11, 2025
b392bc0
fix: change function visibility
web3rover Mar 11, 2025
da2841b
Merge branch 'feat/transient-storage' of github.com:VenusProtocol/ora…
web3rover Mar 11, 2025
1a14221
fix: fixed compile
web3rover Mar 11, 2025
b88b277
feat: added asBNB oracle
web3rover Mar 11, 2025
43c687f
feat: deployed pt oracle for clisBNB
web3rover Mar 12, 2025
b0ef84a
fix: fixed lint
web3rover Mar 12, 2025
08e88d2
fix: resolved comments
web3rover Mar 13, 2025
225f93b
fix: redeployed oracle
web3rover Mar 13, 2025
44e284a
feat: deployed oracle on mainnet
web3rover Mar 14, 2025
80f506d
Merge branch 'develop' into feat/ven-3132
chechu Mar 14, 2025
017ba49
feat: updating deployment files
chechu Mar 14, 2025
735e4cf
Merge pull request #276 from VenusProtocol/feat/ven-3132
chechu Mar 18, 2025
a829098
chore(release): 2.13.0-dev.3 [skip ci]
toolsvenus Mar 18, 2025
68e2e0d
fix: BNB-01, BNB-02
GitGuru7 Mar 19, 2025
ac09ba4
Merge branch 'develop' into feat/ven3131
GitGuru7 Mar 19, 2025
f11bea8
feat: deploy mock asBnb and asBnb oracle
GitGuru7 Mar 19, 2025
ab27d99
feat: updating deployment files
GitGuru7 Mar 19, 2025
d0500e9
fix: lint issues
GitGuru7 Mar 19, 2025
a8025bc
feat: deploy mainnet asBNBOracle
GitGuru7 Mar 20, 2025
686ed4c
feat: updating deployment files
GitGuru7 Mar 20, 2025
eb52f2c
fix: lint prettier issues
GitGuru7 Mar 20, 2025
d2da769
fix: BNB-02
chechu Mar 20, 2025
e33dd9b
docs: add AsBNBOracle audit report by Certik
chechu Mar 20, 2025
6a0ec86
Merge pull request #275 from VenusProtocol/feat/ven3131
GitGuru7 Mar 21, 2025
4860827
chore(release): 2.13.0-dev.4 [skip ci]
toolsvenus Mar 21, 2025
bc23339
feat: wip - snapshotGap
web3rover Apr 1, 2025
cfb4053
fix: fixed tests
web3rover Apr 1, 2025
b5d7106
feat: added setter funcs
web3rover Apr 1, 2025
58dbffb
fix: remove unused param
web3rover Apr 1, 2025
d17516b
fix: remove unchecked
web3rover Apr 1, 2025
5b6ac40
fix: fixed test
web3rover Apr 1, 2025
9bd6319
fix: update underlying price
web3rover Apr 1, 2025
12e4e17
fix: fix import
web3rover Apr 4, 2025
7f065dd
fix: fixed comments
web3rover Apr 4, 2025
9283092
fix: check the right value in the setter and emitting the right event
chechu Apr 4, 2025
c49f54f
Merge branch 'develop' into feat/transient-storage
chechu Apr 4, 2025
919e8cf
feat: add support on AsBNBOracle to be capped
chechu Apr 4, 2025
f9cdee5
chore: replace the gh action not valid anymore
chechu Apr 8, 2025
4c59515
Merge pull request #277 from VenusProtocol/feat/VEN-3175
chechu Apr 9, 2025
a082643
feat: add oracles for Ethena assets on BNB testnet
chechu Apr 12, 2025
6678130
feat: updating deployment files
chechu Apr 12, 2025
65c06ef
fix: make caching optional
web3rover Apr 14, 2025
d2fe227
feat: add oracles for Ethena assets on BNB mainnet
chechu Apr 13, 2025
aa4544e
feat: updating deployment files
chechu Apr 13, 2025
d125ff6
Merge pull request #278 from VenusProtocol/feat/VEN-3181
chechu Apr 15, 2025
dc87c24
chore(release): 2.13.0-dev.5 [skip ci]
toolsvenus Apr 15, 2025
8c2e6d3
Merge branch 'feat/transient-storage' of github.com:VenusProtocol/ora…
web3rover Apr 15, 2025
8f0d719
fix: improved tests coverage
web3rover Apr 23, 2025
2351c87
fix: test coverage for correlated token oracle
web3rover Apr 24, 2025
4da77bd
fix: increase test coverage resilient oracle
web3rover Apr 24, 2025
6c3e10a
fix: merge conflict
web3rover Apr 25, 2025
22bc46e
feat: deployed on bepolia
web3rover Apr 25, 2025
599c45a
fix: revert config
web3rover Apr 25, 2025
243cf65
feat: updating deployment files
web3rover Apr 25, 2025
105d3c5
fix: VCP-02
web3rover Apr 29, 2025
0a42dac
fix: VCP-03
web3rover Apr 29, 2025
666a231
fix: VCP-05
web3rover Apr 29, 2025
c0e1ac7
fix: VPB-03
web3rover Apr 29, 2025
edb889b
fix: VPB-04
web3rover Apr 29, 2025
0395e81
fix: VCP-01
web3rover Apr 29, 2025
995b438
fix: vcp-03
chechu Apr 29, 2025
dd45f16
fix: vcp-05
chechu Apr 29, 2025
a0bcec7
chore: unify sholhint with the rest of the projects
chechu Apr 29, 2025
11bdff7
fix: removed bartio deployments
web3rover Apr 30, 2025
5012be7
fix: use base imports to get acm addr
web3rover Apr 30, 2025
78e47b8
Merge branch 'feat/transient-storage' into fix/deployment-scripts
web3rover May 1, 2025
5f89d59
fix: wip - update params
web3rover May 1, 2025
4421d5b
Merge branch 'develop' into feat/transient-storage
web3rover May 1, 2025
c82fe9c
Merge branch 'feat/transient-storage' into fix/deployment-scripts
web3rover May 1, 2025
322a3f8
fix: updated scripts
web3rover May 1, 2025
0484195
fix: reset deployments
web3rover May 1, 2025
bc3fb86
fix: removed deployments
web3rover May 1, 2025
1226eff
Revert "fix: removed deployments"
web3rover May 1, 2025
1713afe
Revert "fix: reset deployments"
web3rover May 1, 2025
0c29351
Merge pull request #274 from VenusProtocol/fix/deployment-scripts
web3rover May 1, 2025
d6497b9
docs: add audit reports for capped and cached oracles
chechu May 2, 2025
30f9e18
feat: deployed eBTC oracle
web3rover May 2, 2025
389f580
feat: updating deployment files
web3rover May 2, 2025
c1deea3
Revert "feat: deployed eBTC oracle"
web3rover May 2, 2025
683b05d
fix: deploy implementations for opbnbtestnet
web3rover May 2, 2025
b6a13cd
fix: remove chainlink oracle
web3rover May 2, 2025
5100f54
fix: merge conflict
web3rover May 2, 2025
8b61fe7
fix: fixed lint
web3rover May 2, 2025
1a5af49
feat: deployed on opbnbmainnet
web3rover May 2, 2025
515436d
fix: use implementations
web3rover May 2, 2025
5aecb69
fix: redeployed resilient oracle implementation
web3rover May 5, 2025
fbda9e0
fix: deployments - wip
web3rover May 5, 2025
0599347
fix: deployed on op and unichain
web3rover May 5, 2025
dbf0627
fix: fixed lint
web3rover May 5, 2025
a93dd01
fix: deployed contracts
web3rover May 6, 2025
7d39501
fix: deployed main oracle implementations
web3rover May 8, 2025
147fcda
fix: deployed main oracles on mainnet
web3rover May 8, 2025
ccd61e2
fix: deployed arbitrum oracles
web3rover May 8, 2025
164ea41
fix: deployed zksync sepolia oracles
web3rover May 8, 2025
e49d3de
Merge pull request #263 from VenusProtocol/feat/berachain-deployment
web3rover May 9, 2025
3f90687
chore(release): 2.13.0-dev.6 [skip ci]
toolsvenus May 9, 2025
87e844b
fix: deployed oracles on zksync mainnet
web3rover May 9, 2025
e602484
fix: wip - sepolia deployment
web3rover May 12, 2025
9865828
fix: wip - sepolia deployment
web3rover May 12, 2025
1c933c2
fix: wip - sepolia deployment
web3rover May 12, 2025
74a8abf
fix: sfrax oracle
web3rover May 12, 2025
09f63c9
fix: deployed pendle oracle
web3rover May 13, 2025
aa13f26
fix: rsETH and ezETH
web3rover May 13, 2025
ca03708
fix: deployed ezETH oracle
web3rover May 13, 2025
317aae6
fix: fixed lint
web3rover May 13, 2025
7cc3edc
Merge pull request #279 from VenusProtocol/feat/testnet-deployment
web3rover May 13, 2025
a61413b
fix: deployed generic oracles on ethereum
web3rover May 14, 2025
a83f03e
fix: deployed weeth oracle
web3rover May 14, 2025
d63058e
fix: deployed weETHs oracle
web3rover May 14, 2025
d9b1d09
Merge branch 'develop' into feat/transient-storage
chechu May 14, 2025
16dd1b2
feat: updating deployment files
chechu May 14, 2025
f46462a
fix: deployed sfrax oracle
web3rover May 15, 2025
6ef5ac7
fix: deployed pendle oracle
web3rover May 15, 2025
7367b45
fix: deployed rsETH oracle
web3rover May 15, 2025
4dd16cf
fix: ezETH oracle
web3rover May 15, 2025
a6ac47b
fix: deployed erc4626 oracles
web3rover May 15, 2025
6e8dcb9
fix: yearn oracles
web3rover May 15, 2025
fc01d73
fix: fixed lint
web3rover May 15, 2025
fad4b72
feat: deployment script for weETH and wstETH on unichain
Debugger022 May 16, 2025
9d2cd37
feat: deployed OneJump oracle for weETH and wstETH on unichain
Debugger022 May 16, 2025
c64ce1d
feat: deployed OneJump oracle for weETH and wstETH on unichain sepolia
Debugger022 May 16, 2025
cd92092
Merge pull request #280 from VenusProtocol/feat/capped-oracle-deploym…
chechu May 16, 2025
60207af
feat: updating deployment files
chechu May 16, 2025
567bf9f
Merge branch 'develop' into feat/VEN-3230
Debugger022 May 19, 2025
325d1c9
feat: updating deployment files
Debugger022 May 19, 2025
462b3ee
feat: redeploy weETH and wstETH oracles on unichain sepolia
Debugger022 May 20, 2025
4e0767f
feat: redeploy weETH and wstETH oracles on unichain mainnet
Debugger022 May 20, 2025
5153800
feat: updating deployment files
Debugger022 May 20, 2025
4b336c4
feat: updating deployment files
Debugger022 May 20, 2025
b0f13f8
feat: deployment script for wstETH OneJumpOracle
Debugger022 May 20, 2025
82d8cd9
fix: removed proxy files
web3rover May 20, 2025
7e34967
fix: removed addresses
web3rover May 20, 2025
b3e93ae
chore: script to verify zksync contracts
chechu May 20, 2025
54cc458
style: fix linter
chechu May 20, 2025
d67ef0e
feat: consolidate script in one for weETH and wstETH
Debugger022 May 21, 2025
c79d2ac
refactor: deployment script
Debugger022 May 21, 2025
bace6d6
fix: removed oracles
web3rover May 22, 2025
e08d0f2
fix: deployed missing oracles
web3rover May 22, 2025
fe004d0
Merge branch 'feat/transient-storage' into feat/VEN-3230
Debugger022 May 23, 2025
1a117be
Merge pull request #283 from VenusProtocol/feat/VEN-3230
Debugger022 May 23, 2025
2670669
Merge pull request #281 from VenusProtocol/feat/capped-oracle-deploym…
web3rover May 26, 2025
dd5e561
fix: redeployed capped oracles with params
web3rover May 28, 2025
df73342
fix: fix deploy file
web3rover May 28, 2025
9893389
fix: redeployed yvUSDS
web3rover May 29, 2025
bbf64ce
fix: deployed oracles with disabled capping
web3rover May 29, 2025
a9046bb
feat: added config and script
web3rover May 30, 2025
b872b75
feat: deployed oracle
web3rover May 30, 2025
f704821
feat: updating deployment files
web3rover May 30, 2025
1f90111
feat: updating deployment files
web3rover May 30, 2025
51d4fa8
Merge pull request #282 from VenusProtocol/feat/capped-oracle-deploym…
web3rover May 30, 2025
0e23064
feat: updating deployment files
web3rover May 30, 2025
a8b8646
Merge pull request #284 from VenusProtocol/feat/ven-3246
web3rover Jun 3, 2025
3cf07f5
chore(release): 2.13.0-dev.7 [skip ci]
toolsvenus Jun 3, 2025
297066b
Merge branch 'develop' into feat/transient-storage
chechu Jun 11, 2025
9359b10
feat: add deployments of oracles implementation in bsctestnet
Debugger022 Jun 11, 2025
68187b7
feat: add deployments of oracles implementation in bscmainnet
Debugger022 Jun 11, 2025
12d40ee
feat: deployments for ankrBNB, BNBx and slisBNB on bsctestnet
Debugger022 Jun 12, 2025
f59ddac
feat: add deployments of PT-sUSDE-26JUN2025, sUSDe and xSolvBTC in bs…
Debugger022 Jun 12, 2025
911836e
feat: add deployments of AsBNBOracle in bsctestnet
Debugger022 Jun 12, 2025
62a23f5
feat: add deployments of ankrBNB, BNBx and slisBNB in bscmainnet
Debugger022 Jun 12, 2025
f22a12f
feat: add deployments of PT-sUSDe-26JUN2025 in bscmainnet
Debugger022 Jun 12, 2025
bf0c76e
feat: add deployments of AsBNB and xSolvBTC in bscmainnet
Debugger022 Jun 12, 2025
729bd91
fix: minor fix
Debugger022 Jun 13, 2025
aee43d9
Merge branch 'feat/transient-storage' into feat/VEN-3253
Debugger022 Jun 13, 2025
c1c9fa5
Merge pull request #287 from VenusProtocol/feat/VEN-3253
Debugger022 Jun 21, 2025
39831aa
feat: updating deployment files
Debugger022 Jun 21, 2025
65969ce
fix: fixed lint
web3rover Jun 23, 2025
f75104d
fix: fixed lint
web3rover Jun 23, 2025
819bb9b
fix: remove xSolvBTCOneJumpRedStoneOracle implementation and proxy fr…
Debugger022 Jun 25, 2025
679f384
feat: updating deployment files
Debugger022 Jun 25, 2025
a424993
Merge pull request #239 from VenusProtocol/feat/transient-storage
Debugger022 Jun 27, 2025
024bd52
chore(release): 2.13.0-dev.8 [skip ci]
toolsvenus Jun 27, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 1 addition & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ ARCHIVE_NODE_ethereum=https://eth-mainnet.nodereal.io/v1/<YOUR_KEY_HERE>
#ARCHIVE_NODE_basemainnet=https://open-platform.nodereal.io/<YOUR_KEY_HERE>/base
#ARCHIVE_NODE_unichainsepolia=https://unichain-sepolia.g.alchemy.com/v2/<YOUR_KEY_HERE>
#ARCHIVE_NODE_unichainmainnet=https://unichain-mainnet.g.alchemy.com/v2/<YOUR_KEY_HERE>
#ARCHIVE_NODE_berachainbepolia=https://berachain-bepolia.g.alchemy.com/v2/<YOUR_KEY_HERE>

ETHERSCAN_API_KEY=
REPORT_GAS=
5 changes: 2 additions & 3 deletions .github/workflows/cd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,12 @@ jobs:
fetch-depth: 0
persist-credentials: false

- uses: actions/setup-node@v2
- uses: actions/setup-node@v3
with:
cache: "yarn"

- name: Install dependencies
# Hack to get around failing "ethereumjs-abi The remote archive doesn't match the expected checksum" error
run: YARN_CHECKSUM_BEHAVIOR=update yarn
run: yarn

- name: Build
run: yarn build
Expand Down
22 changes: 9 additions & 13 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,13 @@ jobs:
uses: actions/checkout@v2

- name: Setup Node.js environment
uses: actions/setup-node@v2
uses: actions/setup-node@v3
with:
node-version: 18
cache: "yarn"

- name: Install dependencies
# Hack to get around failing "ethereumjs-abi The remote archive doesn't match the expected checksum" error
run: YARN_CHECKSUM_BEHAVIOR=update yarn
run: yarn

- name: Compile contract types
run: yarn hardhat compile
Expand All @@ -43,14 +42,13 @@ jobs:
uses: actions/checkout@v2

- name: Setup Node.js environment
uses: actions/setup-node@v2
uses: actions/setup-node@v3
with:
node-version: 18
cache: "yarn"

- name: Install dependencies
# Hack to get around failing "ethereumjs-abi The remote archive doesn't match the expected checksum" error
run: YARN_CHECKSUM_BEHAVIOR=update yarn
run: yarn

- name: Run hardhat tests coverage
run: yarn hardhat:coverage
Expand Down Expand Up @@ -83,14 +81,13 @@ jobs:
uses: actions/checkout@v2

- name: Setup Node.js environment
uses: actions/setup-node@v2
uses: actions/setup-node@v3
with:
node-version: 18
cache: "yarn"

- name: Install dependencies
# Hack to get around failing "ethereumjs-abi The remote archive doesn't match the expected checksum" error
run: YARN_CHECKSUM_BEHAVIOR=update yarn
run: yarn

- name: Verify deployments work
run: yarn hardhat deploy
Expand All @@ -108,18 +105,17 @@ jobs:
token: ${{ secrets.VENUS_TOOLS_TOKEN }}

- name: Setup Node.js environment
uses: actions/setup-node@v2
uses: actions/setup-node@v3
with:
node-version: 18
cache: "yarn"

- name: Install dependencies
# Hack to get around failing "ethereumjs-abi The remote archive doesn't match the expected checksum" error
run: YARN_CHECKSUM_BEHAVIOR=update yarn
run: yarn

- name: Export deployments
run: |
for NETWORK in bsctestnet bscmainnet ethereum sepolia opbnbtestnet opbnbmainnet arbitrumsepolia arbitrumone opsepolia opmainnet basesepolia basemainnet unichainsepolia unichainmainnet; do
for NETWORK in bsctestnet bscmainnet ethereum sepolia opbnbtestnet opbnbmainnet arbitrumsepolia arbitrumone opsepolia opmainnet basesepolia basemainnet unichainsepolia unichainmainnet berachainbepolia; do
EXPORT=true yarn hardhat export --network ${NETWORK} --export ./deployments/${NETWORK}.json
jq -M '{name, chainId, addresses: .contracts | map_values(.address)}' ./deployments/${NETWORK}.json > ./deployments/${NETWORK}_addresses.json
done
Expand Down
2 changes: 1 addition & 1 deletion .solhint.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"const-name-snakecase": "warn",
"constructor-syntax": "error",
"func-visibility": ["error", { "ignoreConstructors": true }],
"max-line-length": ["error", 120],
"max-line-length": ["error", 175],
"not-rely-on-time": "warn",
"reason-string": ["warn", { "maxLength": 64 }],
"ordering": "error"
Expand Down
276 changes: 276 additions & 0 deletions CHANGELOG.md

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Resilient Price Feeds is a set of smart contracts that uses multiple oracles and

DeFi protocols are vulnerable to incorrectly reported prices which can lead to lost money. A price oracle can be manipulated,fail, or suffer other attacks depending on the type of price oracle. It creates a single point of failure, opening attack vectors to the protocol if not mitigated.

The Resilient Price Feeds uses multiple oracle sources and fallback mechanisms to return accurate prices and protect from oracle failures. Currently, it includes integrations with Chainlink, RedStone, Pyth and Binance Oracle oracles.
The Resilient Price Feeds uses multiple oracle sources and fallback mechanisms to return accurate prices and protect from oracle failures. Currently, it includes integrations with Chainlink, RedStone and Binance Oracle oracles.

## Details

Expand All @@ -21,7 +21,7 @@ anchorRatio = anchorPrice/reporterPrice
isValid = anchorRatio <= upperBoundAnchorRatio && anchorRatio >= lowerBoundAnchorRatio
```

The default configuration uses Chainlink as the main oracle, RedStone or Pyth oracle as the pivot oracle depending on which supports the given market and Binance oracle as the fallback oracle. For some markets we may use RedStone or Pyth as the main oracle if the token price is not supported by Chainlink or Binance oracles.
The default configuration uses Chainlink as the main oracle, RedStone oracle as the pivot oracle depending on which supports the given market and Binance oracle as the fallback oracle. For some markets we may use RedStone as the main oracle if the token price is not supported by Chainlink or Binance oracles.

When fetching an oracle price, for the price to be valid it must be positive and not stagnant. If the price is invalid or stagnant it is ignored and a fallback oracle is used.

Expand Down
Binary file added audits/124_oracles_certik_20250225.pdf
Binary file not shown.
Binary file added audits/125_capped_cached_certik_20250430.pdf
Binary file not shown.
Binary file added audits/126_capped_cached_fairyproof_20250319.pdf
Binary file not shown.
Binary file added audits/127_capped_cached_quantstamp_20250325.pdf
Binary file not shown.
Binary file added audits/128_AsBNBOracle_certik_20250320.pdf
Binary file not shown.
96 changes: 71 additions & 25 deletions contracts/ResilientOracle.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@
// SPDX-FileCopyrightText: 2022 Venus
pragma solidity 0.8.25;

import "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol";
import "./interfaces/VBep20Interface.sol";
import "./interfaces/OracleInterface.sol";
import "@venusprotocol/governance-contracts/contracts/Governance/AccessControlledV8.sol";
import { PausableUpgradeable } from "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol";
import { VBep20Interface } from "./interfaces/VBep20Interface.sol";
import { OracleInterface, ResilientOracleInterface, BoundValidatorInterface } from "./interfaces/OracleInterface.sol";
import { AccessControlledV8 } from "@venusprotocol/governance-contracts/contracts/Governance/AccessControlledV8.sol";
import { ICappedOracle } from "./interfaces/ICappedOracle.sol";
import { Transient } from "./lib/Transient.sol";

/**
* @title ResilientOracle
Expand All @@ -17,8 +19,7 @@ import "@venusprotocol/governance-contracts/contracts/Governance/AccessControlle
* for attacking the protocol.
*
* The Resilient Oracle uses multiple sources and fallback mechanisms to provide accurate prices and protect
* the protocol from oracle attacks. Currently it includes integrations with Chainlink, Pyth, Binance Oracle
* and TWAP (Time-Weighted Average Price) oracles. TWAP uses PancakeSwap as the on-chain price source.
* the protocol from oracle attacks.
*
* For every market (vToken) we configure the main, pivot and fallback oracles. The oracles are configured per
* vToken's underlying asset address. The main oracle oracle is the most trustworthy price source, the pivot
Expand All @@ -36,9 +37,8 @@ anchorRatio = anchorPrice/reporterPrice
isValid = anchorRatio <= upperBoundAnchorRatio && anchorRatio >= lowerBoundAnchorRatio
```

* In most cases, Chainlink is used as the main oracle, TWAP or Pyth oracles are used as the pivot oracle depending
* on which supports the given market and Binance oracle is used as the fallback oracle. For some markets we may
* use Pyth or TWAP as the main oracle if the token price is not supported by Chainlink or Binance oracles.
* In most cases, Chainlink is used as the main oracle, other oracles are used as the pivot oracle depending
* on which supports the given market and Binance oracle is used as the fallback oracle.
*
* For a fetched price to be valid it must be positive and not stagnant. If the price is invalid then we consider the
* oracle to be stagnant and treat it like it's disabled.
Expand Down Expand Up @@ -66,6 +66,8 @@ contract ResilientOracle is PausableUpgradeable, AccessControlledV8, ResilientOr
/// @notice `enableFlagsForOracles` stores the enabled state
/// for each oracle in the same order as `oracles`
bool[3] enableFlagsForOracles;
/// @notice `cachingEnabled` is a flag that indicates whether the asset price should be cached
bool cachingEnabled;
}

uint256 public constant INVALID_PRICE = 0;
Expand All @@ -82,6 +84,12 @@ contract ResilientOracle is PausableUpgradeable, AccessControlledV8, ResilientOr
/// and can serve as any underlying asset of a market that supports native tokens
address public constant NATIVE_TOKEN_ADDR = 0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB;

/// @notice Slot to cache the asset's price, used for transient storage
/// custom:storage-location erc7201:venus-protocol/oracle/ResilientOracle/cache
/// keccak256(abi.encode(uint256(keccak256("venus-protocol/oracle/ResilientOracle/cache")) - 1))
/// & ~bytes32(uint256(0xff))
bytes32 public constant CACHE_SLOT = 0x4e99ec55972332f5e0ef9c6623192c0401b609161bffae64d9ccdd7ad6cc7800;

/// @notice Bound validator contract address
/// @custom:oz-upgrades-unsafe-allow state-variable-immutable
BoundValidatorInterface public immutable boundValidator;
Expand All @@ -101,6 +109,9 @@ contract ResilientOracle is PausableUpgradeable, AccessControlledV8, ResilientOr
/// Event emitted when an oracle is enabled or disabled
event OracleEnabled(address indexed asset, uint256 indexed role, bool indexed enable);

/// Event emitted when an asset cachingEnabled flag is set
event CachedEnabled(address indexed asset, bool indexed enabled);

/**
* @notice Checks whether an address is null or not
*/
Expand Down Expand Up @@ -175,11 +186,8 @@ contract ResilientOracle is PausableUpgradeable, AccessControlledV8, ResilientOr
function setTokenConfigs(TokenConfig[] memory tokenConfigs_) external {
if (tokenConfigs_.length == 0) revert("length can't be 0");
uint256 numTokenConfigs = tokenConfigs_.length;
for (uint256 i; i < numTokenConfigs; ) {
for (uint256 i; i < numTokenConfigs; ++i) {
setTokenConfig(tokenConfigs_[i]);
unchecked {
++i;
}
}
}

Expand Down Expand Up @@ -215,6 +223,7 @@ contract ResilientOracle is PausableUpgradeable, AccessControlledV8, ResilientOr
* @custom:access Only Governance
* @custom:error NotNullAddress error is thrown if asset address is null
* @custom:error TokenConfigExistance error is thrown if token config is not set
* @custom:event Emits OracleEnabled event with asset address, role of the oracle and enabled flag
*/
function enableOracle(
address asset,
Expand All @@ -227,30 +236,22 @@ contract ResilientOracle is PausableUpgradeable, AccessControlledV8, ResilientOr
}

/**
* @notice Updates the TWAP pivot oracle price.
* @notice Updates the capped main oracle snapshot.
* @dev This function should always be called before calling getUnderlyingPrice
* @param vToken vToken address
*/
function updatePrice(address vToken) external override {
address asset = _getUnderlyingAsset(vToken);
(address pivotOracle, bool pivotOracleEnabled) = getOracle(asset, OracleRole.PIVOT);
if (pivotOracle != address(0) && pivotOracleEnabled) {
//if pivot oracle is not TwapOracle it will revert so we need to catch the revert
try TwapInterface(pivotOracle).updateTwap(asset) {} catch {}
}
_updateAssetPrice(asset);
}

/**
* @notice Updates the pivot oracle price. Currently using TWAP
* @notice Updates the capped main oracle snapshot.
* @dev This function should always be called before calling getPrice
* @param asset asset address
*/
function updateAssetPrice(address asset) external {
(address pivotOracle, bool pivotOracleEnabled) = getOracle(asset, OracleRole.PIVOT);
if (pivotOracle != address(0) && pivotOracleEnabled) {
//if pivot oracle is not TwapOracle it will revert so we need to catch the revert
try TwapInterface(pivotOracle).updateTwap(asset) {} catch {}
}
_updateAssetPrice(asset);
}

/**
Expand Down Expand Up @@ -302,6 +303,7 @@ contract ResilientOracle is PausableUpgradeable, AccessControlledV8, ResilientOr
* @custom:error NotNullAddress is thrown if asset address is null
* @custom:error NotNullAddress is thrown if main-role oracle address for asset is null
* @custom:event Emits TokenConfigAdded event when the asset config is set successfully by the authorized account
* @custom:event Emits CachedEnabled event when the asset cachingEnabled flag is set successfully
*/
function setTokenConfig(
TokenConfig memory tokenConfig
Expand All @@ -315,6 +317,7 @@ contract ResilientOracle is PausableUpgradeable, AccessControlledV8, ResilientOr
tokenConfig.oracles[uint256(OracleRole.PIVOT)],
tokenConfig.oracles[uint256(OracleRole.FALLBACK)]
);
emit CachedEnabled(tokenConfig.asset, tokenConfig.cachingEnabled);
}

/**
Expand All @@ -329,8 +332,42 @@ contract ResilientOracle is PausableUpgradeable, AccessControlledV8, ResilientOr
enabled = tokenConfigs[asset].enableFlagsForOracles[uint256(role)];
}

/**
* @notice Updates the capped oracle snapshot.
* @dev Cache the asset price and return if already cached
* @param asset asset address
*/
function _updateAssetPrice(address asset) internal {
if (Transient.readCachedPrice(CACHE_SLOT, asset) != 0) {
return;
}

(address mainOracle, bool mainOracleEnabled) = getOracle(asset, OracleRole.MAIN);
if (mainOracle != address(0) && mainOracleEnabled) {
// if main oracle is not CorrelatedTokenOracle it will revert so we need to catch the revert
try ICappedOracle(mainOracle).updateSnapshot() {} catch {}
}

if (_isCacheEnabled(asset)) {
uint256 price = _getPrice(asset);
Transient.cachePrice(CACHE_SLOT, asset, price);
}
}

/**
* @notice Gets price for the provided asset
* @param asset asset address
* @return price USD price in scaled decimal places.
* @custom:error Invalid resilient oracle price error is thrown if fetched prices from oracle is invalid
*/
function _getPrice(address asset) internal view returns (uint256) {
uint256 pivotPrice = INVALID_PRICE;
uint256 price;

price = Transient.readCachedPrice(CACHE_SLOT, asset);
if (price != 0) {
return price;
}

// Get pivot oracle price, Invalid price if not available or error
(address pivotOracle, bool pivotOracleEnabled) = getOracle(asset, OracleRole.PIVOT);
Expand Down Expand Up @@ -451,4 +488,13 @@ contract ResilientOracle is PausableUpgradeable, AccessControlledV8, ResilientOr
asset = VBep20Interface(vToken).underlying();
}
}

/**
* @dev This function checks if the asset price should be cached
* @param asset asset address
* @return bool true if caching is enabled, false otherwise
*/
function _isCacheEnabled(address asset) private view returns (bool) {
return tokenConfigs[asset].cachingEnabled;
}
}
7 changes: 7 additions & 0 deletions contracts/interfaces/IAsBNB.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// SPDX-License-Identifier: BSD-3-Clause
pragma solidity 0.8.25;

interface IAsBNB {
function minter() external view returns (address);
function decimals() external view returns (uint8);
}
6 changes: 6 additions & 0 deletions contracts/interfaces/IAsBNBMinter.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// SPDX-License-Identifier: BSD-3-Clause
pragma solidity 0.8.25;

interface IAsBNBMinter {
function convertToTokens(uint256 amount) external view returns (uint256);
}
6 changes: 6 additions & 0 deletions contracts/interfaces/ICappedOracle.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// SPDX-License-Identifier: BSD-3-Clause
pragma solidity 0.8.25;

interface ICappedOracle {
function updateSnapshot() external;
}
7 changes: 7 additions & 0 deletions contracts/interfaces/IZkETH.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// SPDX-License-Identifier: BSD-3-Clause
pragma solidity ^0.8.25;

interface IZkETH {
function LSTPerToken() external view returns (uint256);
function decimals() external view returns (uint8);
}
4 changes: 0 additions & 4 deletions contracts/interfaces/OracleInterface.sol
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@ interface ResilientOracleInterface is OracleInterface {
function getUnderlyingPrice(address vToken) external view returns (uint256);
}

interface TwapInterface is OracleInterface {
function updateTwap(address asset) external returns (uint256);
}

interface BoundValidatorInterface {
function validatePriceWithAnchorPrice(
address asset,
Expand Down
Loading