More Info
Private Name Tags
ContractCreator
TokenTracker
Latest 25 from a total of 71,336 transactions
| Transaction Hash |
|
Block
|
From
|
To
|
|||||
|---|---|---|---|---|---|---|---|---|---|
| Approve | 61386336 | 3 hrs ago | IN | 0 S | 0.0024189 | ||||
| Borrow More | 61374737 | 8 hrs ago | IN | 0 S | 0.00708641 | ||||
| Approve | 61365641 | 11 hrs ago | IN | 0 S | 0.0024189 | ||||
| Approve | 61357241 | 13 hrs ago | IN | 0 S | 0.00266079 | ||||
| Remove Collatera... | 61331682 | 21 hrs ago | IN | 0 S | 0.00637868 | ||||
| Approve | 61312718 | 28 hrs ago | IN | 0 S | 0.00142945 | ||||
| Approve | 61305070 | 31 hrs ago | IN | 0 S | 0.00142873 | ||||
| Approve | 61305066 | 31 hrs ago | IN | 0 S | 0.00142945 | ||||
| Approve | 61305023 | 31 hrs ago | IN | 0 S | 0.00142945 | ||||
| Approve | 61304729 | 31 hrs ago | IN | 0 S | 0.0012995 | ||||
| Sell | 61283924 | 39 hrs ago | IN | 0 S | 0.00563502 | ||||
| Remove Collatera... | 61283899 | 39 hrs ago | IN | 0 S | 0.00459684 | ||||
| Approve | 61279893 | 40 hrs ago | IN | 0 S | 0.00142945 | ||||
| Borrow More | 61273889 | 42 hrs ago | IN | 0 S | 0.00654425 | ||||
| Borrow More | 61273856 | 42 hrs ago | IN | 0 S | 0.00654425 | ||||
| Borrow More | 61273834 | 42 hrs ago | IN | 0 S | 0.00654425 | ||||
| Borrow More | 61273809 | 42 hrs ago | IN | 0 S | 0.00654425 | ||||
| Borrow More | 61273785 | 42 hrs ago | IN | 0 S | 0.00654425 | ||||
| Approve | 61267363 | 43 hrs ago | IN | 0 S | 0.00231755 | ||||
| Borrow More | 61231106 | 2 days ago | IN | 0 S | 0.00654425 | ||||
| Borrow More | 61231011 | 2 days ago | IN | 0 S | 0.00654425 | ||||
| Borrow More | 61230971 | 2 days ago | IN | 0 S | 0.00654425 | ||||
| Borrow More | 61230948 | 2 days ago | IN | 0 S | 0.00654425 | ||||
| Borrow More | 61230915 | 2 days ago | IN | 0 S | 0.00654425 | ||||
| Borrow More | 61230888 | 2 days ago | IN | 0 S | 0.00654425 |
Latest 25 internal transactions (View All)
Advanced mode:
| Parent Transaction Hash | Block | From | To | |||
|---|---|---|---|---|---|---|
| 61374737 | 8 hrs ago | 1.21862236 S | ||||
| 61374737 | 8 hrs ago | 0.00836911 S | ||||
| 61283924 | 39 hrs ago | 0.08474789 S | ||||
| 61283924 | 39 hrs ago | 10.32864946 S | ||||
| 61273889 | 42 hrs ago | 150.08670069 S | ||||
| 61273889 | 42 hrs ago | 0.0455268 S | ||||
| 61273856 | 42 hrs ago | 601.0089095 S | ||||
| 61273856 | 42 hrs ago | 0.18230806 S | ||||
| 61273834 | 42 hrs ago | 601.217591 S | ||||
| 61273834 | 42 hrs ago | 0.18237136 S | ||||
| 61273809 | 42 hrs ago | 602.38267265 S | ||||
| 61273809 | 42 hrs ago | 0.18272477 S | ||||
| 61273785 | 42 hrs ago | 603.76279174 S | ||||
| 61273785 | 42 hrs ago | 0.18314341 S | ||||
| 61231106 | 2 days ago | 801.02960076 S | ||||
| 61231106 | 2 days ago | 0.24298167 S | ||||
| 61231011 | 2 days ago | 1,380.49066599 S | ||||
| 61231011 | 2 days ago | 0.41875348 S | ||||
| 61230971 | 2 days ago | 1,358.61794499 S | ||||
| 61230971 | 2 days ago | 0.41211868 S | ||||
| 61230948 | 2 days ago | 1,313.30227079 S | ||||
| 61230948 | 2 days ago | 0.39837278 S | ||||
| 61230915 | 2 days ago | 1,351.32764096 S | ||||
| 61230915 | 2 days ago | 0.40990727 S | ||||
| 61230888 | 2 days ago | 1,321.43838205 S |
Cross-Chain Transactions
Loading...
Loading
Contract Name:
EGGS
Compiler Version
v0.8.28+commit.7893614a
Optimization Enabled:
Yes with 200 runs
Other Settings:
cancun EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
//SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.28;
import "@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol";
import "@openzeppelin/contracts/access/Ownable2Step.sol";
import "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
import "@openzeppelin/contracts/utils/math/Math.sol";
contract EGGS is ERC20Burnable, Ownable2Step, ReentrancyGuard {
address payable public FEE_ADDRESS;
uint256 private constant MIN = 1000;
uint16 public sell_fee = 975;
uint16 public buy_fee = 975;
uint16 public buy_fee_leverage = 10;
uint16 private constant FEE_BASE_1000 = 1000;
uint16 private constant FEES_BUY = 125;
uint16 private constant FEES_SELL = 125;
bool public start = false;
uint128 private constant SONICinWEI = 1 * 10 ** 18;
uint256 private totalBorrowed = 0;
uint256 private totalCollateral = 0;
uint128 public constant maxSupply = 10e28;
uint256 public totalMinted;
uint256 public lastPrice = 0;
struct Loan {
uint256 collateral; // shares of token staked
uint256 borrowed; // user reward per token paid
uint256 endDate;
uint256 numberOfDays;
}
mapping(address => Loan) public Loans;
mapping(uint256 => uint256) public BorrowedByDate;
mapping(uint256 => uint256) public CollateralByDate;
uint256 public lastLiquidationDate;
event Price(uint256 time, uint256 price, uint256 volumeInSonic);
event MaxUpdated(uint256 max);
event SellFeeUpdated(uint256 sellFee);
event FeeAddressUpdated(address _address);
event BuyFeeUpdated(uint256 buyFee);
event LeverageFeeUpdated(uint256 leverageFee);
event Started(bool started);
event Liquidate(uint256 time, uint256 amount);
event LoanDataUpdate(
uint256 collateralByDate,
uint256 borrowedByDate,
uint256 totalBorrowed,
uint256 totalCollateral
);
event SendSonic(address to, uint256 amount);
constructor() ERC20("Eggs", "EGGS") Ownable(msg.sender) {
lastLiquidationDate = getMidnightTimestamp(block.timestamp);
}
function setStart() public payable onlyOwner {
require(FEE_ADDRESS != address(0x0), "Must set fee address");
uint256 teamMint = msg.value * MIN;
require(teamMint >= 1 ether);
mint(msg.sender, teamMint);
_transfer(
msg.sender,
0x000000000000000000000000000000000000dEaD,
1 ether
);
start = true;
emit Started(true);
}
function mint(address to, uint256 value) private {
require(to != address(0x0), "Can't mint to to 0x0 address");
totalMinted = totalMinted + value;
require(totalMinted <= maxSupply, "NO MORE EGGS");
_mint(to, value);
}
function setFeeAddress(address _address) external onlyOwner {
require(
_address != address(0x0),
"Can't set fee address to 0x0 address"
);
FEE_ADDRESS = payable(_address);
emit FeeAddressUpdated(_address);
}
function setBuyFee(uint16 amount) external onlyOwner {
require(amount <= 992, "buy fee must be greater than FEES_BUY");
require(amount >= 975, "buy fee must be less than 2.5%");
buy_fee = amount;
emit BuyFeeUpdated(amount);
}
function setBuyFeeLeverage(uint16 amount) external onlyOwner {
require(amount <= 25, "leverage buy fee must be less 2.5%");
require(amount >= 0, "leverage buy fee must be greater than 0%");
buy_fee_leverage = amount;
emit LeverageFeeUpdated(amount);
}
function setSellFee(uint16 amount) external onlyOwner {
require(amount <= 992, "sell fee must be greater than FEES_SELL");
require(amount >= 975, "sell fee must be less than 2.5%");
sell_fee = amount;
emit SellFeeUpdated(amount);
}
function buy(address receiver) external payable nonReentrant {
liquidate();
require(start, "Trading must be initialized");
require(receiver != address(0x0), "Reciever cannot be 0x0 address");
// Mint Eggs to sender
// AUDIT: to user round down
uint256 eggs = SONICtoEGGS(msg.value);
mint(receiver, (eggs * getBuyFee()) / FEE_BASE_1000);
// Team fee
uint256 feeAddressAmount = msg.value / FEES_BUY;
require(feeAddressAmount > MIN, "must trade over min");
sendSonic(FEE_ADDRESS, feeAddressAmount);
safetyCheck(msg.value);
}
function sell(uint256 eggs) external nonReentrant {
liquidate();
// Total Eth to be sent
// AUDIT: to user round down
uint256 sonic = EGGStoSONIC(eggs);
// Burn of JAY
uint256 feeAddressAmount = sonic / FEES_SELL;
_burn(msg.sender, eggs);
// Payment to sender
sendSonic(msg.sender, (sonic * sell_fee) / FEE_BASE_1000);
// Team fee
require(feeAddressAmount > MIN, "must trade over min");
sendSonic(FEE_ADDRESS, feeAddressAmount);
safetyCheck(sonic);
}
// Calculation may be off if liqudation is due to occur
function getBuyAmount(uint256 amount) public view returns (uint256) {
uint256 eggs = SONICtoEGGSNoTrade(amount);
return ((eggs * getBuyFee()) / FEE_BASE_1000);
}
function leverageFee(
uint256 sonic,
uint256 numberOfDays
) public view returns (uint256) {
uint256 mintFee = (sonic * buy_fee_leverage) / FEE_BASE_1000;
uint256 interest = getInterestFee(sonic, numberOfDays);
return (mintFee + interest);
}
function leverage(
uint256 sonic,
uint256 numberOfDays
) public payable nonReentrant {
require(start, "Trading must be initialized");
require(
numberOfDays < 366,
"Max borrow/extension must be 365 days or less"
);
Loan memory userLoan = Loans[msg.sender];
if (userLoan.borrowed != 0) {
if (isLoanExpired(msg.sender)) {
delete Loans[msg.sender];
}
require(
Loans[msg.sender].borrowed == 0,
"Use account with no loans"
);
}
liquidate();
uint256 endDate = getMidnightTimestamp(
(numberOfDays * 1 days) + block.timestamp
);
uint256 sonicFee = leverageFee(sonic, numberOfDays);
uint256 userSonic = sonic - sonicFee;
uint256 feeAddressAmount = (sonicFee * 3) / 10;
uint256 userBorrow = (userSonic * 99) / 100;
uint256 overCollateralizationAmount = (userSonic) / 100;
uint256 subValue = feeAddressAmount + overCollateralizationAmount;
uint256 totalFee = (sonicFee + overCollateralizationAmount);
uint256 feeOverage;
if (msg.value > totalFee) {
feeOverage = msg.value - totalFee;
sendSonic(msg.sender, feeOverage);
}
require(
msg.value - feeOverage == totalFee,
"Insufficient sonic fee sent"
);
// AUDIT: to user round down
uint256 userEggs = SONICtoEGGSLev(userSonic, subValue);
mint(address(this), userEggs);
require(feeAddressAmount > MIN, "Fees must be higher than min.");
sendSonic(FEE_ADDRESS, feeAddressAmount);
addLoansByDate(userBorrow, userEggs, endDate);
Loans[msg.sender] = Loan({
collateral: userEggs,
borrowed: userBorrow,
endDate: endDate,
numberOfDays: numberOfDays
});
safetyCheck(sonic);
}
function getInterestFee(
uint256 amount,
uint256 numberOfDays
) public pure returns (uint256) {
uint256 interest = Math.mulDiv(0.039e18, numberOfDays, 365) + 0.001e18;
return Math.mulDiv(amount, interest, 1e18);
}
function borrow(uint256 sonic, uint256 numberOfDays) public nonReentrant {
require(
numberOfDays < 366,
"Max borrow/extension must be 365 days or less"
);
require(sonic != 0, "Must borrow more than 0");
if (isLoanExpired(msg.sender)) {
delete Loans[msg.sender];
}
require(
Loans[msg.sender].borrowed == 0,
"Use borrowMore to borrow more"
);
liquidate();
uint256 endDate = getMidnightTimestamp(
(numberOfDays * 1 days) + block.timestamp
);
uint256 sonicFee = getInterestFee(sonic, numberOfDays);
uint256 feeAddressFee = (sonicFee * 3) / 10;
//AUDIT: eggs required from user round up?
uint256 userEggs = SONICtoEGGSNoTradeCeil(sonic);
uint256 newUserBorrow = (sonic * 99) / 100;
Loans[msg.sender] = Loan({
collateral: userEggs,
borrowed: newUserBorrow,
endDate: endDate,
numberOfDays: numberOfDays
});
_transfer(msg.sender, address(this), userEggs);
require(feeAddressFee > MIN, "Fees must be higher than min.");
sendSonic(msg.sender, newUserBorrow - sonicFee);
sendSonic(FEE_ADDRESS, feeAddressFee);
addLoansByDate(newUserBorrow, userEggs, endDate);
safetyCheck(sonicFee);
}
function borrowMore(uint256 sonic) public nonReentrant {
require(!isLoanExpired(msg.sender), "Loan expired use borrow");
require(sonic != 0, "Must borrow more than 0");
liquidate();
uint256 userBorrowed = Loans[msg.sender].borrowed;
uint256 userCollateral = Loans[msg.sender].collateral;
uint256 userEndDate = Loans[msg.sender].endDate;
uint256 todayMidnight = getMidnightTimestamp(block.timestamp);
uint256 newBorrowLength = (userEndDate - todayMidnight) / 1 days;
uint256 sonicFee = getInterestFee(sonic, newBorrowLength);
//AUDIT: eggs required from user round up?
uint256 userEggs = SONICtoEGGSNoTradeCeil(sonic);
uint256 userBorrowedInEggs = SONICtoEGGSNoTrade(userBorrowed);
uint256 userExcessInEggs = ((userCollateral) * 99) /
100 -
userBorrowedInEggs;
uint256 requireCollateralFromUser = userEggs;
if (userExcessInEggs >= userEggs) {
requireCollateralFromUser = 0;
} else {
requireCollateralFromUser =
requireCollateralFromUser -
userExcessInEggs;
}
uint256 feeAddressFee = (sonicFee * 3) / 10;
uint256 newUserBorrow = (sonic * 99) / 100;
uint256 newUserBorrowTotal = userBorrowed + newUserBorrow;
uint256 newUserCollateralTotal = userCollateral +
requireCollateralFromUser;
Loans[msg.sender] = Loan({
collateral: newUserCollateralTotal,
borrowed: newUserBorrowTotal,
endDate: userEndDate,
numberOfDays: newBorrowLength
});
if (requireCollateralFromUser != 0) {
_transfer(msg.sender, address(this), requireCollateralFromUser);
}
require(feeAddressFee > MIN, "Fees must be higher than min.");
sendSonic(FEE_ADDRESS, feeAddressFee);
sendSonic(msg.sender, newUserBorrow - sonicFee);
addLoansByDate(newUserBorrow, requireCollateralFromUser, userEndDate);
safetyCheck(sonicFee);
}
function removeCollateral(uint256 amount) public nonReentrant {
require(
!isLoanExpired(msg.sender),
"Your loan has been liquidated, no collateral to remove"
);
liquidate();
uint256 collateral = Loans[msg.sender].collateral;
// AUDIT: to user round down
require(
Loans[msg.sender].borrowed <=
(EGGStoSONIC(collateral - amount) * 99) / 100,
"Require 99% collateralization rate"
);
Loans[msg.sender].collateral = Loans[msg.sender].collateral - amount;
_transfer(address(this), msg.sender, amount);
subLoansByDate(0, amount, Loans[msg.sender].endDate);
safetyCheck(0);
}
function repay() public payable nonReentrant {
uint256 borrowed = Loans[msg.sender].borrowed;
require(borrowed > msg.value, "Must repay less than borrowed amount");
require(msg.value != 0, "Must repay something");
require(
!isLoanExpired(msg.sender),
"Your loan has been liquidated, cannot repay"
);
uint256 newBorrow = borrowed - msg.value;
Loans[msg.sender].borrowed = newBorrow;
subLoansByDate(msg.value, 0, Loans[msg.sender].endDate);
safetyCheck(0);
}
function closePosition() public payable nonReentrant {
uint256 borrowed = Loans[msg.sender].borrowed;
uint256 collateral = Loans[msg.sender].collateral;
require(
!isLoanExpired(msg.sender),
"Your loan has been liquidated, no collateral to remove"
);
require(borrowed == msg.value, "Must return entire borrowed amount");
_transfer(address(this), msg.sender, collateral);
subLoansByDate(borrowed, collateral, Loans[msg.sender].endDate);
delete Loans[msg.sender];
safetyCheck(0);
}
function flashClosePosition() public nonReentrant {
require(
!isLoanExpired(msg.sender),
"Your loan has been liquidated, no collateral to remove"
);
liquidate();
uint256 borrowed = Loans[msg.sender].borrowed;
uint256 collateral = Loans[msg.sender].collateral;
// AUDIT: from user round up
uint256 collateralInSonic = EGGStoSONIC(collateral);
_burn(address(this), collateral);
uint256 collateralInSonicAfterFee = (collateralInSonic * 99) / 100;
uint256 fee = collateralInSonic / 100;
require(
collateralInSonicAfterFee >= borrowed,
"You do not have enough collateral to close position"
);
uint256 toUser = collateralInSonicAfterFee - borrowed;
uint256 feeAddressFee = (fee * 3) / 10;
sendSonic(msg.sender, toUser);
require(feeAddressFee > MIN, "Fees must be higher than min.");
sendSonic(FEE_ADDRESS, feeAddressFee);
subLoansByDate(borrowed, collateral, Loans[msg.sender].endDate);
delete Loans[msg.sender];
safetyCheck(borrowed);
}
function extendLoan(
uint256 numberOfDays
) public payable nonReentrant returns (uint256) {
uint256 oldEndDate = Loans[msg.sender].endDate;
uint256 borrowed = Loans[msg.sender].borrowed;
uint256 collateral = Loans[msg.sender].collateral;
uint256 _numberOfDays = Loans[msg.sender].numberOfDays;
uint256 newEndDate = oldEndDate + (numberOfDays * 1 days);
uint256 loanFee = getInterestFee(borrowed, numberOfDays);
require(
!isLoanExpired(msg.sender),
"Your loan has been liquidated, no collateral to remove"
);
require(loanFee == msg.value, "Loan extension fee incorrect");
uint256 feeAddressFee = (loanFee * 3) / 10;
require(feeAddressFee > MIN, "Fees must be higher than min.");
sendSonic(FEE_ADDRESS, feeAddressFee);
subLoansByDate(borrowed, collateral, oldEndDate);
addLoansByDate(borrowed, collateral, newEndDate);
Loans[msg.sender].endDate = newEndDate;
Loans[msg.sender].numberOfDays = numberOfDays + _numberOfDays;
require(
(newEndDate - block.timestamp) / 1 days < 366,
"Loan must be under 365 days"
);
safetyCheck(msg.value);
return loanFee;
}
function liquidate() public {
uint256 borrowed;
uint256 collateral;
while (lastLiquidationDate < block.timestamp) {
collateral = collateral + CollateralByDate[lastLiquidationDate];
borrowed = borrowed + BorrowedByDate[lastLiquidationDate];
lastLiquidationDate = lastLiquidationDate + 1 days;
}
if (collateral != 0) {
totalCollateral = totalCollateral - collateral;
_burn(address(this), collateral);
}
if (borrowed != 0) {
totalBorrowed = totalBorrowed - borrowed;
emit Liquidate(lastLiquidationDate - 1 days, borrowed);
}
}
function addLoansByDate(
uint256 borrowed,
uint256 collateral,
uint256 date
) private {
CollateralByDate[date] = CollateralByDate[date] + collateral;
BorrowedByDate[date] = BorrowedByDate[date] + borrowed;
totalBorrowed = totalBorrowed + borrowed;
totalCollateral = totalCollateral + collateral;
emit LoanDataUpdate(
CollateralByDate[date],
BorrowedByDate[date],
totalBorrowed,
totalCollateral
);
}
function subLoansByDate(
uint256 borrowed,
uint256 collateral,
uint256 date
) private {
CollateralByDate[date] = CollateralByDate[date] - collateral;
BorrowedByDate[date] = BorrowedByDate[date] - borrowed;
totalBorrowed = totalBorrowed - borrowed;
totalCollateral = totalCollateral - collateral;
emit LoanDataUpdate(
CollateralByDate[date],
BorrowedByDate[date],
totalBorrowed,
totalCollateral
);
}
// utility fxns
function getMidnightTimestamp(uint256 date) public pure returns (uint256) {
uint256 midnightTimestamp = date - (date % 86400); // Subtracting the remainder when divided by the number of seconds in a day (86400)
return midnightTimestamp + 1 days;
}
function getLoansExpiringByDate(
uint256 date
) public view returns (uint256, uint256) {
return (
BorrowedByDate[getMidnightTimestamp(date)],
CollateralByDate[getMidnightTimestamp(date)]
);
}
function getLoanByAddress(
address _address
) public view returns (uint256, uint256, uint256) {
if (Loans[_address].endDate >= block.timestamp) {
return (
Loans[_address].collateral,
Loans[_address].borrowed,
Loans[_address].endDate
);
} else {
return (0, 0, 0);
}
}
function isLoanExpired(address _address) public view returns (bool) {
return Loans[_address].endDate < block.timestamp;
}
function getBuyFee() public view returns (uint256) {
return buy_fee;
}
// Buy Eggs
function getTotalBorrowed() public view returns (uint256) {
return totalBorrowed;
}
function getTotalCollateral() public view returns (uint256) {
return totalCollateral;
}
function getBacking() public view returns (uint256) {
return address(this).balance + getTotalBorrowed();
}
function safetyCheck(uint256 sonic) private {
uint256 newPrice = (getBacking() * 1 ether) / totalSupply();
uint256 _totalColateral = balanceOf(address(this));
require(
_totalColateral >= totalCollateral,
"The eggs balance of the contract must be greater than or equal to the collateral"
);
require(lastPrice <= newPrice, "The price of eggs cannot decrease");
lastPrice = newPrice;
emit Price(block.timestamp, newPrice, sonic);
}
function EGGStoSONIC(uint256 value) public view returns (uint256) {
return Math.mulDiv(value, getBacking(), totalSupply());
}
function SONICtoEGGS(uint256 value) public view returns (uint256) {
return Math.mulDiv(value, totalSupply(), getBacking() - value);
}
function SONICtoEGGSLev(
uint256 value,
uint256 fee
) public view returns (uint256) {
uint256 backing = getBacking() - fee;
return (value * totalSupply() + (backing - 1)) / backing;
}
function SONICtoEGGSNoTradeCeil(
uint256 value
) public view returns (uint256) {
uint256 backing = getBacking();
return (value * totalSupply() + (backing - 1)) / backing;
}
function SONICtoEGGSNoTrade(uint256 value) public view returns (uint256) {
uint256 backing = getBacking();
return Math.mulDiv(value, totalSupply(), backing);
}
function sendSonic(address _address, uint256 _value) internal {
(bool success, ) = _address.call{value: _value}("");
require(success, "SONIC Transfer failed.");
emit SendSonic(_address, _value);
}
//utils
function getBuyEggs(uint256 amount) external view returns (uint256) {
return
(amount * (totalSupply()) * (buy_fee)) /
(getBacking()) /
(FEE_BASE_1000);
}
receive() external payable {}
fallback() external payable {}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/ERC20Burnable.sol)
pragma solidity ^0.8.20;
import {ERC20} from "../ERC20.sol";
import {Context} from "../../../utils/Context.sol";
/**
* @dev Extension of {ERC20} that allows token holders to destroy both their own
* tokens and those that they have an allowance for, in a way that can be
* recognized off-chain (via event analysis).
*/
abstract contract ERC20Burnable is Context, ERC20 {
/**
* @dev Destroys a `value` amount of tokens from the caller.
*
* See {ERC20-_burn}.
*/
function burn(uint256 value) public virtual {
_burn(_msgSender(), value);
}
/**
* @dev Destroys a `value` amount of tokens from `account`, deducting from
* the caller's allowance.
*
* See {ERC20-_burn} and {ERC20-allowance}.
*
* Requirements:
*
* - the caller must have allowance for ``accounts``'s tokens of at least
* `value`.
*/
function burnFrom(address account, uint256 value) public virtual {
_spendAllowance(account, _msgSender(), value);
_burn(account, value);
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (access/Ownable2Step.sol)
pragma solidity ^0.8.20;
import {Ownable} from "./Ownable.sol";
/**
* @dev Contract module which provides access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* This extension of the {Ownable} contract includes a two-step mechanism to transfer
* ownership, where the new owner must call {acceptOwnership} in order to replace the
* old one. This can help prevent common mistakes, such as transfers of ownership to
* incorrect accounts, or to contracts that are unable to interact with the
* permission system.
*
* The initial owner is specified at deployment time in the constructor for `Ownable`. This
* can later be changed with {transferOwnership} and {acceptOwnership}.
*
* This module is used through inheritance. It will make available all functions
* from parent (Ownable).
*/
abstract contract Ownable2Step is Ownable {
address private _pendingOwner;
event OwnershipTransferStarted(address indexed previousOwner, address indexed newOwner);
/**
* @dev Returns the address of the pending owner.
*/
function pendingOwner() public view virtual returns (address) {
return _pendingOwner;
}
/**
* @dev Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one.
* Can only be called by the current owner.
*
* Setting `newOwner` to the zero address is allowed; this can be used to cancel an initiated ownership transfer.
*/
function transferOwnership(address newOwner) public virtual override onlyOwner {
_pendingOwner = newOwner;
emit OwnershipTransferStarted(owner(), newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`) and deletes any pending owner.
* Internal function without access restriction.
*/
function _transferOwnership(address newOwner) internal virtual override {
delete _pendingOwner;
super._transferOwnership(newOwner);
}
/**
* @dev The new owner accepts the ownership transfer.
*/
function acceptOwnership() public virtual {
address sender = _msgSender();
if (pendingOwner() != sender) {
revert OwnableUnauthorizedAccount(sender);
}
_transferOwnership(sender);
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (utils/ReentrancyGuard.sol)
pragma solidity ^0.8.20;
/**
* @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 EIP-1153 (transient storage) is available on the chain you're deploying at,
* consider using {ReentrancyGuardTransient} instead.
*
* 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;
/**
* @dev Unauthorized reentrant call.
*/
error ReentrancyGuardReentrantCall();
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
if (_status == ENTERED) {
revert ReentrancyGuardReentrantCall();
}
// 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 v5.1.0) (utils/math/Math.sol)
pragma solidity ^0.8.20;
import {Panic} from "../Panic.sol";
import {SafeCast} from "./SafeCast.sol";
/**
* @dev Standard math utilities missing in the Solidity language.
*/
library Math {
enum Rounding {
Floor, // Toward negative infinity
Ceil, // Toward positive infinity
Trunc, // Toward zero
Expand // Away from zero
}
/**
* @dev Returns the addition of two unsigned integers, with an success flag (no overflow).
*/
function tryAdd(uint256 a, uint256 b) internal pure returns (bool success, uint256 result) {
unchecked {
uint256 c = a + b;
if (c < a) return (false, 0);
return (true, c);
}
}
/**
* @dev Returns the subtraction of two unsigned integers, with an success flag (no overflow).
*/
function trySub(uint256 a, uint256 b) internal pure returns (bool success, uint256 result) {
unchecked {
if (b > a) return (false, 0);
return (true, a - b);
}
}
/**
* @dev Returns the multiplication of two unsigned integers, with an success flag (no overflow).
*/
function tryMul(uint256 a, uint256 b) internal pure returns (bool success, uint256 result) {
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 success flag (no division by zero).
*/
function tryDiv(uint256 a, uint256 b) internal pure returns (bool success, uint256 result) {
unchecked {
if (b == 0) return (false, 0);
return (true, a / b);
}
}
/**
* @dev Returns the remainder of dividing two unsigned integers, with a success flag (no division by zero).
*/
function tryMod(uint256 a, uint256 b) internal pure returns (bool success, uint256 result) {
unchecked {
if (b == 0) return (false, 0);
return (true, a % b);
}
}
/**
* @dev Branchless ternary evaluation for `a ? b : c`. Gas costs are constant.
*
* IMPORTANT: This function may reduce bytecode size and consume less gas when used standalone.
* However, the compiler may optimize Solidity ternary operations (i.e. `a ? b : c`) to only compute
* one branch when needed, making this function more expensive.
*/
function ternary(bool condition, uint256 a, uint256 b) internal pure returns (uint256) {
unchecked {
// branchless ternary works because:
// b ^ (a ^ b) == a
// b ^ 0 == b
return b ^ ((a ^ b) * SafeCast.toUint(condition));
}
}
/**
* @dev Returns the largest of two numbers.
*/
function max(uint256 a, uint256 b) internal pure returns (uint256) {
return ternary(a > b, a, b);
}
/**
* @dev Returns the smallest of two numbers.
*/
function min(uint256 a, uint256 b) internal pure returns (uint256) {
return ternary(a < b, a, b);
}
/**
* @dev Returns the average of two numbers. The result is rounded towards
* zero.
*/
function average(uint256 a, uint256 b) internal pure returns (uint256) {
// (a + b) / 2 can overflow.
return (a & b) + (a ^ b) / 2;
}
/**
* @dev Returns the ceiling of the division of two numbers.
*
* This differs from standard division with `/` in that it rounds towards infinity instead
* of rounding towards zero.
*/
function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {
if (b == 0) {
// Guarantee the same behavior as in a regular Solidity division.
Panic.panic(Panic.DIVISION_BY_ZERO);
}
// The following calculation ensures accurate ceiling division without overflow.
// Since a is non-zero, (a - 1) / b will not overflow.
// The largest possible result occurs when (a - 1) / b is type(uint256).max,
// but the largest value we can obtain is type(uint256).max - 1, which happens
// when a = type(uint256).max and b = 1.
unchecked {
return SafeCast.toUint(a > 0) * ((a - 1) / b + 1);
}
}
/**
* @dev Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or
* denominator == 0.
*
* 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²⁵⁶ and mod 2²⁵⁶ - 1, then use
// the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256
// variables such that product = prod1 * 2²⁵⁶ + prod0.
uint256 prod0 = x * y; // Least significant 256 bits of the product
uint256 prod1; // Most significant 256 bits of the product
assembly {
let mm := mulmod(x, y, not(0))
prod1 := sub(sub(mm, prod0), lt(mm, prod0))
}
// Handle non-overflow cases, 256 by 256 division.
if (prod1 == 0) {
// Solidity will revert if denominator == 0, unlike the div opcode on its own.
// The surrounding unchecked block does not change this fact.
// See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.
return prod0 / denominator;
}
// Make sure the result is less than 2²⁵⁶. Also prevents denominator == 0.
if (denominator <= prod1) {
Panic.panic(ternary(denominator == 0, Panic.DIVISION_BY_ZERO, Panic.UNDER_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.
uint256 twos = denominator & (0 - denominator);
assembly {
// Divide denominator by twos.
denominator := div(denominator, twos)
// Divide [prod1 prod0] by twos.
prod0 := div(prod0, twos)
// Flip twos such that it is 2²⁵⁶ / 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²⁵⁶. Now that denominator is an odd number, it has an inverse modulo 2²⁵⁶ such
// that denominator * inv ≡ 1 mod 2²⁵⁶. Compute the inverse by starting with a seed that is correct for
// four bits. That is, denominator * inv ≡ 1 mod 2⁴.
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⁸
inverse *= 2 - denominator * inverse; // inverse mod 2¹⁶
inverse *= 2 - denominator * inverse; // inverse mod 2³²
inverse *= 2 - denominator * inverse; // inverse mod 2⁶⁴
inverse *= 2 - denominator * inverse; // inverse mod 2¹²⁸
inverse *= 2 - denominator * inverse; // inverse mod 2²⁵⁶
// 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²⁵⁶. Since the preconditions guarantee that the outcome is
// less than 2²⁵⁶, 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;
}
}
/**
* @dev 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) {
return mulDiv(x, y, denominator) + SafeCast.toUint(unsignedRoundsUp(rounding) && mulmod(x, y, denominator) > 0);
}
/**
* @dev Calculate the modular multiplicative inverse of a number in Z/nZ.
*
* If n is a prime, then Z/nZ is a field. In that case all elements are inversible, except 0.
* If n is not a prime, then Z/nZ is not a field, and some elements might not be inversible.
*
* If the input value is not inversible, 0 is returned.
*
* NOTE: If you know for sure that n is (big) a prime, it may be cheaper to use Fermat's little theorem and get the
* inverse using `Math.modExp(a, n - 2, n)`. See {invModPrime}.
*/
function invMod(uint256 a, uint256 n) internal pure returns (uint256) {
unchecked {
if (n == 0) return 0;
// The inverse modulo is calculated using the Extended Euclidean Algorithm (iterative version)
// Used to compute integers x and y such that: ax + ny = gcd(a, n).
// When the gcd is 1, then the inverse of a modulo n exists and it's x.
// ax + ny = 1
// ax = 1 + (-y)n
// ax ≡ 1 (mod n) # x is the inverse of a modulo n
// If the remainder is 0 the gcd is n right away.
uint256 remainder = a % n;
uint256 gcd = n;
// Therefore the initial coefficients are:
// ax + ny = gcd(a, n) = n
// 0a + 1n = n
int256 x = 0;
int256 y = 1;
while (remainder != 0) {
uint256 quotient = gcd / remainder;
(gcd, remainder) = (
// The old remainder is the next gcd to try.
remainder,
// Compute the next remainder.
// Can't overflow given that (a % gcd) * (gcd // (a % gcd)) <= gcd
// where gcd is at most n (capped to type(uint256).max)
gcd - remainder * quotient
);
(x, y) = (
// Increment the coefficient of a.
y,
// Decrement the coefficient of n.
// Can overflow, but the result is casted to uint256 so that the
// next value of y is "wrapped around" to a value between 0 and n - 1.
x - y * int256(quotient)
);
}
if (gcd != 1) return 0; // No inverse exists.
return ternary(x < 0, n - uint256(-x), uint256(x)); // Wrap the result if it's negative.
}
}
/**
* @dev Variant of {invMod}. More efficient, but only works if `p` is known to be a prime greater than `2`.
*
* From https://en.wikipedia.org/wiki/Fermat%27s_little_theorem[Fermat's little theorem], we know that if p is
* prime, then `a**(p-1) ≡ 1 mod p`. As a consequence, we have `a * a**(p-2) ≡ 1 mod p`, which means that
* `a**(p-2)` is the modular multiplicative inverse of a in Fp.
*
* NOTE: this function does NOT check that `p` is a prime greater than `2`.
*/
function invModPrime(uint256 a, uint256 p) internal view returns (uint256) {
unchecked {
return Math.modExp(a, p - 2, p);
}
}
/**
* @dev Returns the modular exponentiation of the specified base, exponent and modulus (b ** e % m)
*
* Requirements:
* - modulus can't be zero
* - underlying staticcall to precompile must succeed
*
* IMPORTANT: The result is only valid if the underlying call succeeds. When using this function, make
* sure the chain you're using it on supports the precompiled contract for modular exponentiation
* at address 0x05 as specified in https://eips.ethereum.org/EIPS/eip-198[EIP-198]. Otherwise,
* the underlying function will succeed given the lack of a revert, but the result may be incorrectly
* interpreted as 0.
*/
function modExp(uint256 b, uint256 e, uint256 m) internal view returns (uint256) {
(bool success, uint256 result) = tryModExp(b, e, m);
if (!success) {
Panic.panic(Panic.DIVISION_BY_ZERO);
}
return result;
}
/**
* @dev Returns the modular exponentiation of the specified base, exponent and modulus (b ** e % m).
* It includes a success flag indicating if the operation succeeded. Operation will be marked as failed if trying
* to operate modulo 0 or if the underlying precompile reverted.
*
* IMPORTANT: The result is only valid if the success flag is true. When using this function, make sure the chain
* you're using it on supports the precompiled contract for modular exponentiation at address 0x05 as specified in
* https://eips.ethereum.org/EIPS/eip-198[EIP-198]. Otherwise, the underlying function will succeed given the lack
* of a revert, but the result may be incorrectly interpreted as 0.
*/
function tryModExp(uint256 b, uint256 e, uint256 m) internal view returns (bool success, uint256 result) {
if (m == 0) return (false, 0);
assembly ("memory-safe") {
let ptr := mload(0x40)
// | Offset | Content | Content (Hex) |
// |-----------|------------|--------------------------------------------------------------------|
// | 0x00:0x1f | size of b | 0x0000000000000000000000000000000000000000000000000000000000000020 |
// | 0x20:0x3f | size of e | 0x0000000000000000000000000000000000000000000000000000000000000020 |
// | 0x40:0x5f | size of m | 0x0000000000000000000000000000000000000000000000000000000000000020 |
// | 0x60:0x7f | value of b | 0x<.............................................................b> |
// | 0x80:0x9f | value of e | 0x<.............................................................e> |
// | 0xa0:0xbf | value of m | 0x<.............................................................m> |
mstore(ptr, 0x20)
mstore(add(ptr, 0x20), 0x20)
mstore(add(ptr, 0x40), 0x20)
mstore(add(ptr, 0x60), b)
mstore(add(ptr, 0x80), e)
mstore(add(ptr, 0xa0), m)
// Given the result < m, it's guaranteed to fit in 32 bytes,
// so we can use the memory scratch space located at offset 0.
success := staticcall(gas(), 0x05, ptr, 0xc0, 0x00, 0x20)
result := mload(0x00)
}
}
/**
* @dev Variant of {modExp} that supports inputs of arbitrary length.
*/
function modExp(bytes memory b, bytes memory e, bytes memory m) internal view returns (bytes memory) {
(bool success, bytes memory result) = tryModExp(b, e, m);
if (!success) {
Panic.panic(Panic.DIVISION_BY_ZERO);
}
return result;
}
/**
* @dev Variant of {tryModExp} that supports inputs of arbitrary length.
*/
function tryModExp(
bytes memory b,
bytes memory e,
bytes memory m
) internal view returns (bool success, bytes memory result) {
if (_zeroBytes(m)) return (false, new bytes(0));
uint256 mLen = m.length;
// Encode call args in result and move the free memory pointer
result = abi.encodePacked(b.length, e.length, mLen, b, e, m);
assembly ("memory-safe") {
let dataPtr := add(result, 0x20)
// Write result on top of args to avoid allocating extra memory.
success := staticcall(gas(), 0x05, dataPtr, mload(result), dataPtr, mLen)
// Overwrite the length.
// result.length > returndatasize() is guaranteed because returndatasize() == m.length
mstore(result, mLen)
// Set the memory pointer after the returned data.
mstore(0x40, add(dataPtr, mLen))
}
}
/**
* @dev Returns whether the provided byte array is zero.
*/
function _zeroBytes(bytes memory byteArray) private pure returns (bool) {
for (uint256 i = 0; i < byteArray.length; ++i) {
if (byteArray[i] != 0) {
return false;
}
}
return true;
}
/**
* @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded
* towards zero.
*
* This method is based on Newton's method for computing square roots; the algorithm is restricted to only
* using integer operations.
*/
function sqrt(uint256 a) internal pure returns (uint256) {
unchecked {
// Take care of easy edge cases when a == 0 or a == 1
if (a <= 1) {
return a;
}
// In this function, we use Newton's method to get a root of `f(x) := x² - a`. It involves building a
// sequence x_n that converges toward sqrt(a). For each iteration x_n, we also define the error between
// the current value as `ε_n = | x_n - sqrt(a) |`.
//
// For our first estimation, we consider `e` the smallest power of 2 which is bigger than the square root
// of the target. (i.e. `2**(e-1) ≤ sqrt(a) < 2**e`). We know that `e ≤ 128` because `(2¹²⁸)² = 2²⁵⁶` is
// bigger than any uint256.
//
// By noticing that
// `2**(e-1) ≤ sqrt(a) < 2**e → (2**(e-1))² ≤ a < (2**e)² → 2**(2*e-2) ≤ a < 2**(2*e)`
// we can deduce that `e - 1` is `log2(a) / 2`. We can thus compute `x_n = 2**(e-1)` using a method similar
// to the msb function.
uint256 aa = a;
uint256 xn = 1;
if (aa >= (1 << 128)) {
aa >>= 128;
xn <<= 64;
}
if (aa >= (1 << 64)) {
aa >>= 64;
xn <<= 32;
}
if (aa >= (1 << 32)) {
aa >>= 32;
xn <<= 16;
}
if (aa >= (1 << 16)) {
aa >>= 16;
xn <<= 8;
}
if (aa >= (1 << 8)) {
aa >>= 8;
xn <<= 4;
}
if (aa >= (1 << 4)) {
aa >>= 4;
xn <<= 2;
}
if (aa >= (1 << 2)) {
xn <<= 1;
}
// We now have x_n such that `x_n = 2**(e-1) ≤ sqrt(a) < 2**e = 2 * x_n`. This implies ε_n ≤ 2**(e-1).
//
// We can refine our estimation by noticing that the middle of that interval minimizes the error.
// If we move x_n to equal 2**(e-1) + 2**(e-2), then we reduce the error to ε_n ≤ 2**(e-2).
// This is going to be our x_0 (and ε_0)
xn = (3 * xn) >> 1; // ε_0 := | x_0 - sqrt(a) | ≤ 2**(e-2)
// From here, Newton's method give us:
// x_{n+1} = (x_n + a / x_n) / 2
//
// One should note that:
// x_{n+1}² - a = ((x_n + a / x_n) / 2)² - a
// = ((x_n² + a) / (2 * x_n))² - a
// = (x_n⁴ + 2 * a * x_n² + a²) / (4 * x_n²) - a
// = (x_n⁴ + 2 * a * x_n² + a² - 4 * a * x_n²) / (4 * x_n²)
// = (x_n⁴ - 2 * a * x_n² + a²) / (4 * x_n²)
// = (x_n² - a)² / (2 * x_n)²
// = ((x_n² - a) / (2 * x_n))²
// ≥ 0
// Which proves that for all n ≥ 1, sqrt(a) ≤ x_n
//
// This gives us the proof of quadratic convergence of the sequence:
// ε_{n+1} = | x_{n+1} - sqrt(a) |
// = | (x_n + a / x_n) / 2 - sqrt(a) |
// = | (x_n² + a - 2*x_n*sqrt(a)) / (2 * x_n) |
// = | (x_n - sqrt(a))² / (2 * x_n) |
// = | ε_n² / (2 * x_n) |
// = ε_n² / | (2 * x_n) |
//
// For the first iteration, we have a special case where x_0 is known:
// ε_1 = ε_0² / | (2 * x_0) |
// ≤ (2**(e-2))² / (2 * (2**(e-1) + 2**(e-2)))
// ≤ 2**(2*e-4) / (3 * 2**(e-1))
// ≤ 2**(e-3) / 3
// ≤ 2**(e-3-log2(3))
// ≤ 2**(e-4.5)
//
// For the following iterations, we use the fact that, 2**(e-1) ≤ sqrt(a) ≤ x_n:
// ε_{n+1} = ε_n² / | (2 * x_n) |
// ≤ (2**(e-k))² / (2 * 2**(e-1))
// ≤ 2**(2*e-2*k) / 2**e
// ≤ 2**(e-2*k)
xn = (xn + a / xn) >> 1; // ε_1 := | x_1 - sqrt(a) | ≤ 2**(e-4.5) -- special case, see above
xn = (xn + a / xn) >> 1; // ε_2 := | x_2 - sqrt(a) | ≤ 2**(e-9) -- general case with k = 4.5
xn = (xn + a / xn) >> 1; // ε_3 := | x_3 - sqrt(a) | ≤ 2**(e-18) -- general case with k = 9
xn = (xn + a / xn) >> 1; // ε_4 := | x_4 - sqrt(a) | ≤ 2**(e-36) -- general case with k = 18
xn = (xn + a / xn) >> 1; // ε_5 := | x_5 - sqrt(a) | ≤ 2**(e-72) -- general case with k = 36
xn = (xn + a / xn) >> 1; // ε_6 := | x_6 - sqrt(a) | ≤ 2**(e-144) -- general case with k = 72
// Because e ≤ 128 (as discussed during the first estimation phase), we know have reached a precision
// ε_6 ≤ 2**(e-144) < 1. Given we're operating on integers, then we can ensure that xn is now either
// sqrt(a) or sqrt(a) + 1.
return xn - SafeCast.toUint(xn > a / xn);
}
}
/**
* @dev 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 + SafeCast.toUint(unsignedRoundsUp(rounding) && result * result < a);
}
}
/**
* @dev Return the log in base 2 of a positive value rounded towards zero.
* Returns 0 if given 0.
*/
function log2(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
uint256 exp;
unchecked {
exp = 128 * SafeCast.toUint(value > (1 << 128) - 1);
value >>= exp;
result += exp;
exp = 64 * SafeCast.toUint(value > (1 << 64) - 1);
value >>= exp;
result += exp;
exp = 32 * SafeCast.toUint(value > (1 << 32) - 1);
value >>= exp;
result += exp;
exp = 16 * SafeCast.toUint(value > (1 << 16) - 1);
value >>= exp;
result += exp;
exp = 8 * SafeCast.toUint(value > (1 << 8) - 1);
value >>= exp;
result += exp;
exp = 4 * SafeCast.toUint(value > (1 << 4) - 1);
value >>= exp;
result += exp;
exp = 2 * SafeCast.toUint(value > (1 << 2) - 1);
value >>= exp;
result += exp;
result += SafeCast.toUint(value > 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 + SafeCast.toUint(unsignedRoundsUp(rounding) && 1 << result < value);
}
}
/**
* @dev Return the log in base 10 of a positive value rounded towards zero.
* Returns 0 if given 0.
*/
function log10(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >= 10 ** 64) {
value /= 10 ** 64;
result += 64;
}
if (value >= 10 ** 32) {
value /= 10 ** 32;
result += 32;
}
if (value >= 10 ** 16) {
value /= 10 ** 16;
result += 16;
}
if (value >= 10 ** 8) {
value /= 10 ** 8;
result += 8;
}
if (value >= 10 ** 4) {
value /= 10 ** 4;
result += 4;
}
if (value >= 10 ** 2) {
value /= 10 ** 2;
result += 2;
}
if (value >= 10 ** 1) {
result += 1;
}
}
return result;
}
/**
* @dev Return the log in base 10, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log10(value);
return result + SafeCast.toUint(unsignedRoundsUp(rounding) && 10 ** result < value);
}
}
/**
* @dev Return the log in base 256 of a positive value rounded towards zero.
* Returns 0 if given 0.
*
* Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.
*/
function log256(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
uint256 isGt;
unchecked {
isGt = SafeCast.toUint(value > (1 << 128) - 1);
value >>= isGt * 128;
result += isGt * 16;
isGt = SafeCast.toUint(value > (1 << 64) - 1);
value >>= isGt * 64;
result += isGt * 8;
isGt = SafeCast.toUint(value > (1 << 32) - 1);
value >>= isGt * 32;
result += isGt * 4;
isGt = SafeCast.toUint(value > (1 << 16) - 1);
value >>= isGt * 16;
result += isGt * 2;
result += SafeCast.toUint(value > (1 << 8) - 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 + SafeCast.toUint(unsignedRoundsUp(rounding) && 1 << (result << 3) < value);
}
}
/**
* @dev Returns whether a provided rounding mode is considered rounding up for unsigned integers.
*/
function unsignedRoundsUp(Rounding rounding) internal pure returns (bool) {
return uint8(rounding) % 2 == 1;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (token/ERC20/ERC20.sol)
pragma solidity ^0.8.20;
import {IERC20} from "./IERC20.sol";
import {IERC20Metadata} from "./extensions/IERC20Metadata.sol";
import {Context} from "../../utils/Context.sol";
import {IERC20Errors} from "../../interfaces/draft-IERC6093.sol";
/**
* @dev Implementation of the {IERC20} interface.
*
* This implementation is agnostic to the way tokens are created. This means
* that a supply mechanism has to be added in a derived contract using {_mint}.
*
* TIP: For a detailed writeup see our guide
* https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How
* to implement supply mechanisms].
*
* The default value of {decimals} is 18. To change this, you should override
* this function so it returns a different value.
*
* We have followed general OpenZeppelin Contracts guidelines: functions revert
* instead returning `false` on failure. This behavior is nonetheless
* conventional and does not conflict with the expectations of ERC-20
* applications.
*/
abstract contract ERC20 is Context, IERC20, IERC20Metadata, IERC20Errors {
mapping(address account => uint256) private _balances;
mapping(address account => mapping(address spender => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
/**
* @dev Sets the values for {name} and {symbol}.
*
* All two of these values are immutable: they can only be set once during
* construction.
*/
constructor(string memory name_, string memory symbol_) {
_name = name_;
_symbol = symbol_;
}
/**
* @dev Returns the name of the token.
*/
function name() public view virtual returns (string memory) {
return _name;
}
/**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/
function symbol() public view virtual returns (string memory) {
return _symbol;
}
/**
* @dev Returns the number of decimals used to get its user representation.
* For example, if `decimals` equals `2`, a balance of `505` tokens should
* be displayed to a user as `5.05` (`505 / 10 ** 2`).
*
* Tokens usually opt for a value of 18, imitating the relationship between
* Ether and Wei. This is the default value returned by this function, unless
* it's overridden.
*
* NOTE: This information is only used for _display_ purposes: it in
* no way affects any of the arithmetic of the contract, including
* {IERC20-balanceOf} and {IERC20-transfer}.
*/
function decimals() public view virtual returns (uint8) {
return 18;
}
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSupply() public view virtual returns (uint256) {
return _totalSupply;
}
/**
* @dev See {IERC20-balanceOf}.
*/
function balanceOf(address account) public view virtual returns (uint256) {
return _balances[account];
}
/**
* @dev See {IERC20-transfer}.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - the caller must have a balance of at least `value`.
*/
function transfer(address to, uint256 value) public virtual returns (bool) {
address owner = _msgSender();
_transfer(owner, to, value);
return true;
}
/**
* @dev See {IERC20-allowance}.
*/
function allowance(address owner, address spender) public view virtual returns (uint256) {
return _allowances[owner][spender];
}
/**
* @dev See {IERC20-approve}.
*
* NOTE: If `value` is the maximum `uint256`, the allowance is not updated on
* `transferFrom`. This is semantically equivalent to an infinite approval.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 value) public virtual returns (bool) {
address owner = _msgSender();
_approve(owner, spender, value);
return true;
}
/**
* @dev See {IERC20-transferFrom}.
*
* Skips emitting an {Approval} event indicating an allowance update. This is not
* required by the ERC. See {xref-ERC20-_approve-address-address-uint256-bool-}[_approve].
*
* NOTE: Does not update the allowance if the current allowance
* is the maximum `uint256`.
*
* Requirements:
*
* - `from` and `to` cannot be the zero address.
* - `from` must have a balance of at least `value`.
* - the caller must have allowance for ``from``'s tokens of at least
* `value`.
*/
function transferFrom(address from, address to, uint256 value) public virtual returns (bool) {
address spender = _msgSender();
_spendAllowance(from, spender, value);
_transfer(from, to, value);
return true;
}
/**
* @dev Moves a `value` amount of tokens from `from` to `to`.
*
* This internal function is equivalent to {transfer}, and can be used to
* e.g. implement automatic token fees, slashing mechanisms, etc.
*
* Emits a {Transfer} event.
*
* NOTE: This function is not virtual, {_update} should be overridden instead.
*/
function _transfer(address from, address to, uint256 value) internal {
if (from == address(0)) {
revert ERC20InvalidSender(address(0));
}
if (to == address(0)) {
revert ERC20InvalidReceiver(address(0));
}
_update(from, to, value);
}
/**
* @dev Transfers a `value` amount of tokens from `from` to `to`, or alternatively mints (or burns) if `from`
* (or `to`) is the zero address. All customizations to transfers, mints, and burns should be done by overriding
* this function.
*
* Emits a {Transfer} event.
*/
function _update(address from, address to, uint256 value) internal virtual {
if (from == address(0)) {
// Overflow check required: The rest of the code assumes that totalSupply never overflows
_totalSupply += value;
} else {
uint256 fromBalance = _balances[from];
if (fromBalance < value) {
revert ERC20InsufficientBalance(from, fromBalance, value);
}
unchecked {
// Overflow not possible: value <= fromBalance <= totalSupply.
_balances[from] = fromBalance - value;
}
}
if (to == address(0)) {
unchecked {
// Overflow not possible: value <= totalSupply or value <= fromBalance <= totalSupply.
_totalSupply -= value;
}
} else {
unchecked {
// Overflow not possible: balance + value is at most totalSupply, which we know fits into a uint256.
_balances[to] += value;
}
}
emit Transfer(from, to, value);
}
/**
* @dev Creates a `value` amount of tokens and assigns them to `account`, by transferring it from address(0).
* Relies on the `_update` mechanism
*
* Emits a {Transfer} event with `from` set to the zero address.
*
* NOTE: This function is not virtual, {_update} should be overridden instead.
*/
function _mint(address account, uint256 value) internal {
if (account == address(0)) {
revert ERC20InvalidReceiver(address(0));
}
_update(address(0), account, value);
}
/**
* @dev Destroys a `value` amount of tokens from `account`, lowering the total supply.
* Relies on the `_update` mechanism.
*
* Emits a {Transfer} event with `to` set to the zero address.
*
* NOTE: This function is not virtual, {_update} should be overridden instead
*/
function _burn(address account, uint256 value) internal {
if (account == address(0)) {
revert ERC20InvalidSender(address(0));
}
_update(account, address(0), value);
}
/**
* @dev Sets `value` as the allowance of `spender` over the `owner` s tokens.
*
* This internal function is equivalent to `approve`, and can be used to
* e.g. set automatic allowances for certain subsystems, etc.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
*
* Overrides to this logic should be done to the variant with an additional `bool emitEvent` argument.
*/
function _approve(address owner, address spender, uint256 value) internal {
_approve(owner, spender, value, true);
}
/**
* @dev Variant of {_approve} with an optional flag to enable or disable the {Approval} event.
*
* By default (when calling {_approve}) the flag is set to true. On the other hand, approval changes made by
* `_spendAllowance` during the `transferFrom` operation set the flag to false. This saves gas by not emitting any
* `Approval` event during `transferFrom` operations.
*
* Anyone who wishes to continue emitting `Approval` events on the`transferFrom` operation can force the flag to
* true using the following override:
*
* ```solidity
* function _approve(address owner, address spender, uint256 value, bool) internal virtual override {
* super._approve(owner, spender, value, true);
* }
* ```
*
* Requirements are the same as {_approve}.
*/
function _approve(address owner, address spender, uint256 value, bool emitEvent) internal virtual {
if (owner == address(0)) {
revert ERC20InvalidApprover(address(0));
}
if (spender == address(0)) {
revert ERC20InvalidSpender(address(0));
}
_allowances[owner][spender] = value;
if (emitEvent) {
emit Approval(owner, spender, value);
}
}
/**
* @dev Updates `owner` s allowance for `spender` based on spent `value`.
*
* Does not update the allowance value in case of infinite allowance.
* Revert if not enough allowance is available.
*
* Does not emit an {Approval} event.
*/
function _spendAllowance(address owner, address spender, uint256 value) internal virtual {
uint256 currentAllowance = allowance(owner, spender);
if (currentAllowance != type(uint256).max) {
if (currentAllowance < value) {
revert ERC20InsufficientAllowance(spender, currentAllowance, value);
}
unchecked {
_approve(owner, spender, currentAllowance - value, false);
}
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)
pragma solidity ^0.8.20;
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
function _contextSuffixLength() internal view virtual returns (uint256) {
return 0;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol)
pragma solidity ^0.8.20;
import {Context} from "../utils/Context.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* The initial owner is set to the address provided by the deployer. This can
* later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract Ownable is Context {
address private _owner;
/**
* @dev The caller account is not authorized to perform an operation.
*/
error OwnableUnauthorizedAccount(address account);
/**
* @dev The owner is not a valid owner account. (eg. `address(0)`)
*/
error OwnableInvalidOwner(address owner);
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the address provided by the deployer as the initial owner.
*/
constructor(address initialOwner) {
if (initialOwner == address(0)) {
revert OwnableInvalidOwner(address(0));
}
_transferOwnership(initialOwner);
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
_checkOwner();
_;
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if the sender is not the owner.
*/
function _checkOwner() internal view virtual {
if (owner() != _msgSender()) {
revert OwnableUnauthorizedAccount(_msgSender());
}
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby disabling any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
_transferOwnership(address(0));
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
if (newOwner == address(0)) {
revert OwnableInvalidOwner(address(0));
}
_transferOwnership(newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Internal function without access restriction.
*/
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (utils/Panic.sol)
pragma solidity ^0.8.20;
/**
* @dev Helper library for emitting standardized panic codes.
*
* ```solidity
* contract Example {
* using Panic for uint256;
*
* // Use any of the declared internal constants
* function foo() { Panic.GENERIC.panic(); }
*
* // Alternatively
* function foo() { Panic.panic(Panic.GENERIC); }
* }
* ```
*
* Follows the list from https://github.com/ethereum/solidity/blob/v0.8.24/libsolutil/ErrorCodes.h[libsolutil].
*
* _Available since v5.1._
*/
// slither-disable-next-line unused-state
library Panic {
/// @dev generic / unspecified error
uint256 internal constant GENERIC = 0x00;
/// @dev used by the assert() builtin
uint256 internal constant ASSERT = 0x01;
/// @dev arithmetic underflow or overflow
uint256 internal constant UNDER_OVERFLOW = 0x11;
/// @dev division or modulo by zero
uint256 internal constant DIVISION_BY_ZERO = 0x12;
/// @dev enum conversion error
uint256 internal constant ENUM_CONVERSION_ERROR = 0x21;
/// @dev invalid encoding in storage
uint256 internal constant STORAGE_ENCODING_ERROR = 0x22;
/// @dev empty array pop
uint256 internal constant EMPTY_ARRAY_POP = 0x31;
/// @dev array out of bounds access
uint256 internal constant ARRAY_OUT_OF_BOUNDS = 0x32;
/// @dev resource error (too large allocation or too large array)
uint256 internal constant RESOURCE_ERROR = 0x41;
/// @dev calling invalid internal function
uint256 internal constant INVALID_INTERNAL_FUNCTION = 0x51;
/// @dev Reverts with a panic code. Recommended to use with
/// the internal constants with predefined codes.
function panic(uint256 code) internal pure {
assembly ("memory-safe") {
mstore(0x00, 0x4e487b71)
mstore(0x20, code)
revert(0x1c, 0x24)
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (utils/math/SafeCast.sol)
// This file was procedurally generated from scripts/generate/templates/SafeCast.js.
pragma solidity ^0.8.20;
/**
* @dev Wrappers over Solidity's uintXX/intXX/bool casting operators with added overflow
* checks.
*
* Downcasting from uint256/int256 in Solidity does not revert on overflow. This can
* easily result in undesired exploitation or bugs, since developers usually
* assume that overflows raise errors. `SafeCast` restores this intuition by
* reverting the transaction when such an operation overflows.
*
* Using this library instead of the unchecked operations eliminates an entire
* class of bugs, so it's recommended to use it always.
*/
library SafeCast {
/**
* @dev Value doesn't fit in an uint of `bits` size.
*/
error SafeCastOverflowedUintDowncast(uint8 bits, uint256 value);
/**
* @dev An int value doesn't fit in an uint of `bits` size.
*/
error SafeCastOverflowedIntToUint(int256 value);
/**
* @dev Value doesn't fit in an int of `bits` size.
*/
error SafeCastOverflowedIntDowncast(uint8 bits, int256 value);
/**
* @dev An uint value doesn't fit in an int of `bits` size.
*/
error SafeCastOverflowedUintToInt(uint256 value);
/**
* @dev Returns the downcasted uint248 from uint256, reverting on
* overflow (when the input is greater than largest uint248).
*
* Counterpart to Solidity's `uint248` operator.
*
* Requirements:
*
* - input must fit into 248 bits
*/
function toUint248(uint256 value) internal pure returns (uint248) {
if (value > type(uint248).max) {
revert SafeCastOverflowedUintDowncast(248, value);
}
return uint248(value);
}
/**
* @dev Returns the downcasted uint240 from uint256, reverting on
* overflow (when the input is greater than largest uint240).
*
* Counterpart to Solidity's `uint240` operator.
*
* Requirements:
*
* - input must fit into 240 bits
*/
function toUint240(uint256 value) internal pure returns (uint240) {
if (value > type(uint240).max) {
revert SafeCastOverflowedUintDowncast(240, value);
}
return uint240(value);
}
/**
* @dev Returns the downcasted uint232 from uint256, reverting on
* overflow (when the input is greater than largest uint232).
*
* Counterpart to Solidity's `uint232` operator.
*
* Requirements:
*
* - input must fit into 232 bits
*/
function toUint232(uint256 value) internal pure returns (uint232) {
if (value > type(uint232).max) {
revert SafeCastOverflowedUintDowncast(232, value);
}
return uint232(value);
}
/**
* @dev Returns the downcasted uint224 from uint256, reverting on
* overflow (when the input is greater than largest uint224).
*
* Counterpart to Solidity's `uint224` operator.
*
* Requirements:
*
* - input must fit into 224 bits
*/
function toUint224(uint256 value) internal pure returns (uint224) {
if (value > type(uint224).max) {
revert SafeCastOverflowedUintDowncast(224, value);
}
return uint224(value);
}
/**
* @dev Returns the downcasted uint216 from uint256, reverting on
* overflow (when the input is greater than largest uint216).
*
* Counterpart to Solidity's `uint216` operator.
*
* Requirements:
*
* - input must fit into 216 bits
*/
function toUint216(uint256 value) internal pure returns (uint216) {
if (value > type(uint216).max) {
revert SafeCastOverflowedUintDowncast(216, value);
}
return uint216(value);
}
/**
* @dev Returns the downcasted uint208 from uint256, reverting on
* overflow (when the input is greater than largest uint208).
*
* Counterpart to Solidity's `uint208` operator.
*
* Requirements:
*
* - input must fit into 208 bits
*/
function toUint208(uint256 value) internal pure returns (uint208) {
if (value > type(uint208).max) {
revert SafeCastOverflowedUintDowncast(208, value);
}
return uint208(value);
}
/**
* @dev Returns the downcasted uint200 from uint256, reverting on
* overflow (when the input is greater than largest uint200).
*
* Counterpart to Solidity's `uint200` operator.
*
* Requirements:
*
* - input must fit into 200 bits
*/
function toUint200(uint256 value) internal pure returns (uint200) {
if (value > type(uint200).max) {
revert SafeCastOverflowedUintDowncast(200, value);
}
return uint200(value);
}
/**
* @dev Returns the downcasted uint192 from uint256, reverting on
* overflow (when the input is greater than largest uint192).
*
* Counterpart to Solidity's `uint192` operator.
*
* Requirements:
*
* - input must fit into 192 bits
*/
function toUint192(uint256 value) internal pure returns (uint192) {
if (value > type(uint192).max) {
revert SafeCastOverflowedUintDowncast(192, value);
}
return uint192(value);
}
/**
* @dev Returns the downcasted uint184 from uint256, reverting on
* overflow (when the input is greater than largest uint184).
*
* Counterpart to Solidity's `uint184` operator.
*
* Requirements:
*
* - input must fit into 184 bits
*/
function toUint184(uint256 value) internal pure returns (uint184) {
if (value > type(uint184).max) {
revert SafeCastOverflowedUintDowncast(184, value);
}
return uint184(value);
}
/**
* @dev Returns the downcasted uint176 from uint256, reverting on
* overflow (when the input is greater than largest uint176).
*
* Counterpart to Solidity's `uint176` operator.
*
* Requirements:
*
* - input must fit into 176 bits
*/
function toUint176(uint256 value) internal pure returns (uint176) {
if (value > type(uint176).max) {
revert SafeCastOverflowedUintDowncast(176, value);
}
return uint176(value);
}
/**
* @dev Returns the downcasted uint168 from uint256, reverting on
* overflow (when the input is greater than largest uint168).
*
* Counterpart to Solidity's `uint168` operator.
*
* Requirements:
*
* - input must fit into 168 bits
*/
function toUint168(uint256 value) internal pure returns (uint168) {
if (value > type(uint168).max) {
revert SafeCastOverflowedUintDowncast(168, value);
}
return uint168(value);
}
/**
* @dev Returns the downcasted uint160 from uint256, reverting on
* overflow (when the input is greater than largest uint160).
*
* Counterpart to Solidity's `uint160` operator.
*
* Requirements:
*
* - input must fit into 160 bits
*/
function toUint160(uint256 value) internal pure returns (uint160) {
if (value > type(uint160).max) {
revert SafeCastOverflowedUintDowncast(160, value);
}
return uint160(value);
}
/**
* @dev Returns the downcasted uint152 from uint256, reverting on
* overflow (when the input is greater than largest uint152).
*
* Counterpart to Solidity's `uint152` operator.
*
* Requirements:
*
* - input must fit into 152 bits
*/
function toUint152(uint256 value) internal pure returns (uint152) {
if (value > type(uint152).max) {
revert SafeCastOverflowedUintDowncast(152, value);
}
return uint152(value);
}
/**
* @dev Returns the downcasted uint144 from uint256, reverting on
* overflow (when the input is greater than largest uint144).
*
* Counterpart to Solidity's `uint144` operator.
*
* Requirements:
*
* - input must fit into 144 bits
*/
function toUint144(uint256 value) internal pure returns (uint144) {
if (value > type(uint144).max) {
revert SafeCastOverflowedUintDowncast(144, value);
}
return uint144(value);
}
/**
* @dev Returns the downcasted uint136 from uint256, reverting on
* overflow (when the input is greater than largest uint136).
*
* Counterpart to Solidity's `uint136` operator.
*
* Requirements:
*
* - input must fit into 136 bits
*/
function toUint136(uint256 value) internal pure returns (uint136) {
if (value > type(uint136).max) {
revert SafeCastOverflowedUintDowncast(136, value);
}
return uint136(value);
}
/**
* @dev Returns the downcasted uint128 from uint256, reverting on
* overflow (when the input is greater than largest uint128).
*
* Counterpart to Solidity's `uint128` operator.
*
* Requirements:
*
* - input must fit into 128 bits
*/
function toUint128(uint256 value) internal pure returns (uint128) {
if (value > type(uint128).max) {
revert SafeCastOverflowedUintDowncast(128, value);
}
return uint128(value);
}
/**
* @dev Returns the downcasted uint120 from uint256, reverting on
* overflow (when the input is greater than largest uint120).
*
* Counterpart to Solidity's `uint120` operator.
*
* Requirements:
*
* - input must fit into 120 bits
*/
function toUint120(uint256 value) internal pure returns (uint120) {
if (value > type(uint120).max) {
revert SafeCastOverflowedUintDowncast(120, value);
}
return uint120(value);
}
/**
* @dev Returns the downcasted uint112 from uint256, reverting on
* overflow (when the input is greater than largest uint112).
*
* Counterpart to Solidity's `uint112` operator.
*
* Requirements:
*
* - input must fit into 112 bits
*/
function toUint112(uint256 value) internal pure returns (uint112) {
if (value > type(uint112).max) {
revert SafeCastOverflowedUintDowncast(112, value);
}
return uint112(value);
}
/**
* @dev Returns the downcasted uint104 from uint256, reverting on
* overflow (when the input is greater than largest uint104).
*
* Counterpart to Solidity's `uint104` operator.
*
* Requirements:
*
* - input must fit into 104 bits
*/
function toUint104(uint256 value) internal pure returns (uint104) {
if (value > type(uint104).max) {
revert SafeCastOverflowedUintDowncast(104, value);
}
return uint104(value);
}
/**
* @dev Returns the downcasted uint96 from uint256, reverting on
* overflow (when the input is greater than largest uint96).
*
* Counterpart to Solidity's `uint96` operator.
*
* Requirements:
*
* - input must fit into 96 bits
*/
function toUint96(uint256 value) internal pure returns (uint96) {
if (value > type(uint96).max) {
revert SafeCastOverflowedUintDowncast(96, value);
}
return uint96(value);
}
/**
* @dev Returns the downcasted uint88 from uint256, reverting on
* overflow (when the input is greater than largest uint88).
*
* Counterpart to Solidity's `uint88` operator.
*
* Requirements:
*
* - input must fit into 88 bits
*/
function toUint88(uint256 value) internal pure returns (uint88) {
if (value > type(uint88).max) {
revert SafeCastOverflowedUintDowncast(88, value);
}
return uint88(value);
}
/**
* @dev Returns the downcasted uint80 from uint256, reverting on
* overflow (when the input is greater than largest uint80).
*
* Counterpart to Solidity's `uint80` operator.
*
* Requirements:
*
* - input must fit into 80 bits
*/
function toUint80(uint256 value) internal pure returns (uint80) {
if (value > type(uint80).max) {
revert SafeCastOverflowedUintDowncast(80, value);
}
return uint80(value);
}
/**
* @dev Returns the downcasted uint72 from uint256, reverting on
* overflow (when the input is greater than largest uint72).
*
* Counterpart to Solidity's `uint72` operator.
*
* Requirements:
*
* - input must fit into 72 bits
*/
function toUint72(uint256 value) internal pure returns (uint72) {
if (value > type(uint72).max) {
revert SafeCastOverflowedUintDowncast(72, value);
}
return uint72(value);
}
/**
* @dev Returns the downcasted uint64 from uint256, reverting on
* overflow (when the input is greater than largest uint64).
*
* Counterpart to Solidity's `uint64` operator.
*
* Requirements:
*
* - input must fit into 64 bits
*/
function toUint64(uint256 value) internal pure returns (uint64) {
if (value > type(uint64).max) {
revert SafeCastOverflowedUintDowncast(64, value);
}
return uint64(value);
}
/**
* @dev Returns the downcasted uint56 from uint256, reverting on
* overflow (when the input is greater than largest uint56).
*
* Counterpart to Solidity's `uint56` operator.
*
* Requirements:
*
* - input must fit into 56 bits
*/
function toUint56(uint256 value) internal pure returns (uint56) {
if (value > type(uint56).max) {
revert SafeCastOverflowedUintDowncast(56, value);
}
return uint56(value);
}
/**
* @dev Returns the downcasted uint48 from uint256, reverting on
* overflow (when the input is greater than largest uint48).
*
* Counterpart to Solidity's `uint48` operator.
*
* Requirements:
*
* - input must fit into 48 bits
*/
function toUint48(uint256 value) internal pure returns (uint48) {
if (value > type(uint48).max) {
revert SafeCastOverflowedUintDowncast(48, value);
}
return uint48(value);
}
/**
* @dev Returns the downcasted uint40 from uint256, reverting on
* overflow (when the input is greater than largest uint40).
*
* Counterpart to Solidity's `uint40` operator.
*
* Requirements:
*
* - input must fit into 40 bits
*/
function toUint40(uint256 value) internal pure returns (uint40) {
if (value > type(uint40).max) {
revert SafeCastOverflowedUintDowncast(40, value);
}
return uint40(value);
}
/**
* @dev Returns the downcasted uint32 from uint256, reverting on
* overflow (when the input is greater than largest uint32).
*
* Counterpart to Solidity's `uint32` operator.
*
* Requirements:
*
* - input must fit into 32 bits
*/
function toUint32(uint256 value) internal pure returns (uint32) {
if (value > type(uint32).max) {
revert SafeCastOverflowedUintDowncast(32, value);
}
return uint32(value);
}
/**
* @dev Returns the downcasted uint24 from uint256, reverting on
* overflow (when the input is greater than largest uint24).
*
* Counterpart to Solidity's `uint24` operator.
*
* Requirements:
*
* - input must fit into 24 bits
*/
function toUint24(uint256 value) internal pure returns (uint24) {
if (value > type(uint24).max) {
revert SafeCastOverflowedUintDowncast(24, value);
}
return uint24(value);
}
/**
* @dev Returns the downcasted uint16 from uint256, reverting on
* overflow (when the input is greater than largest uint16).
*
* Counterpart to Solidity's `uint16` operator.
*
* Requirements:
*
* - input must fit into 16 bits
*/
function toUint16(uint256 value) internal pure returns (uint16) {
if (value > type(uint16).max) {
revert SafeCastOverflowedUintDowncast(16, value);
}
return uint16(value);
}
/**
* @dev Returns the downcasted uint8 from uint256, reverting on
* overflow (when the input is greater than largest uint8).
*
* Counterpart to Solidity's `uint8` operator.
*
* Requirements:
*
* - input must fit into 8 bits
*/
function toUint8(uint256 value) internal pure returns (uint8) {
if (value > type(uint8).max) {
revert SafeCastOverflowedUintDowncast(8, value);
}
return uint8(value);
}
/**
* @dev Converts a signed int256 into an unsigned uint256.
*
* Requirements:
*
* - input must be greater than or equal to 0.
*/
function toUint256(int256 value) internal pure returns (uint256) {
if (value < 0) {
revert SafeCastOverflowedIntToUint(value);
}
return uint256(value);
}
/**
* @dev Returns the downcasted int248 from int256, reverting on
* overflow (when the input is less than smallest int248 or
* greater than largest int248).
*
* Counterpart to Solidity's `int248` operator.
*
* Requirements:
*
* - input must fit into 248 bits
*/
function toInt248(int256 value) internal pure returns (int248 downcasted) {
downcasted = int248(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(248, value);
}
}
/**
* @dev Returns the downcasted int240 from int256, reverting on
* overflow (when the input is less than smallest int240 or
* greater than largest int240).
*
* Counterpart to Solidity's `int240` operator.
*
* Requirements:
*
* - input must fit into 240 bits
*/
function toInt240(int256 value) internal pure returns (int240 downcasted) {
downcasted = int240(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(240, value);
}
}
/**
* @dev Returns the downcasted int232 from int256, reverting on
* overflow (when the input is less than smallest int232 or
* greater than largest int232).
*
* Counterpart to Solidity's `int232` operator.
*
* Requirements:
*
* - input must fit into 232 bits
*/
function toInt232(int256 value) internal pure returns (int232 downcasted) {
downcasted = int232(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(232, value);
}
}
/**
* @dev Returns the downcasted int224 from int256, reverting on
* overflow (when the input is less than smallest int224 or
* greater than largest int224).
*
* Counterpart to Solidity's `int224` operator.
*
* Requirements:
*
* - input must fit into 224 bits
*/
function toInt224(int256 value) internal pure returns (int224 downcasted) {
downcasted = int224(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(224, value);
}
}
/**
* @dev Returns the downcasted int216 from int256, reverting on
* overflow (when the input is less than smallest int216 or
* greater than largest int216).
*
* Counterpart to Solidity's `int216` operator.
*
* Requirements:
*
* - input must fit into 216 bits
*/
function toInt216(int256 value) internal pure returns (int216 downcasted) {
downcasted = int216(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(216, value);
}
}
/**
* @dev Returns the downcasted int208 from int256, reverting on
* overflow (when the input is less than smallest int208 or
* greater than largest int208).
*
* Counterpart to Solidity's `int208` operator.
*
* Requirements:
*
* - input must fit into 208 bits
*/
function toInt208(int256 value) internal pure returns (int208 downcasted) {
downcasted = int208(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(208, value);
}
}
/**
* @dev Returns the downcasted int200 from int256, reverting on
* overflow (when the input is less than smallest int200 or
* greater than largest int200).
*
* Counterpart to Solidity's `int200` operator.
*
* Requirements:
*
* - input must fit into 200 bits
*/
function toInt200(int256 value) internal pure returns (int200 downcasted) {
downcasted = int200(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(200, value);
}
}
/**
* @dev Returns the downcasted int192 from int256, reverting on
* overflow (when the input is less than smallest int192 or
* greater than largest int192).
*
* Counterpart to Solidity's `int192` operator.
*
* Requirements:
*
* - input must fit into 192 bits
*/
function toInt192(int256 value) internal pure returns (int192 downcasted) {
downcasted = int192(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(192, value);
}
}
/**
* @dev Returns the downcasted int184 from int256, reverting on
* overflow (when the input is less than smallest int184 or
* greater than largest int184).
*
* Counterpart to Solidity's `int184` operator.
*
* Requirements:
*
* - input must fit into 184 bits
*/
function toInt184(int256 value) internal pure returns (int184 downcasted) {
downcasted = int184(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(184, value);
}
}
/**
* @dev Returns the downcasted int176 from int256, reverting on
* overflow (when the input is less than smallest int176 or
* greater than largest int176).
*
* Counterpart to Solidity's `int176` operator.
*
* Requirements:
*
* - input must fit into 176 bits
*/
function toInt176(int256 value) internal pure returns (int176 downcasted) {
downcasted = int176(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(176, value);
}
}
/**
* @dev Returns the downcasted int168 from int256, reverting on
* overflow (when the input is less than smallest int168 or
* greater than largest int168).
*
* Counterpart to Solidity's `int168` operator.
*
* Requirements:
*
* - input must fit into 168 bits
*/
function toInt168(int256 value) internal pure returns (int168 downcasted) {
downcasted = int168(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(168, value);
}
}
/**
* @dev Returns the downcasted int160 from int256, reverting on
* overflow (when the input is less than smallest int160 or
* greater than largest int160).
*
* Counterpart to Solidity's `int160` operator.
*
* Requirements:
*
* - input must fit into 160 bits
*/
function toInt160(int256 value) internal pure returns (int160 downcasted) {
downcasted = int160(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(160, value);
}
}
/**
* @dev Returns the downcasted int152 from int256, reverting on
* overflow (when the input is less than smallest int152 or
* greater than largest int152).
*
* Counterpart to Solidity's `int152` operator.
*
* Requirements:
*
* - input must fit into 152 bits
*/
function toInt152(int256 value) internal pure returns (int152 downcasted) {
downcasted = int152(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(152, value);
}
}
/**
* @dev Returns the downcasted int144 from int256, reverting on
* overflow (when the input is less than smallest int144 or
* greater than largest int144).
*
* Counterpart to Solidity's `int144` operator.
*
* Requirements:
*
* - input must fit into 144 bits
*/
function toInt144(int256 value) internal pure returns (int144 downcasted) {
downcasted = int144(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(144, value);
}
}
/**
* @dev Returns the downcasted int136 from int256, reverting on
* overflow (when the input is less than smallest int136 or
* greater than largest int136).
*
* Counterpart to Solidity's `int136` operator.
*
* Requirements:
*
* - input must fit into 136 bits
*/
function toInt136(int256 value) internal pure returns (int136 downcasted) {
downcasted = int136(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(136, value);
}
}
/**
* @dev Returns the downcasted int128 from int256, reverting on
* overflow (when the input is less than smallest int128 or
* greater than largest int128).
*
* Counterpart to Solidity's `int128` operator.
*
* Requirements:
*
* - input must fit into 128 bits
*/
function toInt128(int256 value) internal pure returns (int128 downcasted) {
downcasted = int128(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(128, value);
}
}
/**
* @dev Returns the downcasted int120 from int256, reverting on
* overflow (when the input is less than smallest int120 or
* greater than largest int120).
*
* Counterpart to Solidity's `int120` operator.
*
* Requirements:
*
* - input must fit into 120 bits
*/
function toInt120(int256 value) internal pure returns (int120 downcasted) {
downcasted = int120(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(120, value);
}
}
/**
* @dev Returns the downcasted int112 from int256, reverting on
* overflow (when the input is less than smallest int112 or
* greater than largest int112).
*
* Counterpart to Solidity's `int112` operator.
*
* Requirements:
*
* - input must fit into 112 bits
*/
function toInt112(int256 value) internal pure returns (int112 downcasted) {
downcasted = int112(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(112, value);
}
}
/**
* @dev Returns the downcasted int104 from int256, reverting on
* overflow (when the input is less than smallest int104 or
* greater than largest int104).
*
* Counterpart to Solidity's `int104` operator.
*
* Requirements:
*
* - input must fit into 104 bits
*/
function toInt104(int256 value) internal pure returns (int104 downcasted) {
downcasted = int104(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(104, value);
}
}
/**
* @dev Returns the downcasted int96 from int256, reverting on
* overflow (when the input is less than smallest int96 or
* greater than largest int96).
*
* Counterpart to Solidity's `int96` operator.
*
* Requirements:
*
* - input must fit into 96 bits
*/
function toInt96(int256 value) internal pure returns (int96 downcasted) {
downcasted = int96(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(96, value);
}
}
/**
* @dev Returns the downcasted int88 from int256, reverting on
* overflow (when the input is less than smallest int88 or
* greater than largest int88).
*
* Counterpart to Solidity's `int88` operator.
*
* Requirements:
*
* - input must fit into 88 bits
*/
function toInt88(int256 value) internal pure returns (int88 downcasted) {
downcasted = int88(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(88, value);
}
}
/**
* @dev Returns the downcasted int80 from int256, reverting on
* overflow (when the input is less than smallest int80 or
* greater than largest int80).
*
* Counterpart to Solidity's `int80` operator.
*
* Requirements:
*
* - input must fit into 80 bits
*/
function toInt80(int256 value) internal pure returns (int80 downcasted) {
downcasted = int80(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(80, value);
}
}
/**
* @dev Returns the downcasted int72 from int256, reverting on
* overflow (when the input is less than smallest int72 or
* greater than largest int72).
*
* Counterpart to Solidity's `int72` operator.
*
* Requirements:
*
* - input must fit into 72 bits
*/
function toInt72(int256 value) internal pure returns (int72 downcasted) {
downcasted = int72(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(72, value);
}
}
/**
* @dev Returns the downcasted int64 from int256, reverting on
* overflow (when the input is less than smallest int64 or
* greater than largest int64).
*
* Counterpart to Solidity's `int64` operator.
*
* Requirements:
*
* - input must fit into 64 bits
*/
function toInt64(int256 value) internal pure returns (int64 downcasted) {
downcasted = int64(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(64, value);
}
}
/**
* @dev Returns the downcasted int56 from int256, reverting on
* overflow (when the input is less than smallest int56 or
* greater than largest int56).
*
* Counterpart to Solidity's `int56` operator.
*
* Requirements:
*
* - input must fit into 56 bits
*/
function toInt56(int256 value) internal pure returns (int56 downcasted) {
downcasted = int56(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(56, value);
}
}
/**
* @dev Returns the downcasted int48 from int256, reverting on
* overflow (when the input is less than smallest int48 or
* greater than largest int48).
*
* Counterpart to Solidity's `int48` operator.
*
* Requirements:
*
* - input must fit into 48 bits
*/
function toInt48(int256 value) internal pure returns (int48 downcasted) {
downcasted = int48(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(48, value);
}
}
/**
* @dev Returns the downcasted int40 from int256, reverting on
* overflow (when the input is less than smallest int40 or
* greater than largest int40).
*
* Counterpart to Solidity's `int40` operator.
*
* Requirements:
*
* - input must fit into 40 bits
*/
function toInt40(int256 value) internal pure returns (int40 downcasted) {
downcasted = int40(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(40, value);
}
}
/**
* @dev Returns the downcasted int32 from int256, reverting on
* overflow (when the input is less than smallest int32 or
* greater than largest int32).
*
* Counterpart to Solidity's `int32` operator.
*
* Requirements:
*
* - input must fit into 32 bits
*/
function toInt32(int256 value) internal pure returns (int32 downcasted) {
downcasted = int32(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(32, value);
}
}
/**
* @dev Returns the downcasted int24 from int256, reverting on
* overflow (when the input is less than smallest int24 or
* greater than largest int24).
*
* Counterpart to Solidity's `int24` operator.
*
* Requirements:
*
* - input must fit into 24 bits
*/
function toInt24(int256 value) internal pure returns (int24 downcasted) {
downcasted = int24(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(24, value);
}
}
/**
* @dev Returns the downcasted int16 from int256, reverting on
* overflow (when the input is less than smallest int16 or
* greater than largest int16).
*
* Counterpart to Solidity's `int16` operator.
*
* Requirements:
*
* - input must fit into 16 bits
*/
function toInt16(int256 value) internal pure returns (int16 downcasted) {
downcasted = int16(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(16, value);
}
}
/**
* @dev Returns the downcasted int8 from int256, reverting on
* overflow (when the input is less than smallest int8 or
* greater than largest int8).
*
* Counterpart to Solidity's `int8` operator.
*
* Requirements:
*
* - input must fit into 8 bits
*/
function toInt8(int256 value) internal pure returns (int8 downcasted) {
downcasted = int8(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(8, value);
}
}
/**
* @dev Converts an unsigned uint256 into a signed int256.
*
* Requirements:
*
* - input must be less than or equal to maxInt256.
*/
function toInt256(uint256 value) internal pure returns (int256) {
// Note: Unsafe cast below is okay because `type(int256).max` is guaranteed to be positive
if (value > uint256(type(int256).max)) {
revert SafeCastOverflowedUintToInt(value);
}
return int256(value);
}
/**
* @dev Cast a boolean (false or true) to a uint256 (0 or 1) with no jump.
*/
function toUint(bool b) internal pure returns (uint256 u) {
assembly ("memory-safe") {
u := iszero(iszero(b))
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (token/ERC20/IERC20.sol)
pragma solidity ^0.8.20;
/**
* @dev Interface of the ERC-20 standard as defined in the ERC.
*/
interface IERC20 {
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
/**
* @dev Returns the value of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the value of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves a `value` amount of tokens from the caller's account to `to`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address to, uint256 value) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets a `value` amount of tokens as the allowance of `spender` over the
* caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 value) external returns (bool);
/**
* @dev Moves a `value` amount of tokens from `from` to `to` using the
* allowance mechanism. `value` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address from, address to, uint256 value) external returns (bool);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (token/ERC20/extensions/IERC20Metadata.sol)
pragma solidity ^0.8.20;
import {IERC20} from "../IERC20.sol";
/**
* @dev Interface for the optional metadata functions from the ERC-20 standard.
*/
interface IERC20Metadata is IERC20 {
/**
* @dev Returns the name of the token.
*/
function name() external view returns (string memory);
/**
* @dev Returns the symbol of the token.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the decimals places of the token.
*/
function decimals() external view returns (uint8);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (interfaces/draft-IERC6093.sol)
pragma solidity ^0.8.20;
/**
* @dev Standard ERC-20 Errors
* Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC-20 tokens.
*/
interface IERC20Errors {
/**
* @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers.
* @param sender Address whose tokens are being transferred.
* @param balance Current balance for the interacting account.
* @param needed Minimum amount required to perform a transfer.
*/
error ERC20InsufficientBalance(address sender, uint256 balance, uint256 needed);
/**
* @dev Indicates a failure with the token `sender`. Used in transfers.
* @param sender Address whose tokens are being transferred.
*/
error ERC20InvalidSender(address sender);
/**
* @dev Indicates a failure with the token `receiver`. Used in transfers.
* @param receiver Address to which tokens are being transferred.
*/
error ERC20InvalidReceiver(address receiver);
/**
* @dev Indicates a failure with the `spender`’s `allowance`. Used in transfers.
* @param spender Address that may be allowed to operate on tokens without being their owner.
* @param allowance Amount of tokens a `spender` is allowed to operate with.
* @param needed Minimum amount required to perform a transfer.
*/
error ERC20InsufficientAllowance(address spender, uint256 allowance, uint256 needed);
/**
* @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.
* @param approver Address initiating an approval operation.
*/
error ERC20InvalidApprover(address approver);
/**
* @dev Indicates a failure with the `spender` to be approved. Used in approvals.
* @param spender Address that may be allowed to operate on tokens without being their owner.
*/
error ERC20InvalidSpender(address spender);
}
/**
* @dev Standard ERC-721 Errors
* Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC-721 tokens.
*/
interface IERC721Errors {
/**
* @dev Indicates that an address can't be an owner. For example, `address(0)` is a forbidden owner in ERC-20.
* Used in balance queries.
* @param owner Address of the current owner of a token.
*/
error ERC721InvalidOwner(address owner);
/**
* @dev Indicates a `tokenId` whose `owner` is the zero address.
* @param tokenId Identifier number of a token.
*/
error ERC721NonexistentToken(uint256 tokenId);
/**
* @dev Indicates an error related to the ownership over a particular token. Used in transfers.
* @param sender Address whose tokens are being transferred.
* @param tokenId Identifier number of a token.
* @param owner Address of the current owner of a token.
*/
error ERC721IncorrectOwner(address sender, uint256 tokenId, address owner);
/**
* @dev Indicates a failure with the token `sender`. Used in transfers.
* @param sender Address whose tokens are being transferred.
*/
error ERC721InvalidSender(address sender);
/**
* @dev Indicates a failure with the token `receiver`. Used in transfers.
* @param receiver Address to which tokens are being transferred.
*/
error ERC721InvalidReceiver(address receiver);
/**
* @dev Indicates a failure with the `operator`’s approval. Used in transfers.
* @param operator Address that may be allowed to operate on tokens without being their owner.
* @param tokenId Identifier number of a token.
*/
error ERC721InsufficientApproval(address operator, uint256 tokenId);
/**
* @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.
* @param approver Address initiating an approval operation.
*/
error ERC721InvalidApprover(address approver);
/**
* @dev Indicates a failure with the `operator` to be approved. Used in approvals.
* @param operator Address that may be allowed to operate on tokens without being their owner.
*/
error ERC721InvalidOperator(address operator);
}
/**
* @dev Standard ERC-1155 Errors
* Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC-1155 tokens.
*/
interface IERC1155Errors {
/**
* @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers.
* @param sender Address whose tokens are being transferred.
* @param balance Current balance for the interacting account.
* @param needed Minimum amount required to perform a transfer.
* @param tokenId Identifier number of a token.
*/
error ERC1155InsufficientBalance(address sender, uint256 balance, uint256 needed, uint256 tokenId);
/**
* @dev Indicates a failure with the token `sender`. Used in transfers.
* @param sender Address whose tokens are being transferred.
*/
error ERC1155InvalidSender(address sender);
/**
* @dev Indicates a failure with the token `receiver`. Used in transfers.
* @param receiver Address to which tokens are being transferred.
*/
error ERC1155InvalidReceiver(address receiver);
/**
* @dev Indicates a failure with the `operator`’s approval. Used in transfers.
* @param operator Address that may be allowed to operate on tokens without being their owner.
* @param owner Address of the current owner of a token.
*/
error ERC1155MissingApprovalForAll(address operator, address owner);
/**
* @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.
* @param approver Address initiating an approval operation.
*/
error ERC1155InvalidApprover(address approver);
/**
* @dev Indicates a failure with the `operator` to be approved. Used in approvals.
* @param operator Address that may be allowed to operate on tokens without being their owner.
*/
error ERC1155InvalidOperator(address operator);
/**
* @dev Indicates an array length mismatch between ids and values in a safeBatchTransferFrom operation.
* Used in batch transfers.
* @param idsLength Length of the array of token identifiers
* @param valuesLength Length of the array of token amounts
*/
error ERC1155InvalidArrayLength(uint256 idsLength, uint256 valuesLength);
}{
"remappings": [
"@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/",
"ds-test/=lib/openzeppelin-contracts/lib/forge-std/lib/ds-test/src/",
"erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/",
"forge-std/=lib/forge-std/src/",
"halmos-cheatcodes/=lib/openzeppelin-contracts/lib/halmos-cheatcodes/src/",
"openzeppelin-contracts/=lib/openzeppelin-contracts/"
],
"optimizer": {
"enabled": true,
"runs": 200
},
"metadata": {
"useLiteralContent": false,
"bytecodeHash": "ipfs",
"appendCBOR": true
},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"evmVersion": "cancun",
"viaIR": true,
"libraries": {}
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"allowance","type":"uint256"},{"internalType":"uint256","name":"needed","type":"uint256"}],"name":"ERC20InsufficientAllowance","type":"error"},{"inputs":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"uint256","name":"balance","type":"uint256"},{"internalType":"uint256","name":"needed","type":"uint256"}],"name":"ERC20InsufficientBalance","type":"error"},{"inputs":[{"internalType":"address","name":"approver","type":"address"}],"name":"ERC20InvalidApprover","type":"error"},{"inputs":[{"internalType":"address","name":"receiver","type":"address"}],"name":"ERC20InvalidReceiver","type":"error"},{"inputs":[{"internalType":"address","name":"sender","type":"address"}],"name":"ERC20InvalidSender","type":"error"},{"inputs":[{"internalType":"address","name":"spender","type":"address"}],"name":"ERC20InvalidSpender","type":"error"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"OwnableInvalidOwner","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"OwnableUnauthorizedAccount","type":"error"},{"inputs":[],"name":"ReentrancyGuardReentrantCall","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"buyFee","type":"uint256"}],"name":"BuyFeeUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_address","type":"address"}],"name":"FeeAddressUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"leverageFee","type":"uint256"}],"name":"LeverageFeeUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"time","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Liquidate","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"collateralByDate","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"borrowedByDate","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"totalBorrowed","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"totalCollateral","type":"uint256"}],"name":"LoanDataUpdate","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"max","type":"uint256"}],"name":"MaxUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferStarted","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":"uint256","name":"time","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"price","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"volumeInSonic","type":"uint256"}],"name":"Price","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"sellFee","type":"uint256"}],"name":"SellFeeUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"SendSonic","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bool","name":"started","type":"bool"}],"name":"Started","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"stateMutability":"payable","type":"fallback"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"BorrowedByDate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"CollateralByDate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"value","type":"uint256"}],"name":"EGGStoSONIC","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"FEE_ADDRESS","outputs":[{"internalType":"address payable","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"Loans","outputs":[{"internalType":"uint256","name":"collateral","type":"uint256"},{"internalType":"uint256","name":"borrowed","type":"uint256"},{"internalType":"uint256","name":"endDate","type":"uint256"},{"internalType":"uint256","name":"numberOfDays","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"value","type":"uint256"}],"name":"SONICtoEGGS","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"uint256","name":"fee","type":"uint256"}],"name":"SONICtoEGGSLev","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"value","type":"uint256"}],"name":"SONICtoEGGSNoTrade","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"value","type":"uint256"}],"name":"SONICtoEGGSNoTradeCeil","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"acceptOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"sonic","type":"uint256"},{"internalType":"uint256","name":"numberOfDays","type":"uint256"}],"name":"borrow","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"sonic","type":"uint256"}],"name":"borrowMore","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"value","type":"uint256"}],"name":"burn","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"burnFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"receiver","type":"address"}],"name":"buy","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"buy_fee","outputs":[{"internalType":"uint16","name":"","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"buy_fee_leverage","outputs":[{"internalType":"uint16","name":"","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"closePosition","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"numberOfDays","type":"uint256"}],"name":"extendLoan","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"flashClosePosition","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"getBacking","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"getBuyAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"getBuyEggs","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getBuyFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"numberOfDays","type":"uint256"}],"name":"getInterestFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"_address","type":"address"}],"name":"getLoanByAddress","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"date","type":"uint256"}],"name":"getLoansExpiringByDate","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"date","type":"uint256"}],"name":"getMidnightTimestamp","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"getTotalBorrowed","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getTotalCollateral","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_address","type":"address"}],"name":"isLoanExpired","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lastLiquidationDate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lastPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"sonic","type":"uint256"},{"internalType":"uint256","name":"numberOfDays","type":"uint256"}],"name":"leverage","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"sonic","type":"uint256"},{"internalType":"uint256","name":"numberOfDays","type":"uint256"}],"name":"leverageFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"liquidate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"maxSupply","outputs":[{"internalType":"uint128","name":"","type":"uint128"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pendingOwner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"removeCollateral","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"repay","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"eggs","type":"uint256"}],"name":"sell","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"sell_fee","outputs":[{"internalType":"uint16","name":"","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint16","name":"amount","type":"uint16"}],"name":"setBuyFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"amount","type":"uint16"}],"name":"setBuyFeeLeverage","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_address","type":"address"}],"name":"setFeeAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"amount","type":"uint16"}],"name":"setSellFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"setStart","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"start","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalMinted","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]Contract Creation Code
6080604052346103ab576100116103af565b634567677360e01b60208201526100266103af565b634547475360e01b602082015281516001600160401b0381116102be57600354600181811c911680156103a1575b60208210146102a057601f811161033e575b50602092601f82116001146102dd57928192935f926102d2575b50508160011b915f199060031b1c1916176003555b80516001600160401b0381116102be57600454600181811c911680156102b4575b60208210146102a057601f811161023d575b50602091601f82116001146101dd579181925f926101d2575b50508160011b915f199060031b1c1916176004555b33156101bf57600680546001600160a01b03199081169091556005805491821633908117909155604051916001600160a01b03167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e05f80a360016007556008805466ffffffffffffff60a01b1916640a03cf03cf60a01b1790555f6009819055600a819055600c55620151804290810681039081116101ab576201518081018091116101ab5760105561313d90816103d38239f35b634e487b7160e01b5f52601160045260245ffd5b631e4fbdf760e01b5f525f60045260245ffd5b015190505f806100e1565b601f1982169260045f52805f20915f5b8581106102255750836001951061020d575b505050811b016004556100f6565b01515f1960f88460031b161c191690555f80806101ff565b919260206001819286850151815501940192016101ed565b60045f527f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b601f830160051c81019160208410610296575b601f0160051c01905b81811061028b57506100c8565b5f815560010161027e565b9091508190610275565b634e487b7160e01b5f52602260045260245ffd5b90607f16906100b6565b634e487b7160e01b5f52604160045260245ffd5b015190505f80610080565b601f1982169360035f52805f20915f5b868110610326575083600195961061030e575b505050811b01600355610095565b01515f1960f88460031b161c191690555f8080610300565b919260206001819286850151815501940192016102ed565b60035f527fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b601f830160051c81019160208410610397575b601f0160051c01905b81811061038c5750610066565b5f815560010161037f565b9091508190610376565b90607f1690610054565b5f80fd5b60408051919082016001600160401b038111838210176102be576040526004825256fe60806040526004361015610010575b005b5f5f3560e01c8063024cad3b146122e95780630307c4a1146122cc578063035b7c4b146122b3578063053f14da1461229657806306fdde03146121a2578063095ea7b3146120fa5780630df1ff24146120cb5780630ecbcdab14611f1a578063162b51fc14611ef657806317a5a97e14611e2857806318160ddd14611e0b5780631fb87f3914611dd957806323b872dd14611da157806328a0702514611d89578063313ce56714611d6e5780633237c15814611b9a57806333e516d514611b5d5780633421f75014611b3f57806335975a3714611a2757806336189d4314611a025780633be4e598146119e8578063402d8883146117ca57806342966c68146117ac57806342c95e191461178d5780634fbf3ab0146117635780635e96263c146114b457806370a082311461147c57806370c476711461135a57806370f84ba914611312578063715018a6146112ab57806379ba50971461122357806379cc6790146111ef5780637ace2ac9146110125780638705fcd414610f49578063886433ac14610eef5780638da5cb5b14610ec65780638f818b9014610ea157806395ced06f14610e5f57806395d89b4114610d5a5780639d0bf2e914610b115780639d41ac3a1461097a578063a2309ff81461095c578063a9059cbb1461092a578063a925e4a4146108bf578063abd545bf1461089a578063b6013e9a1461086a578063bd0fe67914610850578063be9a65551461082a578063c393d0e314610736578063c94220ab14610715578063c962a4b5146106eb578063d5abeb01146106c3578063d6eb5910146106a5578063dd62ed3e14610652578063e064648a1461052a578063e30c397814610501578063e3eb5ed3146104da578063e4849b3214610454578063eb1edd611461042b578063f088d547146103265763f2fde38b146102b657005b34610323576020366003190112610323576102cf612373565b6102d7612d68565b600680546001600160a01b0319166001600160a01b039283169081179091556005549091167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e227008380a380f35b80fd5b5060203660031901126103235761033b612373565b6103436129b5565b61034b61255d565b6008549061035e60ff8360d01c16612703565b6001600160a01b038116156103e6576103e86103a96103b09361ffff61039e600254610397610390476009549061239f565b3490612550565b9034612918565b9160b01c16906124d3565b0490612f14565b6103d5607d34046103c46103e882116127cf565b6008546001600160a01b0316612a26565b6103de34612ccd565b600160075580f35b60405162461bcd60e51b815260206004820152601e60248201527f52656369657665722063616e6e6f7420626520307830206164647265737300006044820152606490fd5b50346103235780600319360112610323576008546040516001600160a01b039091168152602090f35b5034610323576020366003190112610323576103de6004356104746129b5565b61047c61255d565b6104d561049961048f476009549061239f565b6002549084612918565b916104a8607d84049133612e2f565b6104c86103e86104c161ffff60085460a01c16866124d3565b0433612a26565b6103c46103e882116127cf565b612ccd565b50346103235760203660031901126103235760206104f96004356127af565b604051908152f35b50346103235780600319360112610323576006546040516001600160a01b039091168152602090f35b50346103235760203660031901126103235760043561ffff81169081810361064e57610554612d68565b6103e082116105f9576103cf82106105b4576008805461ffff60a01b191660a09290921b61ffff60a01b169190911790556040519081527f495ee53ee22006979ebc689a00ed737d7c13b6419142f82dcaea4ed95ac1e78090602090a180f35b60405162461bcd60e51b815260206004820152601f60248201527f73656c6c20666565206d757374206265206c657373207468616e20322e3525006044820152606490fd5b60405162461bcd60e51b815260206004820152602760248201527f73656c6c20666565206d7573742062652067726561746572207468616e2046456044820152661154d7d4d1531360ca1b6064820152608490fd5b8280fd5b503461032357604036600319011261032357604061066e612373565b91610677612389565b9260018060a01b031681526001602052209060018060a01b03165f52602052602060405f2054604051908152f35b50346103235780600319360112610323576020600a54604051908152f35b503461032357806003193601126103235760206040516c01431e0fae6d7217caa00000008152f35b50346103235760203660031901126103235760406020916004358152600f83522054604051908152f35b50346103235780600319360112610323575060206104f9476009549061239f565b50806003193601126103235761074a6129b5565b33808252600d602081815260408085206001015484865292909152808420545f9384529220600201546107809042115b15612635565b3481036107da57816107966107ac9333306129d5565b338452600d602052600260408520015491612ea0565b338152600d6020526107d26040822060035f918281558260018201558260028201550155565b6103de612b66565b60405162461bcd60e51b815260206004820152602260248201527f4d7573742072657475726e20656e7469726520626f72726f77656420616d6f756044820152611b9d60f21b6064820152608490fd5b5034610323578060031936011261032357602060ff60085460d01c166040519015158152f35b50346103235760206104f961086436612333565b9061279a565b5034610323576020366003190112610323575060206104f961088f476009549061239f565b600254600435612918565b5034610323578060031936011261032357602061ffff60085460a01c16604051908152f35b5034610323576020366003190112610323576040906001600160a01b036108e4612373565b168152600d6020522080546109266001830154926003600282015491015490604051948594859094939260609260808301968352602083015260408201520152565b0390f35b503461032357604036600319011261032357610951610947612373565b60243590336129d5565b602060405160018152f35b50346103235780600319360112610323576020600b54604051908152f35b50346103235780600319360112610323576109936129b5565b335f908152600d60205260409020600201546109b090421161077a565b6109b861255d565b338152600d6020526001604082200154338252600d60205260408220546109ef6109e5476009549061239f565b6002549083612918565b6109f98230612e2f565b6063810281810460631482151715610a9c576064809104910490838110610ab05783610a2491612550565b90600381029080820460031490151715610a9c5791610a5f610a7692610a52600a6103de9796049133612a26565b6103c46103e88211612504565b338552600d60205260026040862001549083612ea0565b338352600d6020526104d56040842060035f918281558260018201558260028201550155565b634e487b7160e01b85526011600452602485fd5b60405162461bcd60e51b815260206004820152603360248201527f596f7520646f206e6f74206861766520656e6f75676820636f6c6c617465726160448201527236103a379031b637b9b2903837b9b4ba34b7b760691b6064820152608490fd5b503461032357602036600319011261032357600435610b2e6129b5565b335f908152600d60205260409020600201544211610d15578015610b528115612487565b610b5a61255d565b338352600d602052600160408420015491338452600d602052604084205492338552600d60205260026040862001549262015180610ba0610b9a426127af565b86612550565b0494610bac86856123ac565b95610bb6856126ca565b610bcf610bc6476009549061239f565b60025487612918565b6063840284810460631485151715610d0157906064610bee9204612550565b818110610cf257505087945b6003880288810460031489151715610cde57600a900493606382029182046063141715610cca57926103de979694926003610ca2938b610c4c8a610c4660646104d59d9b04809a61239f565b9561239f565b9360405194610c5a866123d3565b8552602085019081526040808601928b845260608701948552338152600d60205220945185555160018501555160028401555191015583610cba576103c46103e88211612504565b610cb5610caf8683612550565b33612a26565b612aed565b610cc58430336129d5565b610a52565b634e487b7160e01b89526011600452602489fd5b634e487b7160e01b8a52601160045260248afd5b610cfb91612550565b94610bfa565b634e487b7160e01b8b52601160045260248bfd5b60405162461bcd60e51b815260206004820152601760248201527f4c6f616e20657870697265642075736520626f72726f770000000000000000006044820152606490fd5b50346103235780600319360112610323576040519080600454908160011c91600181168015610e55575b602084108114610e4157838652908115610e1a5750600114610dbd575b61092684610db181860382612403565b60405191829182612349565b600481527f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b939250905b808210610e0057509091508101602001610db182610da1565b919260018160209254838588010152019101909291610de7565b60ff191660208087019190915292151560051b85019092019250610db19150839050610da1565b634e487b7160e01b83526022600452602483fd5b92607f1692610d84565b503461032357602036600319011261032357610926610e84610e7f612373565b61274f565b604080519384526020840192909252908201529081906060820190565b5034610323578060031936011261032357602061ffff60085460b01c16604051908152f35b50346103235780600319360112610323576005546040516001600160a01b039091168152602090f35b5034610323576020366003190112610323576103e8602091610f3e610f2b610f1b6002546004356124d3565b61ffff60085460b01c16906124d3565b610f38476009549061239f565b906124e6565b905004604051908152f35b503461032357602036600319011261032357610f63612373565b610f6b612d68565b6001600160a01b03168015610fc1576020817f446e39bcf1b47cfadfaa23442cb4b34682cfe6bd9220da084894e3b1f834e4f3926bffffffffffffffffffffffff60a01b6008541617600855604051908152a180f35b60405162461bcd60e51b8152602060048201526024808201527f43616e27742073657420666565206164647265737320746f20307830206164646044820152637265737360e01b6064820152608490fd5b5060203660031901126103235760043561102a6129b5565b338252600d602052600260408320015491338152600d602052600160408220015491338252600d602052604082205490338352600d602052600360408420015491620151808202828104620151801483151715610a9c5761108b908761239f565b9461109683826123ac565b335f908152600d60205260409020600201549097906110b690421161077a565b3488036111aa5760038802888104600314891517156111965761113195889561110961016e9a620151809a97600397610cb5604098611102600a61111e9a046103c46103e88211612504565b8383612ea0565b338652600d602052866002858820015561239f565b92338152600d6020522001554290612550565b0410156111515760209061114434612ccd565b6001600755604051908152f35b60405162461bcd60e51b815260206004820152601b60248201527f4c6f616e206d75737420626520756e64657220333635206461797300000000006044820152606490fd5b634e487b7160e01b87526011600452602487fd5b60405162461bcd60e51b815260206004820152601c60248201527f4c6f616e20657874656e73696f6e2066656520696e636f7272656374000000006044820152606490fd5b50346103235760403660031901126103235761122061120c612373565b6024359061121b823383612d8f565b612e2f565b80f35b5034610323578060031936011261032357600654336001600160a01b039091160361129857600680546001600160a01b0319908116909155600580543392811683179091556001600160a01b03167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08380a380f35b63118cdaa760e01b815233600452602490fd5b50346103235780600319360112610323576112c4612d68565b600680546001600160a01b031990811690915560058054918216905581906001600160a01b03167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a380f35b5034610323576020366003190112610323576020611350611331612373565b6001600160a01b03165f908152600d6020526040902060020154421190565b6040519015158152f35b50346103235760203660031901126103235760043561ffff81169081810361064e57611384612d68565b6103e08211611429576103cf82106113e4576008805461ffff60b01b191660b09290921b61ffff60b01b169190911790556040519081527f7c1445c98b278c9970d007fca6048704bcb25af7cc4a04eb56565d9a9f149ca390602090a180f35b60405162461bcd60e51b815260206004820152601e60248201527f62757920666565206d757374206265206c657373207468616e20322e352500006044820152606490fd5b60405162461bcd60e51b815260206004820152602560248201527f62757920666565206d7573742062652067726561746572207468616e20464545604482015264535f42555960d81b6064820152608490fd5b5034610323576020366003190112610323576020906040906001600160a01b036114a4612373565b1681528083522054604051908152f35b506114be36612333565b906114c76129b5565b6114d860ff60085460d01c16612703565b6114e561016e8310612425565b338352600d602052604083206040516114fd816123d3565b81548152606060036001840154938460208501526002810154604085015201549101526116c5575b61152d61255d565b6201518082028281046201518014831517156116b15761155161155691429061239f565b6127af565b61156083836126a0565b9261156b8484612550565b90600385028581046003148615171561119657600a900492606383028381046063148415171561169d57606490046115b0606485046115aa818861239f565b9861239f565b8881341161167e575b6115c39034612550565b03611639576115e56115da6103de9860039661279a565b95610a528730612f14565b6115f0828683612aed565b604051946115fd866123d3565b8552602085019081526040850191825260608501928352338852600d602052604088209451855551600185015551600284015551910155612ccd565b60405162461bcd60e51b815260206004820152601b60248201527f496e73756666696369656e7420736f6e6963206665652073656e7400000000006044820152606490fd5b506115c361168c8234612550565b6116968133612a26565b90506115b9565b634e487b7160e01b88526011600452602488fd5b634e487b7160e01b84526011600452602484fd5b335f908152600d60205260409020600201544211611738575b338352600d6020526001604084200154156115255760405162461bcd60e51b815260206004820152601960248201527f557365206163636f756e742077697468206e6f206c6f616e73000000000000006044820152606490fd5b338352600d60205261175e6040842060035f918281558260018201558260028201550155565b6116de565b50346103235760203660031901126103235760406020916004358152600e83522054604051908152f35b50346103235760203660031901126103235760206104f96004356126ca565b50346103235760203660031901126103235761122060043533612e2f565b5080600319360112610323576117de6129b5565b338152600d60205260016040822001543481111561199757341561195b57335f908152600d602052604090206002015442116119025761181f903490612550565b338252600d6020526001604083200155338152600d6020526002604082200154808252600f6020526040822054826118ee575f5160206130c85f395f51905f529250815f52600f60205260405f2055805f52600e6020526118843460405f2054612550565b815f52600e60205260405f205561189d34600954612550565b6009819055600a545f928352600f6020908152604080852054600e83529481902054815195865291850191909152830191909152606082015280608081015b0390a16118e7612b66565b6001600755005b634e487b7160e01b83526011600452602483fd5b60405162461bcd60e51b815260206004820152602b60248201527f596f7572206c6f616e20686173206265656e206c6971756964617465642c206360448201526a616e6e6f7420726570617960a81b6064820152608490fd5b60405162461bcd60e51b81526020600482015260146024820152734d75737420726570617920736f6d657468696e6760601b6044820152606490fd5b60405162461bcd60e51b8152602060048201526024808201527f4d757374207265706179206c657373207468616e20626f72726f77656420616d6044820152631bdd5b9d60e21b6064820152608490fd5b50346103235760206104f96119fc36612333565b906126a0565b5034610323578060031936011261032357602061ffff60085460c01c16604051908152f35b508060031936011261032357611a3b612d68565b6008546001600160a01b031615611b03576103e834023481046103e81434151715611aef57670de0b6b3a76400008110611aeb57611a799033612f14565b3315611ad757611a94670de0b6b3a764000061dead33613010565b6008805460ff60d01b1916600160d01b179055604051600181527f4f366f0dc5cd876e456f089309e0c62fc2bc0e116c6f6ae308c392b4ad45b5b990602090a180f35b634b637e8f60e11b81526004819052602490fd5b5080fd5b634e487b7160e01b82526011600452602482fd5b60405162461bcd60e51b81526020600482015260146024820152734d7573742073657420666565206164647265737360601b6044820152606490fd5b50346103235780600319360112610323576020601054604051908152f35b5034610323576020366003190112610323576104f9602091600435906002549050611b9482611b8f476009549061239f565b612550565b91612918565b34611d6a576020366003190112611d6a57600435611bb66129b5565b335f908152600d6020526040902060020154611bd390421161077a565b611bdb61255d565b335f908152600d60205260409020805460019091015490611c1790611c01908490612550565b611c0e476009549061239f565b60025491612918565b606381029080820460631490151715611d56576064900410611d06575f5160206130c85f395f51905f5290335f52600d602052611c588160405f2054612550565b335f52600d60205260405f2055611c708133306129d5565b335f52600d602052600260405f200154805f52600f602052611c968260405f2054612550565b5f828152600f6020908152604090912091909155600e9052600954600a5490926118dc91611cc49190612550565b80600a55825f52600f60205260405f2054925f52600e60205260405f205493604051948594859094939260609260808301968352602083015260408201520152565b60405162461bcd60e51b815260206004820152602260248201527f526571756972652039392520636f6c6c61746572616c697a6174696f6e207261604482015261746560f01b6064820152608490fd5b634e487b7160e01b5f52601160045260245ffd5b5f80fd5b34611d6a575f366003190112611d6a57602060405160128152f35b34611d6a575f366003190112611d6a5761000e61255d565b34611d6a576060366003190112611d6a57610951611dbd612373565b611dc5612389565b60443591611dd4833383612d8f565b6129d5565b34611d6a576020366003190112611d6a5760206103e8611e02610f1b61088f476009549061239f565b04604051908152f35b34611d6a575f366003190112611d6a576020600254604051908152f35b34611d6a576020366003190112611d6a5760043561ffff811690818103611d6a57611e51612d68565b60198211611ea6576008805461ffff60c01b191660c09290921b61ffff60c01b169190911790556040519081527fd4e469371f09a592c9c4fde36ed11fd123a8cc55d93bd2920ea6ad544dff439590602090a1005b60405162461bcd60e51b815260206004820152602260248201527f6c657665726167652062757920666565206d757374206265206c65737320322e604482015261352560f01b6064820152608490fd5b34611d6a575f366003190112611d6a57602061ffff60085460b01c16604051908152f35b34611d6a57611f2836612333565b611f306129b5565b611f3d61016e8210612425565b811590611f4a8215612487565b335f908152600d602052604090206002015442116120a0575b335f52600d602052600160405f20015461205b57611f7f61255d565b620151808102818104620151801482151715611d5657611551611fa391429061239f565b611fad82856123ac565b926003840284810460031485151715611d5657600a900492611fce866126ca565b91606387029687046063141715611d5657610cb56104d59460646118e7980492600360405191611ffd836123d3565b86835260208301868152604084019089825260608501928352335f52600d60205260405f2094518555516001850155516002840155519101556120418430336129d5565b61204e6103e88211612504565b6103c4610caf8885612550565b60405162461bcd60e51b815260206004820152601d60248201527f55736520626f72726f774d6f726520746f20626f72726f77206d6f72650000006044820152606490fd5b335f52600d6020526120c660405f2060035f918281558260018201558260028201550155565b611f63565b34611d6a576020366003190112611d6a5760206104f96120ee476009549061239f565b60025490600435612918565b34611d6a576040366003190112611d6a57612113612373565b60243590331561218f576001600160a01b031690811561217c57335f52600160205260405f20825f526020528060405f20556040519081527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560203392a3602060405160018152f35b634a1406b160e11b5f525f60045260245ffd5b63e602df0560e01b5f525f60045260245ffd5b34611d6a575f366003190112611d6a576040515f6003548060011c9060018116801561228c575b6020831081146122785782855290811561225457506001146121f6575b61092683610db181850382612403565b91905060035f527fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b915f905b80821061223a57509091508101602001610db16121e6565b919260018160209254838588010152019101909291612222565b60ff191660208086019190915291151560051b84019091019150610db190506121e6565b634e487b7160e01b5f52602260045260245ffd5b91607f16916121c9565b34611d6a575f366003190112611d6a576020600c54604051908152f35b34611d6a5760206104f96122c636612333565b906123ac565b34611d6a575f366003190112611d6a576020600954604051908152f35b34611d6a576020366003190112611d6a576040600435612308816127af565b5f52600e60205261231c825f2054916127af565b5f52600f602052815f205482519182526020820152f35b6040906003190112611d6a576004359060243590565b602060409281835280519182918282860152018484015e5f828201840152601f01601f1916010190565b600435906001600160a01b0382168203611d6a57565b602435906001600160a01b0382168203611d6a57565b91908201809211611d5657565b906123b690612811565b66038d7ea4c680008101809111611d56576123d091612895565b90565b6080810190811067ffffffffffffffff8211176123ef57604052565b634e487b7160e01b5f52604160045260245ffd5b90601f8019910116810190811067ffffffffffffffff8211176123ef57604052565b1561242c57565b60405162461bcd60e51b815260206004820152602d60248201527f4d617820626f72726f772f657874656e73696f6e206d7573742062652033363560448201526c2064617973206f72206c65737360981b6064820152608490fd5b1561248e57565b60405162461bcd60e51b815260206004820152601760248201527f4d75737420626f72726f77206d6f7265207468616e20300000000000000000006044820152606490fd5b81810292918115918404141715611d5657565b81156124f0570490565b634e487b7160e01b5f52601260045260245ffd5b1561250b57565b60405162461bcd60e51b815260206004820152601d60248201527f46656573206d75737420626520686967686572207468616e206d696e2e0000006044820152606490fd5b91908203918211611d5657565b5f805b60105491428310156125b15761258661259a91845f52600f60205260405f20549061239f565b91835f52600e60205260405f20549061239f565b91620151808101809111611d565760105590612560565b90915080612616575b50806125c35750565b6125cf81600954612550565b6009556010546201517f19810191908211611d56577f253e5385159062a101837d58c10ad4694c58979ebc3ba6b5cb2cbba2fe4616929160409182519182526020820152a1565b8061262661262f92600a54612550565b600a5530612e2f565b5f6125ba565b1561263c57565b60405162461bcd60e51b815260206004820152603660248201527f596f7572206c6f616e20686173206265656e206c6971756964617465642c206e6044820152756f20636f6c6c61746572616c20746f2072656d6f766560501b6064820152608490fd5b6126c46123d0926103e86126bd61ffff60085460c01c16856124d3565b04926123ac565b9061239f565b6126e46126da476009549061239f565b91600254906124d3565b5f1982019190818311611d56576123d0926126fe9161239f565b6124e6565b1561270a57565b60405162461bcd60e51b815260206004820152601b60248201527f54726164696e67206d75737420626520696e697469616c697a656400000000006044820152606490fd5b6001600160a01b03165f818152600d60205260409020600201549091904211612791575f918252600d6020526040909120805460018201546002909201549092565b5f915081908190565b906126da6126e491611b8f476009549061239f565b6127bf9062015180810690612550565b620151808101809111611d565790565b156127d657565b60405162461bcd60e51b815260206004820152601360248201527236bab9ba103a3930b2329037bb32b91036b4b760691b6044820152606490fd5b5f9080668a8e4b1a3d800002915f1982668a8e4b1a3d800009838082109103818114612889570361016d111561287757509061016d7f4ff4c73064ff4c73064ff4c73064ff4c73064ff4c73064ff4c73064ff4c7306592668a8e4b1a3d80000990030290565b634e487b71905260116020526024601cfd5b5050505061016d900490565b9190915f838202915f19858209918380841093039280840393146129055782670de0b6b3a7640000111561287757507faccb18165bd6fe31ae1cf318dc5b51eee0e1ba569b88cd74c1773b91fac106699394670de0b6b3a7640000910990828211900360ee1b910360121c170290565b505050670de0b6b3a76400009192500490565b91818302915f19818509938380861095039480860395146129a857848311156129905790829109815f0382168092046002816003021880820260020302808202600203028082026002030280820260020302808202600203028091026002030293600183805f03040190848311900302920304170290565b82634e487b715f52156003026011186020526024601cfd5b5050906123d092506124e6565b6002600754146129c6576002600755565b633ee5aeb560e01b5f5260045ffd5b91906001600160a01b03831615612a13576001600160a01b03811615612a00576129fe92613010565b565b63ec442f0560e01b5f525f60045260245ffd5b634b637e8f60e11b5f525f60045260245ffd5b905f80808084865af13d15612ae8573d67ffffffffffffffff81116123ef5760405190612a5d601f8201601f191660200183612403565b81525f60203d92013e5b15612aaa57604080516001600160a01b03909316835260208301919091527f03bbe564cb1b78e43195eeadbde99e5b89b19345862807fcfb59f884e4165e2591a1565b60405162461bcd60e51b815260206004820152601660248201527529a7a724a1902a3930b739b332b9103330b4b632b21760511b6044820152606490fd5b612a67565b91612b61611cc4612b545f5160206130c85f395f51905f5295845f52600f602052612b1c8660405f205461239f565b855f52600f60205260405f2055845f52600e602052612b3f8160405f205461239f565b855f52600e60205260405f205560095461239f565b9384600955600a5461239f565b0390a1565b612b73476009549061239f565b670de0b6b3a7640000810290808204670de0b6b3a76400001490151715611d5657600254612ba0916124e6565b305f525f60205260405f2054600a5411612c495780600c5411612bfa576060817f4afcb4a87cdbd9974efdb92ee48bc8d7cd0ae4bf217004db3d080cbaee652ca792600c556040519042825260208201525f6040820152a1565b60405162461bcd60e51b815260206004820152602160248201527f546865207072696365206f6620656767732063616e6e6f7420646563726561736044820152606560f81b6064820152608490fd5b60405162461bcd60e51b815260206004820152605060248201527f54686520656767732062616c616e6365206f662074686520636f6e747261637460448201527f206d7573742062652067726561746572207468616e206f7220657175616c207460648201526f1bc81d1a194818dbdb1b185d195c985b60821b608482015260a490fd5b612cda476009549061239f565b670de0b6b3a7640000810290808204670de0b6b3a76400001490151715611d5657600254612d07916124e6565b90305f525f60205260405f2054600a5411612c495781600c5411612bfa57600c8290556040805142815260208101939093528201527f4afcb4a87cdbd9974efdb92ee48bc8d7cd0ae4bf217004db3d080cbaee652ca7908060608101612b61565b6005546001600160a01b03163303612d7c57565b63118cdaa760e01b5f523360045260245ffd5b6001600160a01b039081165f8181526001602081815260408084209587168452949052929020549392918401612dc6575b50505050565b828410612e0c57801561218f576001600160a01b0382161561217c575f52600160205260405f209060018060a01b03165f5260205260405f20910390555f808080612dc0565b508290637dc7a0d960e11b5f5260018060a01b031660045260245260445260645ffd5b9091906001600160a01b03168015612a1357805f525f60205260405f2054838110612e86576020845f94955f5160206130e85f395f51905f52938587528684520360408620558060025403600255604051908152a3565b915063391434e360e21b5f5260045260245260445260645ffd5b91612b61611cc4612f075f5160206130c85f395f51905f5295845f52600f602052612ecf8660405f2054612550565b855f52600f60205260405f2055845f52600e602052612ef28160405f2054612550565b855f52600e60205260405f2055600954612550565b9384600955600a54612550565b6001600160a01b0316908115612fcb576c01431e0fae6d7217caa0000000612f3e82600b5461239f565b80600b5511612f97575f5160206130e85f395f51905f5260205f92612f658160025461239f565b60025584158414612f825780600254036002555b604051908152a3565b84845283825260408420818154019055612f79565b60405162461bcd60e51b815260206004820152600c60248201526b4e4f204d4f5245204547475360a01b6044820152606490fd5b60405162461bcd60e51b815260206004820152601c60248201527f43616e2774206d696e7420746f20746f203078302061646472657373000000006044820152606490fd5b6001600160a01b031690816130755760205f5160206130e85f395f51905f529161303c8560025461239f565b6002555b6001600160a01b03169384613060578060025403600255604051908152a3565b845f525f825260405f20818154019055612f79565b815f525f60205260405f20548381106130ac575f5160206130e85f395f51905f529184602092855f525f84520360405f2055613040565b91905063391434e360e21b5f5260045260245260445260645ffdfeaec00f5213a37254bc68a26b0685d1a5b2bf513e1e587c94c7df7f4a62b56c9cddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa26469706673582212204edfd36584b38438891396de6fc8133fb299fd62754157f4fb601413eae72bdc64736f6c634300081c0033
Deployed Bytecode
0x60806040526004361015610010575b005b5f5f3560e01c8063024cad3b146122e95780630307c4a1146122cc578063035b7c4b146122b3578063053f14da1461229657806306fdde03146121a2578063095ea7b3146120fa5780630df1ff24146120cb5780630ecbcdab14611f1a578063162b51fc14611ef657806317a5a97e14611e2857806318160ddd14611e0b5780631fb87f3914611dd957806323b872dd14611da157806328a0702514611d89578063313ce56714611d6e5780633237c15814611b9a57806333e516d514611b5d5780633421f75014611b3f57806335975a3714611a2757806336189d4314611a025780633be4e598146119e8578063402d8883146117ca57806342966c68146117ac57806342c95e191461178d5780634fbf3ab0146117635780635e96263c146114b457806370a082311461147c57806370c476711461135a57806370f84ba914611312578063715018a6146112ab57806379ba50971461122357806379cc6790146111ef5780637ace2ac9146110125780638705fcd414610f49578063886433ac14610eef5780638da5cb5b14610ec65780638f818b9014610ea157806395ced06f14610e5f57806395d89b4114610d5a5780639d0bf2e914610b115780639d41ac3a1461097a578063a2309ff81461095c578063a9059cbb1461092a578063a925e4a4146108bf578063abd545bf1461089a578063b6013e9a1461086a578063bd0fe67914610850578063be9a65551461082a578063c393d0e314610736578063c94220ab14610715578063c962a4b5146106eb578063d5abeb01146106c3578063d6eb5910146106a5578063dd62ed3e14610652578063e064648a1461052a578063e30c397814610501578063e3eb5ed3146104da578063e4849b3214610454578063eb1edd611461042b578063f088d547146103265763f2fde38b146102b657005b34610323576020366003190112610323576102cf612373565b6102d7612d68565b600680546001600160a01b0319166001600160a01b039283169081179091556005549091167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e227008380a380f35b80fd5b5060203660031901126103235761033b612373565b6103436129b5565b61034b61255d565b6008549061035e60ff8360d01c16612703565b6001600160a01b038116156103e6576103e86103a96103b09361ffff61039e600254610397610390476009549061239f565b3490612550565b9034612918565b9160b01c16906124d3565b0490612f14565b6103d5607d34046103c46103e882116127cf565b6008546001600160a01b0316612a26565b6103de34612ccd565b600160075580f35b60405162461bcd60e51b815260206004820152601e60248201527f52656369657665722063616e6e6f7420626520307830206164647265737300006044820152606490fd5b50346103235780600319360112610323576008546040516001600160a01b039091168152602090f35b5034610323576020366003190112610323576103de6004356104746129b5565b61047c61255d565b6104d561049961048f476009549061239f565b6002549084612918565b916104a8607d84049133612e2f565b6104c86103e86104c161ffff60085460a01c16866124d3565b0433612a26565b6103c46103e882116127cf565b612ccd565b50346103235760203660031901126103235760206104f96004356127af565b604051908152f35b50346103235780600319360112610323576006546040516001600160a01b039091168152602090f35b50346103235760203660031901126103235760043561ffff81169081810361064e57610554612d68565b6103e082116105f9576103cf82106105b4576008805461ffff60a01b191660a09290921b61ffff60a01b169190911790556040519081527f495ee53ee22006979ebc689a00ed737d7c13b6419142f82dcaea4ed95ac1e78090602090a180f35b60405162461bcd60e51b815260206004820152601f60248201527f73656c6c20666565206d757374206265206c657373207468616e20322e3525006044820152606490fd5b60405162461bcd60e51b815260206004820152602760248201527f73656c6c20666565206d7573742062652067726561746572207468616e2046456044820152661154d7d4d1531360ca1b6064820152608490fd5b8280fd5b503461032357604036600319011261032357604061066e612373565b91610677612389565b9260018060a01b031681526001602052209060018060a01b03165f52602052602060405f2054604051908152f35b50346103235780600319360112610323576020600a54604051908152f35b503461032357806003193601126103235760206040516c01431e0fae6d7217caa00000008152f35b50346103235760203660031901126103235760406020916004358152600f83522054604051908152f35b50346103235780600319360112610323575060206104f9476009549061239f565b50806003193601126103235761074a6129b5565b33808252600d602081815260408085206001015484865292909152808420545f9384529220600201546107809042115b15612635565b3481036107da57816107966107ac9333306129d5565b338452600d602052600260408520015491612ea0565b338152600d6020526107d26040822060035f918281558260018201558260028201550155565b6103de612b66565b60405162461bcd60e51b815260206004820152602260248201527f4d7573742072657475726e20656e7469726520626f72726f77656420616d6f756044820152611b9d60f21b6064820152608490fd5b5034610323578060031936011261032357602060ff60085460d01c166040519015158152f35b50346103235760206104f961086436612333565b9061279a565b5034610323576020366003190112610323575060206104f961088f476009549061239f565b600254600435612918565b5034610323578060031936011261032357602061ffff60085460a01c16604051908152f35b5034610323576020366003190112610323576040906001600160a01b036108e4612373565b168152600d6020522080546109266001830154926003600282015491015490604051948594859094939260609260808301968352602083015260408201520152565b0390f35b503461032357604036600319011261032357610951610947612373565b60243590336129d5565b602060405160018152f35b50346103235780600319360112610323576020600b54604051908152f35b50346103235780600319360112610323576109936129b5565b335f908152600d60205260409020600201546109b090421161077a565b6109b861255d565b338152600d6020526001604082200154338252600d60205260408220546109ef6109e5476009549061239f565b6002549083612918565b6109f98230612e2f565b6063810281810460631482151715610a9c576064809104910490838110610ab05783610a2491612550565b90600381029080820460031490151715610a9c5791610a5f610a7692610a52600a6103de9796049133612a26565b6103c46103e88211612504565b338552600d60205260026040862001549083612ea0565b338352600d6020526104d56040842060035f918281558260018201558260028201550155565b634e487b7160e01b85526011600452602485fd5b60405162461bcd60e51b815260206004820152603360248201527f596f7520646f206e6f74206861766520656e6f75676820636f6c6c617465726160448201527236103a379031b637b9b2903837b9b4ba34b7b760691b6064820152608490fd5b503461032357602036600319011261032357600435610b2e6129b5565b335f908152600d60205260409020600201544211610d15578015610b528115612487565b610b5a61255d565b338352600d602052600160408420015491338452600d602052604084205492338552600d60205260026040862001549262015180610ba0610b9a426127af565b86612550565b0494610bac86856123ac565b95610bb6856126ca565b610bcf610bc6476009549061239f565b60025487612918565b6063840284810460631485151715610d0157906064610bee9204612550565b818110610cf257505087945b6003880288810460031489151715610cde57600a900493606382029182046063141715610cca57926103de979694926003610ca2938b610c4c8a610c4660646104d59d9b04809a61239f565b9561239f565b9360405194610c5a866123d3565b8552602085019081526040808601928b845260608701948552338152600d60205220945185555160018501555160028401555191015583610cba576103c46103e88211612504565b610cb5610caf8683612550565b33612a26565b612aed565b610cc58430336129d5565b610a52565b634e487b7160e01b89526011600452602489fd5b634e487b7160e01b8a52601160045260248afd5b610cfb91612550565b94610bfa565b634e487b7160e01b8b52601160045260248bfd5b60405162461bcd60e51b815260206004820152601760248201527f4c6f616e20657870697265642075736520626f72726f770000000000000000006044820152606490fd5b50346103235780600319360112610323576040519080600454908160011c91600181168015610e55575b602084108114610e4157838652908115610e1a5750600114610dbd575b61092684610db181860382612403565b60405191829182612349565b600481527f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b939250905b808210610e0057509091508101602001610db182610da1565b919260018160209254838588010152019101909291610de7565b60ff191660208087019190915292151560051b85019092019250610db19150839050610da1565b634e487b7160e01b83526022600452602483fd5b92607f1692610d84565b503461032357602036600319011261032357610926610e84610e7f612373565b61274f565b604080519384526020840192909252908201529081906060820190565b5034610323578060031936011261032357602061ffff60085460b01c16604051908152f35b50346103235780600319360112610323576005546040516001600160a01b039091168152602090f35b5034610323576020366003190112610323576103e8602091610f3e610f2b610f1b6002546004356124d3565b61ffff60085460b01c16906124d3565b610f38476009549061239f565b906124e6565b905004604051908152f35b503461032357602036600319011261032357610f63612373565b610f6b612d68565b6001600160a01b03168015610fc1576020817f446e39bcf1b47cfadfaa23442cb4b34682cfe6bd9220da084894e3b1f834e4f3926bffffffffffffffffffffffff60a01b6008541617600855604051908152a180f35b60405162461bcd60e51b8152602060048201526024808201527f43616e27742073657420666565206164647265737320746f20307830206164646044820152637265737360e01b6064820152608490fd5b5060203660031901126103235760043561102a6129b5565b338252600d602052600260408320015491338152600d602052600160408220015491338252600d602052604082205490338352600d602052600360408420015491620151808202828104620151801483151715610a9c5761108b908761239f565b9461109683826123ac565b335f908152600d60205260409020600201549097906110b690421161077a565b3488036111aa5760038802888104600314891517156111965761113195889561110961016e9a620151809a97600397610cb5604098611102600a61111e9a046103c46103e88211612504565b8383612ea0565b338652600d602052866002858820015561239f565b92338152600d6020522001554290612550565b0410156111515760209061114434612ccd565b6001600755604051908152f35b60405162461bcd60e51b815260206004820152601b60248201527f4c6f616e206d75737420626520756e64657220333635206461797300000000006044820152606490fd5b634e487b7160e01b87526011600452602487fd5b60405162461bcd60e51b815260206004820152601c60248201527f4c6f616e20657874656e73696f6e2066656520696e636f7272656374000000006044820152606490fd5b50346103235760403660031901126103235761122061120c612373565b6024359061121b823383612d8f565b612e2f565b80f35b5034610323578060031936011261032357600654336001600160a01b039091160361129857600680546001600160a01b0319908116909155600580543392811683179091556001600160a01b03167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08380a380f35b63118cdaa760e01b815233600452602490fd5b50346103235780600319360112610323576112c4612d68565b600680546001600160a01b031990811690915560058054918216905581906001600160a01b03167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a380f35b5034610323576020366003190112610323576020611350611331612373565b6001600160a01b03165f908152600d6020526040902060020154421190565b6040519015158152f35b50346103235760203660031901126103235760043561ffff81169081810361064e57611384612d68565b6103e08211611429576103cf82106113e4576008805461ffff60b01b191660b09290921b61ffff60b01b169190911790556040519081527f7c1445c98b278c9970d007fca6048704bcb25af7cc4a04eb56565d9a9f149ca390602090a180f35b60405162461bcd60e51b815260206004820152601e60248201527f62757920666565206d757374206265206c657373207468616e20322e352500006044820152606490fd5b60405162461bcd60e51b815260206004820152602560248201527f62757920666565206d7573742062652067726561746572207468616e20464545604482015264535f42555960d81b6064820152608490fd5b5034610323576020366003190112610323576020906040906001600160a01b036114a4612373565b1681528083522054604051908152f35b506114be36612333565b906114c76129b5565b6114d860ff60085460d01c16612703565b6114e561016e8310612425565b338352600d602052604083206040516114fd816123d3565b81548152606060036001840154938460208501526002810154604085015201549101526116c5575b61152d61255d565b6201518082028281046201518014831517156116b15761155161155691429061239f565b6127af565b61156083836126a0565b9261156b8484612550565b90600385028581046003148615171561119657600a900492606383028381046063148415171561169d57606490046115b0606485046115aa818861239f565b9861239f565b8881341161167e575b6115c39034612550565b03611639576115e56115da6103de9860039661279a565b95610a528730612f14565b6115f0828683612aed565b604051946115fd866123d3565b8552602085019081526040850191825260608501928352338852600d602052604088209451855551600185015551600284015551910155612ccd565b60405162461bcd60e51b815260206004820152601b60248201527f496e73756666696369656e7420736f6e6963206665652073656e7400000000006044820152606490fd5b506115c361168c8234612550565b6116968133612a26565b90506115b9565b634e487b7160e01b88526011600452602488fd5b634e487b7160e01b84526011600452602484fd5b335f908152600d60205260409020600201544211611738575b338352600d6020526001604084200154156115255760405162461bcd60e51b815260206004820152601960248201527f557365206163636f756e742077697468206e6f206c6f616e73000000000000006044820152606490fd5b338352600d60205261175e6040842060035f918281558260018201558260028201550155565b6116de565b50346103235760203660031901126103235760406020916004358152600e83522054604051908152f35b50346103235760203660031901126103235760206104f96004356126ca565b50346103235760203660031901126103235761122060043533612e2f565b5080600319360112610323576117de6129b5565b338152600d60205260016040822001543481111561199757341561195b57335f908152600d602052604090206002015442116119025761181f903490612550565b338252600d6020526001604083200155338152600d6020526002604082200154808252600f6020526040822054826118ee575f5160206130c85f395f51905f529250815f52600f60205260405f2055805f52600e6020526118843460405f2054612550565b815f52600e60205260405f205561189d34600954612550565b6009819055600a545f928352600f6020908152604080852054600e83529481902054815195865291850191909152830191909152606082015280608081015b0390a16118e7612b66565b6001600755005b634e487b7160e01b83526011600452602483fd5b60405162461bcd60e51b815260206004820152602b60248201527f596f7572206c6f616e20686173206265656e206c6971756964617465642c206360448201526a616e6e6f7420726570617960a81b6064820152608490fd5b60405162461bcd60e51b81526020600482015260146024820152734d75737420726570617920736f6d657468696e6760601b6044820152606490fd5b60405162461bcd60e51b8152602060048201526024808201527f4d757374207265706179206c657373207468616e20626f72726f77656420616d6044820152631bdd5b9d60e21b6064820152608490fd5b50346103235760206104f96119fc36612333565b906126a0565b5034610323578060031936011261032357602061ffff60085460c01c16604051908152f35b508060031936011261032357611a3b612d68565b6008546001600160a01b031615611b03576103e834023481046103e81434151715611aef57670de0b6b3a76400008110611aeb57611a799033612f14565b3315611ad757611a94670de0b6b3a764000061dead33613010565b6008805460ff60d01b1916600160d01b179055604051600181527f4f366f0dc5cd876e456f089309e0c62fc2bc0e116c6f6ae308c392b4ad45b5b990602090a180f35b634b637e8f60e11b81526004819052602490fd5b5080fd5b634e487b7160e01b82526011600452602482fd5b60405162461bcd60e51b81526020600482015260146024820152734d7573742073657420666565206164647265737360601b6044820152606490fd5b50346103235780600319360112610323576020601054604051908152f35b5034610323576020366003190112610323576104f9602091600435906002549050611b9482611b8f476009549061239f565b612550565b91612918565b34611d6a576020366003190112611d6a57600435611bb66129b5565b335f908152600d6020526040902060020154611bd390421161077a565b611bdb61255d565b335f908152600d60205260409020805460019091015490611c1790611c01908490612550565b611c0e476009549061239f565b60025491612918565b606381029080820460631490151715611d56576064900410611d06575f5160206130c85f395f51905f5290335f52600d602052611c588160405f2054612550565b335f52600d60205260405f2055611c708133306129d5565b335f52600d602052600260405f200154805f52600f602052611c968260405f2054612550565b5f828152600f6020908152604090912091909155600e9052600954600a5490926118dc91611cc49190612550565b80600a55825f52600f60205260405f2054925f52600e60205260405f205493604051948594859094939260609260808301968352602083015260408201520152565b60405162461bcd60e51b815260206004820152602260248201527f526571756972652039392520636f6c6c61746572616c697a6174696f6e207261604482015261746560f01b6064820152608490fd5b634e487b7160e01b5f52601160045260245ffd5b5f80fd5b34611d6a575f366003190112611d6a57602060405160128152f35b34611d6a575f366003190112611d6a5761000e61255d565b34611d6a576060366003190112611d6a57610951611dbd612373565b611dc5612389565b60443591611dd4833383612d8f565b6129d5565b34611d6a576020366003190112611d6a5760206103e8611e02610f1b61088f476009549061239f565b04604051908152f35b34611d6a575f366003190112611d6a576020600254604051908152f35b34611d6a576020366003190112611d6a5760043561ffff811690818103611d6a57611e51612d68565b60198211611ea6576008805461ffff60c01b191660c09290921b61ffff60c01b169190911790556040519081527fd4e469371f09a592c9c4fde36ed11fd123a8cc55d93bd2920ea6ad544dff439590602090a1005b60405162461bcd60e51b815260206004820152602260248201527f6c657665726167652062757920666565206d757374206265206c65737320322e604482015261352560f01b6064820152608490fd5b34611d6a575f366003190112611d6a57602061ffff60085460b01c16604051908152f35b34611d6a57611f2836612333565b611f306129b5565b611f3d61016e8210612425565b811590611f4a8215612487565b335f908152600d602052604090206002015442116120a0575b335f52600d602052600160405f20015461205b57611f7f61255d565b620151808102818104620151801482151715611d5657611551611fa391429061239f565b611fad82856123ac565b926003840284810460031485151715611d5657600a900492611fce866126ca565b91606387029687046063141715611d5657610cb56104d59460646118e7980492600360405191611ffd836123d3565b86835260208301868152604084019089825260608501928352335f52600d60205260405f2094518555516001850155516002840155519101556120418430336129d5565b61204e6103e88211612504565b6103c4610caf8885612550565b60405162461bcd60e51b815260206004820152601d60248201527f55736520626f72726f774d6f726520746f20626f72726f77206d6f72650000006044820152606490fd5b335f52600d6020526120c660405f2060035f918281558260018201558260028201550155565b611f63565b34611d6a576020366003190112611d6a5760206104f96120ee476009549061239f565b60025490600435612918565b34611d6a576040366003190112611d6a57612113612373565b60243590331561218f576001600160a01b031690811561217c57335f52600160205260405f20825f526020528060405f20556040519081527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560203392a3602060405160018152f35b634a1406b160e11b5f525f60045260245ffd5b63e602df0560e01b5f525f60045260245ffd5b34611d6a575f366003190112611d6a576040515f6003548060011c9060018116801561228c575b6020831081146122785782855290811561225457506001146121f6575b61092683610db181850382612403565b91905060035f527fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b915f905b80821061223a57509091508101602001610db16121e6565b919260018160209254838588010152019101909291612222565b60ff191660208086019190915291151560051b84019091019150610db190506121e6565b634e487b7160e01b5f52602260045260245ffd5b91607f16916121c9565b34611d6a575f366003190112611d6a576020600c54604051908152f35b34611d6a5760206104f96122c636612333565b906123ac565b34611d6a575f366003190112611d6a576020600954604051908152f35b34611d6a576020366003190112611d6a576040600435612308816127af565b5f52600e60205261231c825f2054916127af565b5f52600f602052815f205482519182526020820152f35b6040906003190112611d6a576004359060243590565b602060409281835280519182918282860152018484015e5f828201840152601f01601f1916010190565b600435906001600160a01b0382168203611d6a57565b602435906001600160a01b0382168203611d6a57565b91908201809211611d5657565b906123b690612811565b66038d7ea4c680008101809111611d56576123d091612895565b90565b6080810190811067ffffffffffffffff8211176123ef57604052565b634e487b7160e01b5f52604160045260245ffd5b90601f8019910116810190811067ffffffffffffffff8211176123ef57604052565b1561242c57565b60405162461bcd60e51b815260206004820152602d60248201527f4d617820626f72726f772f657874656e73696f6e206d7573742062652033363560448201526c2064617973206f72206c65737360981b6064820152608490fd5b1561248e57565b60405162461bcd60e51b815260206004820152601760248201527f4d75737420626f72726f77206d6f7265207468616e20300000000000000000006044820152606490fd5b81810292918115918404141715611d5657565b81156124f0570490565b634e487b7160e01b5f52601260045260245ffd5b1561250b57565b60405162461bcd60e51b815260206004820152601d60248201527f46656573206d75737420626520686967686572207468616e206d696e2e0000006044820152606490fd5b91908203918211611d5657565b5f805b60105491428310156125b15761258661259a91845f52600f60205260405f20549061239f565b91835f52600e60205260405f20549061239f565b91620151808101809111611d565760105590612560565b90915080612616575b50806125c35750565b6125cf81600954612550565b6009556010546201517f19810191908211611d56577f253e5385159062a101837d58c10ad4694c58979ebc3ba6b5cb2cbba2fe4616929160409182519182526020820152a1565b8061262661262f92600a54612550565b600a5530612e2f565b5f6125ba565b1561263c57565b60405162461bcd60e51b815260206004820152603660248201527f596f7572206c6f616e20686173206265656e206c6971756964617465642c206e6044820152756f20636f6c6c61746572616c20746f2072656d6f766560501b6064820152608490fd5b6126c46123d0926103e86126bd61ffff60085460c01c16856124d3565b04926123ac565b9061239f565b6126e46126da476009549061239f565b91600254906124d3565b5f1982019190818311611d56576123d0926126fe9161239f565b6124e6565b1561270a57565b60405162461bcd60e51b815260206004820152601b60248201527f54726164696e67206d75737420626520696e697469616c697a656400000000006044820152606490fd5b6001600160a01b03165f818152600d60205260409020600201549091904211612791575f918252600d6020526040909120805460018201546002909201549092565b5f915081908190565b906126da6126e491611b8f476009549061239f565b6127bf9062015180810690612550565b620151808101809111611d565790565b156127d657565b60405162461bcd60e51b815260206004820152601360248201527236bab9ba103a3930b2329037bb32b91036b4b760691b6044820152606490fd5b5f9080668a8e4b1a3d800002915f1982668a8e4b1a3d800009838082109103818114612889570361016d111561287757509061016d7f4ff4c73064ff4c73064ff4c73064ff4c73064ff4c73064ff4c73064ff4c7306592668a8e4b1a3d80000990030290565b634e487b71905260116020526024601cfd5b5050505061016d900490565b9190915f838202915f19858209918380841093039280840393146129055782670de0b6b3a7640000111561287757507faccb18165bd6fe31ae1cf318dc5b51eee0e1ba569b88cd74c1773b91fac106699394670de0b6b3a7640000910990828211900360ee1b910360121c170290565b505050670de0b6b3a76400009192500490565b91818302915f19818509938380861095039480860395146129a857848311156129905790829109815f0382168092046002816003021880820260020302808202600203028082026002030280820260020302808202600203028091026002030293600183805f03040190848311900302920304170290565b82634e487b715f52156003026011186020526024601cfd5b5050906123d092506124e6565b6002600754146129c6576002600755565b633ee5aeb560e01b5f5260045ffd5b91906001600160a01b03831615612a13576001600160a01b03811615612a00576129fe92613010565b565b63ec442f0560e01b5f525f60045260245ffd5b634b637e8f60e11b5f525f60045260245ffd5b905f80808084865af13d15612ae8573d67ffffffffffffffff81116123ef5760405190612a5d601f8201601f191660200183612403565b81525f60203d92013e5b15612aaa57604080516001600160a01b03909316835260208301919091527f03bbe564cb1b78e43195eeadbde99e5b89b19345862807fcfb59f884e4165e2591a1565b60405162461bcd60e51b815260206004820152601660248201527529a7a724a1902a3930b739b332b9103330b4b632b21760511b6044820152606490fd5b612a67565b91612b61611cc4612b545f5160206130c85f395f51905f5295845f52600f602052612b1c8660405f205461239f565b855f52600f60205260405f2055845f52600e602052612b3f8160405f205461239f565b855f52600e60205260405f205560095461239f565b9384600955600a5461239f565b0390a1565b612b73476009549061239f565b670de0b6b3a7640000810290808204670de0b6b3a76400001490151715611d5657600254612ba0916124e6565b305f525f60205260405f2054600a5411612c495780600c5411612bfa576060817f4afcb4a87cdbd9974efdb92ee48bc8d7cd0ae4bf217004db3d080cbaee652ca792600c556040519042825260208201525f6040820152a1565b60405162461bcd60e51b815260206004820152602160248201527f546865207072696365206f6620656767732063616e6e6f7420646563726561736044820152606560f81b6064820152608490fd5b60405162461bcd60e51b815260206004820152605060248201527f54686520656767732062616c616e6365206f662074686520636f6e747261637460448201527f206d7573742062652067726561746572207468616e206f7220657175616c207460648201526f1bc81d1a194818dbdb1b185d195c985b60821b608482015260a490fd5b612cda476009549061239f565b670de0b6b3a7640000810290808204670de0b6b3a76400001490151715611d5657600254612d07916124e6565b90305f525f60205260405f2054600a5411612c495781600c5411612bfa57600c8290556040805142815260208101939093528201527f4afcb4a87cdbd9974efdb92ee48bc8d7cd0ae4bf217004db3d080cbaee652ca7908060608101612b61565b6005546001600160a01b03163303612d7c57565b63118cdaa760e01b5f523360045260245ffd5b6001600160a01b039081165f8181526001602081815260408084209587168452949052929020549392918401612dc6575b50505050565b828410612e0c57801561218f576001600160a01b0382161561217c575f52600160205260405f209060018060a01b03165f5260205260405f20910390555f808080612dc0565b508290637dc7a0d960e11b5f5260018060a01b031660045260245260445260645ffd5b9091906001600160a01b03168015612a1357805f525f60205260405f2054838110612e86576020845f94955f5160206130e85f395f51905f52938587528684520360408620558060025403600255604051908152a3565b915063391434e360e21b5f5260045260245260445260645ffd5b91612b61611cc4612f075f5160206130c85f395f51905f5295845f52600f602052612ecf8660405f2054612550565b855f52600f60205260405f2055845f52600e602052612ef28160405f2054612550565b855f52600e60205260405f2055600954612550565b9384600955600a54612550565b6001600160a01b0316908115612fcb576c01431e0fae6d7217caa0000000612f3e82600b5461239f565b80600b5511612f97575f5160206130e85f395f51905f5260205f92612f658160025461239f565b60025584158414612f825780600254036002555b604051908152a3565b84845283825260408420818154019055612f79565b60405162461bcd60e51b815260206004820152600c60248201526b4e4f204d4f5245204547475360a01b6044820152606490fd5b60405162461bcd60e51b815260206004820152601c60248201527f43616e2774206d696e7420746f20746f203078302061646472657373000000006044820152606490fd5b6001600160a01b031690816130755760205f5160206130e85f395f51905f529161303c8560025461239f565b6002555b6001600160a01b03169384613060578060025403600255604051908152a3565b845f525f825260405f20818154019055612f79565b815f525f60205260405f20548381106130ac575f5160206130e85f395f51905f529184602092855f525f84520360405f2055613040565b91905063391434e360e21b5f5260045260245260445260645ffdfeaec00f5213a37254bc68a26b0685d1a5b2bf513e1e587c94c7df7f4a62b56c9cddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa26469706673582212204edfd36584b38438891396de6fc8133fb299fd62754157f4fb601413eae72bdc64736f6c634300081c0033
Loading...
Loading
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.