Skip to content

Commit

Permalink
add comment
Browse files Browse the repository at this point in the history
  • Loading branch information
pi0neerpat committed Dec 13, 2024
1 parent aab56ff commit 96f3272
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,6 @@
"solhint": "^4.5.2",
"solhint-plugin-defi-wonderland": "^1.1.3",
"sort-package-json": "^2.8.0"
}
},
"packageManager": "[email protected]+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
}
13 changes: 8 additions & 5 deletions src/contracts/oracles/CamelotV2Relayer.sol
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,20 @@ contract CamelotV2Relayer {
uint128 public immutable BASE_AMOUNT;

// --- Registry ---
address public camelotV2Pool;
address public camelotV2Pair;
address public baseToken;
address public quoteToken;

// --- Data ---
string public symbol;

constructor(address _camelotV2Factory, address _baseToken, address _quoteToken, uint32 _quotePeriod) {
camelotV2Pool = ICamelotFactory(_camelotV2Factory).getPair(_baseToken, _quoteToken);
require(camelotV2Pool != address(0));
camelotV2Pair = ICamelotFactory(_camelotV2Factory).getPair(_baseToken, _quoteToken);
require(camelotV2Pair != address(0));
require(camelotV2Pair.stableSwap() == false);

address _token0 = ICamelotPair(camelotV2Pool).token0();
address _token1 = ICamelotPair(camelotV2Pool).token1();
address _token0 = ICamelotPair(camelotV2Pair).token0();
address _token1 = ICamelotPair(camelotV2Pair).token1();

// The factory validates that both token0 and token1 are desired baseToken and quoteTokens
if (_token0 == _baseToken) {
Expand All @@ -43,6 +44,8 @@ contract CamelotV2Relayer {
symbol = string(abi.encodePacked(IERC20Metadata(_baseToken).symbol(), ' / ', IERC20Metadata(_quoteToken).symbol()));
}

// TODO: Update calculation for V2

function getResultWithValidity() external view returns (uint256 _result, bool _validity) {
// TODO: add catch if the pool doesn't have enough history - return false

Expand Down

0 comments on commit 96f3272

Please sign in to comment.