Skip to content
This repository was archived by the owner on Jun 28, 2024. It is now read-only.

Workshop 2/3 Coding Assignment #70

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion lib/openzeppelin-contracts
318 changes: 318 additions & 0 deletions src/workshop_2/ICircuitBreaker.sol

Large diffs are not rendered by default.

51 changes: 51 additions & 0 deletions src/workshop_2/IPriceOracle.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
// SPDX-License-Identifier: GPL-2.0-or-later

pragma solidity ^0.8.19;

interface IPriceOracle {
/// @notice Returns the name of the price oracle.
function name() external view returns (string memory);

/// @notice Returns the quote for a given amount of base asset in quote asset.
/// @param amount The amount of base asset.
/// @param base The address of the base asset.
/// @param quote The address of the quote asset.
/// @return out The quote amount in quote asset.
function getQuote(uint256 amount, address base, address quote) external view returns (uint256 out);

/// @notice Returns the bid and ask quotes for a given amount of base asset in quote asset.
/// @param amount The amount of base asset.
/// @param base The address of the base asset.
/// @param quote The address of the quote asset.
/// @return bidOut The bid quote amount in quote asset.
/// @return askOut The ask quote amount in quote asset.
function getQuotes(
uint256 amount,
address base,
address quote
) external view returns (uint256 bidOut, uint256 askOut);

/// @notice Returns the tick for a given amount of base asset in quote asset.
/// @param amount The amount of base asset.
/// @param base The address of the base asset.
/// @param quote The address of the quote asset.
/// @return tick The tick value.
function getTick(uint256 amount, address base, address quote) external view returns (uint256 tick);

/// @notice Returns the bid and ask ticks for a given amount of base asset in quote asset.
/// @param amount The amount of base asset.
/// @param base The address of the base asset.
/// @param quote The address of the quote asset.
/// @return bidTick The bid tick value.
/// @return askTick The ask tick value.
function getTicks(
uint256 amount,
address base,
address quote
) external view returns (uint256 bidTick, uint256 askTick);

error PO_BaseUnsupported();
error PO_QuoteUnsupported();
error PO_Overflow();
error PO_NoPath();
}
2 changes: 2 additions & 0 deletions src/workshop_2/IWorkshopVault.sol
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,6 @@ interface IWorkshopVault is IVault {
// [ASSIGNMENT] optional: integrate with an oracle of choice in checkAccountStatus() and liquidate()
// [ASSIGNMENT] optional: implement a circuit breaker in checkVaultStatus(), may be EIP-7265 inspired
// [ASSIGNMENT] optional: add EIP-7540 compatibility for RWAs
function doCheckVaultStatus(bytes memory snapshot) external;
function doTakeVaultSnapshot() external returns (bytes memory snapshot);
}
Loading