Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add oracle #19

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
Open
Prev Previous commit
Next Next commit
add solv oracle adapter
Skyewwww authored and Attens1423 committed Jul 23, 2024

Unverified

This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
commit 288e9e0196ce278edcb00cb12911de2e97d509e2
25 changes: 25 additions & 0 deletions contracts/GasSavingPool/adapter/SolvOracleAdapter.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/*
Copyright 2020 DODO ZOO.
SPDX-License-Identifier: Apache-2.0
*/

pragma solidity 0.8.16;

import {IOracle} from "../intf/IOracle.sol";

interface ISftWrappedToken {
function getValueByShares(uint256 shares) external view returns (uint256 value);
}

contract SolvOracleAdapter is IOracle {
ISftWrappedToken public sftWrappedToken;

function prices(address base) external override returns (uint256 price) {
uint256 shares = 1e18;
sftWrappedToken = ISftWrappedToken(base);
uint256 value = sftWrappedToken.getValueByShares(shares);
price = value / 1;
}
}
6 changes: 1 addition & 5 deletions contracts/GasSavingPool/intf/IOracle.sol
Original file line number Diff line number Diff line change
@@ -8,9 +8,5 @@
pragma solidity 0.8.16;

interface IOracle {
function getPrice(address base) external view returns (uint256 latestPrice, bool isValid, bool isStale, uint256 timestamp);

function prices(address base) external view returns (uint256);

function isFeasible(address base) external view returns (bool);
function prices(address base) external returns (uint256);
}