Contract
0xf358ace0f73531a41c26a865ca8333bfdc762905
2
Contract Overview
Balance:
0 MATIC
My Name Tag:
Not Available
[ Download CSV Export ]
Contract Source Code Verified (Exact Match)
Contract Name:
BatchBet
Compiler Version
v0.8.17+commit.8df45f5f
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity ^0.8.15; interface Errors { // -------------------- // Conditional Token // -------------------- // Prepare Condition error ConditionAlreadyPrepared(); // Report payouts error PayoutAlreadyReported(); error PayoutsAreAllZero(); // Redeem Positions error ResultNotReceivedYet(); error InvalidIndex(); error ConditionNotFound(); error InvalidAmount(); error InvalidOutcomeSlotsAmount(); // Funding error InvalidFundingAmount(); error InvalidBurnAmount(); error InvalidDistributionHint(); error HintCannotBeUsed(); // -------------------- // FPMM // -------------------- error MarketHalted(); // Buy error InvalidInvestmentAmount(); error MinimumBuyAmountNotReached(); // Sell error InvalidReturnAmount(); error MaximumSellAmountExceeded(); // ERC20 collateral error TransferFailed(); error ApproveFailed(); // asserts error InvalidOutcomeIndex(); error InvestmentDrainsPool(); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.15; library CeilDiv { // calculates ceil(x/y) function ceildiv(uint256 x, uint256 y) internal pure returns (uint256) { if (x > 0) return ((x - 1) / y) + 1; return x / y; } } library ArrayMath { function max(uint256[] memory values) internal pure returns (uint256) { uint256 result = 0; for (uint256 i = 0; i < values.length; i++) { uint256 value = values[i]; if (result < value) result = value; } return result; } function sum(uint256[] memory values) internal pure returns (uint256) { uint256 result = 0; for (uint256 i = 0; i < values.length; i++) { result += values[i]; } return result; } function hasNonzeroEntries(uint256[] memory values) internal pure returns (bool) { for (uint256 i = 0; i < values.length; i++) { if (values[i] > 0) return true; } return false; } } library Math { function max(uint256 a, uint256 b) public pure returns (uint256) { return (a > b) ? a : b; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.15; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "@openzeppelin/contracts/utils/introspection/ERC165Checker.sol"; import "./IMarketMaker.sol"; import "../Math.sol"; import { Errors } from "../Errors.sol"; /// @title Allows betting on several markets at once. contract BatchBet is Errors { IERC20 public immutable token; bytes4 private immutable marketMakerV1a = 0x8be0519d; error NotAMarket(address addr); using ArrayMath for uint256[]; using ERC165Checker for address; using SafeERC20 for IERC20; constructor(address _token) { require(_token != address(0), "invalid token address"); token = IERC20(_token); } // TODO: does it need nonReentrant function batchBuy( address[] calldata _markets, uint256[] calldata _investmentAmount, uint256[] calldata _outcomeIndex, uint256[] calldata _minOutcomeTokensToBuy ) external { uint256 length = _markets.length; require( length > 0 && _investmentAmount.length == length && _outcomeIndex.length == length && _minOutcomeTokensToBuy.length == length, "Invalid input length" ); uint256 totalInvestment = _investmentAmount.sum(); token.safeTransferFrom(msg.sender, address(this), totalInvestment); for (uint256 i = 0; i < length; i++) { address market = _markets[i]; uint256 investmentAmount = _investmentAmount[i]; uint256 outcomeIndex = _outcomeIndex[i]; uint256 minOutcomeTokensToBuy = _minOutcomeTokensToBuy[i]; if (!market.supportsInterface(marketMakerV1a)) { revert NotAMarket(market); } IMarketMakerV1a amm = IMarketMakerV1a(market); token.safeApprove(address(amm), investmentAmount); // TODO: get fees // TODO: meta-transactions amm.buyFor(msg.sender, investmentAmount, outcomeIndex, minOutcomeTokensToBuy); } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.15; import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol"; import { Errors } from "../Errors.sol"; /// @title Events emitted by a market /// @dev Events used for indexing blockchain events (e.g. in subgraph) interface IMarketEvents is IERC20Upgradeable { event FPMMFundingAdded(address indexed funder, uint256[] amountsAdded, uint256 sharesMinted); event FPMMFundingRemoved( address indexed funder, uint256[] amountsRemoved, uint256 collateralRemovedFromFeePool, uint256 sharesBurnt ); event FPMMBuy( address indexed buyer, uint256 investmentAmount, uint256 feeAmount, uint256 indexed outcomeIndex, uint256 outcomeTokensBought ); event FPMMSell( address indexed seller, uint256 returnAmount, uint256 feeAmount, uint256 indexed outcomeIndex, uint256 outcomeTokensSold ); } interface IMarketMakerV1a is IMarketEvents { function withdrawFees(address account) external; function addFunding(uint256 addedFunds, uint256[] calldata distributionHint) external returns (uint256 mintAmount, uint256[] memory sendBackAmounts); function removeFunding(uint256 sharesToBurn) external returns (uint256[] memory sendAmounts); function buyFor( address receiver, uint256 investmentAmount, uint256 outcomeIndex, uint256 minOutcomeTokensToBuy ) external returns (uint256 outcomeTokensBought); function buy( uint256 investmentAmount, uint256 outcomeIndex, uint256 minOutcomeTokensToBuy ) external returns (uint256 outcomeTokensBought); function sell( uint256 returnAmount, uint256 outcomeIndex, uint256 maxOutcomeTokensToSell ) external returns (uint256 outcomeTokensSold); function isHalted() external view returns (bool); function collectedFees() external view returns (uint256); function feesWithdrawableBy(address account) external view returns (uint256); function calcBuyAmount(uint256 investmentAmount, uint256 outcomeIndex) external view returns (uint256); function calcSellAmount(uint256 returnAmount, uint256 outcomeIndex) external view returns (uint256); } /// @title Second iteration of Market Maker interface /// @dev Interface evolution is done by creating new versions of the interfaces /// and making sure that the derived MarketMaker supports all of them. /// Alternatively we could have gone with breaking the interface down into each /// function one by one and checking each function selector. This would /// introduce a lot more code in `supportsInterface` which is called often, so /// it's easier to keep track of incremental evolution than all the constituent /// pieces interface IMarketMakerV1b is IMarketMakerV1a, Errors { // TODO: add removeFundingFor // TODO: add sellFor function addFundingFor( address receiver, uint256 addedFunds, uint256[] calldata distributionHint ) external returns (uint256 mintAmount, uint256[] memory sendBackAmounts); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `from` to `to` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 amount ) external returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612]. * * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't * need to send a transaction, and thus is not required to hold Ether at all. */ interface IERC20Permit { /** * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens, * given ``owner``'s signed approval. * * IMPORTANT: The same issues {IERC20-approve} has related to transaction * ordering also apply here. * * Emits an {Approval} event. * * Requirements: * * - `spender` cannot be the zero address. * - `deadline` must be a timestamp in the future. * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner` * over the EIP712-formatted function arguments. * - the signature must use ``owner``'s current nonce (see {nonces}). * * For more information on the signature format, see the * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP * section]. */ function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external; /** * @dev Returns the current nonce for `owner`. This value must be * included whenever a signature is generated for {permit}. * * Every successful call to {permit} increases ``owner``'s nonce by one. This * prevents a signature from being used multiple times. */ function nonces(address owner) external view returns (uint256); /** * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}. */ // solhint-disable-next-line func-name-mixedcase function DOMAIN_SEPARATOR() external view returns (bytes32); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/utils/SafeERC20.sol) pragma solidity ^0.8.0; import "../IERC20.sol"; import "../extensions/draft-IERC20Permit.sol"; import "../../../utils/Address.sol"; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { using Address for address; function safeTransfer( IERC20 token, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } function safeTransferFrom( IERC20 token, address from, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } /** * @dev Deprecated. This function has issues similar to the ones found in * {IERC20-approve}, and its usage is discouraged. * * Whenever possible, use {safeIncreaseAllowance} and * {safeDecreaseAllowance} instead. */ function safeApprove( IERC20 token, address spender, uint256 value ) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' require( (value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } function safeIncreaseAllowance( IERC20 token, address spender, uint256 value ) internal { uint256 newAllowance = token.allowance(address(this), spender) + value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } function safeDecreaseAllowance( IERC20 token, address spender, uint256 value ) internal { unchecked { uint256 oldAllowance = token.allowance(address(this), spender); require(oldAllowance >= value, "SafeERC20: decreased allowance below zero"); uint256 newAllowance = oldAllowance - value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } } function safePermit( IERC20Permit token, address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) internal { uint256 nonceBefore = token.nonces(owner); token.permit(owner, spender, value, deadline, v, r, s); uint256 nonceAfter = token.nonces(owner); require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed"); } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); if (returndata.length > 0) { // Return data is optional require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly /// @solidity memory-safe-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.2) (utils/introspection/ERC165Checker.sol) pragma solidity ^0.8.0; import "./IERC165.sol"; /** * @dev Library used to query support of an interface declared via {IERC165}. * * Note that these functions return the actual result of the query: they do not * `revert` if an interface is not supported. It is up to the caller to decide * what to do in these cases. */ library ERC165Checker { // As per the EIP-165 spec, no interface should ever match 0xffffffff bytes4 private constant _INTERFACE_ID_INVALID = 0xffffffff; /** * @dev Returns true if `account` supports the {IERC165} interface, */ function supportsERC165(address account) internal view returns (bool) { // Any contract that implements ERC165 must explicitly indicate support of // InterfaceId_ERC165 and explicitly indicate non-support of InterfaceId_Invalid return _supportsERC165Interface(account, type(IERC165).interfaceId) && !_supportsERC165Interface(account, _INTERFACE_ID_INVALID); } /** * @dev Returns true if `account` supports the interface defined by * `interfaceId`. Support for {IERC165} itself is queried automatically. * * See {IERC165-supportsInterface}. */ function supportsInterface(address account, bytes4 interfaceId) internal view returns (bool) { // query support of both ERC165 as per the spec and support of _interfaceId return supportsERC165(account) && _supportsERC165Interface(account, interfaceId); } /** * @dev Returns a boolean array where each value corresponds to the * interfaces passed in and whether they're supported or not. This allows * you to batch check interfaces for a contract where your expectation * is that some interfaces may not be supported. * * See {IERC165-supportsInterface}. * * _Available since v3.4._ */ function getSupportedInterfaces(address account, bytes4[] memory interfaceIds) internal view returns (bool[] memory) { // an array of booleans corresponding to interfaceIds and whether they're supported or not bool[] memory interfaceIdsSupported = new bool[](interfaceIds.length); // query support of ERC165 itself if (supportsERC165(account)) { // query support of each interface in interfaceIds for (uint256 i = 0; i < interfaceIds.length; i++) { interfaceIdsSupported[i] = _supportsERC165Interface(account, interfaceIds[i]); } } return interfaceIdsSupported; } /** * @dev Returns true if `account` supports all the interfaces defined in * `interfaceIds`. Support for {IERC165} itself is queried automatically. * * Batch-querying can lead to gas savings by skipping repeated checks for * {IERC165} support. * * See {IERC165-supportsInterface}. */ function supportsAllInterfaces(address account, bytes4[] memory interfaceIds) internal view returns (bool) { // query support of ERC165 itself if (!supportsERC165(account)) { return false; } // query support of each interface in _interfaceIds for (uint256 i = 0; i < interfaceIds.length; i++) { if (!_supportsERC165Interface(account, interfaceIds[i])) { return false; } } // all interfaces supported return true; } /** * @notice Query if a contract implements an interface, does not check ERC165 support * @param account The address of the contract to query for support of an interface * @param interfaceId The interface identifier, as specified in ERC-165 * @return true if the contract at account indicates support of the interface with * identifier interfaceId, false otherwise * @dev Assumes that account contains a contract that supports ERC165, otherwise * the behavior of this method is undefined. This precondition can be checked * with {supportsERC165}. * Interface identification is specified in ERC-165. */ function _supportsERC165Interface(address account, bytes4 interfaceId) private view returns (bool) { // prepare call bytes memory encodedParams = abi.encodeWithSelector(IERC165.supportsInterface.selector, interfaceId); // perform static call bool success; uint256 returnSize; uint256 returnValue; assembly { success := staticcall(30000, account, add(encodedParams, 0x20), mload(encodedParams), 0x00, 0x20) returnSize := returndatasize() returnValue := mload(0x00) } return success && returnSize >= 0x20 && returnValue > 0; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20Upgradeable { /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `from` to `to` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 amount ) external returns (bool); }
{ "remappings": [ "@ensdomains/=node_modules/@ensdomains/", "@openzeppelin/=node_modules/@openzeppelin/", "UDS/=lib/upgrade-scripts/lib/UDS/src/", "ds-test/=lib/forge-std/lib/ds-test/src/", "eth-gas-reporter/=node_modules/eth-gas-reporter/", "forge-std/=lib/forge-std/src/", "hardhat/=node_modules/hardhat/", "openzeppelin-contracts-upgradeable/=node_modules/ubet-smartcontracts/lib/upgrade-scripts/exampleOZ/lib/openzeppelin-contracts-upgradeable/", "openzeppelin-contracts/=node_modules/ubet-smartcontracts/lib/upgrade-scripts/exampleOZ/lib/openzeppelin-contracts/", "openzeppelin-solidity/=node_modules/openzeppelin-solidity/", "ubet-smartcontracts/=node_modules/ubet-smartcontracts/", "ubet/=contracts/", "upgrade-scripts/=lib/upgrade-scripts/src/" ], "optimizer": { "enabled": true, "runs": 200 }, "metadata": { "bytecodeHash": "ipfs" }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "evmVersion": "london", "libraries": {} }
[{"inputs":[{"internalType":"address","name":"_token","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"ApproveFailed","type":"error"},{"inputs":[],"name":"ConditionAlreadyPrepared","type":"error"},{"inputs":[],"name":"ConditionNotFound","type":"error"},{"inputs":[],"name":"HintCannotBeUsed","type":"error"},{"inputs":[],"name":"InvalidAmount","type":"error"},{"inputs":[],"name":"InvalidBurnAmount","type":"error"},{"inputs":[],"name":"InvalidDistributionHint","type":"error"},{"inputs":[],"name":"InvalidFundingAmount","type":"error"},{"inputs":[],"name":"InvalidIndex","type":"error"},{"inputs":[],"name":"InvalidInvestmentAmount","type":"error"},{"inputs":[],"name":"InvalidOutcomeIndex","type":"error"},{"inputs":[],"name":"InvalidOutcomeSlotsAmount","type":"error"},{"inputs":[],"name":"InvalidReturnAmount","type":"error"},{"inputs":[],"name":"InvestmentDrainsPool","type":"error"},{"inputs":[],"name":"MarketHalted","type":"error"},{"inputs":[],"name":"MaximumSellAmountExceeded","type":"error"},{"inputs":[],"name":"MinimumBuyAmountNotReached","type":"error"},{"inputs":[{"internalType":"address","name":"addr","type":"address"}],"name":"NotAMarket","type":"error"},{"inputs":[],"name":"PayoutAlreadyReported","type":"error"},{"inputs":[],"name":"PayoutsAreAllZero","type":"error"},{"inputs":[],"name":"ResultNotReceivedYet","type":"error"},{"inputs":[],"name":"TransferFailed","type":"error"},{"inputs":[{"internalType":"address[]","name":"_markets","type":"address[]"},{"internalType":"uint256[]","name":"_investmentAmount","type":"uint256[]"},{"internalType":"uint256[]","name":"_outcomeIndex","type":"uint256[]"},{"internalType":"uint256[]","name":"_minOutcomeTokensToBuy","type":"uint256[]"}],"name":"batchBuy","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"token","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"}]
Contract Creation Code
60c0604052638be0519d60e01b60a05234801561001b57600080fd5b50604051610bbb380380610bbb83398101604081905261003a916100a5565b6001600160a01b0381166100945760405162461bcd60e51b815260206004820152601560248201527f696e76616c696420746f6b656e20616464726573730000000000000000000000604482015260640160405180910390fd5b6001600160a01b03166080526100d5565b6000602082840312156100b757600080fd5b81516001600160a01b03811681146100ce57600080fd5b9392505050565b60805160a051610ab4610107600039600061020701526000818160550152818161014d01526102740152610ab46000f3fe608060405234801561001057600080fd5b50600436106100365760003560e01c80638a6a97821461003b578063fc0c546a14610050575b600080fd5b61004e61004936600461088b565b610093565b005b6100777f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b03909116815260200160405180910390f35b8680158015906100a257508581145b80156100ad57508381145b80156100b857508181145b6101005760405162461bcd60e51b8152602060048201526014602482015273092dcecc2d8d2c840d2dce0eae840d8cadccee8d60631b60448201526064015b60405180910390fd5b600061013e88888080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525061034092505050565b90506101756001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001633308461038e565b60005b828110156103335760008b8b838181106101945761019461094f565b90506020020160208101906101a99190610965565b905060008a8a848181106101bf576101bf61094f565b90506020020135905060008989858181106101dc576101dc61094f565b90506020020135905060008888868181106101f9576101f961094f565b90506020020135905061023e7f0000000000000000000000000000000000000000000000000000000000000000856001600160a01b03166103ff90919063ffffffff16565b61026657604051635aeebcad60e01b81526001600160a01b03851660048201526024016100f7565b8361029b6001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000168286610424565b60405163cc071c4f60e01b81523360048201526024810185905260448101849052606481018390526001600160a01b0382169063cc071c4f906084016020604051808303816000875af11580156102f6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061031a919061098e565b505050505050808061032b906109bd565b915050610178565b5050505050505050505050565b600080805b8351811015610387578381815181106103605761036061094f565b60200260200101518261037391906109d6565b91508061037f816109bd565b915050610345565b5092915050565b6040516001600160a01b03808516602483015283166044820152606481018290526103f99085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b03199093169290921790915261053e565b50505050565b600061040a83610610565b801561041b575061041b8383610643565b90505b92915050565b80158061049e5750604051636eb1769f60e11b81523060048201526001600160a01b03838116602483015284169063dd62ed3e90604401602060405180830381865afa158015610478573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061049c919061098e565b155b6105095760405162461bcd60e51b815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527520746f206e6f6e2d7a65726f20616c6c6f77616e636560501b60648201526084016100f7565b6040516001600160a01b03831660248201526044810182905261053990849063095ea7b360e01b906064016103c2565b505050565b6000610593826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166106cc9092919063ffffffff16565b80519091501561053957808060200190518101906105b191906109e9565b6105395760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016100f7565b6000610623826301ffc9a760e01b610643565b801561041e575061063c826001600160e01b0319610643565b1592915050565b604080516001600160e01b03198316602480830191909152825180830390910181526044909101909152602080820180516001600160e01b03166301ffc9a760e01b178152825160009392849283928392918391908a617530fa92503d915060005190508280156106b5575060208210155b80156106c15750600081115b979650505050505050565b60606106db84846000856106e5565b90505b9392505050565b6060824710156107465760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016100f7565b6001600160a01b0385163b61079d5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016100f7565b600080866001600160a01b031685876040516107b99190610a2f565b60006040518083038185875af1925050503d80600081146107f6576040519150601f19603f3d011682016040523d82523d6000602084013e6107fb565b606091505b50915091506106c1828286606083156108155750816106de565b8251156108255782518084602001fd5b8160405162461bcd60e51b81526004016100f79190610a4b565b60008083601f84011261085157600080fd5b50813567ffffffffffffffff81111561086957600080fd5b6020830191508360208260051b850101111561088457600080fd5b9250929050565b6000806000806000806000806080898b0312156108a757600080fd5b883567ffffffffffffffff808211156108bf57600080fd5b6108cb8c838d0161083f565b909a50985060208b01359150808211156108e457600080fd5b6108f08c838d0161083f565b909850965060408b013591508082111561090957600080fd5b6109158c838d0161083f565b909650945060608b013591508082111561092e57600080fd5b5061093b8b828c0161083f565b999c989b5096995094979396929594505050565b634e487b7160e01b600052603260045260246000fd5b60006020828403121561097757600080fd5b81356001600160a01b03811681146106de57600080fd5b6000602082840312156109a057600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b6000600182016109cf576109cf6109a7565b5060010190565b8082018082111561041e5761041e6109a7565b6000602082840312156109fb57600080fd5b815180151581146106de57600080fd5b60005b83811015610a26578181015183820152602001610a0e565b50506000910152565b60008251610a41818460208701610a0b565b9190910192915050565b6020815260008251806020840152610a6a816040850160208701610a0b565b601f01601f1916919091016040019291505056fea2646970667358221220161d763fa89b60a3d0f4630c5bbdc0c713ec38f4d2b93f8448c7a65a92a4596964736f6c634300081100330000000000000000000000009f931de7c610b0fb327e4f6c305610586bfa8709
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
0000000000000000000000009f931de7c610b0fb327e4f6c305610586bfa8709
-----Decoded View---------------
Arg [0] : _token (address): 0x9f931de7c610b0fb327e4f6c305610586bfa8709
-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 0000000000000000000000009f931de7c610b0fb327e4f6c305610586bfa8709
Age | Block | Fee Address | BC Fee Address | Voting Power | Jailed | Incoming |
---|