Source Code
Latest 25 from a total of 567 transactions
| Transaction Hash |
|
Block
|
From
|
To
|
|||||
|---|---|---|---|---|---|---|---|---|---|
| Request SGP Trad... | 41802534 | 3 hrs ago | IN | 0 ETH | 0.00003231 | ||||
| Request SGP Trad... | 41802516 | 3 hrs ago | IN | 0 ETH | 0.00004519 | ||||
| Request SGP Trad... | 41798228 | 5 hrs ago | IN | 0 ETH | 0.00001003 | ||||
| Request SGP Trad... | 41769277 | 21 hrs ago | IN | 0 ETH | 0.00016575 | ||||
| Request SGP Trad... | 41731290 | 42 hrs ago | IN | 0 ETH | 0.00001106 | ||||
| Request SGP Trad... | 41731282 | 42 hrs ago | IN | 0 ETH | 0.0000111 | ||||
| Request SGP Trad... | 41715618 | 2 days ago | IN | 0 ETH | 0.00005064 | ||||
| Request SGP Trad... | 41691306 | 2 days ago | IN | 0 ETH | 0.00002279 | ||||
| Request SGP Trad... | 41691210 | 2 days ago | IN | 0 ETH | 0.00002345 | ||||
| Request SGP Trad... | 41677590 | 3 days ago | IN | 0 ETH | 0.00073632 | ||||
| Request SGP Trad... | 41673387 | 3 days ago | IN | 0 ETH | 0.00002003 | ||||
| Request SGP Trad... | 41635872 | 3 days ago | IN | 0 ETH | 0.00002171 | ||||
| Request SGP Trad... | 41631660 | 4 days ago | IN | 0 ETH | 0.00001765 | ||||
| Request SGP Trad... | 41626038 | 4 days ago | IN | 0 ETH | 0.00001561 | ||||
| Request SGP Trad... | 41593037 | 4 days ago | IN | 0 ETH | 0.00000079 | ||||
| Request SGP Trad... | 41582516 | 5 days ago | IN | 0 ETH | 0.00000539 | ||||
| Request SGP Trad... | 41582509 | 5 days ago | IN | 0 ETH | 0.0000053 | ||||
| Request SGP Trad... | 41516074 | 6 days ago | IN | 0 ETH | 0.0000332 | ||||
| Request SGP Trad... | 41506676 | 6 days ago | IN | 0 ETH | 0.00003626 | ||||
| Request SGP Trad... | 41503094 | 7 days ago | IN | 0 ETH | 0.00003423 | ||||
| Request SGP Trad... | 41470495 | 7 days ago | IN | 0 ETH | 0.00000643 | ||||
| Request SGP Trad... | 41470468 | 7 days ago | IN | 0 ETH | 0.00000638 | ||||
| Request SGP Trad... | 41423994 | 8 days ago | IN | 0 ETH | 0.00001187 | ||||
| Request SGP Trad... | 41423968 | 8 days ago | IN | 0 ETH | 0.00001175 | ||||
| Request SGP Trad... | 41415970 | 9 days ago | IN | 0 ETH | 0.00001328 |
Cross-Chain Transactions
Loading...
Loading
Contract Name:
SGPTradingProcessor
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 "@openzeppelin/contracts/utils/Strings.sol";
import "../../interfaces/ISportsAMMV2.sol";
import "../../interfaces/IFreeBetsHolder.sol";
import "../../interfaces/ISGPTradingProcessor.sol";
contract SGPTradingProcessor is ChainlinkClient, Ownable, Pausable {
using Strings for uint;
using Strings for int256;
using Strings for uint8;
using Chainlink for Chainlink.Request;
using SafeERC20 for IERC20;
uint private constant ONE = 1e18;
ISportsAMMV2 public sportsAMM;
address public freeBetsHolder;
bytes32 public jobSpecId;
uint public paymentAmount;
uint public maxAllowedExecutionDelay = 60;
mapping(bytes32 => ISGPTradingProcessor.SGPTradeData) public requestIdToTradeData;
mapping(bytes32 => address) public requestIdToRequester;
mapping(bytes32 => bool) public requestIdToFulfillAllowed;
mapping(bytes32 => bool) public requestIdFulfilled;
mapping(bytes32 => uint) public timestampPerRequest;
uint public requestCounter;
mapping(uint => bytes32) public counterToRequestId;
constructor(
address _link,
address _oracle,
address _sportsAMM,
bytes32 _jobSpecId,
uint _paymentAmount
) Ownable(msg.sender) {
setChainlinkToken(_link);
setChainlinkOracle(_oracle);
sportsAMM = ISportsAMMV2(_sportsAMM);
jobSpecId = _jobSpecId;
paymentAmount = _paymentAmount;
}
/// @notice requests SGP trade
/// @param _sgpTradeData for which to request a SGP trade
function requestSGPTrade(
ISGPTradingProcessor.SGPTradeData calldata _sgpTradeData
) external whenNotPaused returns (bytes32 requestId) {
require(_sgpTradeData._tradeData.length > 1, "SGP not possible for a single game");
// **Verify Merkle Proofs**
_verifyMerkleProofs(_sgpTradeData._tradeData);
// **Process trade data**
(
string[] memory sportIds,
string[] memory gameIds,
string[] memory typeIds,
string[] memory playerIds,
string[] memory lines,
string[] memory positions,
uint16 sportId
) = _processTradeData(_sgpTradeData._tradeData);
require(sportsAMM.riskManager().sgpOnSportIdEnabled(sportId), "SGP trading not enabled on _sportId");
// **Create Chainlink request**
Chainlink.Request memory req = buildChainlinkRequest(jobSpecId, address(this), this.fulfillSGPTrade.selector);
req.addStringArray("sportIds", sportIds);
req.addStringArray("gameIds", gameIds);
req.addStringArray("typeIds", typeIds);
req.addStringArray("playerIds", playerIds);
req.addStringArray("positions", positions);
req.addStringArray("lines", lines);
req.addUint("buyInAmount", _sgpTradeData._buyInAmount);
req.addUint("expectedQuote", _sgpTradeData._expectedQuote);
req.addUint("additionalSlippage", _sgpTradeData._additionalSlippage);
requestId = sendChainlinkRequest(req, paymentAmount);
timestampPerRequest[requestId] = block.timestamp;
requestIdToTradeData[requestId] = _sgpTradeData;
requestIdToRequester[requestId] = msg.sender;
counterToRequestId[requestCounter] = requestId;
emit SGPTradeRequested(msg.sender, requestCounter, requestId, _sgpTradeData);
requestCounter++;
}
/// @notice Verifies Merkle proofs for the given trade data
/// @param tradeData The trade data array
function _verifyMerkleProofs(ISportsAMMV2.TradeData[] calldata tradeData) internal view {
uint numOfMarkets = tradeData.length;
bytes32[] memory gameIdsBytes = new bytes32[](numOfMarkets);
for (uint i; i < numOfMarkets; ++i) {
gameIdsBytes[i] = tradeData[i].gameId;
}
sportsAMM.riskManager().batchVerifyMerkleTree(tradeData, sportsAMM.getRootsPerGames(gameIdsBytes));
}
/// @notice Processes trade data and returns formatted arrays
/// @param tradeData The trade data array
/// @return sportIds Formatted sport IDs
/// @return gameIds Formatted game IDs as strings
/// @return typeIds Formatted type IDs
/// @return playerIds Formatted player IDs
/// @return lines Formatted lines
/// @return positions Formatted positions
/// @return sportId The validated sport ID
function _processTradeData(
ISportsAMMV2.TradeData[] calldata tradeData
)
internal
pure
returns (
string[] memory sportIds,
string[] memory gameIds,
string[] memory typeIds,
string[] memory playerIds,
string[] memory lines,
string[] memory positions,
uint16 sportId
)
{
uint numOfMarkets = tradeData.length;
sportIds = new string[](numOfMarkets);
gameIds = new string[](numOfMarkets);
typeIds = new string[](numOfMarkets);
playerIds = new string[](numOfMarkets);
lines = new string[](numOfMarkets);
positions = new string[](numOfMarkets);
bytes32 gameId;
for (uint i = 0; i < numOfMarkets; ++i) {
ISportsAMMV2.TradeData memory marketTradeData = tradeData[i];
sportIds[i] = uint256(marketTradeData.sportId).toString();
gameIds[i] = bytes32ToString(marketTradeData.gameId);
typeIds[i] = uint256(marketTradeData.typeId).toString();
playerIds[i] = uint256(marketTradeData.playerId).toString();
lines[i] = int256(marketTradeData.line).toStringSigned();
positions[i] = uint256(marketTradeData.position).toString();
if (i == 0) {
sportId = marketTradeData.sportId;
gameId = marketTradeData.gameId;
} else {
require(gameId == marketTradeData.gameId, "SGP only possible on the same game");
}
}
}
/// @notice fulfillSGPTrade
/// @param _requestId which is being fulfilled
/// @param _allow whether the sgp trade should go through
/// @param _approvedQuote what will be the actual payout
function fulfillSGPTrade(
bytes32 _requestId,
bool _allow,
uint _approvedQuote
) external whenNotPaused recordChainlinkFulfillment(_requestId) {
//might be redundant as already done by Chainlink Client, but making double sure
require(!requestIdFulfilled[_requestId], "Request ID already fulfilled");
require((timestampPerRequest[_requestId] + maxAllowedExecutionDelay) > block.timestamp, "Request timed out");
ISGPTradingProcessor.SGPTradeData memory sgpTradeData = requestIdToTradeData[_requestId];
address requester = requestIdToRequester[_requestId];
require(
((ONE * _approvedQuote) / sgpTradeData._expectedQuote) <= (ONE + sgpTradeData._additionalSlippage),
"Slippage too high"
);
if (_allow) {
address _createdTicket = sportsAMM.tradeSGP(
sgpTradeData._tradeData,
sgpTradeData._buyInAmount,
_approvedQuote,
requester,
sgpTradeData._referrer,
sgpTradeData._collateral
);
if (requester == freeBetsHolder) {
IFreeBetsHolder(freeBetsHolder).confirmSGPTrade(
_requestId,
_createdTicket,
sgpTradeData._buyInAmount,
sgpTradeData._collateral
);
}
}
requestIdToFulfillAllowed[_requestId] = _allow;
requestIdFulfilled[_requestId] = true;
emit SGPTradeFulfilled(requester, _requestId, _allow, sgpTradeData, _approvedQuote, block.timestamp);
}
/// @notice withdraw collateral in the contract
/// @param collateral the collateral address
/// @param recipient the recipient of the collateral
function withdrawCollateral(address collateral, address recipient) external onlyOwner {
IERC20(collateral).safeTransfer(recipient, IERC20(collateral).balanceOf(address(this)));
}
//////////// SETTERS
/// @notice pause sgp trading
/// @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 _jobSpecId CL node job spec ID
/// @param _paymentAmount amount of paymentAmount token for each request
function setConfiguration(
address _link,
address _oracle,
address _sportsAMM,
bytes32 _jobSpecId,
uint _paymentAmount
) external onlyOwner {
setChainlinkToken(_link);
setChainlinkOracle(_oracle);
sportsAMM = ISportsAMMV2(_sportsAMM);
jobSpecId = _jobSpecId;
paymentAmount = _paymentAmount;
emit ContextReset(_link, _oracle, _sportsAMM, _jobSpecId, _paymentAmount);
}
/// @notice sets the FreeBetsHolder address, required for handling ticket claiming via FreeBetsHolder
function setFreeBetsHolder(address _freeBetsHolder) external onlyOwner {
freeBetsHolder = _freeBetsHolder;
emit SetFreeBetsHolder(_freeBetsHolder);
}
/// @notice setMaxAllowedExecutionDelay
/// @param _maxAllowedExecutionDelay maximum allowed buffer for the CL request to be executed, defaulted at 60 seconds
function setMaxAllowedExecutionDelay(uint _maxAllowedExecutionDelay) external onlyOwner {
maxAllowedExecutionDelay = _maxAllowedExecutionDelay;
emit SetMaxAllowedExecutionDelay(_maxAllowedExecutionDelay);
}
// Helper function to convert bytes32 to string
function bytes32ToString(bytes32 _bytes32) internal pure returns (string memory) {
uint8 i = 0;
while (i < 32 && _bytes32[i] != 0) {
i++;
}
bytes memory bytesArray = new bytes(i);
for (uint8 j = 0; j < i; j++) {
bytesArray[j] = _bytes32[j];
}
return string(bytesArray);
}
/////// EVENTS
event ContextReset(address _link, address _oracle, address _sportsAMM, bytes32 _jobSpecId, uint _paymentAmount);
event SGPTradeRequested(
address requester,
uint requestCounter,
bytes32 requestId,
ISGPTradingProcessor.SGPTradeData sgpTradeData
);
event SGPTradeFulfilled(
address requester,
bytes32 requestId,
bool _allow,
ISGPTradingProcessor.SGPTradeData sgpTradeData,
uint _approvedQuote,
uint timestamp
);
event SetMaxAllowedExecutionDelay(uint _maxAllowedExecutionDelay);
event SetFreeBetsHolder(address _freeBetsHolder);
}// 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/math/Math.sol)
pragma solidity ^0.8.20;
/**
* @dev Standard math utilities missing in the Solidity language.
*/
library Math {
/**
* @dev Muldiv operation overflow.
*/
error MathOverflowedMulDiv();
enum Rounding {
Floor, // Toward negative infinity
Ceil, // Toward positive infinity
Trunc, // Toward zero
Expand // Away from zero
}
/**
* @dev Returns the addition of two unsigned integers, with an overflow flag.
*/
function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
uint256 c = a + b;
if (c < a) return (false, 0);
return (true, c);
}
}
/**
* @dev Returns the subtraction of two unsigned integers, with an overflow flag.
*/
function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b > a) return (false, 0);
return (true, a - b);
}
}
/**
* @dev Returns the multiplication of two unsigned integers, with an overflow flag.
*/
function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) return (true, 0);
uint256 c = a * b;
if (c / a != b) return (false, 0);
return (true, c);
}
}
/**
* @dev Returns the division of two unsigned integers, with a division by zero flag.
*/
function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a / b);
}
}
/**
* @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
*/
function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a % b);
}
}
/**
* @dev Returns the largest of two numbers.
*/
function max(uint256 a, uint256 b) internal pure returns (uint256) {
return a > b ? a : b;
}
/**
* @dev Returns the smallest of two numbers.
*/
function min(uint256 a, uint256 b) internal pure returns (uint256) {
return a < b ? a : b;
}
/**
* @dev Returns the average of two numbers. The result is rounded towards
* zero.
*/
function average(uint256 a, uint256 b) internal pure returns (uint256) {
// (a + b) / 2 can overflow.
return (a & b) + (a ^ b) / 2;
}
/**
* @dev Returns the ceiling of the division of two numbers.
*
* This differs from standard division with `/` in that it rounds towards infinity instead
* of rounding towards zero.
*/
function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {
if (b == 0) {
// Guarantee the same behavior as in a regular Solidity division.
return a / b;
}
// (a + b - 1) / b can overflow on addition, so we distribute.
return a == 0 ? 0 : (a - 1) / b + 1;
}
/**
* @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or
* denominator == 0.
* @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv) with further edits by
* Uniswap Labs also under MIT license.
*/
function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {
unchecked {
// 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use
// use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256
// variables such that product = prod1 * 2^256 + prod0.
uint256 prod0 = x * y; // Least significant 256 bits of the product
uint256 prod1; // Most significant 256 bits of the product
assembly {
let mm := mulmod(x, y, not(0))
prod1 := sub(sub(mm, prod0), lt(mm, prod0))
}
// Handle non-overflow cases, 256 by 256 division.
if (prod1 == 0) {
// Solidity will revert if denominator == 0, unlike the div opcode on its own.
// The surrounding unchecked block does not change this fact.
// See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.
return prod0 / denominator;
}
// Make sure the result is less than 2^256. Also prevents denominator == 0.
if (denominator <= prod1) {
revert MathOverflowedMulDiv();
}
///////////////////////////////////////////////
// 512 by 256 division.
///////////////////////////////////////////////
// Make division exact by subtracting the remainder from [prod1 prod0].
uint256 remainder;
assembly {
// Compute remainder using mulmod.
remainder := mulmod(x, y, denominator)
// Subtract 256 bit number from 512 bit number.
prod1 := sub(prod1, gt(remainder, prod0))
prod0 := sub(prod0, remainder)
}
// Factor powers of two out of denominator and compute largest power of two divisor of denominator.
// Always >= 1. See https://cs.stackexchange.com/q/138556/92363.
uint256 twos = denominator & (0 - denominator);
assembly {
// Divide denominator by twos.
denominator := div(denominator, twos)
// Divide [prod1 prod0] by twos.
prod0 := div(prod0, twos)
// Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.
twos := add(div(sub(0, twos), twos), 1)
}
// Shift in bits from prod1 into prod0.
prod0 |= prod1 * twos;
// Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such
// that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for
// four bits. That is, denominator * inv = 1 mod 2^4.
uint256 inverse = (3 * denominator) ^ 2;
// Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also
// works in modular arithmetic, doubling the correct bits in each step.
inverse *= 2 - denominator * inverse; // inverse mod 2^8
inverse *= 2 - denominator * inverse; // inverse mod 2^16
inverse *= 2 - denominator * inverse; // inverse mod 2^32
inverse *= 2 - denominator * inverse; // inverse mod 2^64
inverse *= 2 - denominator * inverse; // inverse mod 2^128
inverse *= 2 - denominator * inverse; // inverse mod 2^256
// Because the division is now exact we can divide by multiplying with the modular inverse of denominator.
// This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is
// less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1
// is no longer required.
result = prod0 * inverse;
return result;
}
}
/**
* @notice Calculates x * y / denominator with full precision, following the selected rounding direction.
*/
function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) {
uint256 result = mulDiv(x, y, denominator);
if (unsignedRoundsUp(rounding) && mulmod(x, y, denominator) > 0) {
result += 1;
}
return result;
}
/**
* @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded
* towards zero.
*
* Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11).
*/
function sqrt(uint256 a) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
// For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.
//
// We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have
// `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.
//
// This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`
// → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`
// → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`
//
// Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.
uint256 result = 1 << (log2(a) >> 1);
// At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,
// since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at
// every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision
// into the expected uint128 result.
unchecked {
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
return min(result, a / result);
}
}
/**
* @notice Calculates sqrt(a), following the selected rounding direction.
*/
function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = sqrt(a);
return result + (unsignedRoundsUp(rounding) && result * result < a ? 1 : 0);
}
}
/**
* @dev Return the log in base 2 of a positive value rounded towards zero.
* Returns 0 if given 0.
*/
function log2(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >> 128 > 0) {
value >>= 128;
result += 128;
}
if (value >> 64 > 0) {
value >>= 64;
result += 64;
}
if (value >> 32 > 0) {
value >>= 32;
result += 32;
}
if (value >> 16 > 0) {
value >>= 16;
result += 16;
}
if (value >> 8 > 0) {
value >>= 8;
result += 8;
}
if (value >> 4 > 0) {
value >>= 4;
result += 4;
}
if (value >> 2 > 0) {
value >>= 2;
result += 2;
}
if (value >> 1 > 0) {
result += 1;
}
}
return result;
}
/**
* @dev Return the log in base 2, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log2(value);
return result + (unsignedRoundsUp(rounding) && 1 << result < value ? 1 : 0);
}
}
/**
* @dev Return the log in base 10 of a positive value rounded towards zero.
* Returns 0 if given 0.
*/
function log10(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >= 10 ** 64) {
value /= 10 ** 64;
result += 64;
}
if (value >= 10 ** 32) {
value /= 10 ** 32;
result += 32;
}
if (value >= 10 ** 16) {
value /= 10 ** 16;
result += 16;
}
if (value >= 10 ** 8) {
value /= 10 ** 8;
result += 8;
}
if (value >= 10 ** 4) {
value /= 10 ** 4;
result += 4;
}
if (value >= 10 ** 2) {
value /= 10 ** 2;
result += 2;
}
if (value >= 10 ** 1) {
result += 1;
}
}
return result;
}
/**
* @dev Return the log in base 10, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log10(value);
return result + (unsignedRoundsUp(rounding) && 10 ** result < value ? 1 : 0);
}
}
/**
* @dev Return the log in base 256 of a positive value rounded towards zero.
* Returns 0 if given 0.
*
* Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.
*/
function log256(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >> 128 > 0) {
value >>= 128;
result += 16;
}
if (value >> 64 > 0) {
value >>= 64;
result += 8;
}
if (value >> 32 > 0) {
value >>= 32;
result += 4;
}
if (value >> 16 > 0) {
value >>= 16;
result += 2;
}
if (value >> 8 > 0) {
result += 1;
}
}
return result;
}
/**
* @dev Return the log in base 256, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log256(value);
return result + (unsignedRoundsUp(rounding) && 1 << (result << 3) < value ? 1 : 0);
}
}
/**
* @dev Returns whether a provided rounding mode is considered rounding up for unsigned integers.
*/
function unsignedRoundsUp(Rounding rounding) internal pure returns (bool) {
return uint8(rounding) % 2 == 1;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/math/SignedMath.sol)
pragma solidity ^0.8.20;
/**
* @dev Standard signed math utilities missing in the Solidity language.
*/
library SignedMath {
/**
* @dev Returns the largest of two signed numbers.
*/
function max(int256 a, int256 b) internal pure returns (int256) {
return a > b ? a : b;
}
/**
* @dev Returns the smallest of two signed numbers.
*/
function min(int256 a, int256 b) internal pure returns (int256) {
return a < b ? a : b;
}
/**
* @dev Returns the average of two signed numbers without overflow.
* The result is rounded towards zero.
*/
function average(int256 a, int256 b) internal pure returns (int256) {
// Formula from the book "Hacker's Delight"
int256 x = (a & b) + ((a ^ b) >> 1);
return x + (int256(uint256(x) >> 255) & (a ^ b));
}
/**
* @dev Returns the absolute unsigned value of a signed value.
*/
function abs(int256 n) internal pure returns (uint256) {
unchecked {
// must be unchecked in order to support `n = type(int256).min`
return uint256(n >= 0 ? n : -n);
}
}
}// 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
// OpenZeppelin Contracts (last updated v5.0.0) (utils/Strings.sol)
pragma solidity ^0.8.20;
import {Math} from "./math/Math.sol";
import {SignedMath} from "./math/SignedMath.sol";
/**
* @dev String operations.
*/
library Strings {
bytes16 private constant HEX_DIGITS = "0123456789abcdef";
uint8 private constant ADDRESS_LENGTH = 20;
/**
* @dev The `value` string doesn't fit in the specified `length`.
*/
error StringsInsufficientHexLength(uint256 value, uint256 length);
/**
* @dev Converts a `uint256` to its ASCII `string` decimal representation.
*/
function toString(uint256 value) internal pure returns (string memory) {
unchecked {
uint256 length = Math.log10(value) + 1;
string memory buffer = new string(length);
uint256 ptr;
/// @solidity memory-safe-assembly
assembly {
ptr := add(buffer, add(32, length))
}
while (true) {
ptr--;
/// @solidity memory-safe-assembly
assembly {
mstore8(ptr, byte(mod(value, 10), HEX_DIGITS))
}
value /= 10;
if (value == 0) break;
}
return buffer;
}
}
/**
* @dev Converts a `int256` to its ASCII `string` decimal representation.
*/
function toStringSigned(int256 value) internal pure returns (string memory) {
return string.concat(value < 0 ? "-" : "", toString(SignedMath.abs(value)));
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
*/
function toHexString(uint256 value) internal pure returns (string memory) {
unchecked {
return toHexString(value, Math.log256(value) + 1);
}
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
*/
function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
uint256 localValue = value;
bytes memory buffer = new bytes(2 * length + 2);
buffer[0] = "0";
buffer[1] = "x";
for (uint256 i = 2 * length + 1; i > 1; --i) {
buffer[i] = HEX_DIGITS[localValue & 0xf];
localValue >>= 4;
}
if (localValue != 0) {
revert StringsInsufficientHexLength(value, length);
}
return string(buffer);
}
/**
* @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal
* representation.
*/
function toHexString(address addr) internal pure returns (string memory) {
return toHexString(uint256(uint160(addr)), ADDRESS_LENGTH);
}
/**
* @dev Returns true if the two strings are equal.
*/
function equal(string memory a, string memory b) internal pure returns (bool) {
return bytes(a).length == bytes(b).length && keccak256(bytes(a)) == keccak256(bytes(b));
}
}// 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;
function confirmSGPTrade(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 "./ISportsAMMV2.sol";
interface ISGPTradingProcessor {
struct SGPTradeData {
ISportsAMMV2.TradeData[] _tradeData;
uint _buyInAmount;
uint _expectedQuote;
uint _additionalSlippage;
address _referrer;
address _collateral;
}
function fulfillSGPTrade(bytes32 _requestId, bool allow, uint approvedAmount) external;
function requestSGPTrade(SGPTradeData calldata _sgpTradeData) external returns (bytes32);
}// 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 tradeSGP(
ISportsAMMV2.TradeData[] calldata _tradeData,
uint _buyInAmount,
uint _approvedQuote,
address _recipient,
address _referrer,
address _collateral
) external returns (address _createdTicket);
function rootPerGame(bytes32 game) external view returns (bytes32);
function getRootsPerGames(bytes32[] calldata _games) external view returns (bytes32[] memory _roots);
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 expireKnownTicket(address ticket, address ticketOwner) external;
function isSystemTicket(address _ticket) external view returns (bool);
function isSGPTicket(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 riskPerMarketTypeAndPosition(
bytes32 _gameId,
uint _typeId,
uint _playerId,
uint _position
) external view returns (int);
function checkAndUpdateRisks(
ISportsAMMV2.TradeData[] memory _tradeData,
uint _buyInAmount,
uint _payout,
bool _isLive,
uint8 _systemBetDenominator,
bool _isSGP
) external;
function verifyMerkleTree(ISportsAMMV2.TradeData memory _marketTradeData, bytes32 _rootPerGame) external pure;
function batchVerifyMerkleTree(
ISportsAMMV2.TradeData[] memory _marketTradeData,
bytes32[] memory _rootPerGame
) external pure;
function isSportIdFuture(uint16 _sportsId) external view returns (bool);
function sgpOnSportIdEnabled(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;
function preConfirmSGPTrade(bytes32 requestId, uint _buyInAmount) external;
function confirmSGPTrade(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":"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":"bytes32","name":"_jobSpecId","type":"bytes32"},{"indexed":false,"internalType":"uint256","name":"_paymentAmount","type":"uint256"}],"name":"ContextReset","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":"requester","type":"address"},{"indexed":false,"internalType":"bytes32","name":"requestId","type":"bytes32"},{"indexed":false,"internalType":"bool","name":"_allow","type":"bool"},{"components":[{"components":[{"internalType":"bytes32","name":"gameId","type":"bytes32"},{"internalType":"uint16","name":"sportId","type":"uint16"},{"internalType":"uint16","name":"typeId","type":"uint16"},{"internalType":"uint256","name":"maturity","type":"uint256"},{"internalType":"uint8","name":"status","type":"uint8"},{"internalType":"int24","name":"line","type":"int24"},{"internalType":"uint24","name":"playerId","type":"uint24"},{"internalType":"uint256[]","name":"odds","type":"uint256[]"},{"internalType":"bytes32[]","name":"merkleProof","type":"bytes32[]"},{"internalType":"uint8","name":"position","type":"uint8"},{"components":[{"internalType":"uint16","name":"typeId","type":"uint16"},{"internalType":"uint8","name":"position","type":"uint8"},{"internalType":"int24","name":"line","type":"int24"}],"internalType":"struct ISportsAMMV2.CombinedPosition[][]","name":"combinedPositions","type":"tuple[][]"}],"internalType":"struct ISportsAMMV2.TradeData[]","name":"_tradeData","type":"tuple[]"},{"internalType":"uint256","name":"_buyInAmount","type":"uint256"},{"internalType":"uint256","name":"_expectedQuote","type":"uint256"},{"internalType":"uint256","name":"_additionalSlippage","type":"uint256"},{"internalType":"address","name":"_referrer","type":"address"},{"internalType":"address","name":"_collateral","type":"address"}],"indexed":false,"internalType":"struct ISGPTradingProcessor.SGPTradeData","name":"sgpTradeData","type":"tuple"},{"indexed":false,"internalType":"uint256","name":"_approvedQuote","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"timestamp","type":"uint256"}],"name":"SGPTradeFulfilled","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"requester","type":"address"},{"indexed":false,"internalType":"uint256","name":"requestCounter","type":"uint256"},{"indexed":false,"internalType":"bytes32","name":"requestId","type":"bytes32"},{"components":[{"components":[{"internalType":"bytes32","name":"gameId","type":"bytes32"},{"internalType":"uint16","name":"sportId","type":"uint16"},{"internalType":"uint16","name":"typeId","type":"uint16"},{"internalType":"uint256","name":"maturity","type":"uint256"},{"internalType":"uint8","name":"status","type":"uint8"},{"internalType":"int24","name":"line","type":"int24"},{"internalType":"uint24","name":"playerId","type":"uint24"},{"internalType":"uint256[]","name":"odds","type":"uint256[]"},{"internalType":"bytes32[]","name":"merkleProof","type":"bytes32[]"},{"internalType":"uint8","name":"position","type":"uint8"},{"components":[{"internalType":"uint16","name":"typeId","type":"uint16"},{"internalType":"uint8","name":"position","type":"uint8"},{"internalType":"int24","name":"line","type":"int24"}],"internalType":"struct ISportsAMMV2.CombinedPosition[][]","name":"combinedPositions","type":"tuple[][]"}],"internalType":"struct ISportsAMMV2.TradeData[]","name":"_tradeData","type":"tuple[]"},{"internalType":"uint256","name":"_buyInAmount","type":"uint256"},{"internalType":"uint256","name":"_expectedQuote","type":"uint256"},{"internalType":"uint256","name":"_additionalSlippage","type":"uint256"},{"internalType":"address","name":"_referrer","type":"address"},{"internalType":"address","name":"_collateral","type":"address"}],"indexed":false,"internalType":"struct ISGPTradingProcessor.SGPTradeData","name":"sgpTradeData","type":"tuple"}],"name":"SGPTradeRequested","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_freeBetsHolder","type":"address"}],"name":"SetFreeBetsHolder","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_maxAllowedExecutionDelay","type":"uint256"}],"name":"SetMaxAllowedExecutionDelay","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":[],"name":"freeBetsHolder","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_requestId","type":"bytes32"},{"internalType":"bool","name":"_allow","type":"bool"},{"internalType":"uint256","name":"_approvedQuote","type":"uint256"}],"name":"fulfillSGPTrade","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"jobSpecId","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxAllowedExecutionDelay","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"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":"requestIdToFulfillAllowed","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"requestIdToRequester","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"requestIdToTradeData","outputs":[{"internalType":"uint256","name":"_buyInAmount","type":"uint256"},{"internalType":"uint256","name":"_expectedQuote","type":"uint256"},{"internalType":"uint256","name":"_additionalSlippage","type":"uint256"},{"internalType":"address","name":"_referrer","type":"address"},{"internalType":"address","name":"_collateral","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"components":[{"internalType":"bytes32","name":"gameId","type":"bytes32"},{"internalType":"uint16","name":"sportId","type":"uint16"},{"internalType":"uint16","name":"typeId","type":"uint16"},{"internalType":"uint256","name":"maturity","type":"uint256"},{"internalType":"uint8","name":"status","type":"uint8"},{"internalType":"int24","name":"line","type":"int24"},{"internalType":"uint24","name":"playerId","type":"uint24"},{"internalType":"uint256[]","name":"odds","type":"uint256[]"},{"internalType":"bytes32[]","name":"merkleProof","type":"bytes32[]"},{"internalType":"uint8","name":"position","type":"uint8"},{"components":[{"internalType":"uint16","name":"typeId","type":"uint16"},{"internalType":"uint8","name":"position","type":"uint8"},{"internalType":"int24","name":"line","type":"int24"}],"internalType":"struct ISportsAMMV2.CombinedPosition[][]","name":"combinedPositions","type":"tuple[][]"}],"internalType":"struct ISportsAMMV2.TradeData[]","name":"_tradeData","type":"tuple[]"},{"internalType":"uint256","name":"_buyInAmount","type":"uint256"},{"internalType":"uint256","name":"_expectedQuote","type":"uint256"},{"internalType":"uint256","name":"_additionalSlippage","type":"uint256"},{"internalType":"address","name":"_referrer","type":"address"},{"internalType":"address","name":"_collateral","type":"address"}],"internalType":"struct ISGPTradingProcessor.SGPTradeData","name":"_sgpTradeData","type":"tuple"}],"name":"requestSGPTrade","outputs":[{"internalType":"bytes32","name":"requestId","type":"bytes32"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_link","type":"address"},{"internalType":"address","name":"_oracle","type":"address"},{"internalType":"address","name":"_sportsAMM","type":"address"},{"internalType":"bytes32","name":"_jobSpecId","type":"bytes32"},{"internalType":"uint256","name":"_paymentAmount","type":"uint256"}],"name":"setConfiguration","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_freeBetsHolder","type":"address"}],"name":"setFreeBetsHolder","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_maxAllowedExecutionDelay","type":"uint256"}],"name":"setMaxAllowedExecutionDelay","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":"bytes32","name":"","type":"bytes32"}],"name":"timestampPerRequest","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"collateral","type":"address"},{"internalType":"address","name":"recipient","type":"address"}],"name":"withdrawCollateral","outputs":[],"stateMutability":"nonpayable","type":"function"}]Contract Creation Code
60806040526001600455603c600b553480156200001b57600080fd5b5060405162003d8e38038062003d8e8339810160408190526200003e9162000153565b33806200006557604051631e4fbdf760e01b81526000600482015260240160405180910390fd5b6200007081620000e4565b506006805460ff60a01b19169055600280546001600160a01b0319166001600160a01b038716179055600380546001600160a01b0319166001600160a01b038616179055600780546001600160a01b0319166001600160a01b039490941693909317909255600955600a5550620001b09050565b600680546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b80516001600160a01b03811681146200014e57600080fd5b919050565b600080600080600060a086880312156200016c57600080fd5b620001778662000136565b9450620001876020870162000136565b9350620001976040870162000136565b6060870151608090970151959894975095949392505050565b613bce80620001c06000396000f3fe608060405234801561001057600080fd5b506004361061014d5760003560e01c80638da5cb5b116100c3578063c79901f31161007c578063c79901f3146102ec578063c9925288146102ff578063ce18a83714610312578063d395c50814610325578063e27a9abc14610338578063f2fde38b146103b857600080fd5b80638da5cb5b1461027357806390421b7c14610284578063973a814e146102a45780639a995047146102ad578063c35905c6146102c0578063c6a85f6e146102c957600080fd5b8063679c4de111610115578063679c4de1146101f2578063715018a61461020557806371b00be81461020d5780637ff39d2914610216578063805661b01461025757806383223eb51461026a57600080fd5b806301432bf21461015257806316c38b3c1461018a5780631bfa85241461019f5780635c975abb146101c0578063653318f8146101d2575b600080fd5b6101756101603660046124ac565b600f6020526000908152604090205460ff1681565b60405190151581526020015b60405180910390f35b61019d6101983660046124d3565b6103cb565b005b6101b26101ad3660046124f0565b6103eb565b604051908152602001610181565b600654600160a01b900460ff16610175565b6101b26101e03660046124ac565b60106020526000908152604090205481565b61019d61020036600461254f565b610863565b61019d6108ee565b6101b260095481565b61023f6102243660046124ac565b600d602052600090815260409020546001600160a01b031681565b6040516001600160a01b039091168152602001610181565b61019d610265366004612588565b610902565b6101b2600b5481565b6006546001600160a01b031661023f565b6101b26102923660046124ac565b60126020526000908152604090205481565b6101b260115481565b61019d6102bb3660046124ac565b61095f565b6101b2600a5481565b6101756102d73660046124ac565b600e6020526000908152604090205460ff1681565b61019d6102fa3660046125a5565b61099c565b60075461023f906001600160a01b031681565b60085461023f906001600160a01b031681565b61019d610333366004612600565b610a59565b6103846103463660046124ac565b600c60205260009081526040902060018101546002820154600383015460048401546005909401549293919290916001600160a01b03908116911685565b604080519586526020860194909452928401919091526001600160a01b03908116606084015216608082015260a001610181565b61019d6103c6366004612588565b6110a5565b6103d36110e0565b806103e3576103e061110d565b50565b6103e0611162565b60006103f56111a5565b60016104018380612638565b9050116104605760405162461bcd60e51b815260206004820152602260248201527f534750206e6f7420706f737369626c6520666f7220612073696e676c652067616044820152616d6560f01b60648201526084015b60405180910390fd5b61047261046d8380612638565b6111d0565b600080808080808061048c6104878a80612638565b6113c6565b9650965096509650965096509650600760009054906101000a90046001600160a01b03166001600160a01b031663478426636040518163ffffffff1660e01b8152600401602060405180830381865afa1580156104ed573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105119190612688565b6040516301aa3c6960e11b815261ffff831660048201526001600160a01b03919091169063035478d290602401602060405180830381865afa15801561055b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061057f91906126a5565b6105d75760405162461bcd60e51b815260206004820152602360248201527f5347502074726164696e67206e6f7420656e61626c6564206f6e205f73706f726044820152621d125960ea1b6064820152608401610457565b60006105ed6009543063d395c50860e01b611785565b60408051808201909152600881526773706f727449647360c01b602082015290915061061b9082908a6117ac565b60408051808201909152600781526667616d6549647360c81b6020820152610645908290896117ac565b6040805180820190915260078152667479706549647360c81b602082015261066f908290886117ac565b604080518082019091526009815268706c6179657249647360b81b602082015261069b908290876117ac565b604080518082019091526009815268706f736974696f6e7360b81b60208201526106c7908290856117ac565b6040805180820190915260058152646c696e657360d81b60208201526106ef908290866117ac565b61072b6040518060400160405280600b81526020016a189d5e525b905b5bdd5b9d60aa1b8152508b60200135836118299092919063ffffffff16565b604080518082018252600d81526c657870656374656451756f746560981b602082015261075d918391908d0135611829565b6040805180820190915260128152716164646974696f6e616c536c69707061676560701b602082015261079690829060608d0135611829565b6107a281600a54611847565b6000818152601060209081526040808320429055600c90915290209099508a906107cc8282612bb6565b50506000898152600d6020908152604080832080546001600160a01b031916339081179091556011805485526012909352928190208c9055905490517fb9322e7b107a6e3b264aae40c7cd06c5f5f3832a372cbca5083e559ecb72df35926108399290918d908f90612ec9565b60405180910390a160118054906000610851836130b7565b91905055505050505050505050919050565b61086b6110e0565b6040516370a0823160e01b81523060048201526108ea9082906001600160a01b038516906370a0823190602401602060405180830381865afa1580156108b5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108d991906130d0565b6001600160a01b038516919061186a565b5050565b6108f66110e0565b61090060006118bc565b565b61090a6110e0565b600880546001600160a01b0319166001600160a01b0383169081179091556040519081527fc238ff72ce9e31f22c0ef8bf1c701fcc6afd3ed4edc2224a63f16346b68420fb906020015b60405180910390a150565b6109676110e0565b600b8190556040518181527fa1d20d22955d911c8b338eeec58c0fa61197b85b255251efe74df475baa5c73890602001610954565b6109a46110e0565b600280546001600160a01b0319166001600160a01b038716179055600380546001600160a01b0319166001600160a01b038616179055600780546001600160a01b0319166001600160a01b038581169182179092556009849055600a839055604080518884168152928716602084015282015260608101839052608081018290527f4bba2924c9f8b1d7003061aed0e3737c74fddf1b79cd48799498f21058f40ef89060a00160405180910390a15050505050565b610a616111a5565b60008381526005602052604090205483906001600160a01b03163314610ada5760405162461bcd60e51b815260206004820152602860248201527f536f75726365206d75737420626520746865206f7261636c65206f6620746865604482015267081c995c5d595cdd60c21b6064820152608401610457565b60008181526005602052604080822080546001600160a01b03191690555182917f7cc135e0cebb02c3480ae5d74d377283180a2601f8f644edf7987b009316c63a91a26000848152600f602052604090205460ff1615610b7c5760405162461bcd60e51b815260206004820152601c60248201527f5265717565737420494420616c72656164792066756c66696c6c6564000000006044820152606401610457565b600b546000858152601060205260409020544291610b99916130e9565b11610bda5760405162461bcd60e51b815260206004820152601160248201527014995c5d595cdd081d1a5b5959081bdd5d607a1b6044820152606401610457565b6000848152600c602090815260408083208151815460e09481028201850190935260c08101838152909391928492849190879085015b82821015610e1a57600084815260209081902060408051610160810182526008860290920180548352600181015461ffff808216858701526201000090910416838301526002808201546060850152600382015460ff81166080860152610100810490910b60a0850152640100000000900462ffffff1660c08401526004810180548351818702810187019094528084529394919360e086019392830182828015610cda57602002820191906000526020600020905b815481526020019060010190808311610cc6575b5050505050815260200160058201805480602002602001604051908101604052809291908181526020018280548015610d3257602002820191906000526020600020905b815481526020019060010190808311610d1e575b5050509183525050600682015460ff16602080830191909152600783018054604080518285028101850182528281529401939260009084015b82821015610e0357838290600052602060002001805480602002602001604051908101604052809291908181526020016000905b82821015610df0576000848152602090819020604080516060810182529185015461ffff8116835260ff62010000820416838501526301000000900460020b90820152825260019092019101610d9f565b5050505081526020019060010190610d6b565b505050508152505081526020019060010190610c10565b5050509082525060018201546020808301919091526002830154604080840191909152600384015460608085019190915260048501546001600160a01b039081166080860152600590950154851660a09094019390935260008a8152600d909252902054908301519293501690610e9990670de0b6b3a76400006130e9565b6040830151610eb086670de0b6b3a764000061270f565b610eba9190613112565b1115610efc5760405162461bcd60e51b81526020600482015260116024820152700a6d8d2e0e0c2ceca40e8dede40d0d2ced607b1b6044820152606401610457565b841561102a5760075482516020840151608085015160a0860151604051630539ea6d60e31b81526000956001600160a01b0316946329cf536894610f4c94919390928c928a9290916004016132f9565b6020604051808303816000875af1158015610f6b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f8f9190612688565b6008549091506001600160a01b039081169083160361102857600854602084015160a0850151604051637eda2d7b60e01b8152600481018b90526001600160a01b03858116602483015260448201939093529082166064820152911690637eda2d7b90608401600060405180830381600087803b15801561100f57600080fd5b505af1158015611023573d6000803e3d6000fd5b505050505b505b6000868152600e60209081526040808320805489151560ff1991821617909155600f9092529182902080549091166001179055517f9ac10703b3e9d090d5cd8013abd92abe8a6d2033c0a9672a6ee37264075da6eb906110959083908990899087908a904290613341565b60405180910390a1505050505050565b6110ad6110e0565b6001600160a01b0381166110d757604051631e4fbdf760e01b815260006004820152602401610457565b6103e0816118bc565b6006546001600160a01b031633146109005760405163118cdaa760e01b8152336004820152602401610457565b61111561190e565b6006805460ff60a01b191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b61116a6111a5565b6006805460ff60a01b1916600160a01b1790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586111453390565b600654600160a01b900460ff16156109005760405163d93c066560e01b815260040160405180910390fd5b806000816001600160401b038111156111eb576111eb6126e3565b604051908082528060200260200182016040528015611214578160200160208202803683370190505b50905060005b8281101561127757848482818110611234576112346133d2565b905060200281019061124691906126c2565b6000013582828151811061125c5761125c6133d2565b6020908102919091010152611270816130b7565b905061121a565b50600760009054906101000a90046001600160a01b03166001600160a01b031663478426636040518163ffffffff1660e01b8152600401602060405180830381865afa1580156112cb573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112ef9190612688565b600754604051633f51f97b60e21b81526001600160a01b039283169263c5d89be892889288929091169063fd47e5ec9061132d9088906004016133e8565b600060405180830381865afa15801561134a573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526113729190810190613499565b6040518463ffffffff1660e01b81526004016113909392919061352e565b60006040518083038186803b1580156113a857600080fd5b505afa1580156113bc573d6000803e3d6000fd5b5050505050505050565b60608080808080600087806001600160401b038111156113e8576113e86126e3565b60405190808252806020026020018201604052801561141b57816020015b60608152602001906001900390816114065790505b509750806001600160401b03811115611436576114366126e3565b60405190808252806020026020018201604052801561146957816020015b60608152602001906001900390816114545790505b509650806001600160401b03811115611484576114846126e3565b6040519080825280602002602001820160405280156114b757816020015b60608152602001906001900390816114a25790505b509550806001600160401b038111156114d2576114d26126e3565b60405190808252806020026020018201604052801561150557816020015b60608152602001906001900390816114f05790505b509450806001600160401b03811115611520576115206126e3565b60405190808252806020026020018201604052801561155357816020015b606081526020019060019003908161153e5790505b509350806001600160401b0381111561156e5761156e6126e3565b6040519080825280602002602001820160405280156115a157816020015b606081526020019060019003908161158c5790505b5092506000805b828110156117765760008c8c838181106115c4576115c46133d2565b90506020028101906115d691906126c2565b6115df90613823565b90506115f2816020015161ffff16611938565b8b8381518110611604576116046133d2565b602002602001018190525061161c81600001516119cb565b8a838151811061162e5761162e6133d2565b602002602001018190525061164a816040015161ffff16611938565b89838151811061165c5761165c6133d2565b60200260200101819052506116798160c0015162ffffff16611938565b88838151811061168b5761168b6133d2565b60200260200101819052506116a68160a0015160020b611acd565b8783815181106116b8576116b86133d2565b60200260200101819052506116d481610120015160ff16611938565b8683815181106116e6576116e66133d2565b60200260200101819052508160000361170a57602081015181519095509250611765565b805183146117655760405162461bcd60e51b815260206004820152602260248201527f534750206f6e6c7920706f737369626c65206f6e207468652073616d652067616044820152616d6560f01b6064820152608401610457565b5061176f816130b7565b90506115a8565b50505092959891949750929550565b61178d612471565b611795612471565b6117a181868686611b3f565b9150505b9392505050565b60808301516117bb9083611b85565b6117c88360800151611b9c565b60005b8151811015611816576118048282815181106117e9576117e96133d2565b60200260200101518560800151611b8590919063ffffffff16565b8061180e816130b7565b9150506117cb565b506118248360800151611ba7565b505050565b60808301516118389083611b85565b60808301516118249082611bb2565b600354600090611861906001600160a01b03168484611bd7565b90505b92915050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b179052611824908490611c6a565b600680546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600654600160a01b900460ff1661090057604051638dfc202b60e01b815260040160405180910390fd5b6060600061194583611ccd565b60010190506000816001600160401b03811115611964576119646126e3565b6040519080825280601f01601f19166020018201604052801561198e576020820181803683370190505b5090508181016020015b600019016f181899199a1a9b1b9c1cb0b131b232b360811b600a86061a8153600a8504945084611998575b509392505050565b606060005b60208160ff16108015611a045750828160ff16602081106119f3576119f36133d2565b1a60f81b6001600160f81b03191615155b15611a1b5780611a1381613939565b9150506119d0565b60008160ff166001600160401b03811115611a3857611a386126e3565b6040519080825280601f01601f191660200182016040528015611a62576020820181803683370190505b50905060005b8260ff168160ff1610156119c357848160ff1660208110611a8b57611a8b6133d2565b1a60f81b828260ff1681518110611aa457611aa46133d2565b60200101906001600160f81b031916908160001a90535080611ac581613939565b915050611a68565b606060008212611aec5760405180602001604052806000815250611b07565b604051806040016040528060018152602001602d60f81b8152505b611b18611b1384611da5565b611938565b604051602001611b2992919061397c565b6040516020818303038152906040529050919050565b611b47612471565b611b578560800151610100611dbc565b50508284526001600160a01b03821660208501526001600160e01b031981166040850152835b949350505050565b611b928260038351611e21565b6118248282611f2e565b6103e0816004611f55565b6103e0816007611f55565b6001600160401b03811115611bcb576108ea8282611f6a565b6108ea82600083611e21565b600454600090611be88160016130e9565b600455835160408086015160808701515191516000936320214ca360e11b93611c209386938493923092918a916001916024016139d7565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b0319909316929092179091529050611c6086838684611fa1565b9695505050505050565b6000611c7f6001600160a01b038416836120ff565b90508051600014158015611ca4575080806020019051810190611ca291906126a5565b155b1561182457604051635274afe760e01b81526001600160a01b0384166004820152602401610457565b60008072184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b8310611d0c5772184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b830492506040015b6d04ee2d6d415b85acef81000000008310611d38576d04ee2d6d415b85acef8100000000830492506020015b662386f26fc100008310611d5657662386f26fc10000830492506010015b6305f5e1008310611d6e576305f5e100830492506008015b6127108310611d8257612710830492506004015b60648310611d94576064830492506002015b600a83106118645760010192915050565b600080821215611db85781600003611864565b5090565b604080518082019091526060815260006020820152611ddc602083613a3f565b15611e0457611dec602083613a3f565b611df7906020613a53565b611e0190836130e9565b91505b506020828101829052604080518085526000815290920101905290565b6017816001600160401b031611611e4b57611e458360e0600585901b16831761210d565b50505050565b60ff816001600160401b031611611e8757611e71836018611fe0600586901b161761210d565b50611e45836001600160401b0383166001612132565b61ffff816001600160401b031611611ec457611eae836019611fe0600586901b161761210d565b50611e45836001600160401b0383166002612132565b63ffffffff816001600160401b031611611f0357611eed83601a611fe0600586901b161761210d565b50611e45836001600160401b0383166004612132565b611f1883601b611fe0600586901b161761210d565b50611e45836001600160401b0383166008612132565b60408051808201909152606081526000602082015261186183846000015151848551612158565b61182482601f611fe0600585901b161761210d565b611f758260c261210d565b506108ea8282604051602001611f8d91815260200190565b604051602081830303815290604052612242565b6040516bffffffffffffffffffffffff193060601b1660208201526034810184905260009060540160408051808303601f1901815282825280516020918201206000818152600590925291812080546001600160a01b0319166001600160a01b038a1617905590925082917fb5e6e01e79f91267dc17b4e6314d5d4d03593d2ceee0fbb452b750bd70ea5af99190a2600254604051630200057560e51b81526001600160a01b0390911690634000aea09061206490889087908790600401613a66565b6020604051808303816000875af1158015612083573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120a791906126a5565b611b7d5760405162461bcd60e51b815260206004820152602360248201527f756e61626c6520746f207472616e73666572416e6443616c6c20746f206f7261604482015262636c6560e81b6064820152608401610457565b60606118618383600061224f565b60408051808201909152606081526000602082015261186183846000015151846122e2565b604080518082019091526060815260006020820152611b7d84856000015151858561233d565b604080518082019091526060815260006020820152825182111561217b57600080fd5b602085015161218a83866130e9565b11156121bd576121bd856121ad876020015187866121a891906130e9565b6123be565b6121b890600261270f565b6123d5565b6000808651805187602083010193508088870111156121dc5787860182525b505050602084015b6020841061221c57805182526121fb6020836130e9565b91506122086020826130e9565b9050612215602085613a53565b93506121e4565b51815160001960208690036101000a019081169019919091161790525083949350505050565b611b928260028351611e21565b6060814710156122745760405163cd78605960e01b8152306004820152602401610457565b600080856001600160a01b031684866040516122909190613a96565b60006040518083038185875af1925050503d80600081146122cd576040519150601f19603f3d011682016040523d82523d6000602084013e6122d2565b606091505b5091509150611c608683836123ec565b604080518082019091526060815260006020820152836020015183106123175761231784856020015160026121b8919061270f565b8351805160208583010184815350808503612333576001810182525b5093949350505050565b604080518082019091526060815260006020820152602085015161236185846130e9565b111561237557612375856121ad86856130e9565b6000600161238584610100613b8c565b61238f9190613a53565b90508551838682010185831982511617815250805184870111156123b35783860181525b509495945050505050565b6000818311156123cf575081611864565b50919050565b81516123e18383611dbc565b50611e458382611f2e565b606082612401576123fc82612448565b6117a5565b815115801561241857506001600160a01b0384163b155b1561244157604051639996b31560e01b81526001600160a01b0385166004820152602401610457565b50806117a5565b8051156124585780518082602001fd5b604051630a12f52160e11b815260040160405180910390fd5b6040805160a0810182526000808252602080830182905282840182905260608084018390528451808601909552845283015290608082015290565b6000602082840312156124be57600080fd5b5035919050565b80151581146103e057600080fd5b6000602082840312156124e557600080fd5b81356117a5816124c5565b60006020828403121561250257600080fd5b81356001600160401b0381111561251857600080fd5b820160c081850312156117a557600080fd5b6001600160a01b03811681146103e057600080fd5b803561254a8161252a565b919050565b6000806040838503121561256257600080fd5b823561256d8161252a565b9150602083013561257d8161252a565b809150509250929050565b60006020828403121561259a57600080fd5b81356117a58161252a565b600080600080600060a086880312156125bd57600080fd5b85356125c88161252a565b945060208601356125d88161252a565b935060408601356125e88161252a565b94979396509394606081013594506080013592915050565b60008060006060848603121561261557600080fd5b833592506020840135612627816124c5565b929592945050506040919091013590565b6000808335601e1984360301811261264f57600080fd5b8301803591506001600160401b0382111561266957600080fd5b6020019150600581901b360382131561268157600080fd5b9250929050565b60006020828403121561269a57600080fd5b81516117a58161252a565b6000602082840312156126b757600080fd5b81516117a5816124c5565b6000823561015e198336030181126126d957600080fd5b9190910192915050565b634e487b7160e01b600052604160045260246000fd5b634e487b7160e01b600052601160045260246000fd5b8082028115828204841417611864576118646126f9565b80546000808355811561182457828152602081208281015b808210156127545782825560018201915061273e565b5050505050565b80546000825580156108ea578160005260206000208181015b80821015611e455761278582612726565b600182019150612774565b61ffff811681146103e057600080fd5b6000813561186481612790565b60ff811681146103e057600080fd5b60008135611864816127ad565b8060020b81146103e057600080fd5b60008135611864816127c9565b62ffffff811681146103e057600080fd5b60008135611864816127e5565b6001600160401b0383111561281a5761281a6126e3565b600160401b83111561282e5761282e6126e3565b805483825580841015612865576000828152602081208581019083015b808210156128615782825560018201915061284b565b5050505b50818160005260208060002060005b8681101561288e5783358282015592820192600101612874565b50505050505050565b600160401b8311156128ab576128ab6126e3565b8054838255808410156128e2576000828152602081208581019083015b808210156128de578282556001820191506128c8565b5050505b50818160005260208060002060005b8681101561288e57833561290481612790565b825461ffff191661ffff82161783555082840135612921816127ad565b82546040860135612931816127c9565b8060181b65ffffff0000001662ff00008460101b1665ffffffff0000198416171785555050506060840193506001820191506001810190506128f1565b600160401b831115612982576129826126e3565b8054838255808410156129be576000828152602090208481019082015b808210156129bb576129b082612726565b60018201915061299f565b50505b508160008281526020808220825b878110156113bc578435601e198836030181126129e7578485fd5b870180356001600160401b038111156129fe578586fd5b90840190606081023603821315612a13578586fd5b612a1e818386612897565b505093820193600191820191016129cc565b8135815560018101612a5a612a47602085016127a0565b825461ffff191661ffff91909116178255565b612a83612a69604085016127a0565b825463ffff0000191660109190911b63ffff000016178255565b506060820135600282015560038101612ab2612aa1608085016127bc565b825460ff191660ff91909116178255565b612add612ac160a085016127d8565b825460089190911b63ffffff001663ffffff0019909116178255565b612b0c612aec60c085016127f6565b825466ffffff00000000191660209190911b66ffffff0000000016178255565b50612b1a60e0830183612638565b612b28818360048601612803565b5050612b38610100830183612638565b612b46818360058601612803565b5050612b6d612b5861012084016127bc565b6006830160ff821660ff198254161781555050565b612b7b610140830183612638565b611e4581836007860161296e565b600081356118648161252a565b80546001600160a01b0319166001600160a01b0392909216919091179055565b612bc08283612638565b600160401b811115612bd457612bd46126e3565b825481845580821015612c785760036001600160fd1b038281168314612bfc57612bfc6126f9565b8084168414612c0d57612c0d6126f9565b5060008581526020812084831b81019084841b015b80821015612c73578282558260018301558260028301558284830155612c4a60048301612726565b612c5660058301612726565b826006830155612c686007830161275b565b600882019150612c22565b505050505b5060008381526020812083915b83811015612cb657612ca0612c9a84876126c2565b83612a30565b6020929092019160089190910190600101612c85565b5050505050602082013560018201556040820135600282015560608201356003820155612cf1612ce860808401612b89565b60048301612b96565b6108ea612d0060a08401612b89565b60058301612b96565b6000808335601e19843603018112612d2057600080fd5b83016020810192503590506001600160401b03811115612d3f57600080fd5b8060051b360382131561268157600080fd5b803561254a81612790565b803561254a816127ad565b803561254a816127c9565b803561254a816127e5565b81835260006001600160fb1b03831115612d9657600080fd5b8260051b80836020870137939093016020019392505050565b8183526000602080850194508260005b858110156123b3578135612dd281612790565b61ffff16875281830135612de5816127ad565b60ff1687840152604082810135612dfb816127c9565b60020b908801526060968701969190910190600101612dbf565b81835260006020808501808196508560051b810191508460005b87811015612e9c5782840389528135601e19883603018112612e5057600080fd5b870185810190356001600160401b03811115612e6b57600080fd5b606081023603821315612e7d57600080fd5b612e88868284612daf565b9a87019a9550505090840190600101612e2f565b5091979650505050505050565b6000823561015e19833603018112612ec057600080fd5b90910192915050565b6000608060018060a01b0387168352602086818501526040868186015260608381870152610140808701612efd898a612d09565b60c08a89018190529281905261016092838b01600583901b8c0185018460005b8581101561304a578e830361015f19018452612f398288612ea9565b80358452612f488d8201612d51565b61ffff168d850152612f5b818d01612d51565b61ffff168c850152808b01358b850152612f768e8201612d5c565b612f848f86018260ff169052565b5060a0612f92818301612d67565b612fa08287018260020b9052565b5050612fad868201612d72565b62ffffff168685015260e0612fc482820183612d09565b8b83880152612fd68c88018284612d7d565b92505050610100612fe981840184612d09565b87840383890152612ffb848284612d7d565b935050505061012061300e818401612d5c565b60ff1690860152613021828c0183612d09565b92508582038c870152613035828483612e15565b968f019695505050918c019150600101612f1d565b5050898e013560a08e0152888e0135838e0152878e013560e08e01526130718b8f0161253f565b6001600160a01b0381166101008f01529a5061308f60a08f0161253f565b6001600160a01b03166101209d909d019c909c5250999e9d5050505050505050505050505050565b6000600182016130c9576130c96126f9565b5060010190565b6000602082840312156130e257600080fd5b5051919050565b80820180821115611864576118646126f9565b634e487b7160e01b600052601260045260246000fd5b600082613121576131216130fc565b500490565b600081518084526020808501945080840160005b838110156123b35781518752958201959082019060010161313a565b600081518084526020808501808196508360051b810191508286016000805b868110156131e4578385038a52825180518087529087019087870190845b818110156131cf578351805161ffff1684528a81015160ff168b85015260409081015160020b9084015292890192606090920191600101613193565b50509a87019a95505091850191600101613175565b509298975050505050505050565b600081518084526020808501808196508360051b8101915082860160005b85811015612e9c578284038952815161016081518652868201516132398888018261ffff169052565b5060408281015161ffff16908701526060808301519087015260808083015160ff169087015260a08083015160020b9087015260c08083015162ffffff169087015260e08083015181880183905261329383890182613126565b9250505061010080830151878303828901526132af8382613126565b92505050610120808301516132c88289018260ff169052565b505061014080830151925086820381880152506132e58183613156565b9a87019a9550505090840190600101613210565b60c08152600061330c60c08301896131f2565b60208301979097525060408101949094526001600160a01b03928316606085015290821660808401521660a090910152919050565b600060018060a01b038089168352876020840152861515604084015260c06060840152855160c08085015261337a6101808501826131f2565b9050602087015160e085015260408701516101008501526060870151610120850152816080880151166101408501528160a08801511661016085015280925050508360808301528260a0830152979650505050505050565b634e487b7160e01b600052603260045260246000fd5b6020815260006118616020830184613126565b604051606081016001600160401b038111828210171561341d5761341d6126e3565b60405290565b60405161016081016001600160401b038111828210171561341d5761341d6126e3565b604051601f8201601f191681016001600160401b038111828210171561346e5761346e6126e3565b604052919050565b60006001600160401b0382111561348f5761348f6126e3565b5060051b60200190565b600060208083850312156134ac57600080fd5b82516001600160401b038111156134c257600080fd5b8301601f810185136134d357600080fd5b80516134e66134e182613476565b613446565b81815260059190911b8201830190838101908783111561350557600080fd5b928401925b828410156135235783518252928401929084019061350a565b979650505050505050565b60408082528181018490526000906060808401600587901b8501820188855b8981101561368057878303605f19018452613568828c612ea9565b61016081358552602061357c818401612d51565b61ffff168187015261358f838a01612d51565b61ffff1689870152828801358887015260806135ac818501612d5c565b60ff169087015260a06135c0848201612d67565b6135ce8289018260020b9052565b505060c06135dd818501612d72565b62ffffff169087015260e06135f484820185612d09565b84838a0152613606858a018284612d7d565b945050505061010061361a81850185612d09565b888503838a015261362c858284612d7d565b945050505061012061363f818501612d5c565b60ff169087015261014061365584820185612d09565b945087840382890152613669848683612e15565b98830198975050509390930192505060010161354d565b505085810360208701526136948188613126565b9998505050505050505050565b600082601f8301126136b257600080fd5b813560206136c26134e183613476565b82815260059290921b840181019181810190868411156136e157600080fd5b8286015b848110156136fc57803583529183019183016136e5565b509695505050505050565b600082601f83011261371857600080fd5b813560206137286134e183613476565b82815260059290921b8401810191818101908684111561374757600080fd5b8286015b848110156136fc5780356001600160401b0381111561376a5760008081fd5b8701603f8101891361377c5760008081fd5b84810135604061378e6134e183613476565b8281526060928302840182019288820191908d8511156137ae5760008081fd5b948301945b848610156138115780868f0312156137cb5760008081fd5b6137d36133fb565b86356137de81612790565b8152868b01356137ed816127ad565b818c0152868501356137fe816127c9565b81860152835294850194918901916137b3565b5087525050509284019250830161374b565b6000610160823603121561383657600080fd5b61383e613423565b8235815261384e60208401612d51565b602082015261385f60408401612d51565b60408201526060830135606082015261387a60808401612d5c565b608082015261388b60a08401612d67565b60a082015261389c60c08401612d72565b60c082015260e08301356001600160401b03808211156138bb57600080fd5b6138c7368387016136a1565b60e0840152610100915081850135818111156138e257600080fd5b6138ee368288016136a1565b83850152506101209150613903828601612d5c565b828401526101409150818501358181111561391d57600080fd5b61392936828801613707565b8385015250505080915050919050565b600060ff821660ff810361394f5761394f6126f9565b60010192915050565b60005b8381101561397357818101518382015260200161395b565b50506000910152565b6000835161398e818460208801613958565b8351908301906139a2818360208801613958565b01949350505050565b600081518084526139c3816020860160208601613958565b601f01601f19169290920160200192915050565b6001600160a01b0389811682526020820189905260408201889052861660608201526001600160e01b03198516608082015260a0810184905260c0810183905261010060e08201819052600090613a30838201856139ab565b9b9a5050505050505050505050565b600082613a4e57613a4e6130fc565b500690565b81810381811115611864576118646126f9565b60018060a01b0384168152826020820152606060408201526000613a8d60608301846139ab565b95945050505050565b600082516126d9818460208701613958565b600181815b80851115613ae3578160001904821115613ac957613ac96126f9565b80851615613ad657918102915b93841c9390800290613aad565b509250929050565b600082613afa57506001611864565b81613b0757506000611864565b8160018114613b1d5760028114613b2757613b43565b6001915050611864565b60ff841115613b3857613b386126f9565b50506001821b611864565b5060208310610133831016604e8410600b8410161715613b66575081810a611864565b613b708383613aa8565b8060001904821115613b8457613b846126f9565b029392505050565b60006118618383613aeb56fea2646970667358221220656f0c10168c3c703e1c5c4fc6cee760a48a6050173cc33eb622f825d8fe98bf64736f6c63430008140033000000000000000000000000149459ad88d23d2ce0f4f1371203db2122331d94000000000000000000000000b7dec0966366ecc5a1906f83caa12cca2edb0a8c00000000000000000000000076923cdde21928ddbec4b8bfdc8143bb6d0841a86435303366646236656233653433613539353665666166636431393532623065000000000000000000000000000000000000000000000000002386f26fc10000
Deployed Bytecode
0x608060405234801561001057600080fd5b506004361061014d5760003560e01c80638da5cb5b116100c3578063c79901f31161007c578063c79901f3146102ec578063c9925288146102ff578063ce18a83714610312578063d395c50814610325578063e27a9abc14610338578063f2fde38b146103b857600080fd5b80638da5cb5b1461027357806390421b7c14610284578063973a814e146102a45780639a995047146102ad578063c35905c6146102c0578063c6a85f6e146102c957600080fd5b8063679c4de111610115578063679c4de1146101f2578063715018a61461020557806371b00be81461020d5780637ff39d2914610216578063805661b01461025757806383223eb51461026a57600080fd5b806301432bf21461015257806316c38b3c1461018a5780631bfa85241461019f5780635c975abb146101c0578063653318f8146101d2575b600080fd5b6101756101603660046124ac565b600f6020526000908152604090205460ff1681565b60405190151581526020015b60405180910390f35b61019d6101983660046124d3565b6103cb565b005b6101b26101ad3660046124f0565b6103eb565b604051908152602001610181565b600654600160a01b900460ff16610175565b6101b26101e03660046124ac565b60106020526000908152604090205481565b61019d61020036600461254f565b610863565b61019d6108ee565b6101b260095481565b61023f6102243660046124ac565b600d602052600090815260409020546001600160a01b031681565b6040516001600160a01b039091168152602001610181565b61019d610265366004612588565b610902565b6101b2600b5481565b6006546001600160a01b031661023f565b6101b26102923660046124ac565b60126020526000908152604090205481565b6101b260115481565b61019d6102bb3660046124ac565b61095f565b6101b2600a5481565b6101756102d73660046124ac565b600e6020526000908152604090205460ff1681565b61019d6102fa3660046125a5565b61099c565b60075461023f906001600160a01b031681565b60085461023f906001600160a01b031681565b61019d610333366004612600565b610a59565b6103846103463660046124ac565b600c60205260009081526040902060018101546002820154600383015460048401546005909401549293919290916001600160a01b03908116911685565b604080519586526020860194909452928401919091526001600160a01b03908116606084015216608082015260a001610181565b61019d6103c6366004612588565b6110a5565b6103d36110e0565b806103e3576103e061110d565b50565b6103e0611162565b60006103f56111a5565b60016104018380612638565b9050116104605760405162461bcd60e51b815260206004820152602260248201527f534750206e6f7420706f737369626c6520666f7220612073696e676c652067616044820152616d6560f01b60648201526084015b60405180910390fd5b61047261046d8380612638565b6111d0565b600080808080808061048c6104878a80612638565b6113c6565b9650965096509650965096509650600760009054906101000a90046001600160a01b03166001600160a01b031663478426636040518163ffffffff1660e01b8152600401602060405180830381865afa1580156104ed573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105119190612688565b6040516301aa3c6960e11b815261ffff831660048201526001600160a01b03919091169063035478d290602401602060405180830381865afa15801561055b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061057f91906126a5565b6105d75760405162461bcd60e51b815260206004820152602360248201527f5347502074726164696e67206e6f7420656e61626c6564206f6e205f73706f726044820152621d125960ea1b6064820152608401610457565b60006105ed6009543063d395c50860e01b611785565b60408051808201909152600881526773706f727449647360c01b602082015290915061061b9082908a6117ac565b60408051808201909152600781526667616d6549647360c81b6020820152610645908290896117ac565b6040805180820190915260078152667479706549647360c81b602082015261066f908290886117ac565b604080518082019091526009815268706c6179657249647360b81b602082015261069b908290876117ac565b604080518082019091526009815268706f736974696f6e7360b81b60208201526106c7908290856117ac565b6040805180820190915260058152646c696e657360d81b60208201526106ef908290866117ac565b61072b6040518060400160405280600b81526020016a189d5e525b905b5bdd5b9d60aa1b8152508b60200135836118299092919063ffffffff16565b604080518082018252600d81526c657870656374656451756f746560981b602082015261075d918391908d0135611829565b6040805180820190915260128152716164646974696f6e616c536c69707061676560701b602082015261079690829060608d0135611829565b6107a281600a54611847565b6000818152601060209081526040808320429055600c90915290209099508a906107cc8282612bb6565b50506000898152600d6020908152604080832080546001600160a01b031916339081179091556011805485526012909352928190208c9055905490517fb9322e7b107a6e3b264aae40c7cd06c5f5f3832a372cbca5083e559ecb72df35926108399290918d908f90612ec9565b60405180910390a160118054906000610851836130b7565b91905055505050505050505050919050565b61086b6110e0565b6040516370a0823160e01b81523060048201526108ea9082906001600160a01b038516906370a0823190602401602060405180830381865afa1580156108b5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108d991906130d0565b6001600160a01b038516919061186a565b5050565b6108f66110e0565b61090060006118bc565b565b61090a6110e0565b600880546001600160a01b0319166001600160a01b0383169081179091556040519081527fc238ff72ce9e31f22c0ef8bf1c701fcc6afd3ed4edc2224a63f16346b68420fb906020015b60405180910390a150565b6109676110e0565b600b8190556040518181527fa1d20d22955d911c8b338eeec58c0fa61197b85b255251efe74df475baa5c73890602001610954565b6109a46110e0565b600280546001600160a01b0319166001600160a01b038716179055600380546001600160a01b0319166001600160a01b038616179055600780546001600160a01b0319166001600160a01b038581169182179092556009849055600a839055604080518884168152928716602084015282015260608101839052608081018290527f4bba2924c9f8b1d7003061aed0e3737c74fddf1b79cd48799498f21058f40ef89060a00160405180910390a15050505050565b610a616111a5565b60008381526005602052604090205483906001600160a01b03163314610ada5760405162461bcd60e51b815260206004820152602860248201527f536f75726365206d75737420626520746865206f7261636c65206f6620746865604482015267081c995c5d595cdd60c21b6064820152608401610457565b60008181526005602052604080822080546001600160a01b03191690555182917f7cc135e0cebb02c3480ae5d74d377283180a2601f8f644edf7987b009316c63a91a26000848152600f602052604090205460ff1615610b7c5760405162461bcd60e51b815260206004820152601c60248201527f5265717565737420494420616c72656164792066756c66696c6c6564000000006044820152606401610457565b600b546000858152601060205260409020544291610b99916130e9565b11610bda5760405162461bcd60e51b815260206004820152601160248201527014995c5d595cdd081d1a5b5959081bdd5d607a1b6044820152606401610457565b6000848152600c602090815260408083208151815460e09481028201850190935260c08101838152909391928492849190879085015b82821015610e1a57600084815260209081902060408051610160810182526008860290920180548352600181015461ffff808216858701526201000090910416838301526002808201546060850152600382015460ff81166080860152610100810490910b60a0850152640100000000900462ffffff1660c08401526004810180548351818702810187019094528084529394919360e086019392830182828015610cda57602002820191906000526020600020905b815481526020019060010190808311610cc6575b5050505050815260200160058201805480602002602001604051908101604052809291908181526020018280548015610d3257602002820191906000526020600020905b815481526020019060010190808311610d1e575b5050509183525050600682015460ff16602080830191909152600783018054604080518285028101850182528281529401939260009084015b82821015610e0357838290600052602060002001805480602002602001604051908101604052809291908181526020016000905b82821015610df0576000848152602090819020604080516060810182529185015461ffff8116835260ff62010000820416838501526301000000900460020b90820152825260019092019101610d9f565b5050505081526020019060010190610d6b565b505050508152505081526020019060010190610c10565b5050509082525060018201546020808301919091526002830154604080840191909152600384015460608085019190915260048501546001600160a01b039081166080860152600590950154851660a09094019390935260008a8152600d909252902054908301519293501690610e9990670de0b6b3a76400006130e9565b6040830151610eb086670de0b6b3a764000061270f565b610eba9190613112565b1115610efc5760405162461bcd60e51b81526020600482015260116024820152700a6d8d2e0e0c2ceca40e8dede40d0d2ced607b1b6044820152606401610457565b841561102a5760075482516020840151608085015160a0860151604051630539ea6d60e31b81526000956001600160a01b0316946329cf536894610f4c94919390928c928a9290916004016132f9565b6020604051808303816000875af1158015610f6b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f8f9190612688565b6008549091506001600160a01b039081169083160361102857600854602084015160a0850151604051637eda2d7b60e01b8152600481018b90526001600160a01b03858116602483015260448201939093529082166064820152911690637eda2d7b90608401600060405180830381600087803b15801561100f57600080fd5b505af1158015611023573d6000803e3d6000fd5b505050505b505b6000868152600e60209081526040808320805489151560ff1991821617909155600f9092529182902080549091166001179055517f9ac10703b3e9d090d5cd8013abd92abe8a6d2033c0a9672a6ee37264075da6eb906110959083908990899087908a904290613341565b60405180910390a1505050505050565b6110ad6110e0565b6001600160a01b0381166110d757604051631e4fbdf760e01b815260006004820152602401610457565b6103e0816118bc565b6006546001600160a01b031633146109005760405163118cdaa760e01b8152336004820152602401610457565b61111561190e565b6006805460ff60a01b191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b61116a6111a5565b6006805460ff60a01b1916600160a01b1790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586111453390565b600654600160a01b900460ff16156109005760405163d93c066560e01b815260040160405180910390fd5b806000816001600160401b038111156111eb576111eb6126e3565b604051908082528060200260200182016040528015611214578160200160208202803683370190505b50905060005b8281101561127757848482818110611234576112346133d2565b905060200281019061124691906126c2565b6000013582828151811061125c5761125c6133d2565b6020908102919091010152611270816130b7565b905061121a565b50600760009054906101000a90046001600160a01b03166001600160a01b031663478426636040518163ffffffff1660e01b8152600401602060405180830381865afa1580156112cb573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112ef9190612688565b600754604051633f51f97b60e21b81526001600160a01b039283169263c5d89be892889288929091169063fd47e5ec9061132d9088906004016133e8565b600060405180830381865afa15801561134a573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526113729190810190613499565b6040518463ffffffff1660e01b81526004016113909392919061352e565b60006040518083038186803b1580156113a857600080fd5b505afa1580156113bc573d6000803e3d6000fd5b5050505050505050565b60608080808080600087806001600160401b038111156113e8576113e86126e3565b60405190808252806020026020018201604052801561141b57816020015b60608152602001906001900390816114065790505b509750806001600160401b03811115611436576114366126e3565b60405190808252806020026020018201604052801561146957816020015b60608152602001906001900390816114545790505b509650806001600160401b03811115611484576114846126e3565b6040519080825280602002602001820160405280156114b757816020015b60608152602001906001900390816114a25790505b509550806001600160401b038111156114d2576114d26126e3565b60405190808252806020026020018201604052801561150557816020015b60608152602001906001900390816114f05790505b509450806001600160401b03811115611520576115206126e3565b60405190808252806020026020018201604052801561155357816020015b606081526020019060019003908161153e5790505b509350806001600160401b0381111561156e5761156e6126e3565b6040519080825280602002602001820160405280156115a157816020015b606081526020019060019003908161158c5790505b5092506000805b828110156117765760008c8c838181106115c4576115c46133d2565b90506020028101906115d691906126c2565b6115df90613823565b90506115f2816020015161ffff16611938565b8b8381518110611604576116046133d2565b602002602001018190525061161c81600001516119cb565b8a838151811061162e5761162e6133d2565b602002602001018190525061164a816040015161ffff16611938565b89838151811061165c5761165c6133d2565b60200260200101819052506116798160c0015162ffffff16611938565b88838151811061168b5761168b6133d2565b60200260200101819052506116a68160a0015160020b611acd565b8783815181106116b8576116b86133d2565b60200260200101819052506116d481610120015160ff16611938565b8683815181106116e6576116e66133d2565b60200260200101819052508160000361170a57602081015181519095509250611765565b805183146117655760405162461bcd60e51b815260206004820152602260248201527f534750206f6e6c7920706f737369626c65206f6e207468652073616d652067616044820152616d6560f01b6064820152608401610457565b5061176f816130b7565b90506115a8565b50505092959891949750929550565b61178d612471565b611795612471565b6117a181868686611b3f565b9150505b9392505050565b60808301516117bb9083611b85565b6117c88360800151611b9c565b60005b8151811015611816576118048282815181106117e9576117e96133d2565b60200260200101518560800151611b8590919063ffffffff16565b8061180e816130b7565b9150506117cb565b506118248360800151611ba7565b505050565b60808301516118389083611b85565b60808301516118249082611bb2565b600354600090611861906001600160a01b03168484611bd7565b90505b92915050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b179052611824908490611c6a565b600680546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600654600160a01b900460ff1661090057604051638dfc202b60e01b815260040160405180910390fd5b6060600061194583611ccd565b60010190506000816001600160401b03811115611964576119646126e3565b6040519080825280601f01601f19166020018201604052801561198e576020820181803683370190505b5090508181016020015b600019016f181899199a1a9b1b9c1cb0b131b232b360811b600a86061a8153600a8504945084611998575b509392505050565b606060005b60208160ff16108015611a045750828160ff16602081106119f3576119f36133d2565b1a60f81b6001600160f81b03191615155b15611a1b5780611a1381613939565b9150506119d0565b60008160ff166001600160401b03811115611a3857611a386126e3565b6040519080825280601f01601f191660200182016040528015611a62576020820181803683370190505b50905060005b8260ff168160ff1610156119c357848160ff1660208110611a8b57611a8b6133d2565b1a60f81b828260ff1681518110611aa457611aa46133d2565b60200101906001600160f81b031916908160001a90535080611ac581613939565b915050611a68565b606060008212611aec5760405180602001604052806000815250611b07565b604051806040016040528060018152602001602d60f81b8152505b611b18611b1384611da5565b611938565b604051602001611b2992919061397c565b6040516020818303038152906040529050919050565b611b47612471565b611b578560800151610100611dbc565b50508284526001600160a01b03821660208501526001600160e01b031981166040850152835b949350505050565b611b928260038351611e21565b6118248282611f2e565b6103e0816004611f55565b6103e0816007611f55565b6001600160401b03811115611bcb576108ea8282611f6a565b6108ea82600083611e21565b600454600090611be88160016130e9565b600455835160408086015160808701515191516000936320214ca360e11b93611c209386938493923092918a916001916024016139d7565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b0319909316929092179091529050611c6086838684611fa1565b9695505050505050565b6000611c7f6001600160a01b038416836120ff565b90508051600014158015611ca4575080806020019051810190611ca291906126a5565b155b1561182457604051635274afe760e01b81526001600160a01b0384166004820152602401610457565b60008072184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b8310611d0c5772184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b830492506040015b6d04ee2d6d415b85acef81000000008310611d38576d04ee2d6d415b85acef8100000000830492506020015b662386f26fc100008310611d5657662386f26fc10000830492506010015b6305f5e1008310611d6e576305f5e100830492506008015b6127108310611d8257612710830492506004015b60648310611d94576064830492506002015b600a83106118645760010192915050565b600080821215611db85781600003611864565b5090565b604080518082019091526060815260006020820152611ddc602083613a3f565b15611e0457611dec602083613a3f565b611df7906020613a53565b611e0190836130e9565b91505b506020828101829052604080518085526000815290920101905290565b6017816001600160401b031611611e4b57611e458360e0600585901b16831761210d565b50505050565b60ff816001600160401b031611611e8757611e71836018611fe0600586901b161761210d565b50611e45836001600160401b0383166001612132565b61ffff816001600160401b031611611ec457611eae836019611fe0600586901b161761210d565b50611e45836001600160401b0383166002612132565b63ffffffff816001600160401b031611611f0357611eed83601a611fe0600586901b161761210d565b50611e45836001600160401b0383166004612132565b611f1883601b611fe0600586901b161761210d565b50611e45836001600160401b0383166008612132565b60408051808201909152606081526000602082015261186183846000015151848551612158565b61182482601f611fe0600585901b161761210d565b611f758260c261210d565b506108ea8282604051602001611f8d91815260200190565b604051602081830303815290604052612242565b6040516bffffffffffffffffffffffff193060601b1660208201526034810184905260009060540160408051808303601f1901815282825280516020918201206000818152600590925291812080546001600160a01b0319166001600160a01b038a1617905590925082917fb5e6e01e79f91267dc17b4e6314d5d4d03593d2ceee0fbb452b750bd70ea5af99190a2600254604051630200057560e51b81526001600160a01b0390911690634000aea09061206490889087908790600401613a66565b6020604051808303816000875af1158015612083573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120a791906126a5565b611b7d5760405162461bcd60e51b815260206004820152602360248201527f756e61626c6520746f207472616e73666572416e6443616c6c20746f206f7261604482015262636c6560e81b6064820152608401610457565b60606118618383600061224f565b60408051808201909152606081526000602082015261186183846000015151846122e2565b604080518082019091526060815260006020820152611b7d84856000015151858561233d565b604080518082019091526060815260006020820152825182111561217b57600080fd5b602085015161218a83866130e9565b11156121bd576121bd856121ad876020015187866121a891906130e9565b6123be565b6121b890600261270f565b6123d5565b6000808651805187602083010193508088870111156121dc5787860182525b505050602084015b6020841061221c57805182526121fb6020836130e9565b91506122086020826130e9565b9050612215602085613a53565b93506121e4565b51815160001960208690036101000a019081169019919091161790525083949350505050565b611b928260028351611e21565b6060814710156122745760405163cd78605960e01b8152306004820152602401610457565b600080856001600160a01b031684866040516122909190613a96565b60006040518083038185875af1925050503d80600081146122cd576040519150601f19603f3d011682016040523d82523d6000602084013e6122d2565b606091505b5091509150611c608683836123ec565b604080518082019091526060815260006020820152836020015183106123175761231784856020015160026121b8919061270f565b8351805160208583010184815350808503612333576001810182525b5093949350505050565b604080518082019091526060815260006020820152602085015161236185846130e9565b111561237557612375856121ad86856130e9565b6000600161238584610100613b8c565b61238f9190613a53565b90508551838682010185831982511617815250805184870111156123b35783860181525b509495945050505050565b6000818311156123cf575081611864565b50919050565b81516123e18383611dbc565b50611e458382611f2e565b606082612401576123fc82612448565b6117a5565b815115801561241857506001600160a01b0384163b155b1561244157604051639996b31560e01b81526001600160a01b0385166004820152602401610457565b50806117a5565b8051156124585780518082602001fd5b604051630a12f52160e11b815260040160405180910390fd5b6040805160a0810182526000808252602080830182905282840182905260608084018390528451808601909552845283015290608082015290565b6000602082840312156124be57600080fd5b5035919050565b80151581146103e057600080fd5b6000602082840312156124e557600080fd5b81356117a5816124c5565b60006020828403121561250257600080fd5b81356001600160401b0381111561251857600080fd5b820160c081850312156117a557600080fd5b6001600160a01b03811681146103e057600080fd5b803561254a8161252a565b919050565b6000806040838503121561256257600080fd5b823561256d8161252a565b9150602083013561257d8161252a565b809150509250929050565b60006020828403121561259a57600080fd5b81356117a58161252a565b600080600080600060a086880312156125bd57600080fd5b85356125c88161252a565b945060208601356125d88161252a565b935060408601356125e88161252a565b94979396509394606081013594506080013592915050565b60008060006060848603121561261557600080fd5b833592506020840135612627816124c5565b929592945050506040919091013590565b6000808335601e1984360301811261264f57600080fd5b8301803591506001600160401b0382111561266957600080fd5b6020019150600581901b360382131561268157600080fd5b9250929050565b60006020828403121561269a57600080fd5b81516117a58161252a565b6000602082840312156126b757600080fd5b81516117a5816124c5565b6000823561015e198336030181126126d957600080fd5b9190910192915050565b634e487b7160e01b600052604160045260246000fd5b634e487b7160e01b600052601160045260246000fd5b8082028115828204841417611864576118646126f9565b80546000808355811561182457828152602081208281015b808210156127545782825560018201915061273e565b5050505050565b80546000825580156108ea578160005260206000208181015b80821015611e455761278582612726565b600182019150612774565b61ffff811681146103e057600080fd5b6000813561186481612790565b60ff811681146103e057600080fd5b60008135611864816127ad565b8060020b81146103e057600080fd5b60008135611864816127c9565b62ffffff811681146103e057600080fd5b60008135611864816127e5565b6001600160401b0383111561281a5761281a6126e3565b600160401b83111561282e5761282e6126e3565b805483825580841015612865576000828152602081208581019083015b808210156128615782825560018201915061284b565b5050505b50818160005260208060002060005b8681101561288e5783358282015592820192600101612874565b50505050505050565b600160401b8311156128ab576128ab6126e3565b8054838255808410156128e2576000828152602081208581019083015b808210156128de578282556001820191506128c8565b5050505b50818160005260208060002060005b8681101561288e57833561290481612790565b825461ffff191661ffff82161783555082840135612921816127ad565b82546040860135612931816127c9565b8060181b65ffffff0000001662ff00008460101b1665ffffffff0000198416171785555050506060840193506001820191506001810190506128f1565b600160401b831115612982576129826126e3565b8054838255808410156129be576000828152602090208481019082015b808210156129bb576129b082612726565b60018201915061299f565b50505b508160008281526020808220825b878110156113bc578435601e198836030181126129e7578485fd5b870180356001600160401b038111156129fe578586fd5b90840190606081023603821315612a13578586fd5b612a1e818386612897565b505093820193600191820191016129cc565b8135815560018101612a5a612a47602085016127a0565b825461ffff191661ffff91909116178255565b612a83612a69604085016127a0565b825463ffff0000191660109190911b63ffff000016178255565b506060820135600282015560038101612ab2612aa1608085016127bc565b825460ff191660ff91909116178255565b612add612ac160a085016127d8565b825460089190911b63ffffff001663ffffff0019909116178255565b612b0c612aec60c085016127f6565b825466ffffff00000000191660209190911b66ffffff0000000016178255565b50612b1a60e0830183612638565b612b28818360048601612803565b5050612b38610100830183612638565b612b46818360058601612803565b5050612b6d612b5861012084016127bc565b6006830160ff821660ff198254161781555050565b612b7b610140830183612638565b611e4581836007860161296e565b600081356118648161252a565b80546001600160a01b0319166001600160a01b0392909216919091179055565b612bc08283612638565b600160401b811115612bd457612bd46126e3565b825481845580821015612c785760036001600160fd1b038281168314612bfc57612bfc6126f9565b8084168414612c0d57612c0d6126f9565b5060008581526020812084831b81019084841b015b80821015612c73578282558260018301558260028301558284830155612c4a60048301612726565b612c5660058301612726565b826006830155612c686007830161275b565b600882019150612c22565b505050505b5060008381526020812083915b83811015612cb657612ca0612c9a84876126c2565b83612a30565b6020929092019160089190910190600101612c85565b5050505050602082013560018201556040820135600282015560608201356003820155612cf1612ce860808401612b89565b60048301612b96565b6108ea612d0060a08401612b89565b60058301612b96565b6000808335601e19843603018112612d2057600080fd5b83016020810192503590506001600160401b03811115612d3f57600080fd5b8060051b360382131561268157600080fd5b803561254a81612790565b803561254a816127ad565b803561254a816127c9565b803561254a816127e5565b81835260006001600160fb1b03831115612d9657600080fd5b8260051b80836020870137939093016020019392505050565b8183526000602080850194508260005b858110156123b3578135612dd281612790565b61ffff16875281830135612de5816127ad565b60ff1687840152604082810135612dfb816127c9565b60020b908801526060968701969190910190600101612dbf565b81835260006020808501808196508560051b810191508460005b87811015612e9c5782840389528135601e19883603018112612e5057600080fd5b870185810190356001600160401b03811115612e6b57600080fd5b606081023603821315612e7d57600080fd5b612e88868284612daf565b9a87019a9550505090840190600101612e2f565b5091979650505050505050565b6000823561015e19833603018112612ec057600080fd5b90910192915050565b6000608060018060a01b0387168352602086818501526040868186015260608381870152610140808701612efd898a612d09565b60c08a89018190529281905261016092838b01600583901b8c0185018460005b8581101561304a578e830361015f19018452612f398288612ea9565b80358452612f488d8201612d51565b61ffff168d850152612f5b818d01612d51565b61ffff168c850152808b01358b850152612f768e8201612d5c565b612f848f86018260ff169052565b5060a0612f92818301612d67565b612fa08287018260020b9052565b5050612fad868201612d72565b62ffffff168685015260e0612fc482820183612d09565b8b83880152612fd68c88018284612d7d565b92505050610100612fe981840184612d09565b87840383890152612ffb848284612d7d565b935050505061012061300e818401612d5c565b60ff1690860152613021828c0183612d09565b92508582038c870152613035828483612e15565b968f019695505050918c019150600101612f1d565b5050898e013560a08e0152888e0135838e0152878e013560e08e01526130718b8f0161253f565b6001600160a01b0381166101008f01529a5061308f60a08f0161253f565b6001600160a01b03166101209d909d019c909c5250999e9d5050505050505050505050505050565b6000600182016130c9576130c96126f9565b5060010190565b6000602082840312156130e257600080fd5b5051919050565b80820180821115611864576118646126f9565b634e487b7160e01b600052601260045260246000fd5b600082613121576131216130fc565b500490565b600081518084526020808501945080840160005b838110156123b35781518752958201959082019060010161313a565b600081518084526020808501808196508360051b810191508286016000805b868110156131e4578385038a52825180518087529087019087870190845b818110156131cf578351805161ffff1684528a81015160ff168b85015260409081015160020b9084015292890192606090920191600101613193565b50509a87019a95505091850191600101613175565b509298975050505050505050565b600081518084526020808501808196508360051b8101915082860160005b85811015612e9c578284038952815161016081518652868201516132398888018261ffff169052565b5060408281015161ffff16908701526060808301519087015260808083015160ff169087015260a08083015160020b9087015260c08083015162ffffff169087015260e08083015181880183905261329383890182613126565b9250505061010080830151878303828901526132af8382613126565b92505050610120808301516132c88289018260ff169052565b505061014080830151925086820381880152506132e58183613156565b9a87019a9550505090840190600101613210565b60c08152600061330c60c08301896131f2565b60208301979097525060408101949094526001600160a01b03928316606085015290821660808401521660a090910152919050565b600060018060a01b038089168352876020840152861515604084015260c06060840152855160c08085015261337a6101808501826131f2565b9050602087015160e085015260408701516101008501526060870151610120850152816080880151166101408501528160a08801511661016085015280925050508360808301528260a0830152979650505050505050565b634e487b7160e01b600052603260045260246000fd5b6020815260006118616020830184613126565b604051606081016001600160401b038111828210171561341d5761341d6126e3565b60405290565b60405161016081016001600160401b038111828210171561341d5761341d6126e3565b604051601f8201601f191681016001600160401b038111828210171561346e5761346e6126e3565b604052919050565b60006001600160401b0382111561348f5761348f6126e3565b5060051b60200190565b600060208083850312156134ac57600080fd5b82516001600160401b038111156134c257600080fd5b8301601f810185136134d357600080fd5b80516134e66134e182613476565b613446565b81815260059190911b8201830190838101908783111561350557600080fd5b928401925b828410156135235783518252928401929084019061350a565b979650505050505050565b60408082528181018490526000906060808401600587901b8501820188855b8981101561368057878303605f19018452613568828c612ea9565b61016081358552602061357c818401612d51565b61ffff168187015261358f838a01612d51565b61ffff1689870152828801358887015260806135ac818501612d5c565b60ff169087015260a06135c0848201612d67565b6135ce8289018260020b9052565b505060c06135dd818501612d72565b62ffffff169087015260e06135f484820185612d09565b84838a0152613606858a018284612d7d565b945050505061010061361a81850185612d09565b888503838a015261362c858284612d7d565b945050505061012061363f818501612d5c565b60ff169087015261014061365584820185612d09565b945087840382890152613669848683612e15565b98830198975050509390930192505060010161354d565b505085810360208701526136948188613126565b9998505050505050505050565b600082601f8301126136b257600080fd5b813560206136c26134e183613476565b82815260059290921b840181019181810190868411156136e157600080fd5b8286015b848110156136fc57803583529183019183016136e5565b509695505050505050565b600082601f83011261371857600080fd5b813560206137286134e183613476565b82815260059290921b8401810191818101908684111561374757600080fd5b8286015b848110156136fc5780356001600160401b0381111561376a5760008081fd5b8701603f8101891361377c5760008081fd5b84810135604061378e6134e183613476565b8281526060928302840182019288820191908d8511156137ae5760008081fd5b948301945b848610156138115780868f0312156137cb5760008081fd5b6137d36133fb565b86356137de81612790565b8152868b01356137ed816127ad565b818c0152868501356137fe816127c9565b81860152835294850194918901916137b3565b5087525050509284019250830161374b565b6000610160823603121561383657600080fd5b61383e613423565b8235815261384e60208401612d51565b602082015261385f60408401612d51565b60408201526060830135606082015261387a60808401612d5c565b608082015261388b60a08401612d67565b60a082015261389c60c08401612d72565b60c082015260e08301356001600160401b03808211156138bb57600080fd5b6138c7368387016136a1565b60e0840152610100915081850135818111156138e257600080fd5b6138ee368288016136a1565b83850152506101209150613903828601612d5c565b828401526101409150818501358181111561391d57600080fd5b61392936828801613707565b8385015250505080915050919050565b600060ff821660ff810361394f5761394f6126f9565b60010192915050565b60005b8381101561397357818101518382015260200161395b565b50506000910152565b6000835161398e818460208801613958565b8351908301906139a2818360208801613958565b01949350505050565b600081518084526139c3816020860160208601613958565b601f01601f19169290920160200192915050565b6001600160a01b0389811682526020820189905260408201889052861660608201526001600160e01b03198516608082015260a0810184905260c0810183905261010060e08201819052600090613a30838201856139ab565b9b9a5050505050505050505050565b600082613a4e57613a4e6130fc565b500690565b81810381811115611864576118646126f9565b60018060a01b0384168152826020820152606060408201526000613a8d60608301846139ab565b95945050505050565b600082516126d9818460208701613958565b600181815b80851115613ae3578160001904821115613ac957613ac96126f9565b80851615613ad657918102915b93841c9390800290613aad565b509250929050565b600082613afa57506001611864565b81613b0757506000611864565b8160018114613b1d5760028114613b2757613b43565b6001915050611864565b60ff841115613b3857613b386126f9565b50506001821b611864565b5060208310610133831016604e8410600b8410161715613b66575081810a611864565b613b708383613aa8565b8060001904821115613b8457613b846126f9565b029392505050565b60006118618383613aeb56fea2646970667358221220656f0c10168c3c703e1c5c4fc6cee760a48a6050173cc33eb622f825d8fe98bf64736f6c63430008140033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000149459ad88d23d2ce0f4f1371203db2122331d94000000000000000000000000b7dec0966366ecc5a1906f83caa12cca2edb0a8c00000000000000000000000076923cdde21928ddbec4b8bfdc8143bb6d0841a86435303366646236656233653433613539353665666166636431393532623065000000000000000000000000000000000000000000000000002386f26fc10000
-----Decoded View---------------
Arg [0] : _link (address): 0x149459AD88d23d2ce0F4F1371203Db2122331d94
Arg [1] : _oracle (address): 0xB7dec0966366ecC5A1906F83caA12CCA2EDb0a8c
Arg [2] : _sportsAMM (address): 0x76923cDDE21928ddbeC4B8BFDC8143BB6d0841a8
Arg [3] : _jobSpecId (bytes32): 0x6435303366646236656233653433613539353665666166636431393532623065
Arg [4] : _paymentAmount (uint256): 10000000000000000
-----Encoded View---------------
5 Constructor Arguments found :
Arg [0] : 000000000000000000000000149459ad88d23d2ce0f4f1371203db2122331d94
Arg [1] : 000000000000000000000000b7dec0966366ecc5a1906f83caa12cca2edb0a8c
Arg [2] : 00000000000000000000000076923cdde21928ddbec4b8bfdc8143bb6d0841a8
Arg [3] : 6435303366646236656233653433613539353665666166636431393532623065
Arg [4] : 000000000000000000000000000000000000000000000000002386f26fc10000
Loading...
Loading
Loading...
Loading
Loading...
Loading
Net Worth in USD
$0.00
Net Worth in ETH
0
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.