Skip to content
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
Show all changes
208 commits
Select commit Hold shift + click to select a range
f1de71f
chore: update vm version to cancun and dependencies
Debugger022 Dec 4, 2024
1912471
feat: add transient storage in resilient oracle
Debugger022 Dec 4, 2024
2ea9a8d
chore: fix dependency version of hardhat and smock
Debugger022 Dec 12, 2024
f79e2fe
feat: cache asset price into transient storage in resilient oracle
Debugger022 Dec 12, 2024
a799afb
fix: add resolutions to pin hardhat and smock
coreyar Dec 12, 2024
d808048
ci: remove ignore checksums
coreyar Dec 12, 2024
be72452
fix: relock
coreyar Dec 12, 2024
5a0bec5
wip: capped oracle implementation for correlated oracle
Debugger022 Dec 20, 2024
d2c2ff1
refactor: add check for cache price in resilient oracle
Debugger022 Jan 3, 2025
dbcd6c3
refactor: _getPrice method in resilient oracle
Debugger022 Jan 7, 2025
02d4ab7
feat: automatically update snapshot
web3rover Jan 9, 2025
83a8464
fix: fixed tests
web3rover Jan 9, 2025
927541d
feat: make snapshot interval optional
web3rover Jan 9, 2025
1dc13c1
fix: remove env variable defination CI/CD
Debugger022 Jan 9, 2025
742e12d
fix: pr comment
Debugger022 Jan 10, 2025
7e7ccdd
fixup! fix: pr comment
chechu Jan 10, 2025
fe00ce8
Merge branch 'develop' into feat/transient-storage
chechu Jan 10, 2025
c16b2f2
fix: fixed netspec comment
web3rover Jan 14, 2025
135659f
feat: added cappedoracle abstract contract
web3rover Jan 14, 2025
dfb48a2
fix: merge conflict
web3rover Jan 14, 2025
c1ef7e6
fix: skip snapshot update
web3rover Jan 14, 2025
79501aa
feat: added getUncappedPrice func
web3rover Jan 14, 2025
3d8b0b5
fix: optimised gas
web3rover Jan 14, 2025
4ee71b9
feat: added isCapped
web3rover Jan 14, 2025
61f2039
feat: added ICappedOracle interface
web3rover Jan 14, 2025
6e26b79
feat: use cap for sfrxETHOracle
web3rover Jan 14, 2025
f032d89
feat: added transient storage
web3rover Jan 14, 2025
606522d
fix: patch smock package to check if provider has init
coreyar Jan 14, 2025
c881fcf
refactor: add transient library to cache and read value
Debugger022 Jan 14, 2025
725d205
refactor: move cache slot for transient library
Debugger022 Jan 14, 2025
93b833f
fix: merge conflict
web3rover Jan 17, 2025
6a69bb8
fix: use transient lib
web3rover Jan 17, 2025
825d146
fix: optimise if condition
web3rover Jan 17, 2025
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
6254078
fix: use cached price as exchange rate not final price
web3rover Feb 20, 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
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
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
91a66ab
fix: uupdated erc4626 oracles
web3rover Mar 10, 2025
a8f3690
fix: updated yearn markets
web3rover 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
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
65c06ef
fix: make caching optional
web3rover Apr 14, 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
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
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
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
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
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
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .github/workflows/cd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ jobs:
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
9 changes: 3 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ jobs:
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 @@ -49,8 +48,7 @@ jobs:
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 @@ -89,8 +87,7 @@ jobs:
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 Down
59 changes: 49 additions & 10 deletions contracts/ResilientOracle.sol
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,9 @@ contract ResilientOracle is PausableUpgradeable, AccessControlledV8, ResilientOr

mapping(address => TokenConfig) private tokenConfigs;

/// Slot to cache the asset's price, used for transient storage
bytes32 constant CACHE_SLOT = keccak256(abi.encode("venus-protocol/oracle/ResilientOracle/cache"));

event TokenConfigAdded(
address indexed asset,
address indexed mainOracle,
Expand Down Expand Up @@ -233,11 +236,7 @@ contract ResilientOracle is PausableUpgradeable, AccessControlledV8, ResilientOr
*/
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);
}

/**
Expand All @@ -246,11 +245,7 @@ contract ResilientOracle is PausableUpgradeable, AccessControlledV8, ResilientOr
* @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 @@ -329,6 +324,50 @@ contract ResilientOracle is PausableUpgradeable, AccessControlledV8, ResilientOr
enabled = tokenConfigs[asset].enableFlagsForOracles[uint256(role)];
}

/**
* @notice Updates the pivot oracle price. Currently using TWAP
* @dev Cache the asset price and return if already cached
* @param asset asset address
*/
function _updateAssetPrice(address asset) internal {
if (_readCachedPrice(asset) != 0) {
return;
}

(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 {}
}

uint256 price = _getPrice(asset);
_cachePrice(asset, price);
}

/**
* @notice Cache the asset price into transient storage
* @param key address of the asset
* @param value asset price
*/
function _cachePrice(address key, uint256 value) internal {
bytes32 slot = keccak256(abi.encode(CACHE_SLOT, key));
assembly ("memory-safe") {
tstore(slot, value)
}
}

/**
* @notice Read cached price from transient storage
* @param key address of the asset
* @return value cached asset price
*/
function _readCachedPrice(address key) internal view returns (uint256 value) {
bytes32 slot = keccak256(abi.encode(CACHE_SLOT, key));
assembly ("memory-safe") {
value := tload(slot)
}
}

function _getPrice(address asset) internal view returns (uint256) {
uint256 pivotPrice = INVALID_PRICE;

Expand Down
2 changes: 1 addition & 1 deletion hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ const config: HardhatUserConfig = {
yul: !process.env.CI,
},
},
evmVersion: "paris",
evmVersion: "cancun",
outputSelection: {
"*": {
"*": ["storageLayout"],
Expand Down
2 changes: 1 addition & 1 deletion hardhat.config.zksync.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ const config: HardhatUserConfig = {
yul: !process.env.CI,
},
},
evmVersion: "paris",
evmVersion: "cancun",
outputSelection: {
"*": {
"*": ["storageLayout"],
Expand Down
8 changes: 6 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,15 @@
},
"dependencies": {
"@chainlink/contracts": "^0.5.1",
"@defi-wonderland/smock": "2.3.5",
"@defi-wonderland/smock": "2.4.0",
"@nomicfoundation/hardhat-network-helpers": "^1.0.8",
"@openzeppelin/contracts": "^4.6.0",
"@openzeppelin/contracts-upgradeable": "^4.7.3",
"@venusprotocol/governance-contracts": "^2.4.0",
"@venusprotocol/solidity-utilities": "^2.0.0",
"@venusprotocol/venus-protocol": "^9.1.0",
"ethers": "^5.6.8",
"hardhat": "2.19.5",
"hardhat": "2.22.15",
"hardhat-deploy": "^0.12.4",
"module-alias": "^2.2.2",
"solidity-docgen": "^0.6.0-beta.29"
Expand Down Expand Up @@ -117,5 +117,9 @@
},
"_moduleAliases": {
"@nomiclabs/hardhat-ethers": "node_modules/hardhat-deploy-ethers"
},
"resolutions": {
"hardhat": "2.22.15",
"@defi-wonderland/smock": "2.4.0"
}
}
Loading
Loading