Source Code
Overview
S Balance
S Value
$0.05 (@ $0.07/S)Latest 25 from a total of 602 transactions
| Transaction Hash |
|
Block
|
From
|
To
|
|||||
|---|---|---|---|---|---|---|---|---|---|
| Withdraw Fees | 50742760 | 103 days ago | IN | 0 S | 0.00276251 | ||||
| Perform Upkeep | 49384527 | 114 days ago | IN | 1 wei | 0.0175908 | ||||
| Place Prediction | 49384446 | 114 days ago | IN | 0.98 S | 0.0198113 | ||||
| Perform Upkeep | 49384108 | 114 days ago | IN | 1 wei | 0.018075 | ||||
| Place Prediction | 49384042 | 114 days ago | IN | 0.98 S | 0.018838 | ||||
| Place Prediction | 49384016 | 114 days ago | IN | 0.98 S | 0.01981255 | ||||
| Place Prediction | 49383910 | 114 days ago | IN | 0.98 S | 0.01528705 | ||||
| Place Prediction | 49383779 | 114 days ago | IN | 0.98 S | 0.01521088 | ||||
| Perform Upkeep | 49264152 | 115 days ago | IN | 1 wei | 0.0175893 | ||||
| Place Prediction | 49264145 | 115 days ago | IN | 0.98 S | 0.02091687 | ||||
| Perform Upkeep | 49184645 | 116 days ago | IN | 1 wei | 0.02247695 | ||||
| Place Prediction | 49184637 | 116 days ago | IN | 0.98 S | 0.0198149 | ||||
| Perform Upkeep | 49184084 | 116 days ago | IN | 1 wei | 0.0175902 | ||||
| Place Prediction | 49184074 | 116 days ago | IN | 0.98 S | 0.01973335 | ||||
| Place Prediction | 49184015 | 116 days ago | IN | 0.98 S | 0.0152853 | ||||
| Perform Upkeep | 49176427 | 116 days ago | IN | 1 wei | 0.01758945 | ||||
| Place Prediction | 49176397 | 116 days ago | IN | 0.98 S | 0.0150815 | ||||
| Place Prediction | 49176342 | 116 days ago | IN | 0.98 S | 0.0197302 | ||||
| Perform Upkeep | 49165219 | 116 days ago | IN | 1 wei | 0.0171196 | ||||
| Place Prediction | 49165139 | 116 days ago | IN | 0.98 S | 0.02080039 | ||||
| Perform Upkeep | 49165002 | 116 days ago | IN | 1 wei | 0.02271213 | ||||
| Place Prediction | 49164880 | 116 days ago | IN | 0.98 S | 0.0198088 | ||||
| Place Prediction | 49164819 | 116 days ago | IN | 0.98 S | 0.015211 | ||||
| Perform Upkeep | 49161230 | 116 days ago | IN | 1 wei | 0.02247065 | ||||
| Place Prediction | 49161141 | 116 days ago | IN | 0.98 S | 0.02377338 |
Latest 25 internal transactions (View All)
Advanced mode:
| Parent Transaction Hash | Block | From | To | |||
|---|---|---|---|---|---|---|
| 50742760 | 103 days ago | 107 S | ||||
| 49384527 | 114 days ago | 1 wei | ||||
| 49384446 | 114 days ago | 1 wei | ||||
| 49384108 | 114 days ago | 1 wei | ||||
| 49384042 | 114 days ago | 1 wei | ||||
| 49384016 | 114 days ago | 1 wei | ||||
| 49383910 | 114 days ago | 1 wei | ||||
| 49383779 | 114 days ago | 1 wei | ||||
| 49264152 | 115 days ago | 1 wei | ||||
| 49264145 | 115 days ago | 1 wei | ||||
| 49184645 | 116 days ago | 1 wei | ||||
| 49184637 | 116 days ago | 1 wei | ||||
| 49184084 | 116 days ago | 1 wei | ||||
| 49184074 | 116 days ago | 1 wei | ||||
| 49184015 | 116 days ago | 1 wei | ||||
| 49176427 | 116 days ago | 1 wei | ||||
| 49176397 | 116 days ago | 1 wei | ||||
| 49176342 | 116 days ago | 1 wei | ||||
| 49165219 | 116 days ago | 1 wei | ||||
| 49165139 | 116 days ago | 1 wei | ||||
| 49165002 | 116 days ago | 1 wei | ||||
| 49164880 | 116 days ago | 1 wei | ||||
| 49164819 | 116 days ago | 1 wei | ||||
| 49161230 | 116 days ago | 1 wei | ||||
| 49161141 | 116 days ago | 1 wei |
Cross-Chain Transactions
Loading...
Loading
Contract Name:
BangOrCrash
Compiler Version
v0.8.16+commit.07a7930e
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.16;
import "./Base.sol";
import "@pythnetwork/pyth-sdk-solidity/IPyth.sol";
import "@pythnetwork/pyth-sdk-solidity/PythStructs.sol";
import { SafeMath } from "@openzeppelin/contracts/utils/math/SafeMath.sol";
library BangOrCrashErrors {
error InvalidAsset();
error Unauthorized();
error NoPredictions();
}
contract BangOrCrash is Base {
using SafeMath for uint256;
using SafeERC20 for IERC20;
// Pyth price feed
IPyth public pyth;
// Supported price feed IDs
mapping(bytes32 => bool) public supportedAssets;
bytes32[] public assetIds;
// Current asset being used
bytes32 public currentAsset;
// Maximum multiplier
uint256 public constant MAX_MULTIPLIER = 50000;
// Upkeep caller
address public upkeepCaller;
// Round counter
uint256 public roundCounter = 0;
// Emergency pause
bool public emergencyPaused = false;
// Mapping to store winners for each round
mapping(uint256 => address[]) public roundWinners;
// Events
event RoundProcessed(
uint256 roundId,
bytes32 assetId,
int64 endPrice,
uint256 totalPredictions,
uint256 totalWinners
);
event BangOrCrash_Play_Event(
address indexed playerAddress,
uint256 wager,
address tokenAddress,
bytes32 assetId,
bool isPriceUp,
int64 entryPrice
);
event BangOrCrash_Outcome_Event(
address indexed playerAddress,
uint256 wager,
uint256 payout,
address tokenAddress,
bool isPriceUp,
bool isWinner,
int64 entryPrice,
int64 endPrice,
uint256 roundId
);
event Received(address sender, uint256 value);
// Prediction data structure
struct PlayerPrediction {
address player;
uint256 wager;
address tokenAddress;
bool isPriceUp;
int64 entryPrice;
uint256 multiplier;
bool processed;
}
struct RoundResult {
uint256 id;
bytes32 assetId;
uint256 timestamp;
int64 endPrice;
int32 expo;
uint256 totalPredictions;
uint256 totalWinners;
}
// Active player predictions
PlayerPrediction[] public activePredictions;
// History of round results
mapping(uint256 => RoundResult) public roundResults;
constructor(address _bankroll, address _pyth, address _upkeepCaller) {
Bankroll = IBankroll(_bankroll);
pyth = IPyth(_pyth);
upkeepCaller = _upkeepCaller;
// Set default asset to empty - must be set by admin
currentAsset = bytes32(0);
}
modifier onlyUpkeepCaller() {
if (msg.sender != upkeepCaller && msg.sender != owner()) {
revert BangOrCrashErrors.Unauthorized();
}
_;
}
modifier notPaused() {
require(!emergencyPaused, "Contract is paused");
_;
}
modifier validCurrentAsset() {
require(currentAsset != bytes32(0), "No asset set");
require(supportedAssets[currentAsset], "Current asset not supported");
_;
}
function setUpkeepCaller(address _newCaller) external onlyOwner {
require(_newCaller != address(0), "New caller cannot be zero address");
upkeepCaller = _newCaller;
}
// Set the current asset being used for predictions
function setCurrentAsset(bytes32 assetId) external onlyOwner {
require(supportedAssets[assetId], "Asset not supported");
currentAsset = assetId;
}
// Add supported asset
function addAsset(bytes32 assetId) external onlyOwner {
if (!supportedAssets[assetId]) {
supportedAssets[assetId] = true;
assetIds.push(assetId);
// If no current asset is set, set this as default
if (currentAsset == bytes32(0)) {
currentAsset = assetId;
}
}
}
// Remove supported asset
function removeAsset(bytes32 assetId) external onlyOwner {
if (supportedAssets[assetId]) {
supportedAssets[assetId] = false;
// Safe array removal with bounds check
if (assetIds.length > 0) {
for (uint256 i = 0; i < assetIds.length; i++) {
if (assetIds[i] == assetId) {
assetIds[i] = assetIds[assetIds.length - 1];
assetIds.pop();
break;
}
}
}
// Reset current asset if needed
if (currentAsset == assetId) {
currentAsset = bytes32(0);
}
}
}
// Get the current price for an asset
function getCurrentPrice(
bytes32 assetId
) public view returns (PythStructs.Price memory) {
if (!supportedAssets[assetId]) {
revert BangOrCrashErrors.InvalidAsset();
}
return pyth.getPriceUnsafe(assetId);
}
// Get just the price value for an asset
function getAssetPrice(bytes32 assetId) public view returns (int64) {
if (!supportedAssets[assetId]) {
revert BangOrCrashErrors.InvalidAsset();
}
PythStructs.Price memory price = pyth.getPriceUnsafe(assetId);
return price.price;
}
// Place a price prediction - Modified to require fresh price feed
function placePrediction(
uint256 wager,
address tokenAddress,
bool isPriceUp,
uint256 multiplier,
bytes[] calldata priceUpdates
) external payable nonReentrant notPaused validCurrentAsset {
// Validation checks
require(!Bankroll.getStoppedStatus(), "Bankroll not active");
require(
Bankroll.getIsValidWager(address(this), tokenAddress),
"set valid wager to begin"
);
require(multiplier > 0 && multiplier <= MAX_MULTIPLIER, "Invalid multiplier");
// Check wager amount using Kelly criterion
_kellyWager(wager, tokenAddress);
// Update the price feed first to get fresh price
uint fee = pyth.getUpdateFee(priceUpdates);
if (tokenAddress == address(0)) {
require(
msg.value >= wager + fee,
"Insufficient ETH for wager and price update fee"
);
} else {
require(msg.value >= fee, "Insufficient fee for price update");
}
// Transfer wager from player
_transferWager(tokenAddress, wager);
pyth.updatePriceFeeds{ value: fee }(priceUpdates);
// Get current price after update
PythStructs.Price memory currentPrice = pyth.getPriceNoOlderThan(currentAsset, 5);
// Create new prediction with entry price
PlayerPrediction memory prediction = PlayerPrediction({
player: msg.sender,
wager: wager,
tokenAddress: tokenAddress,
isPriceUp: isPriceUp,
entryPrice: currentPrice.price, // Store entry price
multiplier: multiplier,
processed: false
});
// Add to active predictions
activePredictions.push(prediction);
_transferToBankroll(wager, tokenAddress);
// Emit the play event
emit BangOrCrash_Play_Event(
msg.sender,
wager,
tokenAddress,
currentAsset,
isPriceUp,
currentPrice.price
);
}
function performUpkeep(
bytes[] calldata priceUpdates
) external payable onlyUpkeepCaller nonReentrant {
// Check if there are any active predictions
uint256 predictionCount = activePredictions.length;
if (predictionCount == 0) {
revert BangOrCrashErrors.NoPredictions();
}
// Update the price feed first
uint fee = pyth.getUpdateFee(priceUpdates);
require(msg.value >= fee, "Insufficient fee for price update");
pyth.updatePriceFeeds{ value: fee }(priceUpdates);
// Create a new round
roundCounter++;
// Get current price after update
PythStructs.Price memory priceData = pyth.getPriceNoOlderThan(currentAsset, 5);
// Store round data
roundResults[roundCounter].id = roundCounter;
roundResults[roundCounter].assetId = currentAsset;
roundResults[roundCounter].timestamp = block.timestamp;
roundResults[roundCounter].endPrice = priceData.price;
roundResults[roundCounter].expo = priceData.expo;
roundResults[roundCounter].totalPredictions = predictionCount;
// Process winners - comparing each player's entry price to current price
_processWinners(roundCounter, priceData.price);
// Emit the round processed event
emit RoundProcessed(
roundCounter,
currentAsset,
priceData.price,
predictionCount,
roundResults[roundCounter].totalWinners
);
}
function _processWinners(uint256 roundId, int64 endPrice) private {
uint256 winnerCount = 0;
// Track winners and process payouts
for (uint256 i = 0; i < activePredictions.length; i++) {
// Compare this prediction's entry price with end price
bool actualPriceWentUp = (endPrice > activePredictions[i].entryPrice);
// Handle equal prices (no change) case
bool isWinner;
if (endPrice == activePredictions[i].entryPrice) {
// In case of no price change, nobody wins
isWinner = false;
} else {
// Otherwise, check if prediction matches actual direction
isWinner = (activePredictions[i].isPriceUp == actualPriceWentUp);
}
// Handle winner payouts
if (isWinner) {
uint256 payout = activePredictions[i]
.wager
.mul(activePredictions[i].multiplier)
.div(10000);
_transferPayout(
activePredictions[i].player,
payout,
activePredictions[i].tokenAddress
);
// Track winner
roundWinners[roundId].push(activePredictions[i].player);
winnerCount++;
}
// Emit outcome event
emit BangOrCrash_Outcome_Event(
activePredictions[i].player,
activePredictions[i].wager,
isWinner
? activePredictions[i].wager.mul(activePredictions[i].multiplier).div(
10000
)
: 0,
activePredictions[i].tokenAddress,
activePredictions[i].isPriceUp,
isWinner,
activePredictions[i].entryPrice,
endPrice,
roundId
);
}
// Update winner count and clear predictions
roundResults[roundId].totalWinners = winnerCount;
delete activePredictions;
}
// Get the fee required to update price feeds
function getPriceUpdateFee(
bytes[] calldata priceUpdates
) external view returns (uint256) {
return pyth.getUpdateFee(priceUpdates);
}
// Get the active predictions count
function getActivePredictionsCount() external view returns (uint256) {
return activePredictions.length;
}
// Get active prediction details for a specific index
function getActivePredictionDetails(
uint256 index
)
external
view
returns (
address player,
uint256 wager,
address tokenAddress,
bool isPriceUp,
int64 entryPrice
)
{
require(index < activePredictions.length, "Index out of bounds");
PlayerPrediction memory prediction = activePredictions[index];
return (
prediction.player,
prediction.wager,
prediction.tokenAddress,
prediction.isPriceUp,
prediction.entryPrice
);
}
// Get active prediction details for a specific address
function getActivePredictionDetailsByAddress(
address player
)
external
view
returns (
uint256[] memory wagers,
address[] memory tokenAddresses,
bool[] memory isPriceUps,
int64[] memory entryPrices
)
{
// First count how many predictions this player has
uint256 predictionCount = 0;
for (uint256 i = 0; i < activePredictions.length; i++) {
if (activePredictions[i].player == player) {
predictionCount++;
}
}
// Initialize arrays with the correct size
wagers = new uint256[](predictionCount);
tokenAddresses = new address[](predictionCount);
isPriceUps = new bool[](predictionCount);
entryPrices = new int64[](predictionCount);
// Fill arrays with prediction data
uint256 currentIndex = 0;
for (uint256 i = 0; i < activePredictions.length; i++) {
if (activePredictions[i].player == player) {
wagers[currentIndex] = activePredictions[i].wager;
tokenAddresses[currentIndex] = activePredictions[i].tokenAddress;
isPriceUps[currentIndex] = activePredictions[i].isPriceUp;
entryPrices[currentIndex] = activePredictions[i].entryPrice;
currentIndex++;
}
}
return (wagers, tokenAddresses, isPriceUps, entryPrices);
}
// Get round result details
function getRoundResult(uint256 roundId) external view returns (RoundResult memory) {
return roundResults[roundId];
}
// Get winners for a specific round
function getRoundWinners(uint256 roundId) external view returns (address[] memory) {
return roundWinners[roundId];
}
// Get all supported assets
function getSupportedAssets() external view returns (bytes32[] memory) {
return assetIds;
}
// Kelly criterion for maximum wager
function _kellyWager(uint256 wager, address tokenAddress) internal view {
// Get the bankroll balance for the token
uint256 balance;
if (tokenAddress == address(0)) {
balance = address(Bankroll).balance; // For native token (ETH)
} else {
balance = IERC20(tokenAddress).balanceOf(address(Bankroll)); // For ERC20 tokens
}
// Calculate max wager as Kelly fraction of bankroll
uint256 maximumWagerValue = (balance * 1122448) / 100000000; // ~1.12% of bankroll
// Ensure wager is within limits
require(wager <= maximumWagerValue, "Wager exceeds Kelly criterion limit");
}
// Get max wager
function getMaxWager(address tokenAddress) external view returns (uint256) {
uint256 balance;
if (tokenAddress == address(0)) {
balance = address(Bankroll).balance;
} else {
balance = IERC20(tokenAddress).balanceOf(address(Bankroll));
}
uint256 maximumWagerValue = (balance * 1122448) / 100000000;
return maximumWagerValue;
}
// Admin function to refund all active predictions
function adminRefundAllPredictions() external onlyOwner nonReentrant {
require(activePredictions.length > 0, "No active predictions");
for (uint256 i = 0; i < activePredictions.length; i++) {
PlayerPrediction storage prediction = activePredictions[i];
if (!prediction.processed) {
_transferPayout(
prediction.player,
prediction.wager,
prediction.tokenAddress
);
prediction.processed = true;
}
}
// Clear active predictions
delete activePredictions;
}
// Withdraw fees
function withdrawFees(uint256 amount, address tokenAddress) external onlyOwner {
if (tokenAddress == address(0)) {
require(amount <= address(this).balance, "Insufficient balance");
(bool success, ) = payable(msg.sender).call{ value: amount }("");
require(success, "Transfer failed");
} else {
IERC20 token = IERC20(tokenAddress);
uint256 tokenBalance = token.balanceOf(address(this));
require(amount <= tokenBalance, "Insufficient token balance");
token.safeTransfer(msg.sender, amount);
}
}
// Get the fee required for price update
function getFee(bytes[] calldata priceUpdates) external view returns (uint) {
return pyth.getUpdateFee(priceUpdates);
}
// Function to update the price feeds
function updatePriceFeeds(bytes[] calldata priceUpdateData) external payable {
// Calculate update fee
uint updateFee = pyth.getUpdateFee(priceUpdateData);
require(msg.value >= updateFee, "Insufficient fee");
// Update price feeds
pyth.updatePriceFeeds{ value: updateFee }(priceUpdateData);
}
// View function to get the latest price
function getLatestPrice(
bytes32 priceFeedId
) external view returns (PythStructs.Price memory) {
// Get updated price with 60 second staleness threshold
return pyth.getPriceNoOlderThan(priceFeedId, 60);
}
function emergencyPause() external onlyOwner {
emergencyPaused = true;
}
function emergencyUnpause() external onlyOwner {
emergencyPaused = false;
}
receive() external payable {
emit Received(msg.sender, msg.value);
}
fallback() external payable {}
// // @dev Register my contract on Sonic FeeM
function registerMe() external onlyOwner {
(bool _success, ) = address(0xDC2B0D2Dd2b7759D97D50db4eabDC36973110830).call(
abi.encodeWithSignature("selfRegister(uint256)", 136)
);
require(_success, "FeeM registration failed");
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)
pragma solidity ^0.8.0;
import "../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.
*
* By default, the owner account will be the one that deploys the contract. 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;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor() {
_transferOwnership(_msgSender());
}
/**
* @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 {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
}
/**
* @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 {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_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 v4.9.0) (security/ReentrancyGuard.sol)
pragma solidity ^0.8.0;
/**
* @dev Contract module that helps prevent reentrant calls to a function.
*
* Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
* available, which can be applied to functions to make sure there are no nested
* (reentrant) calls to them.
*
* Note that because there is a single `nonReentrant` guard, functions marked as
* `nonReentrant` may not call one another. This can be worked around by making
* those functions `private`, and then adding `external` `nonReentrant` entry
* points to them.
*
* TIP: If you would like to learn more about reentrancy and alternative ways
* to protect against it, check out our blog post
* https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
*/
abstract contract ReentrancyGuard {
// Booleans are more expensive than uint256 or any type that takes up a full
// word because each write operation emits an extra SLOAD to first read the
// slot's contents, replace the bits taken up by the boolean, and then write
// back. This is the compiler's defense against contract upgrades and
// pointer aliasing, and it cannot be disabled.
// The values being non-zero value makes deployment a bit more expensive,
// but in exchange the refund on every call to nonReentrant will be lower in
// amount. Since refunds are capped to a percentage of the total
// transaction's gas, it is best to keep them low in cases like this one, to
// increase the likelihood of the full refund coming into effect.
uint256 private constant _NOT_ENTERED = 1;
uint256 private constant _ENTERED = 2;
uint256 private _status;
constructor() {
_status = _NOT_ENTERED;
}
/**
* @dev Prevents a contract from calling itself, directly or indirectly.
* Calling a `nonReentrant` function from another `nonReentrant`
* function is not supported. It is possible to prevent this from happening
* by making the `nonReentrant` function external, and making it call a
* `private` function that does the actual work.
*/
modifier nonReentrant() {
_nonReentrantBefore();
_;
_nonReentrantAfter();
}
function _nonReentrantBefore() private {
// On the first call to nonReentrant, _status will be _NOT_ENTERED
require(_status != _ENTERED, "ReentrancyGuard: reentrant call");
// Any calls to nonReentrant after this point will fail
_status = _ENTERED;
}
function _nonReentrantAfter() private {
// By storing the original value once again, a refund is triggered (see
// https://eips.ethereum.org/EIPS/eip-2200)
_status = _NOT_ENTERED;
}
/**
* @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a
* `nonReentrant` function in the call stack.
*/
function _reentrancyGuardEntered() internal view returns (bool) {
return _status == _ENTERED;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.4) (token/ERC20/extensions/IERC20Permit.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
* https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
*
* Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
* presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't
* need to send a transaction, and thus is not required to hold Ether at all.
*
* ==== 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 v4.9.0) (token/ERC20/IERC20.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `to`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address to, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `from` to `to` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address from, address to, uint256 amount) external returns (bool);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.3) (token/ERC20/utils/SafeERC20.sol)
pragma solidity ^0.8.0;
import "../IERC20.sol";
import "../extensions/IERC20Permit.sol";
import "../../../utils/Address.sol";
/**
* @title SafeERC20
* @dev Wrappers around ERC20 operations that throw on failure (when the token
* contract returns false). Tokens that return no value (and instead revert or
* throw on failure) are also supported, non-reverting calls are assumed to be
* successful.
* To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
* which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
*/
library SafeERC20 {
using Address for address;
/**
* @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.encodeWithSelector(token.transfer.selector, 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.encodeWithSelector(token.transferFrom.selector, from, to, value));
}
/**
* @dev Deprecated. This function has issues similar to the ones found in
* {IERC20-approve}, and its usage is discouraged.
*
* Whenever possible, use {safeIncreaseAllowance} and
* {safeDecreaseAllowance} instead.
*/
function safeApprove(IERC20 token, address spender, uint256 value) internal {
// safeApprove should only be called when setting an initial allowance,
// or when resetting it to zero. To increase and decrease it, use
// 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
require(
(value == 0) || (token.allowance(address(this), spender) == 0),
"SafeERC20: approve from non-zero to non-zero allowance"
);
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
}
/**
* @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);
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value));
}
/**
* @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
* non-reverting calls are assumed to be successful.
*/
function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {
unchecked {
uint256 oldAllowance = token.allowance(address(this), spender);
require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value));
}
}
/**
* @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.encodeWithSelector(token.approve.selector, spender, value);
if (!_callOptionalReturnBool(token, approvalCall)) {
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0));
_callOptionalReturn(token, approvalCall);
}
}
/**
* @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`.
* Revert on invalid signature.
*/
function safePermit(
IERC20Permit token,
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) internal {
uint256 nonceBefore = token.nonces(owner);
token.permit(owner, spender, value, deadline, v, r, s);
uint256 nonceAfter = token.nonces(owner);
require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed");
}
/**
* @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
* on the return value: the return value is optional (but if data is returned, it must not be false).
* @param token The token targeted by the call.
* @param data The call data (encoded using abi.encode or one of its variants).
*/
function _callOptionalReturn(IERC20 token, bytes memory data) private {
// We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
// we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that
// the target address contains contract code and also asserts for success in the low-level call.
bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
require(returndata.length == 0 || abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
/**
* @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
* on the return value: the return value is optional (but if data is returned, it must not be false).
* @param token The token targeted by the call.
* @param data The call data (encoded using abi.encode or one of its variants).
*
* 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.isContract(address(token));
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)
pragma solidity ^0.8.1;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
*
* Furthermore, `isContract` will also return true if the target contract within
* the same transaction is already scheduled for destruction by `SELFDESTRUCT`,
* which only has an effect at the end of a transaction.
* ====
*
* [IMPORTANT]
* ====
* You shouldn't rely on `isContract` to protect against flash loan attacks!
*
* Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
* like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
* constructor.
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize/address.code.length, which returns 0
// for contracts in construction, since the code is only stored at the end
// of the constructor execution.
return account.code.length > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://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.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{value: amount}("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain `call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value,
string memory errorMessage
) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(
address target,
bytes memory data,
string memory errorMessage
) internal view returns (bytes memory) {
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling
* the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.
*
* _Available since v4.8._
*/
function verifyCallResultFromTarget(
address target,
bool success,
bytes memory returndata,
string memory errorMessage
) internal view returns (bytes memory) {
if (success) {
if (returndata.length == 0) {
// only check isContract if the call was successful and the return data is empty
// otherwise we already know that it was a contract
require(isContract(target), "Address: call to non-contract");
}
return returndata;
} else {
_revert(returndata, errorMessage);
}
}
/**
* @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the
* revert reason or using the provided one.
*
* _Available since v4.3._
*/
function verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) internal pure returns (bytes memory) {
if (success) {
return returndata;
} else {
_revert(returndata, errorMessage);
}
}
function _revert(bytes memory returndata, string memory errorMessage) 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(errorMessage);
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.4) (utils/Context.sol)
pragma solidity ^0.8.0;
/**
* @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;
}
function _contextSuffixLength() internal view virtual returns (uint256) {
return 0;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/Math.sol)
pragma solidity ^0.8.0;
/**
* @dev Standard math utilities missing in the Solidity language.
*/
library Math {
enum Rounding {
Down, // Toward negative infinity
Up, // Toward infinity
Zero // Toward zero
}
/**
* @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 up instead
* of rounding down.
*/
function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {
// (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; // Least significant 256 bits of the product
uint256 prod1; // Most significant 256 bits of the product
assembly {
let mm := mulmod(x, y, not(0))
prod0 := mul(x, y)
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.
require(denominator > prod1, "Math: mulDiv overflow");
///////////////////////////////////////////////
// 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.
// Does not overflow because the denominator cannot be zero at this stage in the function.
uint256 twos = denominator & (~denominator + 1);
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 (rounding == Rounding.Up && 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 down.
*
* 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 + (rounding == Rounding.Up && result * result < a ? 1 : 0);
}
}
/**
* @dev Return the log in base 2, rounded down, of a positive value.
* 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 + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);
}
}
/**
* @dev Return the log in base 10, rounded down, of a positive value.
* 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 + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0);
}
}
/**
* @dev Return the log in base 256, rounded down, of a positive value.
* 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 + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/SafeMath.sol)
pragma solidity ^0.8.0;
// CAUTION
// This version of SafeMath should only be used with Solidity 0.8 or later,
// because it relies on the compiler's built in overflow checks.
/**
* @dev Wrappers over Solidity's arithmetic operations.
*
* NOTE: `SafeMath` is generally not needed starting with Solidity 0.8, since the compiler
* now has built in overflow checking.
*/
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
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.
*
* _Available since v3.4._
*/
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.
*
* _Available since v3.4._
*/
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.
*
* _Available since v3.4._
*/
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.
*
* _Available since v3.4._
*/
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 addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
return a + b;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return a - b;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
*
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
return a * b;
}
/**
* @dev Returns the integer division of two unsigned integers, reverting on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator.
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return a / b;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* reverting when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return a % b;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {trySub}.
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
unchecked {
require(b <= a, errorMessage);
return a - b;
}
}
/**
* @dev Returns the integer division of two unsigned integers, reverting with custom message on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
unchecked {
require(b > 0, errorMessage);
return a / b;
}
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* reverting with custom message when dividing by zero.
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {tryMod}.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
unchecked {
require(b > 0, errorMessage);
return a % b;
}
}
}// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.0;
import "./PythStructs.sol";
import "./IPythEvents.sol";
/// @title Consume prices from the Pyth Network (https://pyth.network/).
/// @dev Please refer to the guidance at https://docs.pyth.network/documentation/pythnet-price-feeds/best-practices for how to consume prices safely.
/// @author Pyth Data Association
interface IPyth is IPythEvents {
/// @notice Returns the price of a price feed without any sanity checks.
/// @dev This function returns the most recent price update in this contract without any recency checks.
/// This function is unsafe as the returned price update may be arbitrarily far in the past.
///
/// Users of this function should check the `publishTime` in the price to ensure that the returned price is
/// sufficiently recent for their application. If you are considering using this function, it may be
/// safer / easier to use `getPriceNoOlderThan`.
/// @return price - please read the documentation of PythStructs.Price to understand how to use this safely.
function getPriceUnsafe(
bytes32 id
) external view returns (PythStructs.Price memory price);
/// @notice Returns the price that is no older than `age` seconds of the current time.
/// @dev This function is a sanity-checked version of `getPriceUnsafe` which is useful in
/// applications that require a sufficiently-recent price. Reverts if the price wasn't updated sufficiently
/// recently.
/// @return price - please read the documentation of PythStructs.Price to understand how to use this safely.
function getPriceNoOlderThan(
bytes32 id,
uint age
) external view returns (PythStructs.Price memory price);
/// @notice Returns the exponentially-weighted moving average price of a price feed without any sanity checks.
/// @dev This function returns the same price as `getEmaPrice` in the case where the price is available.
/// However, if the price is not recent this function returns the latest available price.
///
/// The returned price can be from arbitrarily far in the past; this function makes no guarantees that
/// the returned price is recent or useful for any particular application.
///
/// Users of this function should check the `publishTime` in the price to ensure that the returned price is
/// sufficiently recent for their application. If you are considering using this function, it may be
/// safer / easier to use either `getEmaPrice` or `getEmaPriceNoOlderThan`.
/// @return price - please read the documentation of PythStructs.Price to understand how to use this safely.
function getEmaPriceUnsafe(
bytes32 id
) external view returns (PythStructs.Price memory price);
/// @notice Returns the exponentially-weighted moving average price that is no older than `age` seconds
/// of the current time.
/// @dev This function is a sanity-checked version of `getEmaPriceUnsafe` which is useful in
/// applications that require a sufficiently-recent price. Reverts if the price wasn't updated sufficiently
/// recently.
/// @return price - please read the documentation of PythStructs.Price to understand how to use this safely.
function getEmaPriceNoOlderThan(
bytes32 id,
uint age
) external view returns (PythStructs.Price memory price);
/// @notice Update price feeds with given update messages.
/// This method requires the caller to pay a fee in wei; the required fee can be computed by calling
/// `getUpdateFee` with the length of the `updateData` array.
/// Prices will be updated if they are more recent than the current stored prices.
/// The call will succeed even if the update is not the most recent.
/// @dev Reverts if the transferred fee is not sufficient or the updateData is invalid.
/// @param updateData Array of price update data.
function updatePriceFeeds(bytes[] calldata updateData) external payable;
/// @notice Wrapper around updatePriceFeeds that rejects fast if a price update is not necessary. A price update is
/// necessary if the current on-chain publishTime is older than the given publishTime. It relies solely on the
/// given `publishTimes` for the price feeds and does not read the actual price update publish time within `updateData`.
///
/// This method requires the caller to pay a fee in wei; the required fee can be computed by calling
/// `getUpdateFee` with the length of the `updateData` array.
///
/// `priceIds` and `publishTimes` are two arrays with the same size that correspond to senders known publishTime
/// of each priceId when calling this method. If all of price feeds within `priceIds` have updated and have
/// a newer or equal publish time than the given publish time, it will reject the transaction to save gas.
/// Otherwise, it calls updatePriceFeeds method to update the prices.
///
/// @dev Reverts if update is not needed or the transferred fee is not sufficient or the updateData is invalid.
/// @param updateData Array of price update data.
/// @param priceIds Array of price ids.
/// @param publishTimes Array of publishTimes. `publishTimes[i]` corresponds to known `publishTime` of `priceIds[i]`
function updatePriceFeedsIfNecessary(
bytes[] calldata updateData,
bytes32[] calldata priceIds,
uint64[] calldata publishTimes
) external payable;
/// @notice Returns the required fee to update an array of price updates.
/// @param updateData Array of price update data.
/// @return feeAmount The required fee in Wei.
function getUpdateFee(
bytes[] calldata updateData
) external view returns (uint feeAmount);
/// @notice Parse `updateData` and return price feeds of the given `priceIds` if they are all published
/// within `minPublishTime` and `maxPublishTime`.
///
/// You can use this method if you want to use a Pyth price at a fixed time and not the most recent price;
/// otherwise, please consider using `updatePriceFeeds`. This method may store the price updates on-chain, if they
/// are more recent than the current stored prices.
///
/// This method requires the caller to pay a fee in wei; the required fee can be computed by calling
/// `getUpdateFee` with the length of the `updateData` array.
///
///
/// @dev Reverts if the transferred fee is not sufficient or the updateData is invalid or there is
/// no update for any of the given `priceIds` within the given time range.
/// @param updateData Array of price update data.
/// @param priceIds Array of price ids.
/// @param minPublishTime minimum acceptable publishTime for the given `priceIds`.
/// @param maxPublishTime maximum acceptable publishTime for the given `priceIds`.
/// @return priceFeeds Array of the price feeds corresponding to the given `priceIds` (with the same order).
function parsePriceFeedUpdates(
bytes[] calldata updateData,
bytes32[] calldata priceIds,
uint64 minPublishTime,
uint64 maxPublishTime
) external payable returns (PythStructs.PriceFeed[] memory priceFeeds);
/// @notice Parse time-weighted average price (TWAP) from two consecutive price updates for the given `priceIds`.
///
/// This method calculates TWAP between two data points by processing the difference in cumulative price values
/// divided by the time period. It requires exactly two updates that contain valid price information
/// for all the requested price IDs.
///
/// This method requires the caller to pay a fee in wei; the required fee can be computed by calling
/// `getUpdateFee` with the updateData array.
///
/// @dev Reverts if:
/// - The transferred fee is not sufficient
/// - The updateData is invalid or malformed
/// - The updateData array does not contain exactly 2 updates
/// - There is no update for any of the given `priceIds`
/// - The time ordering between data points is invalid (start time must be before end time)
/// @param updateData Array containing exactly two price updates (start and end points for TWAP calculation)
/// @param priceIds Array of price ids to calculate TWAP for
/// @return twapPriceFeeds Array of TWAP price feeds corresponding to the given `priceIds` (with the same order)
function parseTwapPriceFeedUpdates(
bytes[] calldata updateData,
bytes32[] calldata priceIds
)
external
payable
returns (PythStructs.TwapPriceFeed[] memory twapPriceFeeds);
/// @notice Similar to `parsePriceFeedUpdates` but ensures the updates returned are
/// the first updates published in minPublishTime. That is, if there are multiple updates for a given timestamp,
/// this method will return the first update. This method may store the price updates on-chain, if they
/// are more recent than the current stored prices.
///
///
/// @dev Reverts if the transferred fee is not sufficient or the updateData is invalid or there is
/// no update for any of the given `priceIds` within the given time range and uniqueness condition.
/// @param updateData Array of price update data.
/// @param priceIds Array of price ids.
/// @param minPublishTime minimum acceptable publishTime for the given `priceIds`.
/// @param maxPublishTime maximum acceptable publishTime for the given `priceIds`.
/// @return priceFeeds Array of the price feeds corresponding to the given `priceIds` (with the same order).
function parsePriceFeedUpdatesUnique(
bytes[] calldata updateData,
bytes32[] calldata priceIds,
uint64 minPublishTime,
uint64 maxPublishTime
) external payable returns (PythStructs.PriceFeed[] memory priceFeeds);
/// @dev Same as `parsePriceFeedUpdates`, but also returns the Pythnet slot
/// associated with each price update.
/// @param updateData Array of price update data.
/// @param priceIds Array of price ids.
/// @param minPublishTime minimum acceptable publishTime for the given `priceIds`.
/// @param maxPublishTime maximum acceptable publishTime for the given `priceIds`.
/// @return priceFeeds Array of the price feeds corresponding to the given `priceIds` (with the same order).
/// @return slots Array of the Pythnet slot corresponding to the given `priceIds` (with the same order).
function parsePriceFeedUpdatesWithSlots(
bytes[] calldata updateData,
bytes32[] calldata priceIds,
uint64 minPublishTime,
uint64 maxPublishTime
)
external
payable
returns (
PythStructs.PriceFeed[] memory priceFeeds,
uint64[] memory slots
);
}// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.0;
/// @title IPythEvents contains the events that Pyth contract emits.
/// @dev This interface can be used for listening to the updates for off-chain and testing purposes.
interface IPythEvents {
/// @dev Emitted when the price feed with `id` has received a fresh update.
/// @param id The Pyth Price Feed ID.
/// @param publishTime Publish time of the given price update.
/// @param price Price of the given price update.
/// @param conf Confidence interval of the given price update.
event PriceFeedUpdate(
bytes32 indexed id,
uint64 publishTime,
int64 price,
uint64 conf
);
/// @dev Emitted when the TWAP price feed with `id` has received a fresh update.
/// @param id The Pyth Price Feed ID.
/// @param startTime Start time of the TWAP.
/// @param endTime End time of the TWAP.
/// @param twapPrice Price of the TWAP.
/// @param twapConf Confidence interval of the TWAP.
/// @param downSlotsRatio Down slot ratio of the TWAP.
event TwapPriceFeedUpdate(
bytes32 indexed id,
uint64 startTime,
uint64 endTime,
int64 twapPrice,
uint64 twapConf,
uint32 downSlotsRatio
);
}// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.0;
contract PythStructs {
// A price with a degree of uncertainty, represented as a price +- a confidence interval.
//
// The confidence interval roughly corresponds to the standard error of a normal distribution.
// Both the price and confidence are stored in a fixed-point numeric representation,
// `x * (10^expo)`, where `expo` is the exponent.
//
// Please refer to the documentation at https://docs.pyth.network/documentation/pythnet-price-feeds/best-practices for how
// to how this price safely.
struct Price {
// Price
int64 price;
// Confidence interval around the price
uint64 conf;
// Price exponent
int32 expo;
// Unix timestamp describing when the price was published
uint publishTime;
}
// PriceFeed represents a current aggregate price from pyth publisher feeds.
struct PriceFeed {
// The price ID.
bytes32 id;
// Latest available price
Price price;
// Latest available exponentially-weighted moving average price
Price emaPrice;
}
struct TwapPriceFeed {
// The price ID.
bytes32 id;
// Start time of the TWAP
uint64 startTime;
// End time of the TWAP
uint64 endTime;
// TWAP price
Price twap;
// Down slot ratio represents the ratio of price feed updates that were missed or unavailable
// during the TWAP period, expressed as a fixed-point number between 0 and 1e6 (100%).
// For example:
// - 0 means all price updates were available
// - 500_000 means 50% of updates were missed
// - 1_000_000 means all updates were missed
// This can be used to assess the quality/reliability of the TWAP calculation.
// Applications should define a maximum acceptable ratio (e.g. 100000 for 10%)
// and revert if downSlotsRatio exceeds it.
uint32 downSlotsRatio;
}
// Information used to calculate time-weighted average prices (TWAP)
struct TwapPriceInfo {
// slot 1
int128 cumulativePrice;
uint128 cumulativeConf;
// slot 2
uint64 numDownSlots;
uint64 publishSlot;
uint64 publishTime;
uint64 prevPublishTime;
// slot 3
int32 expo;
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.16;
import { SafeERC20, IERC20 } from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/utils/math/Math.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
interface IBankroll {
// Check if a wager is valid for a given game and token address
function getIsValidWager(
address game,
address tokenAddress
) external view returns (bool);
// Get the owner address of the Bankroll contract
function owner() external view returns (address);
// Transfer the payout amount in tokens from the Bankroll contract to the player
function transferPayout(address player, uint256 payout, address token) external;
function getStoppedStatus() external view returns (bool);
}
contract Base is ReentrancyGuard, Ownable {
using SafeERC20 for IERC20;
error NotApprovedBankroll();
error InvalidValue(uint256 wagerPlusVRFfee, uint256 msgvalue);
IBankroll public Bankroll;
event RefundSuccess(address indexed user, uint256 refund);
event TransferToBankroll(address indexed player, uint256 amount);
/**
* @dev function to request bankroll to give payout to player
* @param player address of the player
* @param payout amount of payout to give
* @param tokenAddress address of the token in which to give the payout
*/
function _transferPayout(
address player,
uint256 payout,
address tokenAddress
) internal {
Bankroll.transferPayout(player, payout, tokenAddress);
}
/**
* @dev function to transfer the player wager to Bankroll,
* , reverts if Bankroll doesn't approve game or token
* @param tokenAddress address of the token the wager is made on
* @param wager total amount wagered
*/
function _transferWager(address tokenAddress, uint256 wager) internal {
if (!Bankroll.getIsValidWager(address(this), tokenAddress)) {
revert NotApprovedBankroll();
}
require(wager != 0, "zero wager");
if (tokenAddress == address(0)) {
if (msg.value < wager) {
revert InvalidValue(wager, msg.value);
}
} else {
IERC20(tokenAddress).safeTransferFrom(msg.sender, address(this), wager);
}
}
function _transferToBankroll(uint256 amount, address tokenAddress) internal {
if (tokenAddress == address(0)) {
(bool success, ) = payable(address(Bankroll)).call{ value: amount }("");
require(success, "Transfer to BR Failed");
} else {
IERC20(tokenAddress).safeTransfer(address(Bankroll), amount);
}
emit TransferToBankroll(msg.sender, amount);
}
}{
"optimizer": {
"enabled": true,
"runs": 200
},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"metadata": {
"useLiteralContent": true
},
"libraries": {}
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[{"internalType":"address","name":"_bankroll","type":"address"},{"internalType":"address","name":"_pyth","type":"address"},{"internalType":"address","name":"_upkeepCaller","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"InvalidAsset","type":"error"},{"inputs":[{"internalType":"uint256","name":"wagerPlusVRFfee","type":"uint256"},{"internalType":"uint256","name":"msgvalue","type":"uint256"}],"name":"InvalidValue","type":"error"},{"inputs":[],"name":"NoPredictions","type":"error"},{"inputs":[],"name":"NotApprovedBankroll","type":"error"},{"inputs":[],"name":"Unauthorized","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"playerAddress","type":"address"},{"indexed":false,"internalType":"uint256","name":"wager","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"payout","type":"uint256"},{"indexed":false,"internalType":"address","name":"tokenAddress","type":"address"},{"indexed":false,"internalType":"bool","name":"isPriceUp","type":"bool"},{"indexed":false,"internalType":"bool","name":"isWinner","type":"bool"},{"indexed":false,"internalType":"int64","name":"entryPrice","type":"int64"},{"indexed":false,"internalType":"int64","name":"endPrice","type":"int64"},{"indexed":false,"internalType":"uint256","name":"roundId","type":"uint256"}],"name":"BangOrCrash_Outcome_Event","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"playerAddress","type":"address"},{"indexed":false,"internalType":"uint256","name":"wager","type":"uint256"},{"indexed":false,"internalType":"address","name":"tokenAddress","type":"address"},{"indexed":false,"internalType":"bytes32","name":"assetId","type":"bytes32"},{"indexed":false,"internalType":"bool","name":"isPriceUp","type":"bool"},{"indexed":false,"internalType":"int64","name":"entryPrice","type":"int64"}],"name":"BangOrCrash_Play_Event","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":"sender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Received","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"refund","type":"uint256"}],"name":"RefundSuccess","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"roundId","type":"uint256"},{"indexed":false,"internalType":"bytes32","name":"assetId","type":"bytes32"},{"indexed":false,"internalType":"int64","name":"endPrice","type":"int64"},{"indexed":false,"internalType":"uint256","name":"totalPredictions","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"totalWinners","type":"uint256"}],"name":"RoundProcessed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"player","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"TransferToBankroll","type":"event"},{"stateMutability":"payable","type":"fallback"},{"inputs":[],"name":"Bankroll","outputs":[{"internalType":"contract IBankroll","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_MULTIPLIER","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"activePredictions","outputs":[{"internalType":"address","name":"player","type":"address"},{"internalType":"uint256","name":"wager","type":"uint256"},{"internalType":"address","name":"tokenAddress","type":"address"},{"internalType":"bool","name":"isPriceUp","type":"bool"},{"internalType":"int64","name":"entryPrice","type":"int64"},{"internalType":"uint256","name":"multiplier","type":"uint256"},{"internalType":"bool","name":"processed","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"assetId","type":"bytes32"}],"name":"addAsset","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"adminRefundAllPredictions","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"assetIds","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"currentAsset","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"emergencyPause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"emergencyPaused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"emergencyUnpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"}],"name":"getActivePredictionDetails","outputs":[{"internalType":"address","name":"player","type":"address"},{"internalType":"uint256","name":"wager","type":"uint256"},{"internalType":"address","name":"tokenAddress","type":"address"},{"internalType":"bool","name":"isPriceUp","type":"bool"},{"internalType":"int64","name":"entryPrice","type":"int64"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"player","type":"address"}],"name":"getActivePredictionDetailsByAddress","outputs":[{"internalType":"uint256[]","name":"wagers","type":"uint256[]"},{"internalType":"address[]","name":"tokenAddresses","type":"address[]"},{"internalType":"bool[]","name":"isPriceUps","type":"bool[]"},{"internalType":"int64[]","name":"entryPrices","type":"int64[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getActivePredictionsCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"assetId","type":"bytes32"}],"name":"getAssetPrice","outputs":[{"internalType":"int64","name":"","type":"int64"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"assetId","type":"bytes32"}],"name":"getCurrentPrice","outputs":[{"components":[{"internalType":"int64","name":"price","type":"int64"},{"internalType":"uint64","name":"conf","type":"uint64"},{"internalType":"int32","name":"expo","type":"int32"},{"internalType":"uint256","name":"publishTime","type":"uint256"}],"internalType":"struct PythStructs.Price","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes[]","name":"priceUpdates","type":"bytes[]"}],"name":"getFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"priceFeedId","type":"bytes32"}],"name":"getLatestPrice","outputs":[{"components":[{"internalType":"int64","name":"price","type":"int64"},{"internalType":"uint64","name":"conf","type":"uint64"},{"internalType":"int32","name":"expo","type":"int32"},{"internalType":"uint256","name":"publishTime","type":"uint256"}],"internalType":"struct PythStructs.Price","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"tokenAddress","type":"address"}],"name":"getMaxWager","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes[]","name":"priceUpdates","type":"bytes[]"}],"name":"getPriceUpdateFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"roundId","type":"uint256"}],"name":"getRoundResult","outputs":[{"components":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"bytes32","name":"assetId","type":"bytes32"},{"internalType":"uint256","name":"timestamp","type":"uint256"},{"internalType":"int64","name":"endPrice","type":"int64"},{"internalType":"int32","name":"expo","type":"int32"},{"internalType":"uint256","name":"totalPredictions","type":"uint256"},{"internalType":"uint256","name":"totalWinners","type":"uint256"}],"internalType":"struct BangOrCrash.RoundResult","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"roundId","type":"uint256"}],"name":"getRoundWinners","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getSupportedAssets","outputs":[{"internalType":"bytes32[]","name":"","type":"bytes32[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes[]","name":"priceUpdates","type":"bytes[]"}],"name":"performUpkeep","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"wager","type":"uint256"},{"internalType":"address","name":"tokenAddress","type":"address"},{"internalType":"bool","name":"isPriceUp","type":"bool"},{"internalType":"uint256","name":"multiplier","type":"uint256"},{"internalType":"bytes[]","name":"priceUpdates","type":"bytes[]"}],"name":"placePrediction","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"pyth","outputs":[{"internalType":"contract IPyth","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"registerMe","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"assetId","type":"bytes32"}],"name":"removeAsset","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"roundCounter","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"roundResults","outputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"bytes32","name":"assetId","type":"bytes32"},{"internalType":"uint256","name":"timestamp","type":"uint256"},{"internalType":"int64","name":"endPrice","type":"int64"},{"internalType":"int32","name":"expo","type":"int32"},{"internalType":"uint256","name":"totalPredictions","type":"uint256"},{"internalType":"uint256","name":"totalWinners","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"roundWinners","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"assetId","type":"bytes32"}],"name":"setCurrentAsset","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_newCaller","type":"address"}],"name":"setUpkeepCaller","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"supportedAssets","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes[]","name":"priceUpdateData","type":"bytes[]"}],"name":"updatePriceFeeds","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"upkeepCaller","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"address","name":"tokenAddress","type":"address"}],"name":"withdrawFees","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]Contract Creation Code
608060405260006008556009805460ff191690553480156200002057600080fd5b50604051620037dd380380620037dd83398101604081905262000043916200010a565b600160005562000053336200009b565b600280546001600160a01b039485166001600160a01b031991821617909155600380549385169382169390931790925560078054919093169116179055600060065562000154565b600180546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b80516001600160a01b03811681146200010557600080fd5b919050565b6000806000606084860312156200012057600080fd5b6200012b84620000ed565b92506200013b60208501620000ed565b91506200014b60408501620000ed565b90509250925092565b61367980620001646000396000f3fe60806040526004361061021c5760003560e01c80638da5cb5b11610122578063d0bcfc0c116100a5578063f2fde38b1161006c578063f2fde38b146108b8578063f98d06f0146108d8578063fa55932f146108f8578063fb984ade14610918578063febc14b11461093857005b8063d0bcfc0c14610810578063d634db0a14610830578063dd2cc3f314610863578063e5406dbf14610883578063ef9e5e28146108a557005b8063a6154bea116100e9578063a6154bea146106b5578063ac128f4f146106d5578063b2ee2f0114610772578063c56acbbf14610792578063c59458ff146107f057005b80638da5cb5b1461062c578063952d0b911461064a578063982b76911461067a578063996007471461068d5780639a198d61146106a057005b80632e881471116101aa578063715018a611610171578063715018a6146105b75780637f1fce78146105cc578063837592db146105ec57806387541ed61461060c5780638a7d3fa61461055757005b80632e8814711461052a5780632f452a48146105575780634a4e3bd51461057757806351858e271461058c5780635d6a618d146105a157005b8063161e444e116101ee578063161e444e146104005780631da0b984146104625780631f31633614610481578063205f46f9146104ea57806327c830a91461050057005b806302849bab1461025d57806302e28c701461029657806303e3cd6a146103b357806310c9f122146103eb57005b3661025b57604080513381523460208201527f88a5966d370b9919b20f3e2c13ff65706f196a4e32cc2c12bf57088f88525874910160405180910390a1005b005b34801561026957600080fd5b5061027d610278366004612ffd565b61094e565b60405161028d949392919061308f565b60405180910390f35b3480156102a257600080fd5b506103576102b1366004613134565b6040805160e081018252600080825260208201819052918101829052606081018290526080810182905260a0810182905260c0810191909152506000908152600c6020908152604091829020825160e08101845281548152600182015492810192909252600281015492820192909252600380830154600781900b6060840152600160401b9004900b6080820152600482015460a082015260059091015460c082015290565b60405161028d9190600060e082019050825182526020830151602083015260408301516040830152606083015160070b6060830152608083015160030b608083015260a083015160a083015260c083015160c083015292915050565b3480156103bf57600080fd5b506103d36103ce36600461314d565b610c9f565b6040516001600160a01b03909116815260200161028d565b3480156103f757600080fd5b5061025b610cd7565b34801561040c57600080fd5b5061042061041b366004613134565b610dd3565b60405161028d9190815160070b81526020808301516001600160401b03169082015260408083015160030b908201526060918201519181019190915260800190565b34801561046e57600080fd5b50600b545b60405190815260200161028d565b34801561048d57600080fd5b506104a161049c366004613134565b610e9a565b604080516001600160a01b03988916815260208101979097529490961693850193909352901515606084015260070b608083015260a082015290151560c082015260e00161028d565b3480156104f657600080fd5b5061047360065481565b34801561050c57600080fd5b5060095461051a9060ff1681565b604051901515815260200161028d565b34801561053657600080fd5b5061054a610545366004613134565b610f00565b60405161028d919061316f565b34801561056357600080fd5b506104736105723660046131cd565b610f6c565b34801561058357600080fd5b5061025b610fe7565b34801561059857600080fd5b5061025b610ffb565b3480156105ad57600080fd5b5061047361c35081565b3480156105c357600080fd5b5061025b611012565b3480156105d857600080fd5b5061025b6105e7366004612ffd565b611024565b3480156105f857600080fd5b5061025b610607366004613134565b6110ae565b34801561061857600080fd5b50610473610627366004613134565b6111b8565b34801561063857600080fd5b506001546001600160a01b03166103d3565b34801561065657600080fd5b5061051a610665366004613134565b60046020526000908152604090205460ff1681565b61025b6106883660046131cd565b6111d9565b61025b61069b36600461321c565b6114ff565b3480156106ac57600080fd5b5061025b611bda565b3480156106c157600080fd5b506007546103d3906001600160a01b031681565b3480156106e157600080fd5b506107376106f0366004613134565b600c6020526000908152604090208054600182015460028301546003808501546004860154600590960154949593949293600782900b93600160401b90920490920b919087565b6040805197885260208801969096529486019390935260079190910b606085015260030b608084015260a083015260c082015260e00161028d565b34801561077e57600080fd5b5061042061078d366004613134565b611cd0565b34801561079e57600080fd5b506107b26107ad366004613134565b611d28565b604080516001600160a01b039687168152602081019590955292909416918301919091521515606082015260079190910b608082015260a00161028d565b3480156107fc57600080fd5b5061025b61080b366004613134565b611e2b565b34801561081c57600080fd5b506002546103d3906001600160a01b031681565b34801561083c57600080fd5b5061085061084b366004613134565b611ea2565b60405160079190910b815260200161028d565b34801561086f57600080fd5b5061025b61087e366004613295565b611f47565b34801561088f57600080fd5b5061089861210c565b60405161028d91906132c1565b61025b6108b33660046131cd565b612164565b3480156108c457600080fd5b5061025b6108d3366004612ffd565b612288565b3480156108e457600080fd5b506003546103d3906001600160a01b031681565b34801561090457600080fd5b5061025b610913366004613134565b6122fe565b34801561092457600080fd5b50610473610933366004612ffd565b61235f565b34801561094457600080fd5b5061047360085481565b6060806060806000805b600b548110156109be57866001600160a01b0316600b828154811061097f5761097f613305565b60009182526020909120600590910201546001600160a01b0316036109ac57816109a881613331565b9250505b806109b681613331565b915050610958565b50806001600160401b038111156109d7576109d761334a565b604051908082528060200260200182016040528015610a00578160200160208202803683370190505b509450806001600160401b03811115610a1b57610a1b61334a565b604051908082528060200260200182016040528015610a44578160200160208202803683370190505b509350806001600160401b03811115610a5f57610a5f61334a565b604051908082528060200260200182016040528015610a88578160200160208202803683370190505b509250806001600160401b03811115610aa357610aa361334a565b604051908082528060200260200182016040528015610acc578160200160208202803683370190505b5091506000805b600b54811015610c9557876001600160a01b0316600b8281548110610afa57610afa613305565b60009182526020909120600590910201546001600160a01b031603610c8357600b8181548110610b2c57610b2c613305565b906000526020600020906005020160010154878381518110610b5057610b50613305565b602002602001018181525050600b8181548110610b6f57610b6f613305565b906000526020600020906005020160020160009054906101000a90046001600160a01b0316868381518110610ba657610ba6613305565b60200260200101906001600160a01b031690816001600160a01b031681525050600b8181548110610bd957610bd9613305565b906000526020600020906005020160020160149054906101000a900460ff16858381518110610c0a57610c0a613305565b602002602001019015159081151581525050600b8181548110610c2f57610c2f613305565b906000526020600020906005020160020160159054906101000a900460070b848381518110610c6057610c60613305565b602002602001019060070b908160070b815250508180610c7f90613331565b9250505b80610c8d81613331565b915050610ad3565b5050509193509193565b600a6020528160005260406000208181548110610cbb57600080fd5b6000918252602090912001546001600160a01b03169150829050565b610cdf61241a565b610ce7612474565b600b54610d335760405162461bcd60e51b81526020600482015260156024820152744e6f206163746976652070726564696374696f6e7360581b60448201526064015b60405180910390fd5b60005b600b54811015610dba576000600b8281548110610d5557610d55613305565b60009182526020909120600590910201600481015490915060ff16610da757805460018201546002830154610d97926001600160a01b039081169291166124cd565b60048101805460ff191660011790555b5080610db281613331565b915050610d36565b50610dc7600b6000612f76565b610dd16001600055565b565b60408051608081018252600080825260208201819052918101829052606081019190915260008281526004602052604090205460ff16610e2657604051636448d6e960e11b815260040160405180910390fd5b6003546040516396834ad360e01b8152600481018490526001600160a01b03909116906396834ad3906024015b608060405180830381865afa158015610e70573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e949190613389565b92915050565b600b8181548110610eaa57600080fd5b6000918252602090912060059091020180546001820154600283015460038401546004909401546001600160a01b03938416955091939281169260ff600160a01b8304811693600160a81b90930460070b921687565b6000818152600a6020908152604091829020805483518184028101840190945280845260609392830182828015610f6057602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311610f42575b50505050509050919050565b60035460405163d47eed4560e01b81526000916001600160a01b03169063d47eed4590610f9f9086908690600401613441565b602060405180830381865afa158015610fbc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fe091906134dc565b9392505050565b610fef61241a565b6009805460ff19169055565b61100361241a565b6009805460ff19166001179055565b61101a61241a565b610dd16000612540565b61102c61241a565b6001600160a01b03811661108c5760405162461bcd60e51b815260206004820152602160248201527f4e65772063616c6c65722063616e6e6f74206265207a65726f206164647265736044820152607360f81b6064820152608401610d2a565b600780546001600160a01b0319166001600160a01b0392909216919091179055565b6110b661241a565b60008181526004602052604090205460ff16156111b5576000818152600460205260409020805460ff19169055600554156111a65760005b6005548110156111a457816005828154811061110c5761110c613305565b906000526020600020015403611192576005805461112c906001906134f5565b8154811061113c5761113c613305565b90600052602060002001546005828154811061115a5761115a613305565b600091825260209091200155600580548061117757611177613508565b600190038181906000526020600020016000905590556111a4565b8061119c81613331565b9150506110ee565b505b80600654036111b55760006006555b50565b600581815481106111c857600080fd5b600091825260209091200154905081565b6007546001600160a01b031633148015906111ff57506001546001600160a01b03163314155b1561121c576040516282b42960e81b815260040160405180910390fd5b611224612474565b600b5460008190036112485760405162f030ab60e61b815260040160405180910390fd5b60035460405163d47eed4560e01b81526000916001600160a01b03169063d47eed459061127b9087908790600401613441565b602060405180830381865afa158015611298573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112bc91906134dc565b9050803410156112de5760405162461bcd60e51b8152600401610d2a9061351e565b600354604051631df3cbc560e31b81526001600160a01b039091169063ef9e5e289083906113129088908890600401613441565b6000604051808303818588803b15801561132b57600080fd5b505af115801561133f573d6000803e3d6000fd5b505060088054935091506000905061135683613331565b909155505060035460065460405163052571af60e51b81526004810191909152600560248201526000916001600160a01b03169063a4ae35e090604401608060405180830381865afa1580156113b0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113d49190613389565b600880546000818152600c602052604080822092835560065460019093019290925582548152818120426002909101558351835482528282206003908101805467ffffffffffffffff19166001600160401b0390931692909217909155848301518454835283832090910180546bffffffff00000000000000001916600160401b63ffffffff90931692909202919091179055825481522060040185905554815191925061148191612592565b60085460065482516000838152600c60209081526040918290206005015482519586529085019390935260079190910b908301526060820185905260808201527f967fecb0b9f457b5ce12c4d7cdf4803c743cd6e286ba993892636c406a5bf17c9060a00160405180910390a15050506114fb6001600055565b5050565b611507612474565b60095460ff161561154f5760405162461bcd60e51b815260206004820152601260248201527110dbdb9d1c9858dd081a5cc81c185d5cd95960721b6044820152606401610d2a565b60065461158d5760405162461bcd60e51b815260206004820152600c60248201526b139bc8185cdcd95d081cd95d60a21b6044820152606401610d2a565b60065460009081526004602052604090205460ff166115ee5760405162461bcd60e51b815260206004820152601b60248201527f43757272656e74206173736574206e6f7420737570706f7274656400000000006044820152606401610d2a565b600260009054906101000a90046001600160a01b03166001600160a01b03166305bfce556040518163ffffffff1660e01b8152600401602060405180830381865afa158015611641573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611665919061355f565b156116a85760405162461bcd60e51b815260206004820152601360248201527242616e6b726f6c6c206e6f742061637469766560681b6044820152606401610d2a565b600254604051632ff5fe7360e21b81523060048201526001600160a01b0387811660248301529091169063bfd7f9cc90604401602060405180830381865afa1580156116f8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061171c919061355f565b6117685760405162461bcd60e51b815260206004820152601860248201527f7365742076616c696420776167657220746f20626567696e00000000000000006044820152606401610d2a565b60008311801561177a575061c3508311155b6117bb5760405162461bcd60e51b815260206004820152601260248201527124b73b30b634b21036bab63a34b83634b2b960711b6044820152606401610d2a565b6117c5868661299d565b60035460405163d47eed4560e01b81526000916001600160a01b03169063d47eed45906117f89086908690600401613441565b602060405180830381865afa158015611815573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061183991906134dc565b90506001600160a01b0386166118bf57611853818861357c565b3410156118ba5760405162461bcd60e51b815260206004820152602f60248201527f496e73756666696369656e742045544820666f7220776167657220616e64207060448201526e72696365207570646174652066656560881b6064820152608401610d2a565b6118df565b803410156118df5760405162461bcd60e51b8152600401610d2a9061351e565b6118e98688612aad565b600354604051631df3cbc560e31b81526001600160a01b039091169063ef9e5e2890839061191d9087908790600401613441565b6000604051808303818588803b15801561193657600080fd5b505af115801561194a573d6000803e3d6000fd5b505060035460065460405163052571af60e51b8152600481019190915260056024820152600094506001600160a01b03909116925063a4ae35e09150604401608060405180830381865afa1580156119a6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119ca9190613389565b6040805160e081018252338152602081018b81526001600160a01b038b81169383019384528a151560608401908152855160070b6080850190815260a085018c8152600060c08701818152600b80546001810182559252875160059092027f0175b7a638427703f0dbe7bb9bbf987a2551717b34e79f33b5b1008d1fa01db9810180549388166001600160a01b03199094169390931790925595517f0175b7a638427703f0dbe7bb9bbf987a2551717b34e79f33b5b1008d1fa01dba82015596517f0175b7a638427703f0dbe7bb9bbf987a2551717b34e79f33b5b1008d1fa01dbb88018054945193516001600160401b0316600160a81b0267ffffffffffffffff60a81b19941515600160a01b026001600160a81b031990961692909616919091179390931791909116929092179055517f0175b7a638427703f0dbe7bb9bbf987a2551717b34e79f33b5b1008d1fa01dbc840155517f0175b7a638427703f0dbe7bb9bbf987a2551717b34e79f33b5b1008d1fa01dbd909201805492151560ff1990931692909217909155909150611b648989612bc8565b6006548251604080518c81526001600160a01b038c16602082015290810192909252881515606083015260070b608082015233907fbf51ae1b423067c655c83d3a5d34c333f2c5cad900c604fb9a90b3c2b311ca309060a00160405180910390a2505050611bd26001600055565b505050505050565b611be261241a565b6040516088602482015260009073dc2b0d2dd2b7759d97d50db4eabdc369731108309060440160408051601f198184030181529181526020820180516001600160e01b03166307983f4560e21b17905251611c3d91906135b3565b6000604051808303816000865af19150503d8060008114611c7a576040519150601f19603f3d011682016040523d82523d6000602084013e611c7f565b606091505b50509050806111b55760405162461bcd60e51b815260206004820152601860248201527f4665654d20726567697374726174696f6e206661696c656400000000000000006044820152606401610d2a565b604080516080810182526000808252602082018190528183018190526060820152600354915163052571af60e51b815260048101849052603c602482015290916001600160a01b03169063a4ae35e090604401610e53565b6000806000806000600b805490508610611d7a5760405162461bcd60e51b8152602060048201526013602482015272496e646578206f7574206f6620626f756e647360681b6044820152606401610d2a565b6000600b8781548110611d8f57611d8f613305565b60009182526020918290206040805160e08101825260059390930290910180546001600160a01b039081168085526001830154958501869052600283015491821693850184905260ff600160a01b83048116151560608701819052600160a81b90930460070b60808701819052600385015460a088015260049094015416151560c090950194909452929b939a50909850909650945092505050565b611e3361241a565b60008181526004602052604090205460ff166111b5576000818152600460205260408120805460ff191660019081179091556005805491820181559091527f036b6384b5eca791c62761152d0c79bb0604c104a5fb6f4eb0703f3154bb3db0018190556006546111b557600655565b60008181526004602052604081205460ff16611ed157604051636448d6e960e11b815260040160405180910390fd5b6003546040516396834ad360e01b8152600481018490526000916001600160a01b0316906396834ad390602401608060405180830381865afa158015611f1b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f3f9190613389565b519392505050565b611f4f61241a565b6001600160a01b0381166120335747821115611fa45760405162461bcd60e51b8152602060048201526014602482015273496e73756666696369656e742062616c616e636560601b6044820152606401610d2a565b604051600090339084908381818185875af1925050503d8060008114611fe6576040519150601f19603f3d011682016040523d82523d6000602084013e611feb565b606091505b505090508061202e5760405162461bcd60e51b815260206004820152600f60248201526e151c985b9cd9995c8819985a5b1959608a1b6044820152606401610d2a565b505050565b6040516370a0823160e01b815230600482015281906000906001600160a01b038316906370a0823190602401602060405180830381865afa15801561207c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120a091906134dc565b9050808411156120f25760405162461bcd60e51b815260206004820152601a60248201527f496e73756666696369656e7420746f6b656e2062616c616e63650000000000006044820152606401610d2a565b6121066001600160a01b0383163386612ccb565b50505050565b6060600580548060200260200160405190810160405280929190818152602001828054801561215a57602002820191906000526020600020905b815481526020019060010190808311612146575b5050505050905090565b60035460405163d47eed4560e01b81526000916001600160a01b03169063d47eed45906121979086908690600401613441565b602060405180830381865afa1580156121b4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121d891906134dc565b90508034101561221d5760405162461bcd60e51b815260206004820152601060248201526f496e73756666696369656e742066656560801b6044820152606401610d2a565b600354604051631df3cbc560e31b81526001600160a01b039091169063ef9e5e289083906122519087908790600401613441565b6000604051808303818588803b15801561226a57600080fd5b505af115801561227e573d6000803e3d6000fd5b5050505050505050565b61229061241a565b6001600160a01b0381166122f55760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610d2a565b6111b581612540565b61230661241a565b60008181526004602052604090205460ff1661235a5760405162461bcd60e51b8152602060048201526013602482015272105cdcd95d081b9bdd081cdd5c1c1bdc9d1959606a1b6044820152606401610d2a565b600655565b6000806001600160a01b03831661238357506002546001600160a01b0316316123f4565b6002546040516370a0823160e01b81526001600160a01b039182166004820152908416906370a0823190602401602060405180830381865afa1580156123cd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123f191906134dc565b90505b60006305f5e10061240883621120906135cf565b61241291906135ee565b949350505050565b6001546001600160a01b03163314610dd15760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610d2a565b6002600054036124c65760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610d2a565b6002600055565b6002546040516336012f6160e11b81526001600160a01b03858116600483015260248201859052838116604483015290911690636c025ec290606401600060405180830381600087803b15801561252357600080fd5b505af1158015612537573d6000803e3d6000fd5b50505050505050565b600180546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6000805b600b5481101561297c576000600b82815481106125b5576125b5613305565b906000526020600020906005020160020160159054906101000a900460070b60070b8460070b1390506000600b83815481106125f3576125f3613305565b906000526020600020906005020160020160159054906101000a900460070b60070b8560070b0361262657506000612661565b811515600b848154811061263c5761263c613305565b906000526020600020906005020160020160149054906101000a900460ff1615151490505b80156127b45760006126d06127106126ca600b878154811061268557612685613305565b906000526020600020906005020160030154600b88815481106126aa576126aa613305565b906000526020600020906005020160010154612d2e90919063ffffffff16565b90612d3a565b9050612743600b85815481106126e8576126e8613305565b906000526020600020906005020160000160009054906101000a90046001600160a01b031682600b878154811061272157612721613305565b60009182526020909120600260059092020101546001600160a01b03166124cd565b6000878152600a60205260409020600b80548690811061276557612765613305565b600091825260208083206005909202909101548354600181018555938352912090910180546001600160a01b0319166001600160a01b03909216919091179055846127af81613331565b955050505b600b83815481106127c7576127c7613305565b6000918252602090912060059091020154600b80546001600160a01b03909216917fac6c745e7a198d91748ae85e72856ebbfd3992c424bad0ea8e3bc5f58937c66c91908690811061281b5761281b613305565b9060005260206000209060050201600101548361283957600061287a565b61287a6127106126ca600b898154811061285557612855613305565b906000526020600020906005020160030154600b8a815481106126aa576126aa613305565b600b878154811061288d5761288d613305565b906000526020600020906005020160020160009054906101000a90046001600160a01b0316600b88815481106128c5576128c5613305565b906000526020600020906005020160020160149054906101000a900460ff1686600b8a815481106128f8576128f8613305565b60009182526020918290206002600590920201015460408051978852918701959095526001600160a01b03909316928501929092521515606084015215156080830152600160a81b9004600790810b60a083015288900b60c082015260e081018990526101000160405180910390a25050808061297490613331565b915050612596565b506000838152600c6020526040812060050182905561202e90600b90612f76565b60006001600160a01b0382166129c057506002546001600160a01b031631612a31565b6002546040516370a0823160e01b81526001600160a01b039182166004820152908316906370a0823190602401602060405180830381865afa158015612a0a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612a2e91906134dc565b90505b60006305f5e100612a4583621120906135cf565b612a4f91906135ee565b9050808411156121065760405162461bcd60e51b815260206004820152602360248201527f57616765722065786365656473204b656c6c7920637269746572696f6e206c696044820152621b5a5d60ea1b6064820152608401610d2a565b600254604051632ff5fe7360e21b81523060048201526001600160a01b0384811660248301529091169063bfd7f9cc90604401602060405180830381865afa158015612afd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612b21919061355f565b612b3e576040516351c3b94f60e01b815260040160405180910390fd5b80600003612b7b5760405162461bcd60e51b815260206004820152600a6024820152693d32b937903bb0b3b2b960b11b6044820152606401610d2a565b6001600160a01b038216612bb357803410156114fb5760405163de9b74a160e01b815260048101829052346024820152604401610d2a565b6114fb6001600160a01b038316333084612d46565b6001600160a01b038116612c78576002546040516000916001600160a01b03169084908381818185875af1925050503d8060008114612c23576040519150601f19603f3d011682016040523d82523d6000602084013e612c28565b606091505b5050905080612c725760405162461bcd60e51b8152602060048201526016602482015275151c985b9cd9995c88081d1bc810948811985a5b195960521b6044820152606401610d2a565b50612c92565b600254612c92906001600160a01b03838116911684612ccb565b60405182815233907ff45bab59fd1f193e25b13cca1a4fcf6c6e4288b9fcee68f5f486858d0a88cd6d9060200160405180910390a25050565b6040516001600160a01b03831660248201526044810182905261202e90849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152612d7e565b6000610fe082846135cf565b6000610fe082846135ee565b6040516001600160a01b03808516602483015283166044820152606481018290526121069085906323b872dd60e01b90608401612cf7565b6000612dd3826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316612e539092919063ffffffff16565b9050805160001480612df4575080806020019051810190612df4919061355f565b61202e5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610d2a565b6060612412848460008585600080866001600160a01b03168587604051612e7a91906135b3565b60006040518083038185875af1925050503d8060008114612eb7576040519150601f19603f3d011682016040523d82523d6000602084013e612ebc565b606091505b5091509150612ecd87838387612ed8565b979650505050505050565b60608315612f47578251600003612f40576001600160a01b0385163b612f405760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610d2a565b5081612412565b6124128383815115612f5c5781518083602001fd5b8060405162461bcd60e51b8152600401610d2a9190613610565b50805460008255600502906000526020600020908101906111b591905b80821115612fdd5780546001600160a01b03191681556000600182018190556002820180546001600160e81b0319169055600382015560048101805460ff19169055600501612f93565b5090565b80356001600160a01b0381168114612ff857600080fd5b919050565b60006020828403121561300f57600080fd5b610fe082612fe1565b600081518084526020808501945080840160005b838110156130515781516001600160a01b03168752958201959082019060010161302c565b509495945050505050565b600081518084526020808501945080840160005b8381101561305157815160070b87529582019590820190600101613070565b6080808252855190820181905260009060209060a0840190828901845b828110156130c8578151845292840192908401906001016130ac565b505050838103828501526130dc8188613018565b8481036040860152865180825283880192509083019060005b818110156131135783511515835292840192918401916001016130f5565b50508481036060860152613127818761305c565b9998505050505050505050565b60006020828403121561314657600080fd5b5035919050565b6000806040838503121561316057600080fd5b50508035926020909101359150565b602081526000610fe06020830184613018565b60008083601f84011261319457600080fd5b5081356001600160401b038111156131ab57600080fd5b6020830191508360208260051b85010111156131c657600080fd5b9250929050565b600080602083850312156131e057600080fd5b82356001600160401b038111156131f657600080fd5b61320285828601613182565b90969095509350505050565b80151581146111b557600080fd5b60008060008060008060a0878903121561323557600080fd5b8635955061324560208801612fe1565b945060408701356132558161320e565b93506060870135925060808701356001600160401b0381111561327757600080fd5b61328389828a01613182565b979a9699509497509295939492505050565b600080604083850312156132a857600080fd5b823591506132b860208401612fe1565b90509250929050565b6020808252825182820181905260009190848201906040850190845b818110156132f9578351835292840192918401916001016132dd565b50909695505050505050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600182016133435761334361331b565b5060010190565b634e487b7160e01b600052604160045260246000fd5b80516001600160401b0381168114612ff857600080fd5b8051600381900b8114612ff857600080fd5b60006080828403121561339b57600080fd5b604051608081018181106001600160401b03821117156133cb57634e487b7160e01b600052604160045260246000fd5b6040528251600781900b81146133e057600080fd5b81526133ee60208401613360565b60208201526133ff60408401613377565b6040820152606083015160608201528091505092915050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b60208082528181018390526000906040600585901b8401810190840186845b878110156134cf57868403603f190183528135368a9003601e1901811261348657600080fd5b890185810190356001600160401b038111156134a157600080fd5b8036038213156134b057600080fd5b6134bb868284613418565b955050509184019190840190600101613460565b5091979650505050505050565b6000602082840312156134ee57600080fd5b5051919050565b81810381811115610e9457610e9461331b565b634e487b7160e01b600052603160045260246000fd5b60208082526021908201527f496e73756666696369656e742066656520666f722070726963652075706461746040820152606560f81b606082015260800190565b60006020828403121561357157600080fd5b8151610fe08161320e565b80820180821115610e9457610e9461331b565b60005b838110156135aa578181015183820152602001613592565b50506000910152565b600082516135c581846020870161358f565b9190910192915050565b60008160001904831182151516156135e9576135e961331b565b500290565b60008261360b57634e487b7160e01b600052601260045260246000fd5b500490565b602081526000825180602084015261362f81604085016020870161358f565b601f01601f1916919091016040019291505056fea2646970667358221220a6c4a30753f9b18c22052748a392a16ee6c8e4d91844951580ad36d07101825564736f6c63430008100033000000000000000000000000b2178f1b2ec5c81d230d7cc83d21e5b63e4b7b500000000000000000000000002880ab155794e7179c9ee2e38200202908c17b430000000000000000000000005df4707980440d7beb2ad83dfa0321889fb27aed
Deployed Bytecode
0x60806040526004361061021c5760003560e01c80638da5cb5b11610122578063d0bcfc0c116100a5578063f2fde38b1161006c578063f2fde38b146108b8578063f98d06f0146108d8578063fa55932f146108f8578063fb984ade14610918578063febc14b11461093857005b8063d0bcfc0c14610810578063d634db0a14610830578063dd2cc3f314610863578063e5406dbf14610883578063ef9e5e28146108a557005b8063a6154bea116100e9578063a6154bea146106b5578063ac128f4f146106d5578063b2ee2f0114610772578063c56acbbf14610792578063c59458ff146107f057005b80638da5cb5b1461062c578063952d0b911461064a578063982b76911461067a578063996007471461068d5780639a198d61146106a057005b80632e881471116101aa578063715018a611610171578063715018a6146105b75780637f1fce78146105cc578063837592db146105ec57806387541ed61461060c5780638a7d3fa61461055757005b80632e8814711461052a5780632f452a48146105575780634a4e3bd51461057757806351858e271461058c5780635d6a618d146105a157005b8063161e444e116101ee578063161e444e146104005780631da0b984146104625780631f31633614610481578063205f46f9146104ea57806327c830a91461050057005b806302849bab1461025d57806302e28c701461029657806303e3cd6a146103b357806310c9f122146103eb57005b3661025b57604080513381523460208201527f88a5966d370b9919b20f3e2c13ff65706f196a4e32cc2c12bf57088f88525874910160405180910390a1005b005b34801561026957600080fd5b5061027d610278366004612ffd565b61094e565b60405161028d949392919061308f565b60405180910390f35b3480156102a257600080fd5b506103576102b1366004613134565b6040805160e081018252600080825260208201819052918101829052606081018290526080810182905260a0810182905260c0810191909152506000908152600c6020908152604091829020825160e08101845281548152600182015492810192909252600281015492820192909252600380830154600781900b6060840152600160401b9004900b6080820152600482015460a082015260059091015460c082015290565b60405161028d9190600060e082019050825182526020830151602083015260408301516040830152606083015160070b6060830152608083015160030b608083015260a083015160a083015260c083015160c083015292915050565b3480156103bf57600080fd5b506103d36103ce36600461314d565b610c9f565b6040516001600160a01b03909116815260200161028d565b3480156103f757600080fd5b5061025b610cd7565b34801561040c57600080fd5b5061042061041b366004613134565b610dd3565b60405161028d9190815160070b81526020808301516001600160401b03169082015260408083015160030b908201526060918201519181019190915260800190565b34801561046e57600080fd5b50600b545b60405190815260200161028d565b34801561048d57600080fd5b506104a161049c366004613134565b610e9a565b604080516001600160a01b03988916815260208101979097529490961693850193909352901515606084015260070b608083015260a082015290151560c082015260e00161028d565b3480156104f657600080fd5b5061047360065481565b34801561050c57600080fd5b5060095461051a9060ff1681565b604051901515815260200161028d565b34801561053657600080fd5b5061054a610545366004613134565b610f00565b60405161028d919061316f565b34801561056357600080fd5b506104736105723660046131cd565b610f6c565b34801561058357600080fd5b5061025b610fe7565b34801561059857600080fd5b5061025b610ffb565b3480156105ad57600080fd5b5061047361c35081565b3480156105c357600080fd5b5061025b611012565b3480156105d857600080fd5b5061025b6105e7366004612ffd565b611024565b3480156105f857600080fd5b5061025b610607366004613134565b6110ae565b34801561061857600080fd5b50610473610627366004613134565b6111b8565b34801561063857600080fd5b506001546001600160a01b03166103d3565b34801561065657600080fd5b5061051a610665366004613134565b60046020526000908152604090205460ff1681565b61025b6106883660046131cd565b6111d9565b61025b61069b36600461321c565b6114ff565b3480156106ac57600080fd5b5061025b611bda565b3480156106c157600080fd5b506007546103d3906001600160a01b031681565b3480156106e157600080fd5b506107376106f0366004613134565b600c6020526000908152604090208054600182015460028301546003808501546004860154600590960154949593949293600782900b93600160401b90920490920b919087565b6040805197885260208801969096529486019390935260079190910b606085015260030b608084015260a083015260c082015260e00161028d565b34801561077e57600080fd5b5061042061078d366004613134565b611cd0565b34801561079e57600080fd5b506107b26107ad366004613134565b611d28565b604080516001600160a01b039687168152602081019590955292909416918301919091521515606082015260079190910b608082015260a00161028d565b3480156107fc57600080fd5b5061025b61080b366004613134565b611e2b565b34801561081c57600080fd5b506002546103d3906001600160a01b031681565b34801561083c57600080fd5b5061085061084b366004613134565b611ea2565b60405160079190910b815260200161028d565b34801561086f57600080fd5b5061025b61087e366004613295565b611f47565b34801561088f57600080fd5b5061089861210c565b60405161028d91906132c1565b61025b6108b33660046131cd565b612164565b3480156108c457600080fd5b5061025b6108d3366004612ffd565b612288565b3480156108e457600080fd5b506003546103d3906001600160a01b031681565b34801561090457600080fd5b5061025b610913366004613134565b6122fe565b34801561092457600080fd5b50610473610933366004612ffd565b61235f565b34801561094457600080fd5b5061047360085481565b6060806060806000805b600b548110156109be57866001600160a01b0316600b828154811061097f5761097f613305565b60009182526020909120600590910201546001600160a01b0316036109ac57816109a881613331565b9250505b806109b681613331565b915050610958565b50806001600160401b038111156109d7576109d761334a565b604051908082528060200260200182016040528015610a00578160200160208202803683370190505b509450806001600160401b03811115610a1b57610a1b61334a565b604051908082528060200260200182016040528015610a44578160200160208202803683370190505b509350806001600160401b03811115610a5f57610a5f61334a565b604051908082528060200260200182016040528015610a88578160200160208202803683370190505b509250806001600160401b03811115610aa357610aa361334a565b604051908082528060200260200182016040528015610acc578160200160208202803683370190505b5091506000805b600b54811015610c9557876001600160a01b0316600b8281548110610afa57610afa613305565b60009182526020909120600590910201546001600160a01b031603610c8357600b8181548110610b2c57610b2c613305565b906000526020600020906005020160010154878381518110610b5057610b50613305565b602002602001018181525050600b8181548110610b6f57610b6f613305565b906000526020600020906005020160020160009054906101000a90046001600160a01b0316868381518110610ba657610ba6613305565b60200260200101906001600160a01b031690816001600160a01b031681525050600b8181548110610bd957610bd9613305565b906000526020600020906005020160020160149054906101000a900460ff16858381518110610c0a57610c0a613305565b602002602001019015159081151581525050600b8181548110610c2f57610c2f613305565b906000526020600020906005020160020160159054906101000a900460070b848381518110610c6057610c60613305565b602002602001019060070b908160070b815250508180610c7f90613331565b9250505b80610c8d81613331565b915050610ad3565b5050509193509193565b600a6020528160005260406000208181548110610cbb57600080fd5b6000918252602090912001546001600160a01b03169150829050565b610cdf61241a565b610ce7612474565b600b54610d335760405162461bcd60e51b81526020600482015260156024820152744e6f206163746976652070726564696374696f6e7360581b60448201526064015b60405180910390fd5b60005b600b54811015610dba576000600b8281548110610d5557610d55613305565b60009182526020909120600590910201600481015490915060ff16610da757805460018201546002830154610d97926001600160a01b039081169291166124cd565b60048101805460ff191660011790555b5080610db281613331565b915050610d36565b50610dc7600b6000612f76565b610dd16001600055565b565b60408051608081018252600080825260208201819052918101829052606081019190915260008281526004602052604090205460ff16610e2657604051636448d6e960e11b815260040160405180910390fd5b6003546040516396834ad360e01b8152600481018490526001600160a01b03909116906396834ad3906024015b608060405180830381865afa158015610e70573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e949190613389565b92915050565b600b8181548110610eaa57600080fd5b6000918252602090912060059091020180546001820154600283015460038401546004909401546001600160a01b03938416955091939281169260ff600160a01b8304811693600160a81b90930460070b921687565b6000818152600a6020908152604091829020805483518184028101840190945280845260609392830182828015610f6057602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311610f42575b50505050509050919050565b60035460405163d47eed4560e01b81526000916001600160a01b03169063d47eed4590610f9f9086908690600401613441565b602060405180830381865afa158015610fbc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fe091906134dc565b9392505050565b610fef61241a565b6009805460ff19169055565b61100361241a565b6009805460ff19166001179055565b61101a61241a565b610dd16000612540565b61102c61241a565b6001600160a01b03811661108c5760405162461bcd60e51b815260206004820152602160248201527f4e65772063616c6c65722063616e6e6f74206265207a65726f206164647265736044820152607360f81b6064820152608401610d2a565b600780546001600160a01b0319166001600160a01b0392909216919091179055565b6110b661241a565b60008181526004602052604090205460ff16156111b5576000818152600460205260409020805460ff19169055600554156111a65760005b6005548110156111a457816005828154811061110c5761110c613305565b906000526020600020015403611192576005805461112c906001906134f5565b8154811061113c5761113c613305565b90600052602060002001546005828154811061115a5761115a613305565b600091825260209091200155600580548061117757611177613508565b600190038181906000526020600020016000905590556111a4565b8061119c81613331565b9150506110ee565b505b80600654036111b55760006006555b50565b600581815481106111c857600080fd5b600091825260209091200154905081565b6007546001600160a01b031633148015906111ff57506001546001600160a01b03163314155b1561121c576040516282b42960e81b815260040160405180910390fd5b611224612474565b600b5460008190036112485760405162f030ab60e61b815260040160405180910390fd5b60035460405163d47eed4560e01b81526000916001600160a01b03169063d47eed459061127b9087908790600401613441565b602060405180830381865afa158015611298573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112bc91906134dc565b9050803410156112de5760405162461bcd60e51b8152600401610d2a9061351e565b600354604051631df3cbc560e31b81526001600160a01b039091169063ef9e5e289083906113129088908890600401613441565b6000604051808303818588803b15801561132b57600080fd5b505af115801561133f573d6000803e3d6000fd5b505060088054935091506000905061135683613331565b909155505060035460065460405163052571af60e51b81526004810191909152600560248201526000916001600160a01b03169063a4ae35e090604401608060405180830381865afa1580156113b0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113d49190613389565b600880546000818152600c602052604080822092835560065460019093019290925582548152818120426002909101558351835482528282206003908101805467ffffffffffffffff19166001600160401b0390931692909217909155848301518454835283832090910180546bffffffff00000000000000001916600160401b63ffffffff90931692909202919091179055825481522060040185905554815191925061148191612592565b60085460065482516000838152600c60209081526040918290206005015482519586529085019390935260079190910b908301526060820185905260808201527f967fecb0b9f457b5ce12c4d7cdf4803c743cd6e286ba993892636c406a5bf17c9060a00160405180910390a15050506114fb6001600055565b5050565b611507612474565b60095460ff161561154f5760405162461bcd60e51b815260206004820152601260248201527110dbdb9d1c9858dd081a5cc81c185d5cd95960721b6044820152606401610d2a565b60065461158d5760405162461bcd60e51b815260206004820152600c60248201526b139bc8185cdcd95d081cd95d60a21b6044820152606401610d2a565b60065460009081526004602052604090205460ff166115ee5760405162461bcd60e51b815260206004820152601b60248201527f43757272656e74206173736574206e6f7420737570706f7274656400000000006044820152606401610d2a565b600260009054906101000a90046001600160a01b03166001600160a01b03166305bfce556040518163ffffffff1660e01b8152600401602060405180830381865afa158015611641573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611665919061355f565b156116a85760405162461bcd60e51b815260206004820152601360248201527242616e6b726f6c6c206e6f742061637469766560681b6044820152606401610d2a565b600254604051632ff5fe7360e21b81523060048201526001600160a01b0387811660248301529091169063bfd7f9cc90604401602060405180830381865afa1580156116f8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061171c919061355f565b6117685760405162461bcd60e51b815260206004820152601860248201527f7365742076616c696420776167657220746f20626567696e00000000000000006044820152606401610d2a565b60008311801561177a575061c3508311155b6117bb5760405162461bcd60e51b815260206004820152601260248201527124b73b30b634b21036bab63a34b83634b2b960711b6044820152606401610d2a565b6117c5868661299d565b60035460405163d47eed4560e01b81526000916001600160a01b03169063d47eed45906117f89086908690600401613441565b602060405180830381865afa158015611815573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061183991906134dc565b90506001600160a01b0386166118bf57611853818861357c565b3410156118ba5760405162461bcd60e51b815260206004820152602f60248201527f496e73756666696369656e742045544820666f7220776167657220616e64207060448201526e72696365207570646174652066656560881b6064820152608401610d2a565b6118df565b803410156118df5760405162461bcd60e51b8152600401610d2a9061351e565b6118e98688612aad565b600354604051631df3cbc560e31b81526001600160a01b039091169063ef9e5e2890839061191d9087908790600401613441565b6000604051808303818588803b15801561193657600080fd5b505af115801561194a573d6000803e3d6000fd5b505060035460065460405163052571af60e51b8152600481019190915260056024820152600094506001600160a01b03909116925063a4ae35e09150604401608060405180830381865afa1580156119a6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119ca9190613389565b6040805160e081018252338152602081018b81526001600160a01b038b81169383019384528a151560608401908152855160070b6080850190815260a085018c8152600060c08701818152600b80546001810182559252875160059092027f0175b7a638427703f0dbe7bb9bbf987a2551717b34e79f33b5b1008d1fa01db9810180549388166001600160a01b03199094169390931790925595517f0175b7a638427703f0dbe7bb9bbf987a2551717b34e79f33b5b1008d1fa01dba82015596517f0175b7a638427703f0dbe7bb9bbf987a2551717b34e79f33b5b1008d1fa01dbb88018054945193516001600160401b0316600160a81b0267ffffffffffffffff60a81b19941515600160a01b026001600160a81b031990961692909616919091179390931791909116929092179055517f0175b7a638427703f0dbe7bb9bbf987a2551717b34e79f33b5b1008d1fa01dbc840155517f0175b7a638427703f0dbe7bb9bbf987a2551717b34e79f33b5b1008d1fa01dbd909201805492151560ff1990931692909217909155909150611b648989612bc8565b6006548251604080518c81526001600160a01b038c16602082015290810192909252881515606083015260070b608082015233907fbf51ae1b423067c655c83d3a5d34c333f2c5cad900c604fb9a90b3c2b311ca309060a00160405180910390a2505050611bd26001600055565b505050505050565b611be261241a565b6040516088602482015260009073dc2b0d2dd2b7759d97d50db4eabdc369731108309060440160408051601f198184030181529181526020820180516001600160e01b03166307983f4560e21b17905251611c3d91906135b3565b6000604051808303816000865af19150503d8060008114611c7a576040519150601f19603f3d011682016040523d82523d6000602084013e611c7f565b606091505b50509050806111b55760405162461bcd60e51b815260206004820152601860248201527f4665654d20726567697374726174696f6e206661696c656400000000000000006044820152606401610d2a565b604080516080810182526000808252602082018190528183018190526060820152600354915163052571af60e51b815260048101849052603c602482015290916001600160a01b03169063a4ae35e090604401610e53565b6000806000806000600b805490508610611d7a5760405162461bcd60e51b8152602060048201526013602482015272496e646578206f7574206f6620626f756e647360681b6044820152606401610d2a565b6000600b8781548110611d8f57611d8f613305565b60009182526020918290206040805160e08101825260059390930290910180546001600160a01b039081168085526001830154958501869052600283015491821693850184905260ff600160a01b83048116151560608701819052600160a81b90930460070b60808701819052600385015460a088015260049094015416151560c090950194909452929b939a50909850909650945092505050565b611e3361241a565b60008181526004602052604090205460ff166111b5576000818152600460205260408120805460ff191660019081179091556005805491820181559091527f036b6384b5eca791c62761152d0c79bb0604c104a5fb6f4eb0703f3154bb3db0018190556006546111b557600655565b60008181526004602052604081205460ff16611ed157604051636448d6e960e11b815260040160405180910390fd5b6003546040516396834ad360e01b8152600481018490526000916001600160a01b0316906396834ad390602401608060405180830381865afa158015611f1b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f3f9190613389565b519392505050565b611f4f61241a565b6001600160a01b0381166120335747821115611fa45760405162461bcd60e51b8152602060048201526014602482015273496e73756666696369656e742062616c616e636560601b6044820152606401610d2a565b604051600090339084908381818185875af1925050503d8060008114611fe6576040519150601f19603f3d011682016040523d82523d6000602084013e611feb565b606091505b505090508061202e5760405162461bcd60e51b815260206004820152600f60248201526e151c985b9cd9995c8819985a5b1959608a1b6044820152606401610d2a565b505050565b6040516370a0823160e01b815230600482015281906000906001600160a01b038316906370a0823190602401602060405180830381865afa15801561207c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120a091906134dc565b9050808411156120f25760405162461bcd60e51b815260206004820152601a60248201527f496e73756666696369656e7420746f6b656e2062616c616e63650000000000006044820152606401610d2a565b6121066001600160a01b0383163386612ccb565b50505050565b6060600580548060200260200160405190810160405280929190818152602001828054801561215a57602002820191906000526020600020905b815481526020019060010190808311612146575b5050505050905090565b60035460405163d47eed4560e01b81526000916001600160a01b03169063d47eed45906121979086908690600401613441565b602060405180830381865afa1580156121b4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121d891906134dc565b90508034101561221d5760405162461bcd60e51b815260206004820152601060248201526f496e73756666696369656e742066656560801b6044820152606401610d2a565b600354604051631df3cbc560e31b81526001600160a01b039091169063ef9e5e289083906122519087908790600401613441565b6000604051808303818588803b15801561226a57600080fd5b505af115801561227e573d6000803e3d6000fd5b5050505050505050565b61229061241a565b6001600160a01b0381166122f55760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610d2a565b6111b581612540565b61230661241a565b60008181526004602052604090205460ff1661235a5760405162461bcd60e51b8152602060048201526013602482015272105cdcd95d081b9bdd081cdd5c1c1bdc9d1959606a1b6044820152606401610d2a565b600655565b6000806001600160a01b03831661238357506002546001600160a01b0316316123f4565b6002546040516370a0823160e01b81526001600160a01b039182166004820152908416906370a0823190602401602060405180830381865afa1580156123cd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123f191906134dc565b90505b60006305f5e10061240883621120906135cf565b61241291906135ee565b949350505050565b6001546001600160a01b03163314610dd15760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610d2a565b6002600054036124c65760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610d2a565b6002600055565b6002546040516336012f6160e11b81526001600160a01b03858116600483015260248201859052838116604483015290911690636c025ec290606401600060405180830381600087803b15801561252357600080fd5b505af1158015612537573d6000803e3d6000fd5b50505050505050565b600180546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6000805b600b5481101561297c576000600b82815481106125b5576125b5613305565b906000526020600020906005020160020160159054906101000a900460070b60070b8460070b1390506000600b83815481106125f3576125f3613305565b906000526020600020906005020160020160159054906101000a900460070b60070b8560070b0361262657506000612661565b811515600b848154811061263c5761263c613305565b906000526020600020906005020160020160149054906101000a900460ff1615151490505b80156127b45760006126d06127106126ca600b878154811061268557612685613305565b906000526020600020906005020160030154600b88815481106126aa576126aa613305565b906000526020600020906005020160010154612d2e90919063ffffffff16565b90612d3a565b9050612743600b85815481106126e8576126e8613305565b906000526020600020906005020160000160009054906101000a90046001600160a01b031682600b878154811061272157612721613305565b60009182526020909120600260059092020101546001600160a01b03166124cd565b6000878152600a60205260409020600b80548690811061276557612765613305565b600091825260208083206005909202909101548354600181018555938352912090910180546001600160a01b0319166001600160a01b03909216919091179055846127af81613331565b955050505b600b83815481106127c7576127c7613305565b6000918252602090912060059091020154600b80546001600160a01b03909216917fac6c745e7a198d91748ae85e72856ebbfd3992c424bad0ea8e3bc5f58937c66c91908690811061281b5761281b613305565b9060005260206000209060050201600101548361283957600061287a565b61287a6127106126ca600b898154811061285557612855613305565b906000526020600020906005020160030154600b8a815481106126aa576126aa613305565b600b878154811061288d5761288d613305565b906000526020600020906005020160020160009054906101000a90046001600160a01b0316600b88815481106128c5576128c5613305565b906000526020600020906005020160020160149054906101000a900460ff1686600b8a815481106128f8576128f8613305565b60009182526020918290206002600590920201015460408051978852918701959095526001600160a01b03909316928501929092521515606084015215156080830152600160a81b9004600790810b60a083015288900b60c082015260e081018990526101000160405180910390a25050808061297490613331565b915050612596565b506000838152600c6020526040812060050182905561202e90600b90612f76565b60006001600160a01b0382166129c057506002546001600160a01b031631612a31565b6002546040516370a0823160e01b81526001600160a01b039182166004820152908316906370a0823190602401602060405180830381865afa158015612a0a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612a2e91906134dc565b90505b60006305f5e100612a4583621120906135cf565b612a4f91906135ee565b9050808411156121065760405162461bcd60e51b815260206004820152602360248201527f57616765722065786365656473204b656c6c7920637269746572696f6e206c696044820152621b5a5d60ea1b6064820152608401610d2a565b600254604051632ff5fe7360e21b81523060048201526001600160a01b0384811660248301529091169063bfd7f9cc90604401602060405180830381865afa158015612afd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612b21919061355f565b612b3e576040516351c3b94f60e01b815260040160405180910390fd5b80600003612b7b5760405162461bcd60e51b815260206004820152600a6024820152693d32b937903bb0b3b2b960b11b6044820152606401610d2a565b6001600160a01b038216612bb357803410156114fb5760405163de9b74a160e01b815260048101829052346024820152604401610d2a565b6114fb6001600160a01b038316333084612d46565b6001600160a01b038116612c78576002546040516000916001600160a01b03169084908381818185875af1925050503d8060008114612c23576040519150601f19603f3d011682016040523d82523d6000602084013e612c28565b606091505b5050905080612c725760405162461bcd60e51b8152602060048201526016602482015275151c985b9cd9995c88081d1bc810948811985a5b195960521b6044820152606401610d2a565b50612c92565b600254612c92906001600160a01b03838116911684612ccb565b60405182815233907ff45bab59fd1f193e25b13cca1a4fcf6c6e4288b9fcee68f5f486858d0a88cd6d9060200160405180910390a25050565b6040516001600160a01b03831660248201526044810182905261202e90849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152612d7e565b6000610fe082846135cf565b6000610fe082846135ee565b6040516001600160a01b03808516602483015283166044820152606481018290526121069085906323b872dd60e01b90608401612cf7565b6000612dd3826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316612e539092919063ffffffff16565b9050805160001480612df4575080806020019051810190612df4919061355f565b61202e5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610d2a565b6060612412848460008585600080866001600160a01b03168587604051612e7a91906135b3565b60006040518083038185875af1925050503d8060008114612eb7576040519150601f19603f3d011682016040523d82523d6000602084013e612ebc565b606091505b5091509150612ecd87838387612ed8565b979650505050505050565b60608315612f47578251600003612f40576001600160a01b0385163b612f405760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610d2a565b5081612412565b6124128383815115612f5c5781518083602001fd5b8060405162461bcd60e51b8152600401610d2a9190613610565b50805460008255600502906000526020600020908101906111b591905b80821115612fdd5780546001600160a01b03191681556000600182018190556002820180546001600160e81b0319169055600382015560048101805460ff19169055600501612f93565b5090565b80356001600160a01b0381168114612ff857600080fd5b919050565b60006020828403121561300f57600080fd5b610fe082612fe1565b600081518084526020808501945080840160005b838110156130515781516001600160a01b03168752958201959082019060010161302c565b509495945050505050565b600081518084526020808501945080840160005b8381101561305157815160070b87529582019590820190600101613070565b6080808252855190820181905260009060209060a0840190828901845b828110156130c8578151845292840192908401906001016130ac565b505050838103828501526130dc8188613018565b8481036040860152865180825283880192509083019060005b818110156131135783511515835292840192918401916001016130f5565b50508481036060860152613127818761305c565b9998505050505050505050565b60006020828403121561314657600080fd5b5035919050565b6000806040838503121561316057600080fd5b50508035926020909101359150565b602081526000610fe06020830184613018565b60008083601f84011261319457600080fd5b5081356001600160401b038111156131ab57600080fd5b6020830191508360208260051b85010111156131c657600080fd5b9250929050565b600080602083850312156131e057600080fd5b82356001600160401b038111156131f657600080fd5b61320285828601613182565b90969095509350505050565b80151581146111b557600080fd5b60008060008060008060a0878903121561323557600080fd5b8635955061324560208801612fe1565b945060408701356132558161320e565b93506060870135925060808701356001600160401b0381111561327757600080fd5b61328389828a01613182565b979a9699509497509295939492505050565b600080604083850312156132a857600080fd5b823591506132b860208401612fe1565b90509250929050565b6020808252825182820181905260009190848201906040850190845b818110156132f9578351835292840192918401916001016132dd565b50909695505050505050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600182016133435761334361331b565b5060010190565b634e487b7160e01b600052604160045260246000fd5b80516001600160401b0381168114612ff857600080fd5b8051600381900b8114612ff857600080fd5b60006080828403121561339b57600080fd5b604051608081018181106001600160401b03821117156133cb57634e487b7160e01b600052604160045260246000fd5b6040528251600781900b81146133e057600080fd5b81526133ee60208401613360565b60208201526133ff60408401613377565b6040820152606083015160608201528091505092915050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b60208082528181018390526000906040600585901b8401810190840186845b878110156134cf57868403603f190183528135368a9003601e1901811261348657600080fd5b890185810190356001600160401b038111156134a157600080fd5b8036038213156134b057600080fd5b6134bb868284613418565b955050509184019190840190600101613460565b5091979650505050505050565b6000602082840312156134ee57600080fd5b5051919050565b81810381811115610e9457610e9461331b565b634e487b7160e01b600052603160045260246000fd5b60208082526021908201527f496e73756666696369656e742066656520666f722070726963652075706461746040820152606560f81b606082015260800190565b60006020828403121561357157600080fd5b8151610fe08161320e565b80820180821115610e9457610e9461331b565b60005b838110156135aa578181015183820152602001613592565b50506000910152565b600082516135c581846020870161358f565b9190910192915050565b60008160001904831182151516156135e9576135e961331b565b500290565b60008261360b57634e487b7160e01b600052601260045260246000fd5b500490565b602081526000825180602084015261362f81604085016020870161358f565b601f01601f1916919091016040019291505056fea2646970667358221220a6c4a30753f9b18c22052748a392a16ee6c8e4d91844951580ad36d07101825564736f6c63430008100033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000b2178f1b2ec5c81d230d7cc83d21e5b63e4b7b500000000000000000000000002880ab155794e7179c9ee2e38200202908c17b430000000000000000000000005df4707980440d7beb2ad83dfa0321889fb27aed
-----Decoded View---------------
Arg [0] : _bankroll (address): 0xB2178f1b2ec5C81d230D7Cc83d21e5b63E4b7B50
Arg [1] : _pyth (address): 0x2880aB155794e7179c9eE2e38200202908C17B43
Arg [2] : _upkeepCaller (address): 0x5DF4707980440D7BEB2AD83dfA0321889FB27AeD
-----Encoded View---------------
3 Constructor Arguments found :
Arg [0] : 000000000000000000000000b2178f1b2ec5c81d230d7cc83d21e5b63e4b7b50
Arg [1] : 0000000000000000000000002880ab155794e7179c9ee2e38200202908c17b43
Arg [2] : 0000000000000000000000005df4707980440d7beb2ad83dfa0321889fb27aed
Loading...
Loading
Loading...
Loading
Loading...
Loading
Net Worth in USD
$0.05
Net Worth in S
Token Allocations
S
100.00%
Multichain Portfolio | 35 Chains
| Chain | Token | Portfolio % | Price | Amount | Value |
|---|---|---|---|---|---|
| SONIC | 100.00% | $0.066406 | 0.8 | $0.053125 |
Loading...
Loading
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
[ 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.