This nametag was submitted by Kleros Scout.
Latest 25 from a total of 4,914 transactions
| Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
|---|---|---|---|---|---|---|---|---|---|
| Request Market R... | 39418888 | 33 mins ago | IN | 0 ETH | 0.0000006 | ||||
| Request Market R... | 39417897 | 1 hr ago | IN | 0 ETH | 0.00000071 | ||||
| Request Market R... | 39417177 | 1 hr ago | IN | 0 ETH | 0.00000082 | ||||
| Request Market R... | 39416457 | 1 hr ago | IN | 0 ETH | 0.00000062 | ||||
| Request Market R... | 39416455 | 1 hr ago | IN | 0 ETH | 0.00000095 | ||||
| Request Market R... | 39412407 | 4 hrs ago | IN | 0 ETH | 0.00000093 | ||||
| Request Market R... | 39411864 | 4 hrs ago | IN | 0 ETH | 0.00000082 | ||||
| Request Market R... | 39411449 | 4 hrs ago | IN | 0 ETH | 0.00000107 | ||||
| Request Market R... | 39411447 | 4 hrs ago | IN | 0 ETH | 0.00000078 | ||||
| Request Market R... | 39411414 | 4 hrs ago | IN | 0 ETH | 0.00000071 | ||||
| Request Market R... | 39409618 | 5 hrs ago | IN | 0 ETH | 0.00000064 | ||||
| Request Market R... | 39409617 | 5 hrs ago | IN | 0 ETH | 0.00000107 | ||||
| Request Market R... | 39409557 | 5 hrs ago | IN | 0 ETH | 0.00000093 | ||||
| Request Market R... | 39409556 | 5 hrs ago | IN | 0 ETH | 0.00000078 | ||||
| Request Market R... | 39407907 | 6 hrs ago | IN | 0 ETH | 0.0000006 | ||||
| Request Market R... | 39407819 | 6 hrs ago | IN | 0 ETH | 0.00000092 | ||||
| Request Market R... | 39407818 | 6 hrs ago | IN | 0 ETH | 0.00000064 | ||||
| Request Market R... | 39407759 | 6 hrs ago | IN | 0 ETH | 0.00000107 | ||||
| Request Market R... | 39407758 | 6 hrs ago | IN | 0 ETH | 0.00000107 | ||||
| Request Market R... | 39407756 | 6 hrs ago | IN | 0 ETH | 0.00000107 | ||||
| Request Market R... | 39407456 | 6 hrs ago | IN | 0 ETH | 0.00000071 | ||||
| Request Market R... | 39406107 | 7 hrs ago | IN | 0 ETH | 0.00000082 | ||||
| Request Market R... | 39405928 | 7 hrs ago | IN | 0 ETH | 0.00000107 | ||||
| Request Market R... | 39405868 | 7 hrs ago | IN | 0 ETH | 0.0000006 | ||||
| Request Market R... | 39405867 | 7 hrs ago | IN | 0 ETH | 0.00000107 |
Cross-Chain Transactions
Loading...
Loading
Contract Name:
ChainlinkResolver
Compiler Version
v0.8.20+commit.a1b79de6
Optimization Enabled:
Yes with 200 runs
Other Settings:
paris EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
// external
import "@chainlink/contracts/src/v0.8/ChainlinkClient.sol";
import "@openzeppelin/contracts/utils/Pausable.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "../../interfaces/ISportsAMMV2.sol";
import "../../interfaces/ISportsAMMV2ResultManager.sol";
contract ChainlinkResolver is ChainlinkClient, Ownable, Pausable {
using Chainlink for Chainlink.Request;
using SafeERC20 for IERC20;
uint private constant ONE = 1e18;
ISportsAMMV2 public sportsAMM;
ISportsAMMV2ResultManager public resultManager;
bytes32 public jobSpecId;
uint public paymentAmount;
IERC20 public linkToken;
mapping(bytes32 => bool) public requestIdFulfilled;
struct MarketResolveData {
bytes32 requestId;
string[] _gameIds;
string[] _typeIds;
string[] _playerIds;
}
mapping(bytes32 => MarketResolveData) public requestIdToMarketResolveData;
uint public requestCounter;
mapping(uint => bytes32) public counterToRequestId;
constructor(
address _link,
address _oracle,
address _sportsAMM,
address _resultManager,
bytes32 _jobSpecId,
uint _paymentAmount
) Ownable(msg.sender) {
setChainlinkToken(_link);
setChainlinkOracle(_oracle);
linkToken = IERC20(_link);
sportsAMM = ISportsAMMV2(_sportsAMM);
resultManager = ISportsAMMV2ResultManager(_resultManager);
jobSpecId = _jobSpecId;
paymentAmount = _paymentAmount;
}
/// @notice requestMarketResolving
/// @param _sportId sports id
/// @param _date date on which game/games are played
/// @param _gameIds for which to request resolving
/// @param _typeIds for which to request resolving
/// @param _playerIds for which to request resolving
function requestMarketResolving(
uint256 _sportId,
uint256 _date,
string[] calldata _gameIds,
string[] calldata _typeIds,
string[] calldata _playerIds
) external whenNotPaused {
require(
_gameIds.length > 0 && _gameIds.length == _typeIds.length && _typeIds.length == _playerIds.length,
"Requested data has to be of same length"
);
Chainlink.Request memory req;
req = buildChainlinkRequest(jobSpecId, address(this), this.fulfillMarketResolve.selector);
req.addUint("date", _date);
req.addUint("sportId", _sportId);
req.addStringArray("gameIds", _gameIds);
req.addStringArray("typeIds", _typeIds);
req.addStringArray("playerIds", _playerIds);
_putLink(msg.sender, paymentAmount);
bytes32 requestId = sendChainlinkRequest(req, paymentAmount);
MarketResolveData memory data = MarketResolveData(requestId, _gameIds, _typeIds, _playerIds);
requestIdToMarketResolveData[requestId] = data;
counterToRequestId[requestCounter++] = requestId;
emit MarketResolvingRequested(msg.sender, _gameIds, _typeIds, _playerIds);
}
/// @notice fulfillMarketResolve
/// @param _requestId which is being responded to
/// @param _results to use for resolving
function fulfillMarketResolve(
bytes32 _requestId,
int24[][] calldata _results
) external whenNotPaused recordChainlinkFulfillment(_requestId) {
//might be redundant as already done by Chainlink Client, but making double sure
require(!requestIdFulfilled[_requestId], "Request ID already fulfilled");
MarketResolveData memory marketData = requestIdToMarketResolveData[_requestId];
bytes32[] memory _gameIds = new bytes32[](marketData._gameIds.length);
uint16[] memory _typeIds = new uint16[](marketData._typeIds.length);
uint24[] memory _playerIds = new uint24[](marketData._playerIds.length);
require(_results.length == _gameIds.length, "Results not of same length as requested");
for (uint i = 0; i < marketData._gameIds.length; i++) {
_gameIds[i] = stringToBytes32(marketData._gameIds[i]);
_typeIds[i] = uint16(st2num(marketData._typeIds[i]));
_playerIds[i] = uint24(st2num(marketData._playerIds[i]));
}
resultManager.setResultsPerMarkets(_gameIds, _typeIds, _playerIds, _results);
requestIdFulfilled[_requestId] = true;
emit FulfillMarketResolveCall(_requestId, marketData._gameIds, marketData._typeIds, marketData._playerIds, _results);
}
/* ========== INTERNALS ========== */
function _putLink(address _sender, uint _payment) internal {
linkToken.safeTransferFrom(_sender, address(this), _payment);
}
function stringToBytes32(string memory source) internal pure returns (bytes32 result) {
bytes memory tempEmptyStringTest = bytes(source);
if (tempEmptyStringTest.length == 0) {
return 0x0;
}
assembly {
result := mload(add(source, 32))
}
}
function st2num(string memory numString) internal pure returns (uint) {
uint val = 0;
bytes memory stringBytes = bytes(numString);
for (uint i = 0; i < stringBytes.length; i++) {
uint exp = stringBytes.length - i;
bytes1 ival = stringBytes[i];
uint8 uval = uint8(ival);
uint jval = uval - uint(0x30);
val += (uint(jval) * (10 ** (exp - 1)));
}
return val;
}
//////////// SETTERS
/// @notice pause resolving
/// @param _setPausing whether to pause or unpause
function setPaused(bool _setPausing) external onlyOwner {
_setPausing ? _pause() : _unpause();
}
/// @notice setConfiguration
/// @param _link paymentAmount token
/// @param _oracle CL node that will execute the requests
/// @param _sportsAMM address
/// @param _resultManager address
/// @param _jobSpecId CL node job spec ID
/// @param _paymentAmount amount of paymentAmount token for each request
function setConfiguration(
address _link,
address _oracle,
address _sportsAMM,
address _resultManager,
bytes32 _jobSpecId,
uint _paymentAmount
) external onlyOwner {
setChainlinkToken(_link);
setChainlinkOracle(_oracle);
linkToken = IERC20(_link);
sportsAMM = ISportsAMMV2(_sportsAMM);
resultManager = ISportsAMMV2ResultManager(_resultManager);
jobSpecId = _jobSpecId;
paymentAmount = _paymentAmount;
emit ContextReset(_link, _oracle, _sportsAMM, _resultManager, _jobSpecId, _paymentAmount);
}
/////// EVENTS
event ContextReset(
address _link,
address _oracle,
address _sportsAMM,
address _resultManager,
bytes32 _jobSpecId,
uint _paymentAmount
);
event MarketResolvingRequested(address requester, string[] _gameIds, string[] _typeIds, string[] _playerIds);
event FulfillMarketResolveCall(
bytes32 requestId,
string[] _gameIds,
string[] _typeIds,
string[] _playerIds,
int24[][] _results
);
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import {CBORChainlink} from "./vendor/CBORChainlink.sol";
import {BufferChainlink} from "./vendor/BufferChainlink.sol";
/**
* @title Library for common Chainlink functions
* @dev Uses imported CBOR library for encoding to buffer
*/
library Chainlink {
uint256 internal constant defaultBufferSize = 256; // solhint-disable-line const-name-snakecase
using CBORChainlink for BufferChainlink.buffer;
struct Request {
bytes32 id;
address callbackAddress;
bytes4 callbackFunctionId;
uint256 nonce;
BufferChainlink.buffer buf;
}
/**
* @notice Initializes a Chainlink request
* @dev Sets the ID, callback address, and callback function signature on the request
* @param self The uninitialized request
* @param jobId The Job Specification ID
* @param callbackAddr The callback address
* @param callbackFunc The callback function signature
* @return The initialized request
*/
function initialize(
Request memory self,
bytes32 jobId,
address callbackAddr,
bytes4 callbackFunc
) internal pure returns (Chainlink.Request memory) {
BufferChainlink.init(self.buf, defaultBufferSize);
self.id = jobId;
self.callbackAddress = callbackAddr;
self.callbackFunctionId = callbackFunc;
return self;
}
/**
* @notice Sets the data for the buffer without encoding CBOR on-chain
* @dev CBOR can be closed with curly-brackets {} or they can be left off
* @param self The initialized request
* @param data The CBOR data
*/
function setBuffer(Request memory self, bytes memory data) internal pure {
BufferChainlink.init(self.buf, data.length);
BufferChainlink.append(self.buf, data);
}
/**
* @notice Adds a string value to the request with a given key name
* @param self The initialized request
* @param key The name of the key
* @param value The string value to add
*/
function add(
Request memory self,
string memory key,
string memory value
) internal pure {
self.buf.encodeString(key);
self.buf.encodeString(value);
}
/**
* @notice Adds a bytes value to the request with a given key name
* @param self The initialized request
* @param key The name of the key
* @param value The bytes value to add
*/
function addBytes(
Request memory self,
string memory key,
bytes memory value
) internal pure {
self.buf.encodeString(key);
self.buf.encodeBytes(value);
}
/**
* @notice Adds a int256 value to the request with a given key name
* @param self The initialized request
* @param key The name of the key
* @param value The int256 value to add
*/
function addInt(
Request memory self,
string memory key,
int256 value
) internal pure {
self.buf.encodeString(key);
self.buf.encodeInt(value);
}
/**
* @notice Adds a uint256 value to the request with a given key name
* @param self The initialized request
* @param key The name of the key
* @param value The uint256 value to add
*/
function addUint(
Request memory self,
string memory key,
uint256 value
) internal pure {
self.buf.encodeString(key);
self.buf.encodeUInt(value);
}
/**
* @notice Adds an array of strings to the request with a given key name
* @param self The initialized request
* @param key The name of the key
* @param values The array of string values to add
*/
function addStringArray(
Request memory self,
string memory key,
string[] memory values
) internal pure {
self.buf.encodeString(key);
self.buf.startArray();
for (uint256 i = 0; i < values.length; i++) {
self.buf.encodeString(values[i]);
}
self.buf.endSequence();
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./Chainlink.sol";
import "./interfaces/ENSInterface.sol";
import "./interfaces/LinkTokenInterface.sol";
import "./interfaces/ChainlinkRequestInterface.sol";
import "./interfaces/OperatorInterface.sol";
import "./interfaces/PointerInterface.sol";
import {ENSResolver as ENSResolver_Chainlink} from "./vendor/ENSResolver.sol";
/**
* @title The ChainlinkClient contract
* @notice Contract writers can inherit this contract in order to create requests for the
* Chainlink network
*/
abstract contract ChainlinkClient {
using Chainlink for Chainlink.Request;
uint256 internal constant LINK_DIVISIBILITY = 10**18;
uint256 private constant AMOUNT_OVERRIDE = 0;
address private constant SENDER_OVERRIDE = address(0);
uint256 private constant ORACLE_ARGS_VERSION = 1;
uint256 private constant OPERATOR_ARGS_VERSION = 2;
bytes32 private constant ENS_TOKEN_SUBNAME = keccak256("link");
bytes32 private constant ENS_ORACLE_SUBNAME = keccak256("oracle");
address private constant LINK_TOKEN_POINTER = 0xC89bD4E1632D3A43CB03AAAd5262cbe4038Bc571;
ENSInterface private s_ens;
bytes32 private s_ensNode;
LinkTokenInterface private s_link;
OperatorInterface private s_oracle;
uint256 private s_requestCount = 1;
mapping(bytes32 => address) private s_pendingRequests;
event ChainlinkRequested(bytes32 indexed id);
event ChainlinkFulfilled(bytes32 indexed id);
event ChainlinkCancelled(bytes32 indexed id);
/**
* @notice Creates a request that can hold additional parameters
* @param specId The Job Specification ID that the request will be created for
* @param callbackAddr address to operate the callback on
* @param callbackFunctionSignature function signature to use for the callback
* @return A Chainlink Request struct in memory
*/
function buildChainlinkRequest(
bytes32 specId,
address callbackAddr,
bytes4 callbackFunctionSignature
) internal pure returns (Chainlink.Request memory) {
Chainlink.Request memory req;
return req.initialize(specId, callbackAddr, callbackFunctionSignature);
}
/**
* @notice Creates a request that can hold additional parameters
* @param specId The Job Specification ID that the request will be created for
* @param callbackFunctionSignature function signature to use for the callback
* @return A Chainlink Request struct in memory
*/
function buildOperatorRequest(bytes32 specId, bytes4 callbackFunctionSignature)
internal
view
returns (Chainlink.Request memory)
{
Chainlink.Request memory req;
return req.initialize(specId, address(this), callbackFunctionSignature);
}
/**
* @notice Creates a Chainlink request to the stored oracle address
* @dev Calls `chainlinkRequestTo` with the stored oracle address
* @param req The initialized Chainlink Request
* @param payment The amount of LINK to send for the request
* @return requestId The request ID
*/
function sendChainlinkRequest(Chainlink.Request memory req, uint256 payment) internal returns (bytes32) {
return sendChainlinkRequestTo(address(s_oracle), req, payment);
}
/**
* @notice Creates a Chainlink request to the specified oracle address
* @dev Generates and stores a request ID, increments the local nonce, and uses `transferAndCall` to
* send LINK which creates a request on the target oracle contract.
* Emits ChainlinkRequested event.
* @param oracleAddress The address of the oracle for the request
* @param req The initialized Chainlink Request
* @param payment The amount of LINK to send for the request
* @return requestId The request ID
*/
function sendChainlinkRequestTo(
address oracleAddress,
Chainlink.Request memory req,
uint256 payment
) internal returns (bytes32 requestId) {
uint256 nonce = s_requestCount;
s_requestCount = nonce + 1;
bytes memory encodedRequest = abi.encodeWithSelector(
ChainlinkRequestInterface.oracleRequest.selector,
SENDER_OVERRIDE, // Sender value - overridden by onTokenTransfer by the requesting contract's address
AMOUNT_OVERRIDE, // Amount value - overridden by onTokenTransfer by the actual amount of LINK sent
req.id,
address(this),
req.callbackFunctionId,
nonce,
ORACLE_ARGS_VERSION,
req.buf.buf
);
return _rawRequest(oracleAddress, nonce, payment, encodedRequest);
}
/**
* @notice Creates a Chainlink request to the stored oracle address
* @dev This function supports multi-word response
* @dev Calls `sendOperatorRequestTo` with the stored oracle address
* @param req The initialized Chainlink Request
* @param payment The amount of LINK to send for the request
* @return requestId The request ID
*/
function sendOperatorRequest(Chainlink.Request memory req, uint256 payment) internal returns (bytes32) {
return sendOperatorRequestTo(address(s_oracle), req, payment);
}
/**
* @notice Creates a Chainlink request to the specified oracle address
* @dev This function supports multi-word response
* @dev Generates and stores a request ID, increments the local nonce, and uses `transferAndCall` to
* send LINK which creates a request on the target oracle contract.
* Emits ChainlinkRequested event.
* @param oracleAddress The address of the oracle for the request
* @param req The initialized Chainlink Request
* @param payment The amount of LINK to send for the request
* @return requestId The request ID
*/
function sendOperatorRequestTo(
address oracleAddress,
Chainlink.Request memory req,
uint256 payment
) internal returns (bytes32 requestId) {
uint256 nonce = s_requestCount;
s_requestCount = nonce + 1;
bytes memory encodedRequest = abi.encodeWithSelector(
OperatorInterface.operatorRequest.selector,
SENDER_OVERRIDE, // Sender value - overridden by onTokenTransfer by the requesting contract's address
AMOUNT_OVERRIDE, // Amount value - overridden by onTokenTransfer by the actual amount of LINK sent
req.id,
req.callbackFunctionId,
nonce,
OPERATOR_ARGS_VERSION,
req.buf.buf
);
return _rawRequest(oracleAddress, nonce, payment, encodedRequest);
}
/**
* @notice Make a request to an oracle
* @param oracleAddress The address of the oracle for the request
* @param nonce used to generate the request ID
* @param payment The amount of LINK to send for the request
* @param encodedRequest data encoded for request type specific format
* @return requestId The request ID
*/
function _rawRequest(
address oracleAddress,
uint256 nonce,
uint256 payment,
bytes memory encodedRequest
) private returns (bytes32 requestId) {
requestId = keccak256(abi.encodePacked(this, nonce));
s_pendingRequests[requestId] = oracleAddress;
emit ChainlinkRequested(requestId);
require(s_link.transferAndCall(oracleAddress, payment, encodedRequest), "unable to transferAndCall to oracle");
}
/**
* @notice Allows a request to be cancelled if it has not been fulfilled
* @dev Requires keeping track of the expiration value emitted from the oracle contract.
* Deletes the request from the `pendingRequests` mapping.
* Emits ChainlinkCancelled event.
* @param requestId The request ID
* @param payment The amount of LINK sent for the request
* @param callbackFunc The callback function specified for the request
* @param expiration The time of the expiration for the request
*/
function cancelChainlinkRequest(
bytes32 requestId,
uint256 payment,
bytes4 callbackFunc,
uint256 expiration
) internal {
OperatorInterface requested = OperatorInterface(s_pendingRequests[requestId]);
delete s_pendingRequests[requestId];
emit ChainlinkCancelled(requestId);
requested.cancelOracleRequest(requestId, payment, callbackFunc, expiration);
}
/**
* @notice the next request count to be used in generating a nonce
* @dev starts at 1 in order to ensure consistent gas cost
* @return returns the next request count to be used in a nonce
*/
function getNextRequestCount() internal view returns (uint256) {
return s_requestCount;
}
/**
* @notice Sets the stored oracle address
* @param oracleAddress The address of the oracle contract
*/
function setChainlinkOracle(address oracleAddress) internal {
s_oracle = OperatorInterface(oracleAddress);
}
/**
* @notice Sets the LINK token address
* @param linkAddress The address of the LINK token contract
*/
function setChainlinkToken(address linkAddress) internal {
s_link = LinkTokenInterface(linkAddress);
}
/**
* @notice Sets the Chainlink token address for the public
* network as given by the Pointer contract
*/
function setPublicChainlinkToken() internal {
setChainlinkToken(PointerInterface(LINK_TOKEN_POINTER).getAddress());
}
/**
* @notice Retrieves the stored address of the LINK token
* @return The address of the LINK token
*/
function chainlinkTokenAddress() internal view returns (address) {
return address(s_link);
}
/**
* @notice Retrieves the stored address of the oracle contract
* @return The address of the oracle contract
*/
function chainlinkOracleAddress() internal view returns (address) {
return address(s_oracle);
}
/**
* @notice Allows for a request which was created on another contract to be fulfilled
* on this contract
* @param oracleAddress The address of the oracle contract that will fulfill the request
* @param requestId The request ID used for the response
*/
function addChainlinkExternalRequest(address oracleAddress, bytes32 requestId) internal notPendingRequest(requestId) {
s_pendingRequests[requestId] = oracleAddress;
}
/**
* @notice Sets the stored oracle and LINK token contracts with the addresses resolved by ENS
* @dev Accounts for subnodes having different resolvers
* @param ensAddress The address of the ENS contract
* @param node The ENS node hash
*/
function useChainlinkWithENS(address ensAddress, bytes32 node) internal {
s_ens = ENSInterface(ensAddress);
s_ensNode = node;
bytes32 linkSubnode = keccak256(abi.encodePacked(s_ensNode, ENS_TOKEN_SUBNAME));
ENSResolver_Chainlink resolver = ENSResolver_Chainlink(s_ens.resolver(linkSubnode));
setChainlinkToken(resolver.addr(linkSubnode));
updateChainlinkOracleWithENS();
}
/**
* @notice Sets the stored oracle contract with the address resolved by ENS
* @dev This may be called on its own as long as `useChainlinkWithENS` has been called previously
*/
function updateChainlinkOracleWithENS() internal {
bytes32 oracleSubnode = keccak256(abi.encodePacked(s_ensNode, ENS_ORACLE_SUBNAME));
ENSResolver_Chainlink resolver = ENSResolver_Chainlink(s_ens.resolver(oracleSubnode));
setChainlinkOracle(resolver.addr(oracleSubnode));
}
/**
* @notice Ensures that the fulfillment is valid for this contract
* @dev Use if the contract developer prefers methods instead of modifiers for validation
* @param requestId The request ID for fulfillment
*/
function validateChainlinkCallback(bytes32 requestId)
internal
recordChainlinkFulfillment(requestId)
// solhint-disable-next-line no-empty-blocks
{
}
/**
* @dev Reverts if the sender is not the oracle of the request.
* Emits ChainlinkFulfilled event.
* @param requestId The request ID for fulfillment
*/
modifier recordChainlinkFulfillment(bytes32 requestId) {
require(msg.sender == s_pendingRequests[requestId], "Source must be the oracle of the request");
delete s_pendingRequests[requestId];
emit ChainlinkFulfilled(requestId);
_;
}
/**
* @dev Reverts if the request is already pending
* @param requestId The request ID for fulfillment
*/
modifier notPendingRequest(bytes32 requestId) {
require(s_pendingRequests[requestId] == address(0), "Request is already pending");
_;
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
interface ChainlinkRequestInterface {
function oracleRequest(
address sender,
uint256 requestPrice,
bytes32 serviceAgreementID,
address callbackAddress,
bytes4 callbackFunctionId,
uint256 nonce,
uint256 dataVersion,
bytes calldata data
) external;
function cancelOracleRequest(
bytes32 requestId,
uint256 payment,
bytes4 callbackFunctionId,
uint256 expiration
) external;
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
interface ENSInterface {
// Logged when the owner of a node assigns a new owner to a subnode.
event NewOwner(bytes32 indexed node, bytes32 indexed label, address owner);
// Logged when the owner of a node transfers ownership to a new account.
event Transfer(bytes32 indexed node, address owner);
// Logged when the resolver for a node changes.
event NewResolver(bytes32 indexed node, address resolver);
// Logged when the TTL of a node changes
event NewTTL(bytes32 indexed node, uint64 ttl);
function setSubnodeOwner(
bytes32 node,
bytes32 label,
address owner
) external;
function setResolver(bytes32 node, address resolver) external;
function setOwner(bytes32 node, address owner) external;
function setTTL(bytes32 node, uint64 ttl) external;
function owner(bytes32 node) external view returns (address);
function resolver(bytes32 node) external view returns (address);
function ttl(bytes32 node) external view returns (uint64);
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
interface LinkTokenInterface {
function allowance(address owner, address spender) external view returns (uint256 remaining);
function approve(address spender, uint256 value) external returns (bool success);
function balanceOf(address owner) external view returns (uint256 balance);
function decimals() external view returns (uint8 decimalPlaces);
function decreaseApproval(address spender, uint256 addedValue) external returns (bool success);
function increaseApproval(address spender, uint256 subtractedValue) external;
function name() external view returns (string memory tokenName);
function symbol() external view returns (string memory tokenSymbol);
function totalSupply() external view returns (uint256 totalTokensIssued);
function transfer(address to, uint256 value) external returns (bool success);
function transferAndCall(
address to,
uint256 value,
bytes calldata data
) external returns (bool success);
function transferFrom(
address from,
address to,
uint256 value
) external returns (bool success);
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./OracleInterface.sol";
import "./ChainlinkRequestInterface.sol";
interface OperatorInterface is OracleInterface, ChainlinkRequestInterface {
function operatorRequest(
address sender,
uint256 payment,
bytes32 specId,
bytes4 callbackFunctionId,
uint256 nonce,
uint256 dataVersion,
bytes calldata data
) external;
function fulfillOracleRequest2(
bytes32 requestId,
uint256 payment,
address callbackAddress,
bytes4 callbackFunctionId,
uint256 expiration,
bytes calldata data
) external returns (bool);
function ownerTransferAndCall(
address to,
uint256 value,
bytes calldata data
) external returns (bool success);
function distributeFunds(address payable[] calldata receivers, uint256[] calldata amounts) external payable;
function getAuthorizedSenders() external returns (address[] memory);
function setAuthorizedSenders(address[] calldata senders) external;
function getForwarder() external returns (address);
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
interface OracleInterface {
function fulfillOracleRequest(
bytes32 requestId,
uint256 payment,
address callbackAddress,
bytes4 callbackFunctionId,
uint256 expiration,
bytes32 data
) external returns (bool);
function isAuthorizedSender(address node) external view returns (bool);
function withdraw(address recipient, uint256 amount) external;
function withdrawable() external view returns (uint256);
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
interface PointerInterface {
function getAddress() external view returns (address);
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev A library for working with mutable byte buffers in Solidity.
*
* Byte buffers are mutable and expandable, and provide a variety of primitives
* for writing to them. At any time you can fetch a bytes object containing the
* current contents of the buffer. The bytes object should not be stored between
* operations, as it may change due to resizing of the buffer.
*/
library BufferChainlink {
/**
* @dev Represents a mutable buffer. Buffers have a current value (buf) and
* a capacity. The capacity may be longer than the current value, in
* which case it can be extended without the need to allocate more memory.
*/
struct buffer {
bytes buf;
uint256 capacity;
}
/**
* @dev Initializes a buffer with an initial capacity.
* @param buf The buffer to initialize.
* @param capacity The number of bytes of space to allocate the buffer.
* @return The buffer, for chaining.
*/
function init(buffer memory buf, uint256 capacity) internal pure returns (buffer memory) {
if (capacity % 32 != 0) {
capacity += 32 - (capacity % 32);
}
// Allocate space for the buffer data
buf.capacity = capacity;
assembly {
let ptr := mload(0x40)
mstore(buf, ptr)
mstore(ptr, 0)
mstore(0x40, add(32, add(ptr, capacity)))
}
return buf;
}
/**
* @dev Initializes a new buffer from an existing bytes object.
* Changes to the buffer may mutate the original value.
* @param b The bytes object to initialize the buffer with.
* @return A new buffer.
*/
function fromBytes(bytes memory b) internal pure returns (buffer memory) {
buffer memory buf;
buf.buf = b;
buf.capacity = b.length;
return buf;
}
function resize(buffer memory buf, uint256 capacity) private pure {
bytes memory oldbuf = buf.buf;
init(buf, capacity);
append(buf, oldbuf);
}
function max(uint256 a, uint256 b) private pure returns (uint256) {
if (a > b) {
return a;
}
return b;
}
/**
* @dev Sets buffer length to 0.
* @param buf The buffer to truncate.
* @return The original buffer, for chaining..
*/
function truncate(buffer memory buf) internal pure returns (buffer memory) {
assembly {
let bufptr := mload(buf)
mstore(bufptr, 0)
}
return buf;
}
/**
* @dev Writes a byte string to a buffer. Resizes if doing so would exceed
* the capacity of the buffer.
* @param buf The buffer to append to.
* @param off The start offset to write to.
* @param data The data to append.
* @param len The number of bytes to copy.
* @return The original buffer, for chaining.
*/
function write(
buffer memory buf,
uint256 off,
bytes memory data,
uint256 len
) internal pure returns (buffer memory) {
require(len <= data.length);
if (off + len > buf.capacity) {
resize(buf, max(buf.capacity, len + off) * 2);
}
uint256 dest;
uint256 src;
assembly {
// Memory address of the buffer data
let bufptr := mload(buf)
// Length of existing buffer data
let buflen := mload(bufptr)
// Start address = buffer address + offset + sizeof(buffer length)
dest := add(add(bufptr, 32), off)
// Update buffer length if we're extending it
if gt(add(len, off), buflen) {
mstore(bufptr, add(len, off))
}
src := add(data, 32)
}
// Copy word-length chunks while possible
for (; len >= 32; len -= 32) {
assembly {
mstore(dest, mload(src))
}
dest += 32;
src += 32;
}
// Copy remaining bytes
unchecked {
uint256 mask = (256**(32 - len)) - 1;
assembly {
let srcpart := and(mload(src), not(mask))
let destpart := and(mload(dest), mask)
mstore(dest, or(destpart, srcpart))
}
}
return buf;
}
/**
* @dev Appends a byte string to a buffer. Resizes if doing so would exceed
* the capacity of the buffer.
* @param buf The buffer to append to.
* @param data The data to append.
* @param len The number of bytes to copy.
* @return The original buffer, for chaining.
*/
function append(
buffer memory buf,
bytes memory data,
uint256 len
) internal pure returns (buffer memory) {
return write(buf, buf.buf.length, data, len);
}
/**
* @dev Appends a byte string to a buffer. Resizes if doing so would exceed
* the capacity of the buffer.
* @param buf The buffer to append to.
* @param data The data to append.
* @return The original buffer, for chaining.
*/
function append(buffer memory buf, bytes memory data) internal pure returns (buffer memory) {
return write(buf, buf.buf.length, data, data.length);
}
/**
* @dev Writes a byte to the buffer. Resizes if doing so would exceed the
* capacity of the buffer.
* @param buf The buffer to append to.
* @param off The offset to write the byte at.
* @param data The data to append.
* @return The original buffer, for chaining.
*/
function writeUint8(
buffer memory buf,
uint256 off,
uint8 data
) internal pure returns (buffer memory) {
if (off >= buf.capacity) {
resize(buf, buf.capacity * 2);
}
assembly {
// Memory address of the buffer data
let bufptr := mload(buf)
// Length of existing buffer data
let buflen := mload(bufptr)
// Address = buffer address + sizeof(buffer length) + off
let dest := add(add(bufptr, off), 32)
mstore8(dest, data)
// Update buffer length if we extended it
if eq(off, buflen) {
mstore(bufptr, add(buflen, 1))
}
}
return buf;
}
/**
* @dev Appends a byte to the buffer. Resizes if doing so would exceed the
* capacity of the buffer.
* @param buf The buffer to append to.
* @param data The data to append.
* @return The original buffer, for chaining.
*/
function appendUint8(buffer memory buf, uint8 data) internal pure returns (buffer memory) {
return writeUint8(buf, buf.buf.length, data);
}
/**
* @dev Writes up to 32 bytes to the buffer. Resizes if doing so would
* exceed the capacity of the buffer.
* @param buf The buffer to append to.
* @param off The offset to write at.
* @param data The data to append.
* @param len The number of bytes to write (left-aligned).
* @return The original buffer, for chaining.
*/
function write(
buffer memory buf,
uint256 off,
bytes32 data,
uint256 len
) private pure returns (buffer memory) {
if (len + off > buf.capacity) {
resize(buf, (len + off) * 2);
}
unchecked {
uint256 mask = (256**len) - 1;
// Right-align data
data = data >> (8 * (32 - len));
assembly {
// Memory address of the buffer data
let bufptr := mload(buf)
// Address = buffer address + sizeof(buffer length) + off + len
let dest := add(add(bufptr, off), len)
mstore(dest, or(and(mload(dest), not(mask)), data))
// Update buffer length if we extended it
if gt(add(off, len), mload(bufptr)) {
mstore(bufptr, add(off, len))
}
}
}
return buf;
}
/**
* @dev Writes a bytes20 to the buffer. Resizes if doing so would exceed the
* capacity of the buffer.
* @param buf The buffer to append to.
* @param off The offset to write at.
* @param data The data to append.
* @return The original buffer, for chaining.
*/
function writeBytes20(
buffer memory buf,
uint256 off,
bytes20 data
) internal pure returns (buffer memory) {
return write(buf, off, bytes32(data), 20);
}
/**
* @dev Appends a bytes20 to the buffer. Resizes if doing so would exceed
* the capacity of the buffer.
* @param buf The buffer to append to.
* @param data The data to append.
* @return The original buffer, for chhaining.
*/
function appendBytes20(buffer memory buf, bytes20 data) internal pure returns (buffer memory) {
return write(buf, buf.buf.length, bytes32(data), 20);
}
/**
* @dev Appends a bytes32 to the buffer. Resizes if doing so would exceed
* the capacity of the buffer.
* @param buf The buffer to append to.
* @param data The data to append.
* @return The original buffer, for chaining.
*/
function appendBytes32(buffer memory buf, bytes32 data) internal pure returns (buffer memory) {
return write(buf, buf.buf.length, data, 32);
}
/**
* @dev Writes an integer to the buffer. Resizes if doing so would exceed
* the capacity of the buffer.
* @param buf The buffer to append to.
* @param off The offset to write at.
* @param data The data to append.
* @param len The number of bytes to write (right-aligned).
* @return The original buffer, for chaining.
*/
function writeInt(
buffer memory buf,
uint256 off,
uint256 data,
uint256 len
) private pure returns (buffer memory) {
if (len + off > buf.capacity) {
resize(buf, (len + off) * 2);
}
uint256 mask = (256**len) - 1;
assembly {
// Memory address of the buffer data
let bufptr := mload(buf)
// Address = buffer address + off + sizeof(buffer length) + len
let dest := add(add(bufptr, off), len)
mstore(dest, or(and(mload(dest), not(mask)), data))
// Update buffer length if we extended it
if gt(add(off, len), mload(bufptr)) {
mstore(bufptr, add(off, len))
}
}
return buf;
}
/**
* @dev Appends a byte to the end of the buffer. Resizes if doing so would
* exceed the capacity of the buffer.
* @param buf The buffer to append to.
* @param data The data to append.
* @return The original buffer.
*/
function appendInt(
buffer memory buf,
uint256 data,
uint256 len
) internal pure returns (buffer memory) {
return writeInt(buf, buf.buf.length, data, len);
}
}// SPDX-License-Identifier: MIT
pragma solidity >=0.4.19;
import {BufferChainlink} from "./BufferChainlink.sol";
library CBORChainlink {
using BufferChainlink for BufferChainlink.buffer;
uint8 private constant MAJOR_TYPE_INT = 0;
uint8 private constant MAJOR_TYPE_NEGATIVE_INT = 1;
uint8 private constant MAJOR_TYPE_BYTES = 2;
uint8 private constant MAJOR_TYPE_STRING = 3;
uint8 private constant MAJOR_TYPE_ARRAY = 4;
uint8 private constant MAJOR_TYPE_MAP = 5;
uint8 private constant MAJOR_TYPE_TAG = 6;
uint8 private constant MAJOR_TYPE_CONTENT_FREE = 7;
uint8 private constant TAG_TYPE_BIGNUM = 2;
uint8 private constant TAG_TYPE_NEGATIVE_BIGNUM = 3;
function encodeFixedNumeric(BufferChainlink.buffer memory buf, uint8 major, uint64 value) private pure {
if(value <= 23) {
buf.appendUint8(uint8((major << 5) | value));
} else if (value <= 0xFF) {
buf.appendUint8(uint8((major << 5) | 24));
buf.appendInt(value, 1);
} else if (value <= 0xFFFF) {
buf.appendUint8(uint8((major << 5) | 25));
buf.appendInt(value, 2);
} else if (value <= 0xFFFFFFFF) {
buf.appendUint8(uint8((major << 5) | 26));
buf.appendInt(value, 4);
} else {
buf.appendUint8(uint8((major << 5) | 27));
buf.appendInt(value, 8);
}
}
function encodeIndefiniteLengthType(BufferChainlink.buffer memory buf, uint8 major) private pure {
buf.appendUint8(uint8((major << 5) | 31));
}
function encodeUInt(BufferChainlink.buffer memory buf, uint value) internal pure {
if(value > 0xFFFFFFFFFFFFFFFF) {
encodeBigNum(buf, value);
} else {
encodeFixedNumeric(buf, MAJOR_TYPE_INT, uint64(value));
}
}
function encodeInt(BufferChainlink.buffer memory buf, int value) internal pure {
if(value < -0x10000000000000000) {
encodeSignedBigNum(buf, value);
} else if(value > 0xFFFFFFFFFFFFFFFF) {
encodeBigNum(buf, uint(value));
} else if(value >= 0) {
encodeFixedNumeric(buf, MAJOR_TYPE_INT, uint64(uint256(value)));
} else {
encodeFixedNumeric(buf, MAJOR_TYPE_NEGATIVE_INT, uint64(uint256(-1 - value)));
}
}
function encodeBytes(BufferChainlink.buffer memory buf, bytes memory value) internal pure {
encodeFixedNumeric(buf, MAJOR_TYPE_BYTES, uint64(value.length));
buf.append(value);
}
function encodeBigNum(BufferChainlink.buffer memory buf, uint value) internal pure {
buf.appendUint8(uint8((MAJOR_TYPE_TAG << 5) | TAG_TYPE_BIGNUM));
encodeBytes(buf, abi.encode(value));
}
function encodeSignedBigNum(BufferChainlink.buffer memory buf, int input) internal pure {
buf.appendUint8(uint8((MAJOR_TYPE_TAG << 5) | TAG_TYPE_NEGATIVE_BIGNUM));
encodeBytes(buf, abi.encode(uint256(-1 - input)));
}
function encodeString(BufferChainlink.buffer memory buf, string memory value) internal pure {
encodeFixedNumeric(buf, MAJOR_TYPE_STRING, uint64(bytes(value).length));
buf.append(bytes(value));
}
function startArray(BufferChainlink.buffer memory buf) internal pure {
encodeIndefiniteLengthType(buf, MAJOR_TYPE_ARRAY);
}
function startMap(BufferChainlink.buffer memory buf) internal pure {
encodeIndefiniteLengthType(buf, MAJOR_TYPE_MAP);
}
function endSequence(BufferChainlink.buffer memory buf) internal pure {
encodeIndefiniteLengthType(buf, MAJOR_TYPE_CONTENT_FREE);
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
abstract contract ENSResolver {
function addr(bytes32 node) public view virtual returns (address);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol)
pragma solidity ^0.8.20;
import {Context} from "../utils/Context.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* The initial owner is set to the address provided by the deployer. This can
* later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract Ownable is Context {
address private _owner;
/**
* @dev The caller account is not authorized to perform an operation.
*/
error OwnableUnauthorizedAccount(address account);
/**
* @dev The owner is not a valid owner account. (eg. `address(0)`)
*/
error OwnableInvalidOwner(address owner);
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the address provided by the deployer as the initial owner.
*/
constructor(address initialOwner) {
if (initialOwner == address(0)) {
revert OwnableInvalidOwner(address(0));
}
_transferOwnership(initialOwner);
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
_checkOwner();
_;
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if the sender is not the owner.
*/
function _checkOwner() internal view virtual {
if (owner() != _msgSender()) {
revert OwnableUnauthorizedAccount(_msgSender());
}
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby disabling any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
_transferOwnership(address(0));
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
if (newOwner == address(0)) {
revert OwnableInvalidOwner(address(0));
}
_transferOwnership(newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Internal function without access restriction.
*/
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Permit.sol)
pragma solidity ^0.8.20;
/**
* @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.
*
* ==== Security Considerations
*
* There are two important considerations concerning the use of `permit`. The first is that a valid permit signature
* expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be
* considered as an intention to spend the allowance in any specific way. The second is that because permits have
* built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should
* take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be
* generally recommended is:
*
* ```solidity
* function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public {
* try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {}
* doThing(..., value);
* }
*
* function doThing(..., uint256 value) public {
* token.safeTransferFrom(msg.sender, address(this), value);
* ...
* }
* ```
*
* Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of
* `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also
* {SafeERC20-safeTransferFrom}).
*
* Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so
* contracts should have entry points that don't rely on permit.
*/
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].
*
* CAUTION: See Security Considerations above.
*/
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 v5.0.0) (token/ERC20/IERC20.sol)
pragma solidity ^0.8.20;
/**
* @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 value of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the value of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves a `value` amount of 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 value) 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 a `value` amount of tokens 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 value) external returns (bool);
/**
* @dev Moves a `value` amount of tokens from `from` to `to` using the
* allowance mechanism. `value` 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 value) external returns (bool);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/utils/SafeERC20.sol)
pragma solidity ^0.8.20;
import {IERC20} from "../IERC20.sol";
import {IERC20Permit} from "../extensions/IERC20Permit.sol";
import {Address} from "../../../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;
/**
* @dev An operation with an ERC20 token failed.
*/
error SafeERC20FailedOperation(address token);
/**
* @dev Indicates a failed `decreaseAllowance` request.
*/
error SafeERC20FailedDecreaseAllowance(address spender, uint256 currentAllowance, uint256 requestedDecrease);
/**
* @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,
* non-reverting calls are assumed to be successful.
*/
function safeTransfer(IERC20 token, address to, uint256 value) internal {
_callOptionalReturn(token, abi.encodeCall(token.transfer, (to, value)));
}
/**
* @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the
* calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.
*/
function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
_callOptionalReturn(token, abi.encodeCall(token.transferFrom, (from, to, value)));
}
/**
* @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
* non-reverting calls are assumed to be successful.
*/
function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
uint256 oldAllowance = token.allowance(address(this), spender);
forceApprove(token, spender, oldAllowance + value);
}
/**
* @dev Decrease the calling contract's allowance toward `spender` by `requestedDecrease`. If `token` returns no
* value, non-reverting calls are assumed to be successful.
*/
function safeDecreaseAllowance(IERC20 token, address spender, uint256 requestedDecrease) internal {
unchecked {
uint256 currentAllowance = token.allowance(address(this), spender);
if (currentAllowance < requestedDecrease) {
revert SafeERC20FailedDecreaseAllowance(spender, currentAllowance, requestedDecrease);
}
forceApprove(token, spender, currentAllowance - requestedDecrease);
}
}
/**
* @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,
* non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval
* to be set to zero before setting it to a non-zero value, such as USDT.
*/
function forceApprove(IERC20 token, address spender, uint256 value) internal {
bytes memory approvalCall = abi.encodeCall(token.approve, (spender, value));
if (!_callOptionalReturnBool(token, approvalCall)) {
_callOptionalReturn(token, abi.encodeCall(token.approve, (spender, 0)));
_callOptionalReturn(token, approvalCall);
}
}
/**
* @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);
if (returndata.length != 0 && !abi.decode(returndata, (bool))) {
revert SafeERC20FailedOperation(address(token));
}
}
/**
* @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).
*
* This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.
*/
function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {
// 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 cannot use {Address-functionCall} here since this should return false
// and not revert is the subcall reverts.
(bool success, bytes memory returndata) = address(token).call(data);
return success && (returndata.length == 0 || abi.decode(returndata, (bool))) && address(token).code.length > 0;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/Address.sol)
pragma solidity ^0.8.20;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev The ETH balance of the account is not enough to perform the operation.
*/
error AddressInsufficientBalance(address account);
/**
* @dev There's no code at `target` (it is not a contract).
*/
error AddressEmptyCode(address target);
/**
* @dev A call to an address target failed. The target may have reverted.
*/
error FailedInnerCall();
/**
* @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://consensys.net/diligence/blog/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.8.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
if (address(this).balance < amount) {
revert AddressInsufficientBalance(address(this));
}
(bool success, ) = recipient.call{value: amount}("");
if (!success) {
revert FailedInnerCall();
}
}
/**
* @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 or custom error, it is bubbled
* up by this function (like regular Solidity function calls). However, if
* the call reverted with no returned reason, this function reverts with a
* {FailedInnerCall} error.
*
* 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.
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0);
}
/**
* @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`.
*/
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
if (address(this).balance < value) {
revert AddressInsufficientBalance(address(this));
}
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResultFromTarget(target, success, returndata);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResultFromTarget(target, success, returndata);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResultFromTarget(target, success, returndata);
}
/**
* @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target
* was not a contract or bubbling up the revert reason (falling back to {FailedInnerCall}) in case of an
* unsuccessful call.
*/
function verifyCallResultFromTarget(
address target,
bool success,
bytes memory returndata
) internal view returns (bytes memory) {
if (!success) {
_revert(returndata);
} else {
// only check if target is a contract if the call was successful and the return data is empty
// otherwise we already know that it was a contract
if (returndata.length == 0 && target.code.length == 0) {
revert AddressEmptyCode(target);
}
return returndata;
}
}
/**
* @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the
* revert reason or with a default {FailedInnerCall} error.
*/
function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) {
if (!success) {
_revert(returndata);
} else {
return returndata;
}
}
/**
* @dev Reverts with returndata if present. Otherwise reverts with {FailedInnerCall}.
*/
function _revert(bytes memory returndata) private pure {
// 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 FailedInnerCall();
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/Context.sol)
pragma solidity ^0.8.20;
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/Pausable.sol)
pragma solidity ^0.8.20;
import {Context} from "../utils/Context.sol";
/**
* @dev Contract module which allows children to implement an emergency stop
* mechanism that can be triggered by an authorized account.
*
* This module is used through inheritance. It will make available the
* modifiers `whenNotPaused` and `whenPaused`, which can be applied to
* the functions of your contract. Note that they will not be pausable by
* simply including this module, only once the modifiers are put in place.
*/
abstract contract Pausable is Context {
bool private _paused;
/**
* @dev Emitted when the pause is triggered by `account`.
*/
event Paused(address account);
/**
* @dev Emitted when the pause is lifted by `account`.
*/
event Unpaused(address account);
/**
* @dev The operation failed because the contract is paused.
*/
error EnforcedPause();
/**
* @dev The operation failed because the contract is not paused.
*/
error ExpectedPause();
/**
* @dev Initializes the contract in unpaused state.
*/
constructor() {
_paused = false;
}
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*
* Requirements:
*
* - The contract must not be paused.
*/
modifier whenNotPaused() {
_requireNotPaused();
_;
}
/**
* @dev Modifier to make a function callable only when the contract is paused.
*
* Requirements:
*
* - The contract must be paused.
*/
modifier whenPaused() {
_requirePaused();
_;
}
/**
* @dev Returns true if the contract is paused, and false otherwise.
*/
function paused() public view virtual returns (bool) {
return _paused;
}
/**
* @dev Throws if the contract is paused.
*/
function _requireNotPaused() internal view virtual {
if (paused()) {
revert EnforcedPause();
}
}
/**
* @dev Throws if the contract is not paused.
*/
function _requirePaused() internal view virtual {
if (!paused()) {
revert ExpectedPause();
}
}
/**
* @dev Triggers stopped state.
*
* Requirements:
*
* - The contract must not be paused.
*/
function _pause() internal virtual whenNotPaused {
_paused = true;
emit Paused(_msgSender());
}
/**
* @dev Returns to normal state.
*
* Requirements:
*
* - The contract must be paused.
*/
function _unpause() internal virtual whenPaused {
_paused = false;
emit Unpaused(_msgSender());
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
import "./IProxyBetting.sol";
interface IFreeBetsHolder is IProxyBetting {
function confirmLiveTrade(bytes32 requestId, address _createdTicket, uint _buyInAmount, address _collateral) external;
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
interface IProxyBetting {
function getActiveTicketsPerUser(uint _index, uint _pageSize, address _user) external view returns (address[] memory);
function numOfActiveTicketsPerUser(address _user) external view returns (uint);
function getResolvedTicketsPerUser(uint _index, uint _pageSize, address _user) external view returns (address[] memory);
function numOfResolvedTicketsPerUser(address _user) external view returns (uint);
function confirmTicketResolved(address _resolvedTicket) external;
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "../interfaces/ISportsAMMV2Manager.sol";
import "../interfaces/ISportsAMMV2ResultManager.sol";
import "../interfaces/ISportsAMMV2RiskManager.sol";
import "../interfaces/ISportsAMMV2Manager.sol";
import "../interfaces/IFreeBetsHolder.sol";
import "../interfaces/IStakingThalesBettingProxy.sol";
interface ISportsAMMV2 {
struct CombinedPosition {
uint16 typeId;
uint8 position;
int24 line;
}
struct TradeData {
bytes32 gameId;
uint16 sportId;
uint16 typeId;
uint maturity;
uint8 status;
int24 line;
uint24 playerId;
uint[] odds;
bytes32[] merkleProof;
uint8 position;
CombinedPosition[][] combinedPositions;
}
function defaultCollateral() external view returns (IERC20);
function manager() external view returns (ISportsAMMV2Manager);
function resultManager() external view returns (ISportsAMMV2ResultManager);
function safeBoxFee() external view returns (uint);
function exerciseTicket(address _ticket) external;
function riskManager() external view returns (ISportsAMMV2RiskManager);
function freeBetsHolder() external view returns (IFreeBetsHolder);
function stakingThalesBettingProxy() external view returns (IStakingThalesBettingProxy);
function tradeLive(
TradeData[] calldata _tradeData,
uint _buyInAmount,
uint _expectedQuote,
address _recipient,
address _referrer,
address _collateral
) external returns (address _createdTicket);
function trade(
TradeData[] calldata _tradeData,
uint _buyInAmount,
uint _expectedQuote,
uint _additionalSlippage,
address _referrer,
address _collateral,
bool _isEth
) external returns (address _createdTicket);
function tradeSystemBet(
TradeData[] calldata _tradeData,
uint _buyInAmount,
uint _expectedQuote,
uint _additionalSlippage,
address _referrer,
address _collateral,
bool _isEth,
uint8 _systemBetDenominator
) external returns (address _createdTicket);
function rootPerGame(bytes32 game) external view returns (bytes32);
function paused() external view returns (bool);
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
import "./ISportsAMMV2.sol";
interface ISportsAMMV2Manager {
enum Role {
ROOT_SETTING,
RISK_MANAGING,
MARKET_RESOLVING,
TICKET_PAUSER
}
function isWhitelistedAddress(address _address, Role role) external view returns (bool);
function decimals() external view returns (uint);
function feeToken() external view returns (address);
function isActiveTicket(address _ticket) external view returns (bool);
function getActiveTickets(uint _index, uint _pageSize) external view returns (address[] memory);
function numOfActiveTickets() external view returns (uint);
function getActiveTicketsPerUser(uint _index, uint _pageSize, address _user) external view returns (address[] memory);
function numOfActiveTicketsPerUser(address _user) external view returns (uint);
function getResolvedTicketsPerUser(uint _index, uint _pageSize, address _user) external view returns (address[] memory);
function numOfResolvedTicketsPerUser(address _user) external view returns (uint);
function getTicketsPerGame(uint _index, uint _pageSize, bytes32 _gameId) external view returns (address[] memory);
function numOfTicketsPerGame(bytes32 _gameId) external view returns (uint);
function isKnownTicket(address _ticket) external view returns (bool);
function sportsAMM() external view returns (address);
function getTicketsPerMarket(
uint _index,
uint _pageSize,
bytes32 _gameId,
uint _typeId,
uint _playerId
) external view returns (address[] memory);
function numOfTicketsPerMarket(bytes32 _gameId, uint _typeId, uint _playerId) external view returns (uint);
function addNewKnownTicket(ISportsAMMV2.TradeData[] memory _tradeData, address ticket, address user) external;
function resolveKnownTicket(address ticket, address ticketOwner) external;
function isSystemTicket(address _ticket) external view returns (bool);
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "./ISportsAMMV2.sol";
interface ISportsAMMV2ResultManager {
enum MarketPositionStatus {
Open,
Cancelled,
Winning,
Losing
}
function isMarketResolved(
bytes32 _gameId,
uint16 _typeId,
uint24 _playerId,
int24 _line,
ISportsAMMV2.CombinedPosition[] memory combinedPositions
) external view returns (bool isResolved);
function getMarketPositionStatus(
bytes32 _gameId,
uint16 _typeId,
uint24 _playerId,
int24 _line,
uint _position,
ISportsAMMV2.CombinedPosition[] memory _combinedPositions
) external view returns (MarketPositionStatus status);
function isWinningMarketPosition(
bytes32 _gameId,
uint16 _typeId,
uint24 _playerId,
int24 _line,
uint _position,
ISportsAMMV2.CombinedPosition[] memory _combinedPositions
) external view returns (bool isWinning);
function isCancelledMarketPosition(
bytes32 _gameId,
uint16 _typeId,
uint24 _playerId,
int24 _line,
uint _position,
ISportsAMMV2.CombinedPosition[] memory _combinedPositions
) external view returns (bool isCancelled);
function getResultsPerMarket(
bytes32 _gameId,
uint16 _typeId,
uint24 _playerId
) external view returns (int24[] memory results);
function resultTypePerMarketType(uint _typeId) external view returns (uint8 marketType);
function isMarketResolvedAndPositionWinning(
bytes32 _gameId,
uint16 _typeId,
uint24 _playerId,
int24 _line,
uint _position,
ISportsAMMV2.CombinedPosition[] memory _combinedPositions
) external view returns (bool isResolved, bool isWinning);
function setResultsPerMarkets(
bytes32[] memory _gameIds,
uint16[] memory _typeIds,
uint24[] memory _playerIds,
int24[][] memory _results
) external;
function isGameCancelled(bytes32 _gameId) external view returns (bool);
function cancelGames(bytes32[] memory _gameIds) external;
function cancelMarkets(
bytes32[] memory _gameIds,
uint16[] memory _typeIds,
uint24[] memory _playerIds,
int24[] memory _lines
) external;
function cancelMarket(bytes32 _gameId, uint16 _typeId, uint24 _playerId, int24 _line) external;
function cancelGame(bytes32 _gameId) external;
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
import "./ISportsAMMV2.sol";
interface ISportsAMMV2RiskManager {
struct TypeCap {
uint typeId;
uint cap;
}
struct CapData {
uint capPerSport;
uint capPerChild;
TypeCap[] capPerType;
}
struct DynamicLiquidityData {
uint cutoffTimePerSport;
uint cutoffDividerPerSport;
}
struct RiskData {
uint sportId;
CapData capData;
uint riskMultiplierPerSport;
DynamicLiquidityData dynamicLiquidityData;
}
enum RiskStatus {
NoRisk,
OutOfLiquidity,
InvalidCombination
}
function minBuyInAmount() external view returns (uint);
function maxTicketSize() external view returns (uint);
function maxSupportedAmount() external view returns (uint);
function maxSupportedOdds() external view returns (uint);
function maxAllowedSystemCombinations() external view returns (uint);
function expiryDuration() external view returns (uint);
function liveTradingPerSportAndTypeEnabled(uint _sportId, uint _typeId) external view returns (bool _enabled);
function calculateCapToBeUsed(
bytes32 _gameId,
uint16 _sportId,
uint16 _typeId,
uint24 _playerId,
int24 _line,
uint _maturity,
bool _isLive
) external view returns (uint cap);
function checkRisks(
ISportsAMMV2.TradeData[] memory _tradeData,
uint _buyInAmount,
bool _isLive,
uint8 _systemBetDenominator
) external view returns (ISportsAMMV2RiskManager.RiskStatus riskStatus, bool[] memory isMarketOutOfLiquidity);
function checkLimits(
uint _buyInAmount,
uint _totalQuote,
uint _payout,
uint _expectedPayout,
uint _additionalSlippage,
uint _ticketSize
) external view;
function spentOnGame(bytes32 _gameId) external view returns (uint);
function checkAndUpdateRisks(
ISportsAMMV2.TradeData[] memory _tradeData,
uint _buyInAmount,
bool _isLive,
uint8 _systemBetDenominator
) external;
function verifyMerkleTree(ISportsAMMV2.TradeData memory _marketTradeData, bytes32 _rootPerGame) external pure;
function isSportIdFuture(uint16 _sportsId) external view returns (bool);
function getMaxSystemBetPayout(
ISportsAMMV2.TradeData[] memory _tradeData,
uint8 _systemBetDenominator,
uint _buyInAmount,
uint _addedPayoutPercentage
) external view returns (uint systemBetPayout, uint systemBetQuote);
function generateCombinations(uint8 n, uint8 k) external pure returns (uint8[][] memory);
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
import "./IProxyBetting.sol";
interface IStakingThalesBettingProxy is IProxyBetting {
function preConfirmLiveTrade(bytes32 requestId, uint _buyInAmount) external;
function confirmLiveTrade(bytes32 requestId, address _createdTicket, uint _buyInAmount) external;
}{
"optimizer": {
"enabled": true,
"runs": 200
},
"evmVersion": "paris",
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"libraries": {}
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[{"internalType":"address","name":"_link","type":"address"},{"internalType":"address","name":"_oracle","type":"address"},{"internalType":"address","name":"_sportsAMM","type":"address"},{"internalType":"address","name":"_resultManager","type":"address"},{"internalType":"bytes32","name":"_jobSpecId","type":"bytes32"},{"internalType":"uint256","name":"_paymentAmount","type":"uint256"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"address","name":"target","type":"address"}],"name":"AddressEmptyCode","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"AddressInsufficientBalance","type":"error"},{"inputs":[],"name":"EnforcedPause","type":"error"},{"inputs":[],"name":"ExpectedPause","type":"error"},{"inputs":[],"name":"FailedInnerCall","type":"error"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"OwnableInvalidOwner","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"OwnableUnauthorizedAccount","type":"error"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"SafeERC20FailedOperation","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"id","type":"bytes32"}],"name":"ChainlinkCancelled","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"id","type":"bytes32"}],"name":"ChainlinkFulfilled","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"id","type":"bytes32"}],"name":"ChainlinkRequested","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_link","type":"address"},{"indexed":false,"internalType":"address","name":"_oracle","type":"address"},{"indexed":false,"internalType":"address","name":"_sportsAMM","type":"address"},{"indexed":false,"internalType":"address","name":"_resultManager","type":"address"},{"indexed":false,"internalType":"bytes32","name":"_jobSpecId","type":"bytes32"},{"indexed":false,"internalType":"uint256","name":"_paymentAmount","type":"uint256"}],"name":"ContextReset","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"requestId","type":"bytes32"},{"indexed":false,"internalType":"string[]","name":"_gameIds","type":"string[]"},{"indexed":false,"internalType":"string[]","name":"_typeIds","type":"string[]"},{"indexed":false,"internalType":"string[]","name":"_playerIds","type":"string[]"},{"indexed":false,"internalType":"int24[][]","name":"_results","type":"int24[][]"}],"name":"FulfillMarketResolveCall","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"requester","type":"address"},{"indexed":false,"internalType":"string[]","name":"_gameIds","type":"string[]"},{"indexed":false,"internalType":"string[]","name":"_typeIds","type":"string[]"},{"indexed":false,"internalType":"string[]","name":"_playerIds","type":"string[]"}],"name":"MarketResolvingRequested","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"counterToRequestId","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_requestId","type":"bytes32"},{"internalType":"int24[][]","name":"_results","type":"int24[][]"}],"name":"fulfillMarketResolve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"jobSpecId","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"linkToken","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"paymentAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"requestCounter","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"requestIdFulfilled","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"requestIdToMarketResolveData","outputs":[{"internalType":"bytes32","name":"requestId","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_sportId","type":"uint256"},{"internalType":"uint256","name":"_date","type":"uint256"},{"internalType":"string[]","name":"_gameIds","type":"string[]"},{"internalType":"string[]","name":"_typeIds","type":"string[]"},{"internalType":"string[]","name":"_playerIds","type":"string[]"}],"name":"requestMarketResolving","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"resultManager","outputs":[{"internalType":"contract ISportsAMMV2ResultManager","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_link","type":"address"},{"internalType":"address","name":"_oracle","type":"address"},{"internalType":"address","name":"_sportsAMM","type":"address"},{"internalType":"address","name":"_resultManager","type":"address"},{"internalType":"bytes32","name":"_jobSpecId","type":"bytes32"},{"internalType":"uint256","name":"_paymentAmount","type":"uint256"}],"name":"setConfiguration","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_setPausing","type":"bool"}],"name":"setPaused","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"sportsAMM","outputs":[{"internalType":"contract ISportsAMMV2","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"}]Contract Creation Code
608060405260016004553480156200001657600080fd5b50604051620027103803806200271083398101604081905262000039916200016c565b33806200006057604051631e4fbdf760e01b81526000600482015260240160405180910390fd5b6200006b81620000fd565b506006805460ff60a01b19169055600280546001600160a01b0319166001600160a01b038816179055600380546001600160a01b0319166001600160a01b038716179055600b80546001600160a01b03199081166001600160a01b03988916179091556007805482169588169590951790945560088054909416929095169190911790915560095550600a55620001db565b600680546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b80516001600160a01b03811681146200016757600080fd5b919050565b60008060008060008060c087890312156200018657600080fd5b62000191876200014f565b9550620001a1602088016200014f565b9450620001b1604088016200014f565b9350620001c1606088016200014f565b92506080870151915060a087015190509295509295509295565b61252580620001eb6000396000f3fe608060405234801561001057600080fd5b506004361061010b5760003560e01c806371b00be8116100a2578063973a814e11610071578063973a814e14610236578063c35905c61461023f578063c992528814610248578063d843dc951461025b578063f2fde38b1461027b57600080fd5b806371b00be8146101db5780638da5cb5b146101f25780638ff9d5cf1461020357806390421b7c1461021657600080fd5b806349379692116100de578063493796921461018357806357970e93146101965780635c975abb146101c1578063715018a6146101d357600080fd5b806301432bf21461011057806316c38b3c146101485780631e9cb0b91461015d57806349222fa014610170575b600080fd5b61013361011e366004611a42565b600c6020526000908152604090205460ff1681565b60405190151581526020015b60405180910390f35b61015b610156366004611a69565b61028e565b005b61015b61016b366004611ad1565b6102ae565b61015b61017e366004611b7d565b610577565b61015b610191366004611be4565b610c54565b600b546101a9906001600160a01b031681565b6040516001600160a01b03909116815260200161013f565b600654600160a01b900460ff16610133565b61015b610d33565b6101e460095481565b60405190815260200161013f565b6006546001600160a01b03166101a9565b6008546101a9906001600160a01b031681565b6101e4610224366004611a42565b600f6020526000908152604090205481565b6101e4600e5481565b6101e4600a5481565b6007546101a9906001600160a01b031681565b6101e4610269366004611a42565b600d6020526000908152604090205481565b61015b610289366004611c4a565b610d47565b610296610d82565b806102a6576102a3610daf565b50565b6102a3610e04565b6102b6610e47565b84158015906102c457508483145b80156102cf57508281145b6103305760405162461bcd60e51b815260206004820152602760248201527f52657175657374656420646174612068617320746f206265206f662073616d65604482015266040d8cadccee8d60cb1b60648201526084015b60405180910390fd5b61033861194a565b60095461034d9030630249117d60e51b610e72565b6040805180820190915260048152636461746560e01b60208201529091506103779082908a610e99565b6040805180820190915260078152661cdc1bdc9d125960ca1b60208201526103a19082908b610e99565b60408051808201909152600781526667616d6549647360c81b60208201526103d5906103cd888a611cab565b839190610ebc565b6040805180820190915260078152667479706549647360c81b6020820152610401906103cd8688611cab565b604080518082019091526009815268706c6179657249647360b81b602082015261042f906103cd8486611cab565b61043b33600a54610f34565b600061044982600a54610f50565b9050600060405180608001604052808381526020018a8a9061046b9190611cab565b815260200161047a888a611cab565b81526020016104898688611cab565b90526000838152600d6020908152604090912082518155818301518051939450849391926104bf92600185019290910190611985565b50604082015180516104db916002840191602090910190611985565b50606082015180516104f7916003840191602090910190611985565b5050600e8054849250600f91600091908261051183611d95565b919050558152602001908152602001600020819055507fe283ea1d842946e265a058f8c17946a5217fbd3bf0bbd188c9a75b2e5ba2f746338a8a8a8a8a8a6040516105629796959493929190611e68565b60405180910390a15050505050505050505050565b61057f610e47565b60008381526005602052604090205483906001600160a01b031633146105f85760405162461bcd60e51b815260206004820152602860248201527f536f75726365206d75737420626520746865206f7261636c65206f6620746865604482015267081c995c5d595cdd60c21b6064820152608401610327565b60008181526005602052604080822080546001600160a01b03191690555182917f7cc135e0cebb02c3480ae5d74d377283180a2601f8f644edf7987b009316c63a91a26000848152600c602052604090205460ff161561069a5760405162461bcd60e51b815260206004820152601c60248201527f5265717565737420494420616c72656164792066756c66696c6c6564000000006044820152606401610327565b6000848152600d602090815260408083208151608081018352815481526001820180548451818702810187019095528085529194929385840193909290879084015b828210156107885783829060005260206000200180546106fb90611ec3565b80601f016020809104026020016040519081016040528092919081815260200182805461072790611ec3565b80156107745780601f1061074957610100808354040283529160200191610774565b820191906000526020600020905b81548152906001019060200180831161075757829003601f168201915b5050505050815260200190600101906106dc565b50505050815260200160028201805480602002602001604051908101604052809291908181526020016000905b828210156108615783829060005260206000200180546107d490611ec3565b80601f016020809104026020016040519081016040528092919081815260200182805461080090611ec3565b801561084d5780601f106108225761010080835404028352916020019161084d565b820191906000526020600020905b81548152906001019060200180831161083057829003601f168201915b5050505050815260200190600101906107b5565b50505050815260200160038201805480602002602001604051908101604052809291908181526020016000905b8282101561093a5783829060005260206000200180546108ad90611ec3565b80601f01602080910402602001604051908101604052809291908181526020018280546108d990611ec3565b80156109265780601f106108fb57610100808354040283529160200191610926565b820191906000526020600020905b81548152906001019060200180831161090957829003601f168201915b50505050508152602001906001019061088e565b5050505081525050905060008160200151516001600160401b0381111561096357610963611c65565b60405190808252806020026020018201604052801561098c578160200160208202803683370190505b50905060008260400151516001600160401b038111156109ae576109ae611c65565b6040519080825280602002602001820160405280156109d7578160200160208202803683370190505b50905060008360600151516001600160401b038111156109f9576109f9611c65565b604051908082528060200260200182016040528015610a22578160200160208202803683370190505b5083519091508614610a865760405162461bcd60e51b815260206004820152602760248201527f526573756c7473206e6f74206f662073616d65206c656e6774682061732072656044820152661c5d595cdd195960ca1b6064820152608401610327565b60005b846020015151811015610b7957610abc85602001518281518110610aaf57610aaf611ef7565b6020026020010151610f73565b848281518110610ace57610ace611ef7565b602002602001018181525050610b0085604001518281518110610af357610af3611ef7565b6020026020010151610f92565b838281518110610b1257610b12611ef7565b602002602001019061ffff16908161ffff1681525050610b4185606001518281518110610af357610af3611ef7565b828281518110610b5357610b53611ef7565b62ffffff9092166020928302919091019091015280610b7181611d95565b915050610a89565b506008546040516319aafc5960e01b81526001600160a01b03909116906319aafc5990610bb2908690869086908d908d90600401612020565b600060405180830381600087803b158015610bcc57600080fd5b505af1158015610be0573d6000803e3d6000fd5b5050506000898152600c6020908152604091829020805460ff1916600117905586015186820151606088015192517f2a86494ce6636a05e73b9beec12a0319526bd518419db63d26ea06e75044de2f9450610c42938d9392918d908d90612161565b60405180910390a15050505050505050565b610c5c610d82565b600280546001600160a01b0319166001600160a01b038816179055600380546001600160a01b0319166001600160a01b038716179055600b80546001600160a01b038881166001600160a01b03199283168117909355600780548883169084168117909155600880548884169416841790556009869055600a8590556040805194855291891660208501529083015260608201526080810183905260a081018290527f70aea940798270dc650b39ad807316152941bb6e0fcef7e37dcc418d1109598f9060c00160405180910390a1505050505050565b610d3b610d82565b610d456000611036565b565b610d4f610d82565b6001600160a01b038116610d7957604051631e4fbdf760e01b815260006004820152602401610327565b6102a381611036565b6006546001600160a01b03163314610d455760405163118cdaa760e01b8152336004820152602401610327565b610db7611088565b6006805460ff60a01b191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b610e0c610e47565b6006805460ff60a01b1916600160a01b1790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258610de73390565b600654600160a01b900460ff1615610d455760405163d93c066560e01b815260040160405180910390fd5b610e7a61194a565b610e8261194a565b610e8e818686866110b2565b9150505b9392505050565b6080830151610ea890836110f8565b6080830151610eb7908261110f565b505050565b6080830151610ecb90836110f8565b610ed88360800151611134565b60005b8151811015610f2657610f14828281518110610ef957610ef9611ef7565b602002602001015185608001516110f890919063ffffffff16565b80610f1e81611d95565b915050610edb565b50610eb7836080015161113f565b600b54610f4c906001600160a01b031683308461114a565b5050565b600354600090610f6a906001600160a01b031684846111aa565b90505b92915050565b805160009082908203610f895750600092915050565b50506020015190565b60008082815b815181101561102d576000818351610fb091906121c2565b90506000838381518110610fc657610fc6611ef7565b01602001516001600160f81b03198116915060f81c6000610fe86030836121c2565b9050610ff56001856121c2565b61100090600a6122b9565b61100a90826122c5565b61101490886122dc565b965050505050808061102590611d95565b915050610f98565b50909392505050565b600680546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600654600160a01b900460ff16610d4557604051638dfc202b60e01b815260040160405180910390fd5b6110ba61194a565b6110ca856080015161010061123d565b50508284526001600160a01b03821660208501526001600160e01b031981166040850152835b949350505050565b61110582600383516112a2565b610eb782826113a9565b6001600160401b0381111561112857610f4c82826113d0565b610f4c826000836112a2565b6102a3816004611407565b6102a3816007611407565b604080516001600160a01b0385811660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b1790526111a490859061141c565b50505050565b6004546000906111bb8160016122dc565b600455835160408086015160808701515191516000936320214ca360e11b936111f39386938493923092918a916001916024016122ef565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b03199093169290921790915290506112338683868461147f565b9695505050505050565b60408051808201909152606081526000602082015261125d602083612357565b156112855761126d602083612357565b6112789060206121c2565b61128290836122dc565b91505b506020828101829052604080518085526000815290920101905290565b6017816001600160401b0316116112c6576111a48360e0600585901b1683176115dd565b60ff816001600160401b031611611302576112ec836018611fe0600586901b16176115dd565b506111a4836001600160401b0383166001611602565b61ffff816001600160401b03161161133f57611329836019611fe0600586901b16176115dd565b506111a4836001600160401b0383166002611602565b63ffffffff816001600160401b03161161137e5761136883601a611fe0600586901b16176115dd565b506111a4836001600160401b0383166004611602565b61139383601b611fe0600586901b16176115dd565b506111a4836001600160401b0383166008611602565b604080518082019091526060815260006020820152610f6a83846000015151848551611628565b6113db8260c26115dd565b50610f4c82826040516020016113f391815260200190565b604051602081830303815290604052611712565b610eb782601f611fe0600585901b16176115dd565b60006114316001600160a01b0384168361171f565b905080516000141580156114565750808060200190518101906114549190612379565b155b15610eb757604051635274afe760e01b81526001600160a01b0384166004820152602401610327565b6040516bffffffffffffffffffffffff193060601b1660208201526034810184905260009060540160408051808303601f1901815282825280516020918201206000818152600590925291812080546001600160a01b0319166001600160a01b038a1617905590925082917fb5e6e01e79f91267dc17b4e6314d5d4d03593d2ceee0fbb452b750bd70ea5af99190a2600254604051630200057560e51b81526001600160a01b0390911690634000aea09061154290889087908790600401612396565b6020604051808303816000875af1158015611561573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115859190612379565b6110f05760405162461bcd60e51b815260206004820152602360248201527f756e61626c6520746f207472616e73666572416e6443616c6c20746f206f7261604482015262636c6560e81b6064820152608401610327565b604080518082019091526060815260006020820152610f6a838460000151518461172d565b6040805180820190915260608152600060208201526110f0848560000151518585611788565b604080518082019091526060815260006020820152825182111561164b57600080fd5b602085015161165a83866122dc565b111561168d5761168d8561167d8760200151878661167891906122dc565b611809565b6116889060026122c5565b611820565b6000808651805187602083010193508088870111156116ac5787860182525b505050602084015b602084106116ec57805182526116cb6020836122dc565b91506116d86020826122dc565b90506116e56020856121c2565b93506116b4565b51815160001960208690036101000a019081169019919091161790525083949350505050565b61110582600283516112a2565b6060610f6a83836000611837565b6040805180820190915260608152600060208201528360200151831061176257611762848560200151600261168891906122c5565b835180516020858301018481535080850361177e576001810182525b5093949350505050565b60408051808201909152606081526000602082015260208501516117ac85846122dc565b11156117c0576117c08561167d86856122dc565b600060016117d0846101006122b9565b6117da91906121c2565b90508551838682010185831982511617815250805184870111156117fe5783860181525b509495945050505050565b60008183111561181a575081610f6d565b50919050565b815161182c838361123d565b506111a483826113a9565b60608147101561185c5760405163cd78605960e01b8152306004820152602401610327565b600080856001600160a01b0316848660405161187891906123c6565b60006040518083038185875af1925050503d80600081146118b5576040519150601f19603f3d011682016040523d82523d6000602084013e6118ba565b606091505b50915091506112338683836060826118da576118d582611921565b610e92565b81511580156118f157506001600160a01b0384163b155b1561191a57604051639996b31560e01b81526001600160a01b0385166004820152602401610327565b5080610e92565b8051156119315780518082602001fd5b604051630a12f52160e11b815260040160405180910390fd5b6040805160a0810182526000808252602080830182905282840182905260608084018390528451808601909552845283015290608082015290565b8280548282559060005260206000209081019282156119cb579160200282015b828111156119cb57825182906119bb9082612430565b50916020019190600101906119a5565b506119d79291506119db565b5090565b808211156119d75760006119ef82826119f8565b506001016119db565b508054611a0490611ec3565b6000825580601f10611a14575050565b601f0160209004906000526020600020908101906102a391905b808211156119d75760008155600101611a2e565b600060208284031215611a5457600080fd5b5035919050565b80151581146102a357600080fd5b600060208284031215611a7b57600080fd5b8135610e9281611a5b565b60008083601f840112611a9857600080fd5b5081356001600160401b03811115611aaf57600080fd5b6020830191508360208260051b8501011115611aca57600080fd5b9250929050565b60008060008060008060008060a0898b031215611aed57600080fd5b883597506020890135965060408901356001600160401b0380821115611b1257600080fd5b611b1e8c838d01611a86565b909850965060608b0135915080821115611b3757600080fd5b611b438c838d01611a86565b909650945060808b0135915080821115611b5c57600080fd5b50611b698b828c01611a86565b999c989b5096995094979396929594505050565b600080600060408486031215611b9257600080fd5b8335925060208401356001600160401b03811115611baf57600080fd5b611bbb86828701611a86565b9497909650939450505050565b80356001600160a01b0381168114611bdf57600080fd5b919050565b60008060008060008060c08789031215611bfd57600080fd5b611c0687611bc8565b9550611c1460208801611bc8565b9450611c2260408801611bc8565b9350611c3060608801611bc8565b92506080870135915060a087013590509295509295509295565b600060208284031215611c5c57600080fd5b610f6a82611bc8565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b0381118282101715611ca357611ca3611c65565b604052919050565b60006001600160401b0380841115611cc557611cc5611c65565b8360051b6020611cd6818301611c7b565b868152918501918181019036841115611cee57600080fd5b865b84811015611d7357803586811115611d085760008081fd5b8801601f3681830112611d1b5760008081fd5b813588811115611d2d57611d2d611c65565b611d3e818301601f19168801611c7b565b91508082523687828501011115611d555760008081fd5b80878401888401376000908201870152845250918301918301611cf0565b50979650505050505050565b634e487b7160e01b600052601160045260246000fd5b600060018201611da757611da7611d7f565b5060010190565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b81835260006020808501808196508560051b810191508460005b87811015611e5b5782840389528135601e19883603018112611e1257600080fd5b870185810190356001600160401b03811115611e2d57600080fd5b803603821315611e3c57600080fd5b611e47868284611dae565b9a87019a9550505090840190600101611df1565b5091979650505050505050565b6001600160a01b0388168152608060208201819052600090611e8d908301888a611dd7565b8281036040840152611ea0818789611dd7565b90508281036060840152611eb5818587611dd7565b9a9950505050505050505050565b600181811c90821680611ed757607f821691505b60208210810361181a57634e487b7160e01b600052602260045260246000fd5b634e487b7160e01b600052603260045260246000fd5b600081518084526020808501945080840160005b838110156117fe57815162ffffff1687529582019590820190600101611f21565b818352600060208085019450826000805b86811015611f7f5782358060020b808214611f6c578384fd5b8952509683019691830191600101611f53565b50959695505050505050565b81835260006020808501808196506005915085821b81018560005b88811015612012578383038a528135601e19893603018112611fc757600080fd5b880186810190356001600160401b03811115611fe257600080fd5b80871b3603821315611ff357600080fd5b611ffe858284611f42565b9b88019b9450505090850190600101611fa6565b509098975050505050505050565b6080808252865190820181905260009060209060a0840190828a01845b828110156120595781518452928401929084019060010161203d565b5050508381038285015287518082528883019183019060005b8181101561209257835161ffff1683529284019291840191600101612072565b505084810360408601526120a68189611f0d565b9250505082810360608401526120bd818587611f8b565b98975050505050505050565b60005b838110156120e45781810151838201526020016120cc565b50506000910152565b600081518084526121058160208601602086016120c9565b601f01601f19169290920160200192915050565b600081518084526020808501808196508360051b8101915082860160005b85811015611e5b57828403895261214f8483516120ed565b98850198935090840190600101612137565b86815260a06020820152600061217a60a0830188612119565b828103604084015261218c8188612119565b905082810360608401526121a08187612119565b905082810360808401526121b5818587611f8b565b9998505050505050505050565b81810381811115610f6d57610f6d611d7f565b600181815b808511156122105781600019048211156121f6576121f6611d7f565b8085161561220357918102915b93841c93908002906121da565b509250929050565b60008261222757506001610f6d565b8161223457506000610f6d565b816001811461224a576002811461225457612270565b6001915050610f6d565b60ff84111561226557612265611d7f565b50506001821b610f6d565b5060208310610133831016604e8410600b8410161715612293575081810a610f6d565b61229d83836121d5565b80600019048211156122b1576122b1611d7f565b029392505050565b6000610f6a8383612218565b8082028115828204841417610f6d57610f6d611d7f565b80820180821115610f6d57610f6d611d7f565b6001600160a01b0389811682526020820189905260408201889052861660608201526001600160e01b03198516608082015260a0810184905260c0810183905261010060e08201819052600090612348838201856120ed565b9b9a5050505050505050505050565b60008261237457634e487b7160e01b600052601260045260246000fd5b500690565b60006020828403121561238b57600080fd5b8151610e9281611a5b565b60018060a01b03841681528260208201526060604082015260006123bd60608301846120ed565b95945050505050565b600082516123d88184602087016120c9565b9190910192915050565b601f821115610eb757600081815260208120601f850160051c810160208610156124095750805b601f850160051c820191505b8181101561242857828155600101612415565b505050505050565b81516001600160401b0381111561244957612449611c65565b61245d816124578454611ec3565b846123e2565b602080601f831160018114612492576000841561247a5750858301515b600019600386901b1c1916600185901b178555612428565b600085815260208120601f198616915b828110156124c1578886015182559484019460019091019084016124a2565b50858210156124df5787850151600019600388901b60f8161c191681555b5050505050600190811b0190555056fea2646970667358221220d1f68d2eabf55998c62c33c81211616958862e379f718d32ed78e5d31b117a7d64736f6c63430008140033000000000000000000000000149459ad88d23d2ce0f4f1371203db2122331d94000000000000000000000000b7dec0966366ecc5a1906f83caa12cca2edb0a8c00000000000000000000000076923cdde21928ddbec4b8bfdc8143bb6d0841a8000000000000000000000000e4123fdc540fd3f969d71ec14e0839dc63a11ae661313139393636633462386434383738386335633763333962356338383532640000000000000000000000000000000000000000000000000de0b6b3a7640000
Deployed Bytecode
0x608060405234801561001057600080fd5b506004361061010b5760003560e01c806371b00be8116100a2578063973a814e11610071578063973a814e14610236578063c35905c61461023f578063c992528814610248578063d843dc951461025b578063f2fde38b1461027b57600080fd5b806371b00be8146101db5780638da5cb5b146101f25780638ff9d5cf1461020357806390421b7c1461021657600080fd5b806349379692116100de578063493796921461018357806357970e93146101965780635c975abb146101c1578063715018a6146101d357600080fd5b806301432bf21461011057806316c38b3c146101485780631e9cb0b91461015d57806349222fa014610170575b600080fd5b61013361011e366004611a42565b600c6020526000908152604090205460ff1681565b60405190151581526020015b60405180910390f35b61015b610156366004611a69565b61028e565b005b61015b61016b366004611ad1565b6102ae565b61015b61017e366004611b7d565b610577565b61015b610191366004611be4565b610c54565b600b546101a9906001600160a01b031681565b6040516001600160a01b03909116815260200161013f565b600654600160a01b900460ff16610133565b61015b610d33565b6101e460095481565b60405190815260200161013f565b6006546001600160a01b03166101a9565b6008546101a9906001600160a01b031681565b6101e4610224366004611a42565b600f6020526000908152604090205481565b6101e4600e5481565b6101e4600a5481565b6007546101a9906001600160a01b031681565b6101e4610269366004611a42565b600d6020526000908152604090205481565b61015b610289366004611c4a565b610d47565b610296610d82565b806102a6576102a3610daf565b50565b6102a3610e04565b6102b6610e47565b84158015906102c457508483145b80156102cf57508281145b6103305760405162461bcd60e51b815260206004820152602760248201527f52657175657374656420646174612068617320746f206265206f662073616d65604482015266040d8cadccee8d60cb1b60648201526084015b60405180910390fd5b61033861194a565b60095461034d9030630249117d60e51b610e72565b6040805180820190915260048152636461746560e01b60208201529091506103779082908a610e99565b6040805180820190915260078152661cdc1bdc9d125960ca1b60208201526103a19082908b610e99565b60408051808201909152600781526667616d6549647360c81b60208201526103d5906103cd888a611cab565b839190610ebc565b6040805180820190915260078152667479706549647360c81b6020820152610401906103cd8688611cab565b604080518082019091526009815268706c6179657249647360b81b602082015261042f906103cd8486611cab565b61043b33600a54610f34565b600061044982600a54610f50565b9050600060405180608001604052808381526020018a8a9061046b9190611cab565b815260200161047a888a611cab565b81526020016104898688611cab565b90526000838152600d6020908152604090912082518155818301518051939450849391926104bf92600185019290910190611985565b50604082015180516104db916002840191602090910190611985565b50606082015180516104f7916003840191602090910190611985565b5050600e8054849250600f91600091908261051183611d95565b919050558152602001908152602001600020819055507fe283ea1d842946e265a058f8c17946a5217fbd3bf0bbd188c9a75b2e5ba2f746338a8a8a8a8a8a6040516105629796959493929190611e68565b60405180910390a15050505050505050505050565b61057f610e47565b60008381526005602052604090205483906001600160a01b031633146105f85760405162461bcd60e51b815260206004820152602860248201527f536f75726365206d75737420626520746865206f7261636c65206f6620746865604482015267081c995c5d595cdd60c21b6064820152608401610327565b60008181526005602052604080822080546001600160a01b03191690555182917f7cc135e0cebb02c3480ae5d74d377283180a2601f8f644edf7987b009316c63a91a26000848152600c602052604090205460ff161561069a5760405162461bcd60e51b815260206004820152601c60248201527f5265717565737420494420616c72656164792066756c66696c6c6564000000006044820152606401610327565b6000848152600d602090815260408083208151608081018352815481526001820180548451818702810187019095528085529194929385840193909290879084015b828210156107885783829060005260206000200180546106fb90611ec3565b80601f016020809104026020016040519081016040528092919081815260200182805461072790611ec3565b80156107745780601f1061074957610100808354040283529160200191610774565b820191906000526020600020905b81548152906001019060200180831161075757829003601f168201915b5050505050815260200190600101906106dc565b50505050815260200160028201805480602002602001604051908101604052809291908181526020016000905b828210156108615783829060005260206000200180546107d490611ec3565b80601f016020809104026020016040519081016040528092919081815260200182805461080090611ec3565b801561084d5780601f106108225761010080835404028352916020019161084d565b820191906000526020600020905b81548152906001019060200180831161083057829003601f168201915b5050505050815260200190600101906107b5565b50505050815260200160038201805480602002602001604051908101604052809291908181526020016000905b8282101561093a5783829060005260206000200180546108ad90611ec3565b80601f01602080910402602001604051908101604052809291908181526020018280546108d990611ec3565b80156109265780601f106108fb57610100808354040283529160200191610926565b820191906000526020600020905b81548152906001019060200180831161090957829003601f168201915b50505050508152602001906001019061088e565b5050505081525050905060008160200151516001600160401b0381111561096357610963611c65565b60405190808252806020026020018201604052801561098c578160200160208202803683370190505b50905060008260400151516001600160401b038111156109ae576109ae611c65565b6040519080825280602002602001820160405280156109d7578160200160208202803683370190505b50905060008360600151516001600160401b038111156109f9576109f9611c65565b604051908082528060200260200182016040528015610a22578160200160208202803683370190505b5083519091508614610a865760405162461bcd60e51b815260206004820152602760248201527f526573756c7473206e6f74206f662073616d65206c656e6774682061732072656044820152661c5d595cdd195960ca1b6064820152608401610327565b60005b846020015151811015610b7957610abc85602001518281518110610aaf57610aaf611ef7565b6020026020010151610f73565b848281518110610ace57610ace611ef7565b602002602001018181525050610b0085604001518281518110610af357610af3611ef7565b6020026020010151610f92565b838281518110610b1257610b12611ef7565b602002602001019061ffff16908161ffff1681525050610b4185606001518281518110610af357610af3611ef7565b828281518110610b5357610b53611ef7565b62ffffff9092166020928302919091019091015280610b7181611d95565b915050610a89565b506008546040516319aafc5960e01b81526001600160a01b03909116906319aafc5990610bb2908690869086908d908d90600401612020565b600060405180830381600087803b158015610bcc57600080fd5b505af1158015610be0573d6000803e3d6000fd5b5050506000898152600c6020908152604091829020805460ff1916600117905586015186820151606088015192517f2a86494ce6636a05e73b9beec12a0319526bd518419db63d26ea06e75044de2f9450610c42938d9392918d908d90612161565b60405180910390a15050505050505050565b610c5c610d82565b600280546001600160a01b0319166001600160a01b038816179055600380546001600160a01b0319166001600160a01b038716179055600b80546001600160a01b038881166001600160a01b03199283168117909355600780548883169084168117909155600880548884169416841790556009869055600a8590556040805194855291891660208501529083015260608201526080810183905260a081018290527f70aea940798270dc650b39ad807316152941bb6e0fcef7e37dcc418d1109598f9060c00160405180910390a1505050505050565b610d3b610d82565b610d456000611036565b565b610d4f610d82565b6001600160a01b038116610d7957604051631e4fbdf760e01b815260006004820152602401610327565b6102a381611036565b6006546001600160a01b03163314610d455760405163118cdaa760e01b8152336004820152602401610327565b610db7611088565b6006805460ff60a01b191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b610e0c610e47565b6006805460ff60a01b1916600160a01b1790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258610de73390565b600654600160a01b900460ff1615610d455760405163d93c066560e01b815260040160405180910390fd5b610e7a61194a565b610e8261194a565b610e8e818686866110b2565b9150505b9392505050565b6080830151610ea890836110f8565b6080830151610eb7908261110f565b505050565b6080830151610ecb90836110f8565b610ed88360800151611134565b60005b8151811015610f2657610f14828281518110610ef957610ef9611ef7565b602002602001015185608001516110f890919063ffffffff16565b80610f1e81611d95565b915050610edb565b50610eb7836080015161113f565b600b54610f4c906001600160a01b031683308461114a565b5050565b600354600090610f6a906001600160a01b031684846111aa565b90505b92915050565b805160009082908203610f895750600092915050565b50506020015190565b60008082815b815181101561102d576000818351610fb091906121c2565b90506000838381518110610fc657610fc6611ef7565b01602001516001600160f81b03198116915060f81c6000610fe86030836121c2565b9050610ff56001856121c2565b61100090600a6122b9565b61100a90826122c5565b61101490886122dc565b965050505050808061102590611d95565b915050610f98565b50909392505050565b600680546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600654600160a01b900460ff16610d4557604051638dfc202b60e01b815260040160405180910390fd5b6110ba61194a565b6110ca856080015161010061123d565b50508284526001600160a01b03821660208501526001600160e01b031981166040850152835b949350505050565b61110582600383516112a2565b610eb782826113a9565b6001600160401b0381111561112857610f4c82826113d0565b610f4c826000836112a2565b6102a3816004611407565b6102a3816007611407565b604080516001600160a01b0385811660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b1790526111a490859061141c565b50505050565b6004546000906111bb8160016122dc565b600455835160408086015160808701515191516000936320214ca360e11b936111f39386938493923092918a916001916024016122ef565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b03199093169290921790915290506112338683868461147f565b9695505050505050565b60408051808201909152606081526000602082015261125d602083612357565b156112855761126d602083612357565b6112789060206121c2565b61128290836122dc565b91505b506020828101829052604080518085526000815290920101905290565b6017816001600160401b0316116112c6576111a48360e0600585901b1683176115dd565b60ff816001600160401b031611611302576112ec836018611fe0600586901b16176115dd565b506111a4836001600160401b0383166001611602565b61ffff816001600160401b03161161133f57611329836019611fe0600586901b16176115dd565b506111a4836001600160401b0383166002611602565b63ffffffff816001600160401b03161161137e5761136883601a611fe0600586901b16176115dd565b506111a4836001600160401b0383166004611602565b61139383601b611fe0600586901b16176115dd565b506111a4836001600160401b0383166008611602565b604080518082019091526060815260006020820152610f6a83846000015151848551611628565b6113db8260c26115dd565b50610f4c82826040516020016113f391815260200190565b604051602081830303815290604052611712565b610eb782601f611fe0600585901b16176115dd565b60006114316001600160a01b0384168361171f565b905080516000141580156114565750808060200190518101906114549190612379565b155b15610eb757604051635274afe760e01b81526001600160a01b0384166004820152602401610327565b6040516bffffffffffffffffffffffff193060601b1660208201526034810184905260009060540160408051808303601f1901815282825280516020918201206000818152600590925291812080546001600160a01b0319166001600160a01b038a1617905590925082917fb5e6e01e79f91267dc17b4e6314d5d4d03593d2ceee0fbb452b750bd70ea5af99190a2600254604051630200057560e51b81526001600160a01b0390911690634000aea09061154290889087908790600401612396565b6020604051808303816000875af1158015611561573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115859190612379565b6110f05760405162461bcd60e51b815260206004820152602360248201527f756e61626c6520746f207472616e73666572416e6443616c6c20746f206f7261604482015262636c6560e81b6064820152608401610327565b604080518082019091526060815260006020820152610f6a838460000151518461172d565b6040805180820190915260608152600060208201526110f0848560000151518585611788565b604080518082019091526060815260006020820152825182111561164b57600080fd5b602085015161165a83866122dc565b111561168d5761168d8561167d8760200151878661167891906122dc565b611809565b6116889060026122c5565b611820565b6000808651805187602083010193508088870111156116ac5787860182525b505050602084015b602084106116ec57805182526116cb6020836122dc565b91506116d86020826122dc565b90506116e56020856121c2565b93506116b4565b51815160001960208690036101000a019081169019919091161790525083949350505050565b61110582600283516112a2565b6060610f6a83836000611837565b6040805180820190915260608152600060208201528360200151831061176257611762848560200151600261168891906122c5565b835180516020858301018481535080850361177e576001810182525b5093949350505050565b60408051808201909152606081526000602082015260208501516117ac85846122dc565b11156117c0576117c08561167d86856122dc565b600060016117d0846101006122b9565b6117da91906121c2565b90508551838682010185831982511617815250805184870111156117fe5783860181525b509495945050505050565b60008183111561181a575081610f6d565b50919050565b815161182c838361123d565b506111a483826113a9565b60608147101561185c5760405163cd78605960e01b8152306004820152602401610327565b600080856001600160a01b0316848660405161187891906123c6565b60006040518083038185875af1925050503d80600081146118b5576040519150601f19603f3d011682016040523d82523d6000602084013e6118ba565b606091505b50915091506112338683836060826118da576118d582611921565b610e92565b81511580156118f157506001600160a01b0384163b155b1561191a57604051639996b31560e01b81526001600160a01b0385166004820152602401610327565b5080610e92565b8051156119315780518082602001fd5b604051630a12f52160e11b815260040160405180910390fd5b6040805160a0810182526000808252602080830182905282840182905260608084018390528451808601909552845283015290608082015290565b8280548282559060005260206000209081019282156119cb579160200282015b828111156119cb57825182906119bb9082612430565b50916020019190600101906119a5565b506119d79291506119db565b5090565b808211156119d75760006119ef82826119f8565b506001016119db565b508054611a0490611ec3565b6000825580601f10611a14575050565b601f0160209004906000526020600020908101906102a391905b808211156119d75760008155600101611a2e565b600060208284031215611a5457600080fd5b5035919050565b80151581146102a357600080fd5b600060208284031215611a7b57600080fd5b8135610e9281611a5b565b60008083601f840112611a9857600080fd5b5081356001600160401b03811115611aaf57600080fd5b6020830191508360208260051b8501011115611aca57600080fd5b9250929050565b60008060008060008060008060a0898b031215611aed57600080fd5b883597506020890135965060408901356001600160401b0380821115611b1257600080fd5b611b1e8c838d01611a86565b909850965060608b0135915080821115611b3757600080fd5b611b438c838d01611a86565b909650945060808b0135915080821115611b5c57600080fd5b50611b698b828c01611a86565b999c989b5096995094979396929594505050565b600080600060408486031215611b9257600080fd5b8335925060208401356001600160401b03811115611baf57600080fd5b611bbb86828701611a86565b9497909650939450505050565b80356001600160a01b0381168114611bdf57600080fd5b919050565b60008060008060008060c08789031215611bfd57600080fd5b611c0687611bc8565b9550611c1460208801611bc8565b9450611c2260408801611bc8565b9350611c3060608801611bc8565b92506080870135915060a087013590509295509295509295565b600060208284031215611c5c57600080fd5b610f6a82611bc8565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b0381118282101715611ca357611ca3611c65565b604052919050565b60006001600160401b0380841115611cc557611cc5611c65565b8360051b6020611cd6818301611c7b565b868152918501918181019036841115611cee57600080fd5b865b84811015611d7357803586811115611d085760008081fd5b8801601f3681830112611d1b5760008081fd5b813588811115611d2d57611d2d611c65565b611d3e818301601f19168801611c7b565b91508082523687828501011115611d555760008081fd5b80878401888401376000908201870152845250918301918301611cf0565b50979650505050505050565b634e487b7160e01b600052601160045260246000fd5b600060018201611da757611da7611d7f565b5060010190565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b81835260006020808501808196508560051b810191508460005b87811015611e5b5782840389528135601e19883603018112611e1257600080fd5b870185810190356001600160401b03811115611e2d57600080fd5b803603821315611e3c57600080fd5b611e47868284611dae565b9a87019a9550505090840190600101611df1565b5091979650505050505050565b6001600160a01b0388168152608060208201819052600090611e8d908301888a611dd7565b8281036040840152611ea0818789611dd7565b90508281036060840152611eb5818587611dd7565b9a9950505050505050505050565b600181811c90821680611ed757607f821691505b60208210810361181a57634e487b7160e01b600052602260045260246000fd5b634e487b7160e01b600052603260045260246000fd5b600081518084526020808501945080840160005b838110156117fe57815162ffffff1687529582019590820190600101611f21565b818352600060208085019450826000805b86811015611f7f5782358060020b808214611f6c578384fd5b8952509683019691830191600101611f53565b50959695505050505050565b81835260006020808501808196506005915085821b81018560005b88811015612012578383038a528135601e19893603018112611fc757600080fd5b880186810190356001600160401b03811115611fe257600080fd5b80871b3603821315611ff357600080fd5b611ffe858284611f42565b9b88019b9450505090850190600101611fa6565b509098975050505050505050565b6080808252865190820181905260009060209060a0840190828a01845b828110156120595781518452928401929084019060010161203d565b5050508381038285015287518082528883019183019060005b8181101561209257835161ffff1683529284019291840191600101612072565b505084810360408601526120a68189611f0d565b9250505082810360608401526120bd818587611f8b565b98975050505050505050565b60005b838110156120e45781810151838201526020016120cc565b50506000910152565b600081518084526121058160208601602086016120c9565b601f01601f19169290920160200192915050565b600081518084526020808501808196508360051b8101915082860160005b85811015611e5b57828403895261214f8483516120ed565b98850198935090840190600101612137565b86815260a06020820152600061217a60a0830188612119565b828103604084015261218c8188612119565b905082810360608401526121a08187612119565b905082810360808401526121b5818587611f8b565b9998505050505050505050565b81810381811115610f6d57610f6d611d7f565b600181815b808511156122105781600019048211156121f6576121f6611d7f565b8085161561220357918102915b93841c93908002906121da565b509250929050565b60008261222757506001610f6d565b8161223457506000610f6d565b816001811461224a576002811461225457612270565b6001915050610f6d565b60ff84111561226557612265611d7f565b50506001821b610f6d565b5060208310610133831016604e8410600b8410161715612293575081810a610f6d565b61229d83836121d5565b80600019048211156122b1576122b1611d7f565b029392505050565b6000610f6a8383612218565b8082028115828204841417610f6d57610f6d611d7f565b80820180821115610f6d57610f6d611d7f565b6001600160a01b0389811682526020820189905260408201889052861660608201526001600160e01b03198516608082015260a0810184905260c0810183905261010060e08201819052600090612348838201856120ed565b9b9a5050505050505050505050565b60008261237457634e487b7160e01b600052601260045260246000fd5b500690565b60006020828403121561238b57600080fd5b8151610e9281611a5b565b60018060a01b03841681528260208201526060604082015260006123bd60608301846120ed565b95945050505050565b600082516123d88184602087016120c9565b9190910192915050565b601f821115610eb757600081815260208120601f850160051c810160208610156124095750805b601f850160051c820191505b8181101561242857828155600101612415565b505050505050565b81516001600160401b0381111561244957612449611c65565b61245d816124578454611ec3565b846123e2565b602080601f831160018114612492576000841561247a5750858301515b600019600386901b1c1916600185901b178555612428565b600085815260208120601f198616915b828110156124c1578886015182559484019460019091019084016124a2565b50858210156124df5787850151600019600388901b60f8161c191681555b5050505050600190811b0190555056fea2646970667358221220d1f68d2eabf55998c62c33c81211616958862e379f718d32ed78e5d31b117a7d64736f6c63430008140033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000149459ad88d23d2ce0f4f1371203db2122331d94000000000000000000000000b7dec0966366ecc5a1906f83caa12cca2edb0a8c00000000000000000000000076923cdde21928ddbec4b8bfdc8143bb6d0841a8000000000000000000000000e4123fdc540fd3f969d71ec14e0839dc63a11ae661313139393636633462386434383738386335633763333962356338383532640000000000000000000000000000000000000000000000000de0b6b3a7640000
-----Decoded View---------------
Arg [0] : _link (address): 0x149459AD88d23d2ce0F4F1371203Db2122331d94
Arg [1] : _oracle (address): 0xB7dec0966366ecC5A1906F83caA12CCA2EDb0a8c
Arg [2] : _sportsAMM (address): 0x76923cDDE21928ddbeC4B8BFDC8143BB6d0841a8
Arg [3] : _resultManager (address): 0xe4123FdC540FD3f969d71eC14e0839dC63A11AE6
Arg [4] : _jobSpecId (bytes32): 0x6131313939363663346238643438373838633563376333396235633838353264
Arg [5] : _paymentAmount (uint256): 1000000000000000000
-----Encoded View---------------
6 Constructor Arguments found :
Arg [0] : 000000000000000000000000149459ad88d23d2ce0f4f1371203db2122331d94
Arg [1] : 000000000000000000000000b7dec0966366ecc5a1906f83caa12cca2edb0a8c
Arg [2] : 00000000000000000000000076923cdde21928ddbec4b8bfdc8143bb6d0841a8
Arg [3] : 000000000000000000000000e4123fdc540fd3f969d71ec14e0839dc63a11ae6
Arg [4] : 6131313939363663346238643438373838633563376333396235633838353264
Arg [5] : 0000000000000000000000000000000000000000000000000de0b6b3a7640000
Loading...
Loading
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 34 Chains
| Chain | Token | Portfolio % | Price | Amount | Value |
|---|
Loading...
Loading
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.