Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
9 changes: 9 additions & 0 deletions packages/contracts/contracts/interfaces/IPriceAdapter.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.0 <0.9.0;

interface IPriceAdapter {

function registerPriceRoute(bytes[] route) external returns (bytes32);

function getPrice(bytes32 route, uint256 inAmount) external ;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;



// Interfaces
import "./interfaces/IPriceAdapter.sol";


contract PriceAdapterUniswapV3 is
IPriceAdapter,

{



mapping(bytes32 => bytes) public priceRoutes;

/* Modifiers */


/* Events */

event RouteRegistered(bytes32 hash, bytes route);


/* External Functions */


function registerPriceRoute(
bytes[] route
) external returns (bytes32 hash) {


// validate the route for length, other restrictions


// hash the route with keccak256


// store the route by its hash in the priceRoutes mapping


}


function getPrice(
bytes32 route , uint256 inAmount
) external returns (uint256 marketId_) {


// lookup the route from the mapping


// use the route to query uniswapV3 for the price using inAmount



}

}