diff --git a/src/UmaCtfAdapter.sol b/src/UmaCtfAdapter.sol index 87434b1..b91aa93 100644 --- a/src/UmaCtfAdapter.sol +++ b/src/UmaCtfAdapter.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: MIT pragma solidity 0.8.15; -import { IERC20 } from "openzeppelin-contracts/token/ERC20/IERC20.sol"; +import { IERC20 } from "lib/openzeppelin-contracts/contracts/token/ERC20/IERC20.sol"; import { Auth } from "./mixins/Auth.sol"; import { BulletinBoard } from "./mixins/BulletinBoard.sol"; @@ -74,13 +74,13 @@ contract UmaCtfAdapter is IUmaCtfAdapter, Auth, BulletinBoard, IOptimisticReques /// Prepares the condition using the Adapter as the oracle and a fixed outcome slot count = 2. /// @param ancillaryData - Data used to resolve a question /// @param rewardToken - ERC20 token address used for payment of rewards and fees - /// @param reward - Reward offered to a successful OO proposer. + /// @param reward - Reward offered to a successful OO proposer. /// Must be chosen carefully, to properly economically incentize OO proposers. /// @param proposalBond - Bond required to be posted by OO proposers/disputers. /// If 0, the default OO bond is used. /// Must be chosen carefully, to properly economically incentize OO proposers and disputers. - /// Questions expected to secure a large amount of value should consider a larger proposal bond. - /// @param liveness - OO liveness period in seconds. + /// Questions expected to secure a large amount of value should consider a larger proposal bond. + /// @param liveness - OO liveness period in seconds. /// If 0, the default liveness period of 2 hours is used. /// Must be chosen carefully, depending on the value backed by the question. /// Questions expected to secure a large amount of value should consider a longer liveness period. @@ -149,9 +149,9 @@ contract UmaCtfAdapter is IUmaCtfAdapter, Auth, BulletinBoard, IOptimisticReques if (!_hasPrice(questionData)) revert PriceNotAvailable(); // Fetches price from OO - int256 price = optimisticOracle.getRequest( - address(this), YES_OR_NO_IDENTIFIER, questionData.requestTimestamp, questionData.ancillaryData - ).resolvedPrice; + int256 price = optimisticOracle + .getRequest(address(this), YES_OR_NO_IDENTIFIER, questionData.requestTimestamp, questionData.ancillaryData) + .resolvedPrice; return _constructPayouts(price); } @@ -361,7 +361,11 @@ contract UmaCtfAdapter is IUmaCtfAdapter, Auth, BulletinBoard, IOptimisticReques // Send a price request to the Optimistic oracle optimisticOracle.requestPrice( - YES_OR_NO_IDENTIFIER, requestTimestamp, ancillaryData, IERC20(rewardToken), reward + YES_OR_NO_IDENTIFIER, + requestTimestamp, + ancillaryData, + IERC20(rewardToken), + reward ); // Ensure the price request is event based @@ -386,9 +390,12 @@ contract UmaCtfAdapter is IUmaCtfAdapter, Auth, BulletinBoard, IOptimisticReques /// @notice Reset the question by updating the requestTimestamp field and sending a new price request to the OO /// @param questionID - The unique questionID - function _reset(address requestor, bytes32 questionID, bool resetRefund, QuestionData storage questionData) - internal - { + function _reset( + address requestor, + bytes32 questionID, + bool resetRefund, + QuestionData storage questionData + ) internal { uint256 requestTimestamp = block.timestamp; // Update the question parameters in storage questionData.requestTimestamp = requestTimestamp; @@ -415,7 +422,9 @@ contract UmaCtfAdapter is IUmaCtfAdapter, Auth, BulletinBoard, IOptimisticReques function _resolve(bytes32 questionID, QuestionData storage questionData) internal { // Get the price from the OO int256 price = optimisticOracle.settleAndGetPrice( - YES_OR_NO_IDENTIFIER, questionData.requestTimestamp, questionData.ancillaryData + YES_OR_NO_IDENTIFIER, + questionData.requestTimestamp, + questionData.ancillaryData ); // If the OO returns the ignore price, reset the question @@ -438,9 +447,13 @@ contract UmaCtfAdapter is IUmaCtfAdapter, Auth, BulletinBoard, IOptimisticReques } function _hasPrice(QuestionData storage questionData) internal view returns (bool) { - return optimisticOracle.hasPrice( - address(this), YES_OR_NO_IDENTIFIER, questionData.requestTimestamp, questionData.ancillaryData - ); + return + optimisticOracle.hasPrice( + address(this), + YES_OR_NO_IDENTIFIER, + questionData.requestTimestamp, + questionData.ancillaryData + ); } function _refund(QuestionData storage questionData) internal { diff --git a/src/interfaces/IConditionalTokens.sol b/src/interfaces/IConditionalTokens.sol index 56d6790..97d63d3 100644 --- a/src/interfaces/IConditionalTokens.sol +++ b/src/interfaces/IConditionalTokens.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: MIT pragma solidity 0.8.15; -import { IERC20 } from "openzeppelin-contracts/token/ERC20/IERC20.sol"; +import { IERC20 } from "lib/openzeppelin-contracts/contracts/token/ERC20/IERC20.sol"; interface IConditionalTokens { /// Mapping key is an condition ID. Value represents numerators of the payout vector associated with the condition. This array is initialized with a length equal to the outcome slot count. E.g. Condition with 3 outcomes [A, B, C] and two of those correct [0.5, 0.5, 0]. In Ethereum there are no decimal values, so here, 0.5 is represented by fractions like 1/2 == 0.5. That's why we need numerator and denominator values. Payout numerators are also used as a check of initialization. If the numerators array is empty (has length zero), the condition was not created/prepared. See getOutcomeSlotCount. @@ -59,19 +59,21 @@ interface IConditionalTokens { /// @param oracle The account assigned to report the result for the prepared condition. /// @param questionId An identifier for the question to be answered by the oracle. /// @param outcomeSlotCount The number of outcome slots which should be used for this condition. Must not exceed 256. - function getConditionId(address oracle, bytes32 questionId, uint256 outcomeSlotCount) - external - pure - returns (bytes32); + function getConditionId( + address oracle, + bytes32 questionId, + uint256 outcomeSlotCount + ) external pure returns (bytes32); /// @dev Constructs an outcome collection ID from a parent collection and an outcome collection. /// @param parentCollectionId Collection ID of the parent outcome collection, or bytes32(0) if there's no parent. /// @param conditionId Condition ID of the outcome collection to combine with the parent outcome collection. /// @param indexSet Index set of the outcome collection to combine with the parent outcome collection. - function getCollectionId(bytes32 parentCollectionId, bytes32 conditionId, uint256 indexSet) - external - view - returns (bytes32); + function getCollectionId( + bytes32 parentCollectionId, + bytes32 conditionId, + uint256 indexSet + ) external view returns (bytes32); /// @dev Constructs a position ID from a collateral token and an outcome collection. These IDs are used as the ERC-1155 ID for this contract. /// @param collateralToken Collateral token which backs the position. diff --git a/src/interfaces/IOptimisticOracleV2.sol b/src/interfaces/IOptimisticOracleV2.sol index 4890b93..b670ed8 100644 --- a/src/interfaces/IOptimisticOracleV2.sol +++ b/src/interfaces/IOptimisticOracleV2.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: MIT pragma solidity 0.8.15; -import "openzeppelin-contracts/token/ERC20/IERC20.sol"; +import "lib/openzeppelin-contracts/contracts/token/ERC20/IERC20.sol"; struct RequestSettings { bool eventBased; // True if the request is set to be event-based. @@ -70,9 +70,12 @@ interface IOptimisticOracleV2 { /// @param ancillaryData ancillary data of the price being requested. /// @return totalBond the amount that's pulled from the disputer's wallet as a bond. The bond will be returned to /// the disputer once settled if the dispute was valid (the proposal was incorrect). - function disputePrice(address requester, bytes32 identifier, uint256 timestamp, bytes memory ancillaryData) - external - returns (uint256 totalBond); + function disputePrice( + address requester, + bytes32 identifier, + uint256 timestamp, + bytes memory ancillaryData + ) external returns (uint256 totalBond); /// @notice Set the proposal bond associated with a price request. /// @param identifier price identifier to identify the existing request. @@ -81,9 +84,12 @@ interface IOptimisticOracleV2 { /// @param bond custom bond amount to set. /// @return totalBond new bond + final fee that the proposer and disputer will be required to pay. This can be /// changed again with a subsequent call to setBond(). - function setBond(bytes32 identifier, uint256 timestamp, bytes memory ancillaryData, uint256 bond) - external - returns (uint256 totalBond); + function setBond( + bytes32 identifier, + uint256 timestamp, + bytes memory ancillaryData, + uint256 bond + ) external returns (uint256 totalBond); /// @notice Sets the request to be an "event-based" request. /// @dev Calling this method has a few impacts on the request: @@ -138,9 +144,12 @@ interface IOptimisticOracleV2 { /// @param ancillaryData ancillary data of the price being requested. /// @return payout the amount that the "winner" (proposer or disputer) receives on settlement. This amount includes /// the returned bonds as well as additional rewards. - function settle(address requester, bytes32 identifier, uint256 timestamp, bytes memory ancillaryData) - external - returns (uint256 payout); + function settle( + address requester, + bytes32 identifier, + uint256 timestamp, + bytes memory ancillaryData + ) external returns (uint256 payout); /// @notice Retrieves a price that was previously requested by a caller. Reverts if the request is not settled /// or settleable. Note: this method is not view so that this call may actually settle the price request if it @@ -150,9 +159,11 @@ interface IOptimisticOracleV2 { /// @param ancillaryData ancillary data of the price being requested. /// @return resolved price. //// - function settleAndGetPrice(bytes32 identifier, uint256 timestamp, bytes memory ancillaryData) - external - returns (int256); + function settleAndGetPrice( + bytes32 identifier, + uint256 timestamp, + bytes memory ancillaryData + ) external returns (int256); /// @notice Gets the current data structure containing all information about a price request. /// @param requester sender of the initial price request. @@ -161,10 +172,12 @@ interface IOptimisticOracleV2 { /// @param ancillaryData ancillary data of the price being requested. /// @return the Request data structure. //// - function getRequest(address requester, bytes32 identifier, uint256 timestamp, bytes memory ancillaryData) - external - view - returns (Request memory); + function getRequest( + address requester, + bytes32 identifier, + uint256 timestamp, + bytes memory ancillaryData + ) external view returns (Request memory); /// @notice Checks if a given request has resolved or been settled (i.e the optimistic oracle has a price). /// @param requester sender of the initial price request. @@ -172,10 +185,12 @@ interface IOptimisticOracleV2 { /// @param timestamp timestamp to identify the existing request. /// @param ancillaryData ancillary data of the price being requested. /// @return true if price has resolved or settled, false otherwise. - function hasPrice(address requester, bytes32 identifier, uint256 timestamp, bytes memory ancillaryData) - external - view - returns (bool); + function hasPrice( + address requester, + bytes32 identifier, + uint256 timestamp, + bytes memory ancillaryData + ) external view returns (bool); function defaultLiveness() external view returns (uint256); } diff --git a/src/libraries/TransferHelper.sol b/src/libraries/TransferHelper.sol index 3b59908..b51c21c 100644 --- a/src/libraries/TransferHelper.sol +++ b/src/libraries/TransferHelper.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: MIT pragma solidity 0.8.15; -import { SafeTransferLib, ERC20 } from "solmate/utils/SafeTransferLib.sol"; +import { SafeTransferLib, ERC20 } from "lib/solmate/src/utils/SafeTransferLib.sol"; /// @title TransferHelper /// @notice Helper library to transfer tokens