From fdd5245852c2a04d5aef5d67b213d5e612a3d078 Mon Sep 17 00:00:00 2001 From: Brean0 Date: Wed, 9 Oct 2024 15:23:00 -0400 Subject: [PATCH] add Update OracleImplementation --- .../init/InitUpdateOracleImplementation.sol | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 protocol/contracts/beanstalk/init/InitUpdateOracleImplementation.sol diff --git a/protocol/contracts/beanstalk/init/InitUpdateOracleImplementation.sol b/protocol/contracts/beanstalk/init/InitUpdateOracleImplementation.sol new file mode 100644 index 000000000..d0c588496 --- /dev/null +++ b/protocol/contracts/beanstalk/init/InitUpdateOracleImplementation.sol @@ -0,0 +1,28 @@ +/* + SPDX-License-Identifier: MIT +*/ + +pragma solidity ^0.8.20; +import {Implementation} from "contracts/beanstalk/storage/System.sol"; +import {LibAppStorage, AppStorage} from "contracts/libraries/LibAppStorage.sol"; +import {LibWhitelist} from "contracts/libraries/Silo/LibWhitelist.sol"; + +/** + * @author Publius + * @title InitUpdateOracleImplementation switches the WEETH and WSTETH oracle Implementation. + **/ +contract InitUpdateOracleImplementation { + AppStorage internal s; + address internal constant WSTETH = 0x5979D7b546E38E414F7E9822514be443A4800529; + address internal constant WEETH = 0x35751007a407ca6FEFfE80b3cB397736D2cf4dbe; + + function init() external { + // get the wsteth oracle implementation + Implementation memory wstethImplOld = s.sys.oracleImplementation[WSTETH]; + Implementation memory WeethImplOld = s.sys.oracleImplementation[WEETH]; + + // switch the wsteth and weeth oracle implementations. + LibWhitelist.updateOracleImplementationForToken(WSTETH, WeethImplOld); + LibWhitelist.updateOracleImplementationForToken(WEETH, wstethImplOld); + } +}