Overview
ETH Balance
0 ETH
Eth Value
$0.00More Info
Private Name Tags
ContractCreator
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
This contract may be a proxy contract. Click on More Options and select Is this a proxy? to confirm and enable the "Read as Proxy" & "Write as Proxy" tabs.
Contract Source Code Verified (Exact Match)
Contract Name:
RepoTokenLinkedList
Compiler Version
v0.8.20+commit.a1b79de6
Optimization Enabled:
Yes with 200 runs
Other Settings:
paris EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity ^0.8.20; import {AccessControlUpgradeable} from "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol"; import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol"; import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol"; import {PausableUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/PausableUpgradeable.sol"; import {ReentrancyGuardUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/ReentrancyGuardUpgradeable.sol"; import {ERC20} from "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import {IERC20, SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import {RepoTokenLinkedListEventEmitter} from "./RepoTokenLinkedListEventEmitter.sol"; import {ITermDiscountRateAdapter} from "./interface/ITermDiscountRateAdapter.sol"; import {ITermRepoToken} from "./interface/ITermRepoToken.sol"; import {ITermRepoServicer} from "./interface/ITermRepoServicer.sol"; import {ITermController} from "./interface/ITermController.sol"; /// @title RepoTokenLinkedListStorageV1 /// @notice Storage contract for the RepoTokenLinkedList contract RepoTokenLinkedListStorageV1 { /// @notice Structure to represent a token listing /// @dev Uses a linked list structure for efficient management struct Listing { address seller; address token; uint256 amount; uint256 next; // Pointer to the next listing uint256 prev; // Pointer to the previous listing } /// @notice Structure to represent a queue for each Repo token struct Queue { uint256 head; uint256 tail; } mapping(address => bool) public repoTokenBlacklist; mapping(address => uint256) public totalListed; // Tracks the cumulative balance for each repoToken mapping(uint256 => Listing) public listings; // Linked list storage mapping(address => uint256) public minimumListingAmount; // Minimum purchase amount for each repoToken mapping(address => Queue) public queues; // Queue for each Repo token uint256 public nextId; // Counter to assign unique IDs to listings uint256 public discountRateMarkup; // Markup applied to the discount rate in RATE_PRECISION ITermDiscountRateAdapter public discountRateAdapter; } /// @title RepoTokenLinkedList /// @notice A marketplace for trading repo tokens /// @dev Implements upgradeable patterns and various security features contract RepoTokenLinkedList is Initializable, UUPSUpgradeable, AccessControlUpgradeable, ReentrancyGuardUpgradeable, PausableUpgradeable, RepoTokenLinkedListStorageV1 { using SafeERC20 for IERC20; using SafeERC20 for ERC20; ITermController public immutable TERM_CONTROLLER; RepoTokenLinkedListEventEmitter public immutable REPO_TOKEN_LINKED_LIST_EVENT_EMITTER; bytes32 public constant ADMIN_ROLE = keccak256("ADMIN_ROLE"); bytes32 public constant DEVOPS_ROLE = keccak256("DEVOPS_ROLE"); uint256 public constant RATE_PRECISION = 1e18; uint256 public constant MAX_MARKUP = 2e16; uint256 public constant REDEMPTION_VALUE_PRECISION = 1e18; // Term default is 18 decimal places uint256 public constant THREESIXTY_DAYCOUNT_SECONDS = 360 days; address public constant USDC = 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48; address public constant WETH = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2; /// @notice Contract constructor /// @param termController Address of the term controller contract /// @param repoTokenLinkedListEventEmitter Address of the event emitter contract constructor( address termController, address repoTokenLinkedListEventEmitter ) { _disableInitializers(); TERM_CONTROLLER = ITermController(termController); // make sure term controller is valid require(!TERM_CONTROLLER.isTermDeployed(address(0))); REPO_TOKEN_LINKED_LIST_EVENT_EMITTER = RepoTokenLinkedListEventEmitter(repoTokenLinkedListEventEmitter); } /// @notice Initializes the contract with admin and devops roles /// @param discountRateAdapter_ The address of the discount rate oracle /// @param adminWallet_ The address to be granted the admin role /// @param devopsWallet_ The address to be granted the devops role /// @dev Sets up roles and initializes the contract using OpenZeppelin's upgradeable pattern /// @dev See: https://docs.openzeppelin.com/contracts/4.x/upgradeable function initialize( address discountRateAdapter_, address adminWallet_, address devopsWallet_ ) external initializer { UUPSUpgradeable.__UUPSUpgradeable_init(); AccessControlUpgradeable.__AccessControl_init(); ReentrancyGuardUpgradeable.__ReentrancyGuard_init(); PausableUpgradeable.__Pausable_init(); discountRateAdapter = ITermDiscountRateAdapter(discountRateAdapter_); nextId = 1; minimumListingAmount[USDC] = 1000 * 1e6; // Set a default minimum purchase amount for USDC minimumListingAmount[WETH] = 5 * 1e17; // Set a default minimum purchase amount for WETH _grantRole(ADMIN_ROLE, adminWallet_); _grantRole(DEVOPS_ROLE, devopsWallet_); } /// @notice Modifier to check if a repo token is valid modifier onlyValidatedRepoToken(address repoToken) { require(isRepoTokenValid(repoToken), "RepoToken is not validated"); _; } /// @notice Sets the blacklist status for a repo token /// @param repoToken The address of the repo token /// @param blacklisted The blacklist status to set function setRepoTokenBlacklist(address repoToken, bool blacklisted) external onlyRole(ADMIN_ROLE) { // This function can be used to blacklist or unblacklist a repoToken repoTokenBlacklist[repoToken] = blacklisted; REPO_TOKEN_LINKED_LIST_EVENT_EMITTER.emitRepoTokenBlacklistUpdated(repoToken, blacklisted); } /// @notice Sets a new discount rate adapter /// @param newAdapter The address of the new discount rate adapter function setDiscountRateAdapter(address newAdapter) external onlyRole(ADMIN_ROLE) { ITermDiscountRateAdapter newDiscountAdapter = ITermDiscountRateAdapter(newAdapter); require(address(newDiscountAdapter.TERM_CONTROLLER()) != address(0)); REPO_TOKEN_LINKED_LIST_EVENT_EMITTER.emitDiscountRateAdapterUpdated( address(discountRateAdapter), newAdapter ); discountRateAdapter = newDiscountAdapter; } /// @notice Sets a new value for the discount rate markup /// @dev Only callable by accounts with the ADMIN_ROLE /// @param newMarkup The new markup value to set function setDiscountRateMarkup(uint256 newMarkup) external onlyRole(ADMIN_ROLE) { require(newMarkup < MAX_MARKUP, "Markup must be less than 2%"); uint256 oldMarkup = discountRateMarkup; discountRateMarkup = newMarkup; } function manageMinimumListing(address token, uint256 amount) external onlyRole(ADMIN_ROLE) { require(amount > 0, "Amount must be greater than 0"); uint256 oldAmount = minimumListingAmount[token]; minimumListingAmount[token] = amount; REPO_TOKEN_LINKED_LIST_EVENT_EMITTER.emitMinListingAmountUpdated(oldAmount, amount); } /// @notice Pauses the contract function pause() external onlyRole(ADMIN_ROLE) { _pause(); REPO_TOKEN_LINKED_LIST_EVENT_EMITTER.emitPaused(); } /// @notice Unpauses the contract function unpause() external onlyRole(ADMIN_ROLE) { _unpause(); REPO_TOKEN_LINKED_LIST_EVENT_EMITTER.emitUnpaused(); } /// @notice Creates a new listing for a repo token /// @param repoToken The address of the repo token to list /// @param amount The amount of tokens to list function createListing(address repoToken, uint256 amount) external nonReentrant whenNotPaused onlyValidatedRepoToken(repoToken) { require(amount > 0, "Amount must be greater than 0"); ITermRepoToken termRepoToken = ITermRepoToken(repoToken); (, address purchaseTokenAddr, ,) = termRepoToken.config(); // Ensure the repoToken is valid require(minimumListingAmount[purchaseTokenAddr] > 0, "No miminimum listing amount set for token"); require(amount >= minimumListingAmount[purchaseTokenAddr], "Amount is less than minimum listing amount"); // Transfer the tokens to the contract require(IERC20(repoToken).transferFrom(msg.sender, address(this), amount), "Token transfer failed"); uint256 listingId = nextId++; listings[listingId] = Listing({ seller: msg.sender, token: repoToken, amount: amount, next: 0, prev: 0 }); Queue storage queue = queues[repoToken]; if (queue.tail != 0) { listings[queue.tail].next = listingId; listings[listingId].prev = queue.tail; } queue.tail = listingId; if (queue.head == 0) { queue.head = listingId; } totalListed[repoToken] += amount; // Increment the total listed amount for this repoToken REPO_TOKEN_LINKED_LIST_EVENT_EMITTER.emitNewListing(listingId, msg.sender, repoToken, amount); } /// @notice Allows a user to purchase repo tokens /// @param desiredAmount The amount of tokens to purchase /// @param repoToken The address of the repo token to purchase function purchase( uint256 desiredAmount, address repoToken ) external nonReentrant whenNotPaused onlyValidatedRepoToken(repoToken) { require(desiredAmount <= totalListed[repoToken], "Desired amount exceeds total listed tokens"); (uint256 redemptionTimestamp, address purchaseToken, ,) = ITermRepoToken(repoToken).config(); uint256 timeToMaturity = redemptionTimestamp > block.timestamp ? redemptionTimestamp - block.timestamp : 0; uint256 rate = discountRateAdapter.getDiscountRate(repoToken); require(rate > 0 && rate < RATE_PRECISION, "Discount rate out of valid range"); uint256 numerator = ITermRepoToken(repoToken).redemptionValue() * RATE_PRECISION * THREESIXTY_DAYCOUNT_SECONDS; uint256 denominator = RATE_PRECISION * THREESIXTY_DAYCOUNT_SECONDS + ((rate - discountRateMarkup) * timeToMaturity); uint256 pricePerToken = (numerator / denominator); require(pricePerToken > 0, "No valid pricePerToken calculated for the specified repoToken"); _purchase(repoToken, purchaseToken, desiredAmount, pricePerToken); } /// @notice Allows a user to purchase repo tokens /// @param purchaseTokenAmount The amount of purchase tokens to spend in purchase /// @param repoToken The address of the repo token to purchase function swapExactPurchaseForRepo( uint256 purchaseTokenAmount, address repoToken ) external nonReentrant whenNotPaused onlyValidatedRepoToken(repoToken) { (uint256 redemptionTimestamp, address purchaseToken, ,) = ITermRepoToken(repoToken).config(); uint256 repoTokenPrecision = 10 ** ERC20(repoToken).decimals(); uint256 purchaseTokenPrecision = 10 ** ERC20(purchaseToken).decimals(); uint256 timeToMaturity = redemptionTimestamp > block.timestamp ? redemptionTimestamp - block.timestamp : 0; uint256 rate = discountRateAdapter.getDiscountRate(repoToken); require(rate > 0 && rate < RATE_PRECISION, "Discount rate out of valid range"); uint256 numerator = ITermRepoToken(repoToken).redemptionValue() * RATE_PRECISION * THREESIXTY_DAYCOUNT_SECONDS; uint256 denominator = RATE_PRECISION * THREESIXTY_DAYCOUNT_SECONDS + ((rate - discountRateMarkup) * timeToMaturity); uint256 pricePerToken = (numerator / denominator); require(pricePerToken > 0, "No valid pricePerToken calculated for the specified repoToken"); uint256 repoTokenAmount = purchaseTokenAmount * REDEMPTION_VALUE_PRECISION * repoTokenPrecision / (pricePerToken * purchaseTokenPrecision); require(repoTokenAmount <= totalListed[repoToken], "Desired amount exceeds total listed tokens"); _purchase(repoToken, purchaseToken, repoTokenAmount, pricePerToken); } /// @notice Internal function to handle the purchase logic /// @param repoToken The address of the repo token to purchase /// @param purchaseToken The address of the token used for purchase /// @param desiredAmount The amount of tokens to purchase /// @param pricePerToken The price per token function _purchase(address repoToken, address purchaseToken, uint256 desiredAmount, uint256 pricePerToken) private { uint256 repoTokenPrecision = 10 ** ERC20(repoToken).decimals(); uint256 purchaseTokenPrecision = 10 ** ERC20(purchaseToken).decimals(); uint256 remainingAmount = desiredAmount; Queue storage queue = queues[repoToken]; uint256 currentListing = queue.head; while (currentListing != 0 && remainingAmount > 0) { Listing storage listing = listings[currentListing]; require(listing.token == repoToken, "Unexpected repoToken"); require(listing.amount > 0, "Unexpected empty listing"); uint256 purchaseAmount = remainingAmount > listing.amount ? listing.amount : remainingAmount; uint256 cost = (pricePerToken * purchaseAmount) / REDEMPTION_VALUE_PRECISION; cost = (cost * purchaseTokenPrecision) / repoTokenPrecision; listing.amount -= purchaseAmount; totalListed[repoToken] -= purchaseAmount; remainingAmount -= purchaseAmount; _emitAndTransfer( currentListing, purchaseToken, listing.seller, listing.token, purchaseAmount, cost ); if (listing.amount == 0) { uint256 nextListing = listing.next; removeListing(repoToken, currentListing); currentListing = nextListing; } else { currentListing = listing.next; } } require(remainingAmount == 0, "Not enough tokens available to fulfill the purchase"); } function _emitAndTransfer( uint256 currentListing, address purchaseToken, address seller, address token, uint256 purchaseAmount, uint256 cost ) private { REPO_TOKEN_LINKED_LIST_EVENT_EMITTER.emitPurchase( currentListing, msg.sender, seller, token, purchaseAmount, purchaseToken, cost ); require(IERC20(purchaseToken).transferFrom(msg.sender, seller, cost), "Payment transfer failed"); require(IERC20(token).transfer(msg.sender, purchaseAmount), "Token transfer failed"); } /// @notice Allows a seller to cancel their listing /// @param listingId The ID of the listing to cancel /// @param skipRedeem Whether to skip the redeem process function cancelListing(uint256 listingId, bool skipRedeem) public nonReentrant whenNotPaused { require(listingId < nextId, "Listing does not exist"); // Ensure the listing exists Listing storage listing = listings[listingId]; require(listing.seller == msg.sender || hasRole(ADMIN_ROLE, msg.sender), "Only the seller can cancel this listing"); uint256 amount = listing.amount; address token = listing.token; address seller = listing.seller; totalListed[token] -= amount; // Decrement the total listed amount // Remove the listing from the linked list removeListing(token, listingId); (uint256 redemptionTimestamp, address purchaseToken, address termRepoServicer,) = ITermRepoToken(token).config(); uint256 currentBalance = IERC20(token).balanceOf(address(this)); // Handle edge case if someone inadverdently redeems repoToken on behalf of listing contract /// @notice Repotokens can be redeemed by anyone on behalf of any third-party if (currentBalance < amount) { // Partial balance scenario uint256 availableAmount = currentBalance; // Transfer available repoTokens require(IERC20(token).transfer(seller, availableAmount), "RepoToken transfer failed"); // Calculate and transfer the remaining value in purchaseTokens uint256 missingAmount = amount - availableAmount; uint256 redemptionValue = ITermRepoToken(token).redemptionValue(); uint256 purchaseTokenAmount = (missingAmount * redemptionValue) / REDEMPTION_VALUE_PRECISION; ITermRepoServicer termRepoServicer = ITermRepoServicer(termRepoServicer); if (termRepoServicer.shortfallHaircutMantissa() == 0) { require(IERC20(purchaseToken).transfer(seller, purchaseTokenAmount), "PurchaseToken transfer failed"); } else { // Adjust purchaseTokenAmount for shortfallHaircutMantissa uint256 proRataRedemptionAmount = (purchaseTokenAmount * termRepoServicer.shortfallHaircutMantissa()) / RATE_PRECISION; require(IERC20(purchaseToken).transfer(seller, proRataRedemptionAmount), "PurchaseToken transfer failed"); } } else { // Full balance available require(IERC20(token).transfer(seller, amount), "Token transfer failed"); } // If past maturity, redeem on behalf of user if (!skipRedeem && redemptionTimestamp < block.timestamp) { try ITermRepoServicer(termRepoServicer).redeemTermRepoTokens( seller, currentBalance < amount ? currentBalance : amount ) { // redemption succeeded } catch { // redemption failed, do not remove token from the list } } REPO_TOKEN_LINKED_LIST_EVENT_EMITTER.emitListingCancelled(listingId, seller, amount); } function batchCancelListings(uint256[] calldata listingIds, bool skipRedeem) external { for (uint256 i = 0; i < listingIds.length; i++) { cancelListing(listingIds[i], skipRedeem); } } /// @notice Internal function to remove a listing /// @param repoToken The address of the repo token /// @param listingId The ID of the listing to remove function removeListing(address repoToken, uint256 listingId) internal { Listing storage listing = listings[listingId]; Queue storage queue = queues[repoToken]; require(listing.token == repoToken, "Unexpected repoToken"); if (listing.prev != 0) { listings[listing.prev].next = listing.next; } else { queue.head = listing.next; // Update head if necessary } if (listing.next != 0) { listings[listing.next].prev = listing.prev; } else { queue.tail = listing.prev; // Update tail if necessary } delete listings[listingId]; } /// @notice Retrieves the details of a listing /// @param listingId The ID of the listing to retrieve /// @return seller The address of the seller /// @return token The address of the token being sold /// @return amount The amount of tokens being sold function getListing(uint256 listingId) external view returns (address seller, address token, uint256 amount) { require(listingId < nextId, "Listing does not exist"); // Ensure the listing exists Listing storage listing = listings[listingId]; return (listing.seller, listing.token, listing.amount); } /// @notice Gets the total number of active listings /// @param repoToken The address of the repo token /// @return The total number of listings function getTotalListings(address repoToken) external view returns (uint256) { // Traversing the linked list to count total listings uint256 count = 0; Queue storage queue = queues[repoToken]; uint256 currentListing = queue.head; while (currentListing != 0) { count++; currentListing = listings[currentListing].next; } return count; } /// @notice Checks if a repo token is valid /// @param repoToken The address of the repo token to check /// @return bool indicating if the repo token is valid function isRepoTokenValid(address repoToken) public view returns (bool) { // Check if the repoToken is blacklisted if (repoTokenBlacklist[repoToken]) { return false; } // Check if the repoToken is deployed by the TERM_CONTROLLER if (!TERM_CONTROLLER.isTermDeployed(repoToken)) { return false; } // Check the redemption timestamp to ensure the repoToken is still valid (uint256 redemptionTimestamp, , , ) = ITermRepoToken(repoToken).config(); if (redemptionTimestamp < block.timestamp) { return false; } return true; } // ========================================================================= // = Upgradeability ======================================================== // ========================================================================= /// @notice Ensures only authorized addresses can upgrade the contract /// @param newImplementation The address of the new contract implementation /// @dev Overrides the UUPSUpgradeable _authorizeUpgrade function to include role checks. // solhint-disable no-empty-blocks ///@dev required override by the OpenZeppelin UUPS module function _authorizeUpgrade( address ) internal view override onlyRole(DEVOPS_ROLE) {} // solhint-enable no-empty-blocks }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (access/AccessControl.sol) pragma solidity ^0.8.20; import {IAccessControl} from "@openzeppelin/contracts/access/IAccessControl.sol"; import {ContextUpgradeable} from "../utils/ContextUpgradeable.sol"; import {ERC165Upgradeable} from "../utils/introspection/ERC165Upgradeable.sol"; import {Initializable} from "../proxy/utils/Initializable.sol"; /** * @dev Contract module that allows children to implement role-based access * control mechanisms. This is a lightweight version that doesn't allow enumerating role * members except through off-chain means by accessing the contract event logs. Some * applications may benefit from on-chain enumerability, for those cases see * {AccessControlEnumerable}. * * Roles are referred to by their `bytes32` identifier. These should be exposed * in the external API and be unique. The best way to achieve this is by * using `public constant` hash digests: * * ```solidity * bytes32 public constant MY_ROLE = keccak256("MY_ROLE"); * ``` * * Roles can be used to represent a set of permissions. To restrict access to a * function call, use {hasRole}: * * ```solidity * function foo() public { * require(hasRole(MY_ROLE, msg.sender)); * ... * } * ``` * * Roles can be granted and revoked dynamically via the {grantRole} and * {revokeRole} functions. Each role has an associated admin role, and only * accounts that have a role's admin role can call {grantRole} and {revokeRole}. * * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means * that only accounts with this role will be able to grant or revoke other * roles. More complex role relationships can be created by using * {_setRoleAdmin}. * * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to * grant and revoke this role. Extra precautions should be taken to secure * accounts that have been granted it. We recommend using {AccessControlDefaultAdminRules} * to enforce additional security measures for this role. */ abstract contract AccessControlUpgradeable is Initializable, ContextUpgradeable, IAccessControl, ERC165Upgradeable { struct RoleData { mapping(address account => bool) hasRole; bytes32 adminRole; } bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00; /// @custom:storage-location erc7201:openzeppelin.storage.AccessControl struct AccessControlStorage { mapping(bytes32 role => RoleData) _roles; } // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.AccessControl")) - 1)) & ~bytes32(uint256(0xff)) bytes32 private constant AccessControlStorageLocation = 0x02dd7bc7dec4dceedda775e58dd541e08a116c6c53815c0bd028192f7b626800; function _getAccessControlStorage() private pure returns (AccessControlStorage storage $) { assembly { $.slot := AccessControlStorageLocation } } /** * @dev Modifier that checks that an account has a specific role. Reverts * with an {AccessControlUnauthorizedAccount} error including the required role. */ modifier onlyRole(bytes32 role) { _checkRole(role); _; } function __AccessControl_init() internal onlyInitializing { } function __AccessControl_init_unchained() internal onlyInitializing { } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId); } /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) public view virtual returns (bool) { AccessControlStorage storage $ = _getAccessControlStorage(); return $._roles[role].hasRole[account]; } /** * @dev Reverts with an {AccessControlUnauthorizedAccount} error if `_msgSender()` * is missing `role`. Overriding this function changes the behavior of the {onlyRole} modifier. */ function _checkRole(bytes32 role) internal view virtual { _checkRole(role, _msgSender()); } /** * @dev Reverts with an {AccessControlUnauthorizedAccount} error if `account` * is missing `role`. */ function _checkRole(bytes32 role, address account) internal view virtual { if (!hasRole(role, account)) { revert AccessControlUnauthorizedAccount(account, role); } } /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) public view virtual returns (bytes32) { AccessControlStorage storage $ = _getAccessControlStorage(); return $._roles[role].adminRole; } /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. * * May emit a {RoleGranted} event. */ function grantRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) { _grantRole(role, account); } /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. * * May emit a {RoleRevoked} event. */ function revokeRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) { _revokeRole(role, account); } /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been revoked `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `callerConfirmation`. * * May emit a {RoleRevoked} event. */ function renounceRole(bytes32 role, address callerConfirmation) public virtual { if (callerConfirmation != _msgSender()) { revert AccessControlBadConfirmation(); } _revokeRole(role, callerConfirmation); } /** * @dev Sets `adminRole` as ``role``'s admin role. * * Emits a {RoleAdminChanged} event. */ function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual { AccessControlStorage storage $ = _getAccessControlStorage(); bytes32 previousAdminRole = getRoleAdmin(role); $._roles[role].adminRole = adminRole; emit RoleAdminChanged(role, previousAdminRole, adminRole); } /** * @dev Attempts to grant `role` to `account` and returns a boolean indicating if `role` was granted. * * Internal function without access restriction. * * May emit a {RoleGranted} event. */ function _grantRole(bytes32 role, address account) internal virtual returns (bool) { AccessControlStorage storage $ = _getAccessControlStorage(); if (!hasRole(role, account)) { $._roles[role].hasRole[account] = true; emit RoleGranted(role, account, _msgSender()); return true; } else { return false; } } /** * @dev Attempts to revoke `role` to `account` and returns a boolean indicating if `role` was revoked. * * Internal function without access restriction. * * May emit a {RoleRevoked} event. */ function _revokeRole(bytes32 role, address account) internal virtual returns (bool) { AccessControlStorage storage $ = _getAccessControlStorage(); if (hasRole(role, account)) { $._roles[role].hasRole[account] = false; emit RoleRevoked(role, account, _msgSender()); return true; } else { return false; } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (proxy/utils/Initializable.sol) pragma solidity ^0.8.20; /** * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect. * * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be * reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in * case an upgrade adds a module that needs to be initialized. * * For example: * * [.hljs-theme-light.nopadding] * ```solidity * contract MyToken is ERC20Upgradeable { * function initialize() initializer public { * __ERC20_init("MyToken", "MTK"); * } * } * * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable { * function initializeV2() reinitializer(2) public { * __ERC20Permit_init("MyToken"); * } * } * ``` * * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}. * * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity. * * [CAUTION] * ==== * Avoid leaving a contract uninitialized. * * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed: * * [.hljs-theme-light.nopadding] * ``` * /// @custom:oz-upgrades-unsafe-allow constructor * constructor() { * _disableInitializers(); * } * ``` * ==== */ abstract contract Initializable { /** * @dev Storage of the initializable contract. * * It's implemented on a custom ERC-7201 namespace to reduce the risk of storage collisions * when using with upgradeable contracts. * * @custom:storage-location erc7201:openzeppelin.storage.Initializable */ struct InitializableStorage { /** * @dev Indicates that the contract has been initialized. */ uint64 _initialized; /** * @dev Indicates that the contract is in the process of being initialized. */ bool _initializing; } // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.Initializable")) - 1)) & ~bytes32(uint256(0xff)) bytes32 private constant INITIALIZABLE_STORAGE = 0xf0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00; /** * @dev The contract is already initialized. */ error InvalidInitialization(); /** * @dev The contract is not initializing. */ error NotInitializing(); /** * @dev Triggered when the contract has been initialized or reinitialized. */ event Initialized(uint64 version); /** * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope, * `onlyInitializing` functions can be used to initialize parent contracts. * * Similar to `reinitializer(1)`, except that in the context of a constructor an `initializer` may be invoked any * number of times. This behavior in the constructor can be useful during testing and is not expected to be used in * production. * * Emits an {Initialized} event. */ modifier initializer() { // solhint-disable-next-line var-name-mixedcase InitializableStorage storage $ = _getInitializableStorage(); // Cache values to avoid duplicated sloads bool isTopLevelCall = !$._initializing; uint64 initialized = $._initialized; // Allowed calls: // - initialSetup: the contract is not in the initializing state and no previous version was // initialized // - construction: the contract is initialized at version 1 (no reininitialization) and the // current contract is just being deployed bool initialSetup = initialized == 0 && isTopLevelCall; bool construction = initialized == 1 && address(this).code.length == 0; if (!initialSetup && !construction) { revert InvalidInitialization(); } $._initialized = 1; if (isTopLevelCall) { $._initializing = true; } _; if (isTopLevelCall) { $._initializing = false; emit Initialized(1); } } /** * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be * used to initialize parent contracts. * * A reinitializer may be used after the original initialization step. This is essential to configure modules that * are added through upgrades and that require initialization. * * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer` * cannot be nested. If one is invoked in the context of another, execution will revert. * * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in * a contract, executing them in the right order is up to the developer or operator. * * WARNING: Setting the version to 2**64 - 1 will prevent any future reinitialization. * * Emits an {Initialized} event. */ modifier reinitializer(uint64 version) { // solhint-disable-next-line var-name-mixedcase InitializableStorage storage $ = _getInitializableStorage(); if ($._initializing || $._initialized >= version) { revert InvalidInitialization(); } $._initialized = version; $._initializing = true; _; $._initializing = false; emit Initialized(version); } /** * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the * {initializer} and {reinitializer} modifiers, directly or indirectly. */ modifier onlyInitializing() { _checkInitializing(); _; } /** * @dev Reverts if the contract is not in an initializing state. See {onlyInitializing}. */ function _checkInitializing() internal view virtual { if (!_isInitializing()) { revert NotInitializing(); } } /** * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call. * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized * to any version. It is recommended to use this to lock implementation contracts that are designed to be called * through proxies. * * Emits an {Initialized} event the first time it is successfully executed. */ function _disableInitializers() internal virtual { // solhint-disable-next-line var-name-mixedcase InitializableStorage storage $ = _getInitializableStorage(); if ($._initializing) { revert InvalidInitialization(); } if ($._initialized != type(uint64).max) { $._initialized = type(uint64).max; emit Initialized(type(uint64).max); } } /** * @dev Returns the highest version that has been initialized. See {reinitializer}. */ function _getInitializedVersion() internal view returns (uint64) { return _getInitializableStorage()._initialized; } /** * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}. */ function _isInitializing() internal view returns (bool) { return _getInitializableStorage()._initializing; } /** * @dev Returns a pointer to the storage namespace. */ // solhint-disable-next-line var-name-mixedcase function _getInitializableStorage() private pure returns (InitializableStorage storage $) { assembly { $.slot := INITIALIZABLE_STORAGE } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (proxy/utils/UUPSUpgradeable.sol) pragma solidity ^0.8.20; import {IERC1822Proxiable} from "@openzeppelin/contracts/interfaces/draft-IERC1822.sol"; import {ERC1967Utils} from "@openzeppelin/contracts/proxy/ERC1967/ERC1967Utils.sol"; import {Initializable} from "./Initializable.sol"; /** * @dev An upgradeability mechanism designed for UUPS proxies. The functions included here can perform an upgrade of an * {ERC1967Proxy}, when this contract is set as the implementation behind such a proxy. * * A security mechanism ensures that an upgrade does not turn off upgradeability accidentally, although this risk is * reinstated if the upgrade retains upgradeability but removes the security mechanism, e.g. by replacing * `UUPSUpgradeable` with a custom implementation of upgrades. * * The {_authorizeUpgrade} function must be overridden to include access restriction to the upgrade mechanism. */ abstract contract UUPSUpgradeable is Initializable, IERC1822Proxiable { /// @custom:oz-upgrades-unsafe-allow state-variable-immutable address private immutable __self = address(this); /** * @dev The version of the upgrade interface of the contract. If this getter is missing, both `upgradeTo(address)` * and `upgradeToAndCall(address,bytes)` are present, and `upgradeTo` must be used if no function should be called, * while `upgradeToAndCall` will invoke the `receive` function if the second argument is the empty byte string. * If the getter returns `"5.0.0"`, only `upgradeToAndCall(address,bytes)` is present, and the second argument must * be the empty byte string if no function should be called, making it impossible to invoke the `receive` function * during an upgrade. */ string public constant UPGRADE_INTERFACE_VERSION = "5.0.0"; /** * @dev The call is from an unauthorized context. */ error UUPSUnauthorizedCallContext(); /** * @dev The storage `slot` is unsupported as a UUID. */ error UUPSUnsupportedProxiableUUID(bytes32 slot); /** * @dev Check that the execution is being performed through a delegatecall call and that the execution context is * a proxy contract with an implementation (as defined in ERC1967) pointing to self. This should only be the case * for UUPS and transparent proxies that are using the current contract as their implementation. Execution of a * function through ERC1167 minimal proxies (clones) would not normally pass this test, but is not guaranteed to * fail. */ modifier onlyProxy() { _checkProxy(); _; } /** * @dev Check that the execution is not being performed through a delegate call. This allows a function to be * callable on the implementing contract but not through proxies. */ modifier notDelegated() { _checkNotDelegated(); _; } function __UUPSUpgradeable_init() internal onlyInitializing { } function __UUPSUpgradeable_init_unchained() internal onlyInitializing { } /** * @dev Implementation of the ERC1822 {proxiableUUID} function. This returns the storage slot used by the * implementation. It is used to validate the implementation's compatibility when performing an upgrade. * * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this * function revert if invoked through a proxy. This is guaranteed by the `notDelegated` modifier. */ function proxiableUUID() external view virtual notDelegated returns (bytes32) { return ERC1967Utils.IMPLEMENTATION_SLOT; } /** * @dev Upgrade the implementation of the proxy to `newImplementation`, and subsequently execute the function call * encoded in `data`. * * Calls {_authorizeUpgrade}. * * Emits an {Upgraded} event. * * @custom:oz-upgrades-unsafe-allow-reachable delegatecall */ function upgradeToAndCall(address newImplementation, bytes memory data) public payable virtual onlyProxy { _authorizeUpgrade(newImplementation); _upgradeToAndCallUUPS(newImplementation, data); } /** * @dev Reverts if the execution is not performed via delegatecall or the execution * context is not of a proxy with an ERC1967-compliant implementation pointing to self. * See {_onlyProxy}. */ function _checkProxy() internal view virtual { if ( address(this) == __self || // Must be called through delegatecall ERC1967Utils.getImplementation() != __self // Must be called through an active proxy ) { revert UUPSUnauthorizedCallContext(); } } /** * @dev Reverts if the execution is performed via delegatecall. * See {notDelegated}. */ function _checkNotDelegated() internal view virtual { if (address(this) != __self) { // Must not be called through delegatecall revert UUPSUnauthorizedCallContext(); } } /** * @dev Function that should revert when `msg.sender` is not authorized to upgrade the contract. Called by * {upgradeToAndCall}. * * Normally, this function will use an xref:access.adoc[access control] modifier such as {Ownable-onlyOwner}. * * ```solidity * function _authorizeUpgrade(address) internal onlyOwner {} * ``` */ function _authorizeUpgrade(address newImplementation) internal virtual; /** * @dev Performs an implementation upgrade with a security check for UUPS proxies, and additional setup call. * * As a security check, {proxiableUUID} is invoked in the new implementation, and the return value * is expected to be the implementation slot in ERC1967. * * Emits an {IERC1967-Upgraded} event. */ function _upgradeToAndCallUUPS(address newImplementation, bytes memory data) private { try IERC1822Proxiable(newImplementation).proxiableUUID() returns (bytes32 slot) { if (slot != ERC1967Utils.IMPLEMENTATION_SLOT) { revert UUPSUnsupportedProxiableUUID(slot); } ERC1967Utils.upgradeToAndCall(newImplementation, data); } catch { // The implementation is not UUPS revert ERC1967Utils.ERC1967InvalidImplementation(newImplementation); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/Pausable.sol) pragma solidity ^0.8.20; import {ContextUpgradeable} from "../utils/ContextUpgradeable.sol"; import {Initializable} from "../proxy/utils/Initializable.sol"; /** * @dev Contract module which allows children to implement an emergency stop * mechanism that can be triggered by an authorized account. * * This module is used through inheritance. It will make available the * modifiers `whenNotPaused` and `whenPaused`, which can be applied to * the functions of your contract. Note that they will not be pausable by * simply including this module, only once the modifiers are put in place. */ abstract contract PausableUpgradeable is Initializable, ContextUpgradeable { /// @custom:storage-location erc7201:openzeppelin.storage.Pausable struct PausableStorage { bool _paused; } // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.Pausable")) - 1)) & ~bytes32(uint256(0xff)) bytes32 private constant PausableStorageLocation = 0xcd5ed15c6e187e77e9aee88184c21f4f2182ab5827cb3b7e07fbedcd63f03300; function _getPausableStorage() private pure returns (PausableStorage storage $) { assembly { $.slot := PausableStorageLocation } } /** * @dev Emitted when the pause is triggered by `account`. */ event Paused(address account); /** * @dev Emitted when the pause is lifted by `account`. */ event Unpaused(address account); /** * @dev The operation failed because the contract is paused. */ error EnforcedPause(); /** * @dev The operation failed because the contract is not paused. */ error ExpectedPause(); /** * @dev Initializes the contract in unpaused state. */ function __Pausable_init() internal onlyInitializing { __Pausable_init_unchained(); } function __Pausable_init_unchained() internal onlyInitializing { PausableStorage storage $ = _getPausableStorage(); $._paused = false; } /** * @dev Modifier to make a function callable only when the contract is not paused. * * Requirements: * * - The contract must not be paused. */ modifier whenNotPaused() { _requireNotPaused(); _; } /** * @dev Modifier to make a function callable only when the contract is paused. * * Requirements: * * - The contract must be paused. */ modifier whenPaused() { _requirePaused(); _; } /** * @dev Returns true if the contract is paused, and false otherwise. */ function paused() public view virtual returns (bool) { PausableStorage storage $ = _getPausableStorage(); return $._paused; } /** * @dev Throws if the contract is paused. */ function _requireNotPaused() internal view virtual { if (paused()) { revert EnforcedPause(); } } /** * @dev Throws if the contract is not paused. */ function _requirePaused() internal view virtual { if (!paused()) { revert ExpectedPause(); } } /** * @dev Triggers stopped state. * * Requirements: * * - The contract must not be paused. */ function _pause() internal virtual whenNotPaused { PausableStorage storage $ = _getPausableStorage(); $._paused = true; emit Paused(_msgSender()); } /** * @dev Returns to normal state. * * Requirements: * * - The contract must be paused. */ function _unpause() internal virtual whenPaused { PausableStorage storage $ = _getPausableStorage(); $._paused = false; emit Unpaused(_msgSender()); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/ReentrancyGuard.sol) pragma solidity ^0.8.20; import {Initializable} from "../proxy/utils/Initializable.sol"; /** * @dev Contract module that helps prevent reentrant calls to a function. * * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier * available, which can be applied to functions to make sure there are no nested * (reentrant) calls to them. * * Note that because there is a single `nonReentrant` guard, functions marked as * `nonReentrant` may not call one another. This can be worked around by making * those functions `private`, and then adding `external` `nonReentrant` entry * points to them. * * TIP: If you would like to learn more about reentrancy and alternative ways * to protect against it, check out our blog post * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul]. */ abstract contract ReentrancyGuardUpgradeable is Initializable { // 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; /// @custom:storage-location erc7201:openzeppelin.storage.ReentrancyGuard struct ReentrancyGuardStorage { uint256 _status; } // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.ReentrancyGuard")) - 1)) & ~bytes32(uint256(0xff)) bytes32 private constant ReentrancyGuardStorageLocation = 0x9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f00; function _getReentrancyGuardStorage() private pure returns (ReentrancyGuardStorage storage $) { assembly { $.slot := ReentrancyGuardStorageLocation } } /** * @dev Unauthorized reentrant call. */ error ReentrancyGuardReentrantCall(); function __ReentrancyGuard_init() internal onlyInitializing { __ReentrancyGuard_init_unchained(); } function __ReentrancyGuard_init_unchained() internal onlyInitializing { ReentrancyGuardStorage storage $ = _getReentrancyGuardStorage(); $._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 { ReentrancyGuardStorage storage $ = _getReentrancyGuardStorage(); // 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 { ReentrancyGuardStorage storage $ = _getReentrancyGuardStorage(); // 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) { ReentrancyGuardStorage storage $ = _getReentrancyGuardStorage(); return $._status == ENTERED; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.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 ERC20 * applications. * * Additionally, an {Approval} event is emitted on calls to {transferFrom}. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. */ 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}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}. * * 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: * ``` * 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.0) (token/ERC20/utils/SafeERC20.sol) pragma solidity ^0.8.20; import {IERC20} from "../IERC20.sol"; import {IERC20Permit} from "../extensions/IERC20Permit.sol"; import {Address} from "../../../utils/Address.sol"; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { using Address for address; /** * @dev An operation with an ERC20 token failed. */ error SafeERC20FailedOperation(address token); /** * @dev Indicates a failed `decreaseAllowance` request. */ error SafeERC20FailedDecreaseAllowance(address spender, uint256 currentAllowance, uint256 requestedDecrease); /** * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value, * non-reverting calls are assumed to be successful. */ function safeTransfer(IERC20 token, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeCall(token.transfer, (to, value))); } /** * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful. */ function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeCall(token.transferFrom, (from, to, value))); } /** * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value, * non-reverting calls are assumed to be successful. */ function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 oldAllowance = token.allowance(address(this), spender); forceApprove(token, spender, oldAllowance + value); } /** * @dev Decrease the calling contract's allowance toward `spender` by `requestedDecrease`. If `token` returns no * value, non-reverting calls are assumed to be successful. */ function safeDecreaseAllowance(IERC20 token, address spender, uint256 requestedDecrease) internal { unchecked { uint256 currentAllowance = token.allowance(address(this), spender); if (currentAllowance < requestedDecrease) { revert SafeERC20FailedDecreaseAllowance(spender, currentAllowance, requestedDecrease); } forceApprove(token, spender, currentAllowance - requestedDecrease); } } /** * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value, * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval * to be set to zero before setting it to a non-zero value, such as USDT. */ function forceApprove(IERC20 token, address spender, uint256 value) internal { bytes memory approvalCall = abi.encodeCall(token.approve, (spender, value)); if (!_callOptionalReturnBool(token, approvalCall)) { _callOptionalReturn(token, abi.encodeCall(token.approve, (spender, 0))); _callOptionalReturn(token, approvalCall); } } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data); if (returndata.length != 0 && !abi.decode(returndata, (bool))) { revert SafeERC20FailedOperation(address(token)); } } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). * * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead. */ function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false // and not revert is the subcall reverts. (bool success, bytes memory returndata) = address(token).call(data); return success && (returndata.length == 0 || abi.decode(returndata, (bool))) && address(token).code.length > 0; } }
// SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.20; import "./interface/IRepoTokenLinkedListEvents.sol"; import "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol"; import "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol"; /// @title Token Marketplace Event Emitter /// @notice Handles the emission of events for the term token marketplace contract system. /// @dev This contract extends OpenZeppelin's upgradeable contract suite for access control and upgradeability, implementing the ITokenMarketplaceEvents interface. contract RepoTokenLinkedListEventEmitter is Initializable, UUPSUpgradeable, AccessControlUpgradeable, IRepoTokenLinkedListEvents { bytes32 public constant ADMIN_ROLE = keccak256("ADMIN_ROLE"); bytes32 public constant DEVOPS_ROLE = keccak256("DEVOPS_ROLE"); bytes32 public constant LISTING_CONTRACT = keccak256("LISTING_CONTRACT"); /// @custom:oz-upgrades-unsafe-allow constructor constructor() { _disableInitializers(); } /// @notice Initializes the contract with admin and devops wallets /// @param adminWallet_ Address of the admin wallet /// @param devopsWallet_ Address of the devops wallet /// @dev Initializes upgradeability features and sets up initial roles. /// @dev See: https://docs.openzeppelin.com/contracts/4.x/upgradeable function initialize( address adminWallet_, address devopsWallet_ ) external initializer { UUPSUpgradeable.__UUPSUpgradeable_init(); AccessControlUpgradeable.__AccessControl_init(); _grantRole(ADMIN_ROLE, adminWallet_); _grantRole(DEVOPS_ROLE, devopsWallet_); } /// @notice Assigns the LISTING_CONTRACT role to a listing contract address /// @param listingContract Address of the listing contract to pair /// @dev Only ADMIN_ROLE can call this function to pair a listing contract for event emission. function pairListingContract(address listingContract) external onlyRole(ADMIN_ROLE){ _grantRole(LISTING_CONTRACT, listingContract); } /** * @notice Emits an event for a new listing. * @param listingId The ID of the listing. * @param seller The address of the seller. * @param repoToken The address of the repo token. * @param amount The amount of the repo token. */ /// @dev Restricted to only addresses with the LISTING_CONTRACT role. function emitNewListing( uint256 listingId, address seller, address repoToken, uint256 amount ) external onlyRole(LISTING_CONTRACT) { emit NewListing(listingId, seller, repoToken, amount); } /** * @dev Emits a purchase event with the given parameters. * @param listingId The ID of the listing. * @param buyer The address of the buyer. * @param seller The address of the seller. * @param repoToken The address of the repo token. * @param amount The amount of tokens purchased. * @param purchaseToken The address of the purchase token. * @param cost The cost of amount in purchase token. */ /// @dev Restricted to only addresses with the LISTING_CONTRACT role. function emitPurchase( uint256 listingId, address buyer, address seller, address repoToken, uint256 amount, address purchaseToken, uint256 cost ) external onlyRole(LISTING_CONTRACT) { emit Purchase(listingId, buyer, seller, repoToken, amount, purchaseToken, cost); } /** * @dev Emits an event when a listing is cancelled. * @param listingId The ID of the cancelled listing. * @param seller The address of the seller. * @param amount The amount of tokens cancelled. */ /// @dev Restricted to only addresses with the LISTING_CONTRACT role. function emitListingCancelled( uint256 listingId, address seller, uint256 amount ) external onlyRole(LISTING_CONTRACT) { emit ListingCancelled(listingId, seller, amount); } function emitDiscountRateAdapterUpdated( address oldAdapter, address newAdapter ) external onlyRole(LISTING_CONTRACT) { emit DiscountRateAdapterUpdated(oldAdapter, newAdapter); } function emitPaused() external onlyRole(LISTING_CONTRACT) { emit Paused(); } function emitUnpaused() external onlyRole(LISTING_CONTRACT) { emit Unpaused(); } function emitRepoTokenBlacklistUpdated(address repoToken, bool blacklisted) external onlyRole(LISTING_CONTRACT) { emit RepoTokenBlacklistUpdated(repoToken, blacklisted); } function emitMinListingAmountUpdated(uint256 oldAmount, uint256 newAmount) external onlyRole(LISTING_CONTRACT) { emit MinListingAmountUpdated(oldAmount, newAmount); } // ======================================================================== // = Admin =============================================================== // ======================================================================== // solhint-disable no-empty-blocks /// @notice Ensures that only authorized addresses can upgrade the contract /// @dev Overrides the UUPSUpgradeable _authorizeUpgrade function to include a role check. /// @dev required override by the OpenZeppelin UUPS module function _authorizeUpgrade( address ) internal view override onlyRole(DEVOPS_ROLE) {} // solhint-enable no-empty-blocks }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import { ITermController } from "./ITermController.sol"; interface ITermDiscountRateAdapter { function TERM_CONTROLLER() external view returns (ITermController); function getDiscountRate(address repoToken) external view returns (uint256); }
// SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.20; import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; interface ITermRepoToken is IERC20 { function redemptionValue() external view returns (uint256); function config() external view returns ( uint256 redemptionTimestamp, address purchaseToken, address termRepoServicer, address termRepoCollateralManager ); function termRepoId() external view returns (bytes32); }
// SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.20; interface ITermRepoServicer { function shortfallHaircutMantissa() external view returns (uint256); function redeemTermRepoTokens( address redeemer, uint256 amountToRedeem ) external; function termRepoToken() external view returns (address); function purchaseToken() external view returns (address); }
// SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.20; struct AuctionMetadata { bytes32 termAuctionId; uint256 auctionClearingRate; uint256 auctionClearingBlockTimestamp; } interface ITermController { function isTermDeployed(address contractAddress) external view returns (bool); function getTermAuctionResults(bytes32 termRepoId) external view returns (AuctionMetadata[] memory auctionMetadata, uint8 numOfAuctions); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (access/IAccessControl.sol) pragma solidity ^0.8.20; /** * @dev External interface of AccessControl declared to support ERC165 detection. */ interface IAccessControl { /** * @dev The `account` is missing a role. */ error AccessControlUnauthorizedAccount(address account, bytes32 neededRole); /** * @dev The caller of a function is not the expected one. * * NOTE: Don't confuse with {AccessControlUnauthorizedAccount}. */ error AccessControlBadConfirmation(); /** * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole` * * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite * {RoleAdminChanged} not being emitted signaling this. */ event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole); /** * @dev Emitted when `account` is granted `role`. * * `sender` is the account that originated the contract call, an admin role * bearer except when using {AccessControl-_setupRole}. */ event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Emitted when `account` is revoked `role`. * * `sender` is the account that originated the contract call: * - if using `revokeRole`, it is the admin role bearer * - if using `renounceRole`, it is the role bearer (i.e. `account`) */ event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) external view returns (bool); /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {AccessControl-_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) external view returns (bytes32); /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function grantRole(bytes32 role, address account) external; /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function revokeRole(bytes32 role, address account) external; /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been granted `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `callerConfirmation`. */ function renounceRole(bytes32 role, address callerConfirmation) external; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol) pragma solidity ^0.8.20; import {Initializable} from "../proxy/utils/Initializable.sol"; /** * @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 ContextUpgradeable is Initializable { function __Context_init() internal onlyInitializing { } function __Context_init_unchained() internal onlyInitializing { } 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) (utils/introspection/ERC165.sol) pragma solidity ^0.8.20; import {IERC165} from "@openzeppelin/contracts/utils/introspection/IERC165.sol"; import {Initializable} from "../../proxy/utils/Initializable.sol"; /** * @dev Implementation of the {IERC165} interface. * * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check * for the additional interface id that will be supported. For example: * * ```solidity * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId); * } * ``` */ abstract contract ERC165Upgradeable is Initializable, IERC165 { function __ERC165_init() internal onlyInitializing { } function __ERC165_init_unchained() internal onlyInitializing { } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual returns (bool) { return interfaceId == type(IERC165).interfaceId; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (interfaces/draft-IERC1822.sol) pragma solidity ^0.8.20; /** * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified * proxy whose upgrades are fully controlled by the current implementation. */ interface IERC1822Proxiable { /** * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation * address. * * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this * function revert if invoked through a proxy. */ function proxiableUUID() external view returns (bytes32); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (proxy/ERC1967/ERC1967Utils.sol) pragma solidity ^0.8.20; import {IBeacon} from "../beacon/IBeacon.sol"; import {Address} from "../../utils/Address.sol"; import {StorageSlot} from "../../utils/StorageSlot.sol"; /** * @dev This abstract contract provides getters and event emitting update functions for * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots. */ library ERC1967Utils { // We re-declare ERC-1967 events here because they can't be used directly from IERC1967. // This will be fixed in Solidity 0.8.21. At that point we should remove these events. /** * @dev Emitted when the implementation is upgraded. */ event Upgraded(address indexed implementation); /** * @dev Emitted when the admin account has changed. */ event AdminChanged(address previousAdmin, address newAdmin); /** * @dev Emitted when the beacon is changed. */ event BeaconUpgraded(address indexed beacon); /** * @dev Storage slot with the address of the current implementation. * This is the keccak-256 hash of "eip1967.proxy.implementation" subtracted by 1. */ // solhint-disable-next-line private-vars-leading-underscore bytes32 internal constant IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc; /** * @dev The `implementation` of the proxy is invalid. */ error ERC1967InvalidImplementation(address implementation); /** * @dev The `admin` of the proxy is invalid. */ error ERC1967InvalidAdmin(address admin); /** * @dev The `beacon` of the proxy is invalid. */ error ERC1967InvalidBeacon(address beacon); /** * @dev An upgrade function sees `msg.value > 0` that may be lost. */ error ERC1967NonPayable(); /** * @dev Returns the current implementation address. */ function getImplementation() internal view returns (address) { return StorageSlot.getAddressSlot(IMPLEMENTATION_SLOT).value; } /** * @dev Stores a new address in the EIP1967 implementation slot. */ function _setImplementation(address newImplementation) private { if (newImplementation.code.length == 0) { revert ERC1967InvalidImplementation(newImplementation); } StorageSlot.getAddressSlot(IMPLEMENTATION_SLOT).value = newImplementation; } /** * @dev Performs implementation upgrade with additional setup call if data is nonempty. * This function is payable only if the setup call is performed, otherwise `msg.value` is rejected * to avoid stuck value in the contract. * * Emits an {IERC1967-Upgraded} event. */ function upgradeToAndCall(address newImplementation, bytes memory data) internal { _setImplementation(newImplementation); emit Upgraded(newImplementation); if (data.length > 0) { Address.functionDelegateCall(newImplementation, data); } else { _checkNonPayable(); } } /** * @dev Storage slot with the admin of the contract. * This is the keccak-256 hash of "eip1967.proxy.admin" subtracted by 1. */ // solhint-disable-next-line private-vars-leading-underscore bytes32 internal constant ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103; /** * @dev Returns the current admin. * * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using * the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103` */ function getAdmin() internal view returns (address) { return StorageSlot.getAddressSlot(ADMIN_SLOT).value; } /** * @dev Stores a new address in the EIP1967 admin slot. */ function _setAdmin(address newAdmin) private { if (newAdmin == address(0)) { revert ERC1967InvalidAdmin(address(0)); } StorageSlot.getAddressSlot(ADMIN_SLOT).value = newAdmin; } /** * @dev Changes the admin of the proxy. * * Emits an {IERC1967-AdminChanged} event. */ function changeAdmin(address newAdmin) internal { emit AdminChanged(getAdmin(), newAdmin); _setAdmin(newAdmin); } /** * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy. * This is the keccak-256 hash of "eip1967.proxy.beacon" subtracted by 1. */ // solhint-disable-next-line private-vars-leading-underscore bytes32 internal constant BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50; /** * @dev Returns the current beacon. */ function getBeacon() internal view returns (address) { return StorageSlot.getAddressSlot(BEACON_SLOT).value; } /** * @dev Stores a new beacon in the EIP1967 beacon slot. */ function _setBeacon(address newBeacon) private { if (newBeacon.code.length == 0) { revert ERC1967InvalidBeacon(newBeacon); } StorageSlot.getAddressSlot(BEACON_SLOT).value = newBeacon; address beaconImplementation = IBeacon(newBeacon).implementation(); if (beaconImplementation.code.length == 0) { revert ERC1967InvalidImplementation(beaconImplementation); } } /** * @dev Change the beacon and trigger a setup call if data is nonempty. * This function is payable only if the setup call is performed, otherwise `msg.value` is rejected * to avoid stuck value in the contract. * * Emits an {IERC1967-BeaconUpgraded} event. * * CAUTION: Invoking this function has no effect on an instance of {BeaconProxy} since v5, since * it uses an immutable beacon without looking at the value of the ERC-1967 beacon slot for * efficiency. */ function upgradeBeaconToAndCall(address newBeacon, bytes memory data) internal { _setBeacon(newBeacon); emit BeaconUpgraded(newBeacon); if (data.length > 0) { Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data); } else { _checkNonPayable(); } } /** * @dev Reverts if `msg.value` is not zero. It can be used to avoid `msg.value` stuck in the contract * if an upgrade doesn't perform an initialization call. */ function _checkNonPayable() private { if (msg.value > 0) { revert ERC1967NonPayable(); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.20; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); /** * @dev Returns the value of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the value of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves a `value` amount of tokens from the caller's account to `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, uint256 value) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets a `value` amount of tokens as the allowance of `spender` over the * caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 value) external returns (bool); /** * @dev Moves a `value` amount of tokens from `from` to `to` using the * allowance mechanism. `value` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address from, address to, uint256 value) external returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Metadata.sol) pragma solidity ^0.8.20; import {IERC20} from "../IERC20.sol"; /** * @dev Interface for the optional metadata functions from the ERC20 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.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) (interfaces/draft-IERC6093.sol) pragma solidity ^0.8.20; /** * @dev Standard ERC20 Errors * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC20 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 ERC721 Errors * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC721 tokens. */ interface IERC721Errors { /** * @dev Indicates that an address can't be an owner. For example, `address(0)` is a forbidden owner in EIP-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 ERC1155 Errors * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC1155 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); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Permit.sol) pragma solidity ^0.8.20; /** * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612]. * * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't * need to send a transaction, and thus is not required to hold Ether at all. * * ==== Security Considerations * * There are two important considerations concerning the use of `permit`. The first is that a valid permit signature * expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be * considered as an intention to spend the allowance in any specific way. The second is that because permits have * built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should * take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be * generally recommended is: * * ```solidity * function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public { * try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {} * doThing(..., value); * } * * function doThing(..., uint256 value) public { * token.safeTransferFrom(msg.sender, address(this), value); * ... * } * ``` * * Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of * `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also * {SafeERC20-safeTransferFrom}). * * Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so * contracts should have entry points that don't rely on permit. */ interface IERC20Permit { /** * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens, * given ``owner``'s signed approval. * * IMPORTANT: The same issues {IERC20-approve} has related to transaction * ordering also apply here. * * Emits an {Approval} event. * * Requirements: * * - `spender` cannot be the zero address. * - `deadline` must be a timestamp in the future. * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner` * over the EIP712-formatted function arguments. * - the signature must use ``owner``'s current nonce (see {nonces}). * * For more information on the signature format, see the * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP * section]. * * CAUTION: See Security Considerations above. */ function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external; /** * @dev Returns the current nonce for `owner`. This value must be * included whenever a signature is generated for {permit}. * * Every successful call to {permit} increases ``owner``'s nonce by one. This * prevents a signature from being used multiple times. */ function nonces(address owner) external view returns (uint256); /** * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}. */ // solhint-disable-next-line func-name-mixedcase function DOMAIN_SEPARATOR() external view returns (bytes32); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/Address.sol) pragma solidity ^0.8.20; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev The ETH balance of the account is not enough to perform the operation. */ error AddressInsufficientBalance(address account); /** * @dev There's no code at `target` (it is not a contract). */ error AddressEmptyCode(address target); /** * @dev A call to an address target failed. The target may have reverted. */ error FailedInnerCall(); /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.8.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { if (address(this).balance < amount) { revert AddressInsufficientBalance(address(this)); } (bool success, ) = recipient.call{value: amount}(""); if (!success) { revert FailedInnerCall(); } } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason or custom error, it is bubbled * up by this function (like regular Solidity function calls). However, if * the call reverted with no returned reason, this function reverts with a * {FailedInnerCall} error. * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCallWithValue(target, data, 0); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. */ function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { if (address(this).balance < value) { revert AddressInsufficientBalance(address(this)); } (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResultFromTarget(target, success, returndata); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResultFromTarget(target, success, returndata); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResultFromTarget(target, success, returndata); } /** * @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target * was not a contract or bubbling up the revert reason (falling back to {FailedInnerCall}) in case of an * unsuccessful call. */ function verifyCallResultFromTarget( address target, bool success, bytes memory returndata ) internal view returns (bytes memory) { if (!success) { _revert(returndata); } else { // only check if target is a contract if the call was successful and the return data is empty // otherwise we already know that it was a contract if (returndata.length == 0 && target.code.length == 0) { revert AddressEmptyCode(target); } return returndata; } } /** * @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the * revert reason or with a default {FailedInnerCall} error. */ function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) { if (!success) { _revert(returndata); } else { return returndata; } } /** * @dev Reverts with returndata if present. Otherwise reverts with {FailedInnerCall}. */ function _revert(bytes memory returndata) private pure { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly /// @solidity memory-safe-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert FailedInnerCall(); } } }
// SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.20; interface IRepoTokenLinkedListEvents { event NewListing(uint256 listingId, address seller, address token, uint256 amount); event Purchase(uint256 listingId, address buyer, address seller, address repoToken, uint256 amount, address purchaseToken, uint256 cost); event ListingCancelled(uint256 listingId, address seller, uint256 amount); event DiscountRateAdapterUpdated( address indexed oldAdapter, address indexed newAdapter ); event Paused(); event Unpaused(); event RepoTokenBlacklistUpdated( address indexed repoToken, bool blacklisted ); event MinListingAmountUpdated(uint256 oldAmount, uint256 newAmount); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/IERC165.sol) pragma solidity ^0.8.20; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (proxy/beacon/IBeacon.sol) pragma solidity ^0.8.20; /** * @dev This is the interface that {BeaconProxy} expects of its beacon. */ interface IBeacon { /** * @dev Must return an address that can be used as a delegate call target. * * {UpgradeableBeacon} will check that this address is a contract. */ function implementation() external view returns (address); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/StorageSlot.sol) // This file was procedurally generated from scripts/generate/templates/StorageSlot.js. pragma solidity ^0.8.20; /** * @dev Library for reading and writing primitive types to specific storage slots. * * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts. * This library helps with reading and writing to such slots without the need for inline assembly. * * The functions in this library return Slot structs that contain a `value` member that can be used to read or write. * * Example usage to set ERC1967 implementation slot: * ```solidity * contract ERC1967 { * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc; * * function _getImplementation() internal view returns (address) { * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value; * } * * function _setImplementation(address newImplementation) internal { * require(newImplementation.code.length > 0); * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation; * } * } * ``` */ library StorageSlot { struct AddressSlot { address value; } struct BooleanSlot { bool value; } struct Bytes32Slot { bytes32 value; } struct Uint256Slot { uint256 value; } struct StringSlot { string value; } struct BytesSlot { bytes value; } /** * @dev Returns an `AddressSlot` with member `value` located at `slot`. */ function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `BooleanSlot` with member `value` located at `slot`. */ function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `Bytes32Slot` with member `value` located at `slot`. */ function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `Uint256Slot` with member `value` located at `slot`. */ function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `StringSlot` with member `value` located at `slot`. */ function getStringSlot(bytes32 slot) internal pure returns (StringSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `StringSlot` representation of the string storage pointer `store`. */ function getStringSlot(string storage store) internal pure returns (StringSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := store.slot } } /** * @dev Returns an `BytesSlot` with member `value` located at `slot`. */ function getBytesSlot(bytes32 slot) internal pure returns (BytesSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `BytesSlot` representation of the bytes storage pointer `store`. */ function getBytesSlot(bytes storage store) internal pure returns (BytesSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := store.slot } } }
{ "remappings": [ "@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/", "@openzeppelin/contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/contracts/", "ds-test/=lib/forge-std/lib/ds-test/src/", "erc4626-tests/=lib/openzeppelin-contracts-upgradeable/lib/erc4626-tests/", "forge-std/=lib/forge-std/src/", "openzeppelin-contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/", "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": "paris", "viaIR": false, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[{"internalType":"address","name":"termController","type":"address"},{"internalType":"address","name":"repoTokenLinkedListEventEmitter","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"AccessControlBadConfirmation","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"bytes32","name":"neededRole","type":"bytes32"}],"name":"AccessControlUnauthorizedAccount","type":"error"},{"inputs":[{"internalType":"address","name":"target","type":"address"}],"name":"AddressEmptyCode","type":"error"},{"inputs":[{"internalType":"address","name":"implementation","type":"address"}],"name":"ERC1967InvalidImplementation","type":"error"},{"inputs":[],"name":"ERC1967NonPayable","type":"error"},{"inputs":[],"name":"EnforcedPause","type":"error"},{"inputs":[],"name":"ExpectedPause","type":"error"},{"inputs":[],"name":"FailedInnerCall","type":"error"},{"inputs":[],"name":"InvalidInitialization","type":"error"},{"inputs":[],"name":"NotInitializing","type":"error"},{"inputs":[],"name":"ReentrancyGuardReentrantCall","type":"error"},{"inputs":[],"name":"UUPSUnauthorizedCallContext","type":"error"},{"inputs":[{"internalType":"bytes32","name":"slot","type":"bytes32"}],"name":"UUPSUnsupportedProxiableUUID","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint64","name":"version","type":"uint64"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"implementation","type":"address"}],"name":"Upgraded","type":"event"},{"inputs":[],"name":"ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DEVOPS_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_MARKUP","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"RATE_PRECISION","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"REDEMPTION_VALUE_PRECISION","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"REPO_TOKEN_LINKED_LIST_EVENT_EMITTER","outputs":[{"internalType":"contract RepoTokenLinkedListEventEmitter","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"TERM_CONTROLLER","outputs":[{"internalType":"contract ITermController","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"THREESIXTY_DAYCOUNT_SECONDS","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"UPGRADE_INTERFACE_VERSION","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"USDC","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"WETH","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"listingIds","type":"uint256[]"},{"internalType":"bool","name":"skipRedeem","type":"bool"}],"name":"batchCancelListings","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"listingId","type":"uint256"},{"internalType":"bool","name":"skipRedeem","type":"bool"}],"name":"cancelListing","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"repoToken","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"createListing","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"discountRateAdapter","outputs":[{"internalType":"contract ITermDiscountRateAdapter","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"discountRateMarkup","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"listingId","type":"uint256"}],"name":"getListing","outputs":[{"internalType":"address","name":"seller","type":"address"},{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"repoToken","type":"address"}],"name":"getTotalListings","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"discountRateAdapter_","type":"address"},{"internalType":"address","name":"adminWallet_","type":"address"},{"internalType":"address","name":"devopsWallet_","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"repoToken","type":"address"}],"name":"isRepoTokenValid","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"listings","outputs":[{"internalType":"address","name":"seller","type":"address"},{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"next","type":"uint256"},{"internalType":"uint256","name":"prev","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"manageMinimumListing","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"minimumListingAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"nextId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"proxiableUUID","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"desiredAmount","type":"uint256"},{"internalType":"address","name":"repoToken","type":"address"}],"name":"purchase","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"queues","outputs":[{"internalType":"uint256","name":"head","type":"uint256"},{"internalType":"uint256","name":"tail","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"callerConfirmation","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"repoTokenBlacklist","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newAdapter","type":"address"}],"name":"setDiscountRateAdapter","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"newMarkup","type":"uint256"}],"name":"setDiscountRateMarkup","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"repoToken","type":"address"},{"internalType":"bool","name":"blacklisted","type":"bool"}],"name":"setRepoTokenBlacklist","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"purchaseTokenAmount","type":"uint256"},{"internalType":"address","name":"repoToken","type":"address"}],"name":"swapExactPurchaseForRepo","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"totalListed","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newImplementation","type":"address"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"upgradeToAndCall","outputs":[],"stateMutability":"payable","type":"function"}]
Contract Creation Code
60e0604052306080523480156200001557600080fd5b5060405162003d8e38038062003d8e8339810160408190526200003891620001a1565b62000042620000d0565b6001600160a01b03821660a081905260405163e7e4b8db60e01b81526000600482015263e7e4b8db90602401602060405180830381865afa1580156200008c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620000b29190620001d9565b15620000bd57600080fd5b6001600160a01b031660c0525062000204565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00805468010000000000000000900460ff1615620001215760405163f92ee8a960e01b815260040160405180910390fd5b80546001600160401b0390811614620001815780546001600160401b0319166001600160401b0390811782556040519081527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d29060200160405180910390a15b50565b80516001600160a01b03811681146200019c57600080fd5b919050565b60008060408385031215620001b557600080fd5b620001c08362000184565b9150620001d06020840162000184565b90509250929050565b600060208284031215620001ec57600080fd5b81518015158114620001fd57600080fd5b9392505050565b60805160a05160c051613b0d620002816000396000818161053a015281816109e201528181610b2301528181610c78015281816111510152818161157301528181611bc9015281816125a40152612fd90152600081816104c90152611a080152600081816127b8015281816127e101526129460152613b0d6000f3fe6080604052600436106102675760003560e01c8063776f119611610144578063add5ba4b116100b6578063c0c53b8b1161007a578063c0c53b8b146107d0578063d547741f146107f0578063d6725d0c14610810578063dd68f53a14610828578063de74e57b14610848578063f9cb30cd146108d257600080fd5b8063add5ba4b14610730578063ae77c23714610750578063b6769b6f14610770578063b7bd869c14610790578063bb347b17146107b057600080fd5b806389a302711161010857806389a302711461064d57806391d148541461067557806396ef72af14610695578063a217fddf146106b5578063ad3cb1cc146106ca578063ad5c46481461070857600080fd5b8063776f1196146105945780637a5f3359146105af5780638456cb59146105cf57806385e1c724146105e45780638911ac641461060457600080fd5b806336568abe116101dd57806354c885e0116101a157806354c885e0146104875780635c2e63fc146104b75780635c975abb146105035780635d7a85561461052857806361b8ce8c1461055c57806375b238fc1461057257600080fd5b806336568abe146104145780633f4ba83a14610434578063478cb783146104495780634f1ef2861461045f57806352d1902d1461047257600080fd5b8063166d98cf1161022f578063166d98cf14610353578063190e0def14610380578063201a6625146103a0578063248a9ca3146103d45780632b3ba681146103295780632f2ff15d146103f457600080fd5b806301ffc9a71461026c57806308ca9d3c146102a1578063107a274a146102c3578063123451341461030957806314e3a39814610329575b600080fd5b34801561027857600080fd5b5061028c610287366004613383565b6108ff565b60405190151581526020015b60405180910390f35b3480156102ad57600080fd5b506102c16102bc3660046133c2565b610936565b005b3480156102cf57600080fd5b506102e36102de3660046133ee565b610a44565b604080516001600160a01b03948516815293909216602084015290820152606001610298565b34801561031557600080fd5b506102c1610324366004613415565b610ac6565b34801561033557600080fd5b50610345670de0b6b3a764000081565b604051908152602001610298565b34801561035f57600080fd5b5061034561036e36600461344e565b60016020526000908152604090205481565b34801561038c57600080fd5b5061034561039b36600461344e565b610b86565b3480156103ac57600080fd5b506103457f793a6c9b7e0a9549c74edc2f9ae0dc50903dfaa9a56fb0116b27a8c71de3e2c681565b3480156103e057600080fd5b506103456103ef3660046133ee565b610bda565b34801561040057600080fd5b506102c161040f36600461346b565b610bfc565b34801561042057600080fd5b506102c161042f36600461346b565b610c1e565b34801561044057600080fd5b506102c1610c56565b34801561045557600080fd5b5061034560065481565b6102c161046d3660046134a6565b610cec565b34801561047e57600080fd5b50610345610d0b565b34801561049357600080fd5b5061028c6104a236600461344e565b60006020819052908152604090205460ff1681565b3480156104c357600080fd5b506104eb7f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b039091168152602001610298565b34801561050f57600080fd5b50600080516020613a788339815191525460ff1661028c565b34801561053457600080fd5b506104eb7f000000000000000000000000000000000000000000000000000000000000000081565b34801561056857600080fd5b5061034560055481565b34801561057e57600080fd5b50610345600080516020613ab883398151915281565b3480156105a057600080fd5b5061034566470de4df82000081565b3480156105bb57600080fd5b506102c16105ca36600461346b565b610d28565b3480156105db57600080fd5b506102c161112f565b3480156105f057600080fd5b506102c16105ff3660046133c2565b6111aa565b34801561061057600080fd5b5061063861061f36600461344e565b6004602052600090815260409020805460019091015482565b60408051928352602083019190915201610298565b34801561065957600080fd5b506104eb73a0b86991c6218b36c1d19d4a2e9eb0ce3606eb4881565b34801561068157600080fd5b5061028c61069036600461346b565b6115eb565b3480156106a157600080fd5b506102c16106b036600461356a565b611623565b3480156106c157600080fd5b50610345600081565b3480156106d657600080fd5b506106fb604051806040016040528060058152602001640352e302e360dc1b81525081565b6040516102989190613614565b34801561071457600080fd5b506104eb73c02aaa39b223fe8d0a0e5c4f27ead9083c756cc281565b34801561073c57600080fd5b506102c161074b3660046133ee565b611662565b34801561075c57600080fd5b506102c161076b36600461346b565b6116d6565b34801561077c57600080fd5b5061028c61078b36600461344e565b6119c0565b34801561079c57600080fd5b506102c16107ab36600461344e565b611b02565b3480156107bc57600080fd5b506007546104eb906001600160a01b031681565b3480156107dc57600080fd5b506102c16107eb366004613647565b611c4c565b3480156107fc57600080fd5b506102c161080b36600461346b565b611e47565b34801561081c57600080fd5b506103456301da9c0081565b34801561083457600080fd5b506102c1610843366004613687565b611e63565b34801561085457600080fd5b5061089f6108633660046133ee565b6002602081905260009182526040909120805460018201549282015460038301546004909301546001600160a01b039283169490921692909185565b604080516001600160a01b039687168152959094166020860152928401919091526060830152608082015260a001610298565b3480156108de57600080fd5b506103456108ed36600461344e565b60036020526000908152604090205481565b60006001600160e01b03198216637965db0b60e01b148061093057506301ffc9a760e01b6001600160e01b03198316145b92915050565b600080516020613ab883398151915261094e8161261f565b600082116109a35760405162461bcd60e51b815260206004820152601d60248201527f416d6f756e74206d7573742062652067726561746572207468616e203000000060448201526064015b60405180910390fd5b6001600160a01b038381166000908152600360205260409081902080549085905590516368d374b560e11b8152600481018290526024810185905290917f0000000000000000000000000000000000000000000000000000000000000000169063d1a6e96a90604401600060405180830381600087803b158015610a2657600080fd5b505af1158015610a3a573d6000803e3d6000fd5b5050505050505050565b60008060006005548410610a935760405162461bcd60e51b8152602060048201526016602482015275131a5cdd1a5b99c8191bd95cc81b9bdd08195e1a5cdd60521b604482015260640161099a565b50505060009081526002602081905260409091208054600182015491909201546001600160a01b03928316939290911691565b600080516020613ab8833981519152610ade8161261f565b6001600160a01b0383811660008181526020819052604090819020805460ff19168615159081179091559051637948ecd560e01b8152600481019290925260248201527f000000000000000000000000000000000000000000000000000000000000000090911690637948ecd590604401600060405180830381600087803b158015610b6957600080fd5b505af1158015610b7d573d6000803e3d6000fd5b50505050505050565b6001600160a01b038116600090815260046020526040812080548291905b8015610bd15782610bb4816136c2565b60009283526002602052604090922060030154919350610ba49050565b50909392505050565b6000908152600080516020613a58833981519152602052604090206001015490565b610c0582610bda565b610c0e8161261f565b610c18838361262c565b50505050565b6001600160a01b0381163314610c475760405163334bd91960e11b815260040160405180910390fd5b610c5182826126d1565b505050565b600080516020613ab8833981519152610c6e8161261f565b610c7661274d565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316639bc29da96040518163ffffffff1660e01b8152600401600060405180830381600087803b158015610cd157600080fd5b505af1158015610ce5573d6000803e3d6000fd5b5050505050565b610cf46127ad565b610cfd82612854565b610d07828261287e565b5050565b6000610d1561293b565b50600080516020613a3883398151915290565b610d30612984565b610d386129bc565b80610d42816119c0565b610d5e5760405162461bcd60e51b815260040161099a906136db565b600080836001600160a01b03166379502c556040518163ffffffff1660e01b8152600401608060405180830381865afa158015610d9f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dc39190613712565b5050915091506000846001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015610e09573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e2d9190613767565b610e3890600a61386e565b90506000826001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015610e7a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e9e9190613767565b610ea990600a61386e565b90506000428511610ebb576000610ec5565b610ec5428661387d565b600754604051633580ec1360e11b81526001600160a01b038a8116600483015292935060009290911690636b01d82690602401602060405180830381865afa158015610f15573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f399190613890565b9050600081118015610f525750670de0b6b3a764000081105b610f9e5760405162461bcd60e51b815260206004820181905260248201527f446973636f756e742072617465206f7574206f662076616c69642072616e6765604482015260640161099a565b60006301da9c00670de0b6b3a76400008a6001600160a01b031663ef4474cd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610fec573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110109190613890565b61101a91906138a9565b61102491906138a9565b905060008360065484611037919061387d565b61104191906138a9565b6110576301da9c00670de0b6b3a76400006138a9565b61106191906138c0565b9050600061106f82846138d3565b9050600081116110915760405162461bcd60e51b815260040161099a906138f5565b600061109d87836138a9565b88670de0b6b3a76400008f6110b291906138a9565b6110bc91906138a9565b6110c691906138d3565b6001600160a01b038d166000908152600160205260409020549091508111156111015760405162461bcd60e51b815260040161099a90613952565b61110d8c8a83856129ed565b5050505050505050505050610d076001600080516020613a9883398151915255565b600080516020613ab88339815191526111478161261f565b61114f612d3e565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663f6e51b396040518163ffffffff1660e01b8152600401600060405180830381600087803b158015610cd157600080fd5b6111b2612984565b6111ba6129bc565b816111c4816119c0565b6111e05760405162461bcd60e51b815260040161099a906136db565b600082116112305760405162461bcd60e51b815260206004820152601d60248201527f416d6f756e74206d7573742062652067726561746572207468616e2030000000604482015260640161099a565b60008390506000816001600160a01b03166379502c556040518163ffffffff1660e01b8152600401608060405180830381865afa158015611275573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112999190613712565b50506001600160a01b038116600090815260036020526040902054909250151590506113195760405162461bcd60e51b815260206004820152602960248201527f4e6f206d696d696e696d756d206c697374696e6720616d6f756e7420736574206044820152683337b9103a37b5b2b760b91b606482015260840161099a565b6001600160a01b0381166000908152600360205260409020548410156113945760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206973206c657373207468616e206d696e696d756d206c6973746044820152691a5b99c8185b5bdd5b9d60b21b606482015260840161099a565b6040516323b872dd60e01b8152336004820152306024820152604481018590526001600160a01b038616906323b872dd906064016020604051808303816000875af11580156113e7573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061140b919061399c565b6114275760405162461bcd60e51b815260040161099a906139b9565b6005805460009182611438836136c2565b909155506040805160a0810182523381526001600160a01b0389811660208084018281528486018c8152600060608701818152608088018281528a835260028087528a842099518a54908a166001600160a01b0319918216178b5595516001808c01805492909b169190971617909855925196880196909655945160038701555160049586015591835292909252919091209081015491925090156114ff576001810180546000908152600260205260408082206003018590559154848252919020600401555b600181018290558054600003611513578181555b6001600160a01b0387166000908152600160205260408120805488929061153b9084906138c0565b9091555050604051632842fe6760e01b8152600481018390523360248201526001600160a01b038881166044830152606482018890527f00000000000000000000000000000000000000000000000000000000000000001690632842fe6790608401600060405180830381600087803b1580156115b757600080fd5b505af11580156115cb573d6000803e3d6000fd5b505050505050505050610d076001600080516020613a9883398151915255565b6000918252600080516020613a58833981519152602090815260408084206001600160a01b0393909316845291905290205460ff1690565b60005b82811015610c1857611650848483818110611643576116436139e8565b9050602002013583611e63565b8061165a816136c2565b915050611626565b600080516020613ab883398151915261167a8161261f565b66470de4df82000082106116d05760405162461bcd60e51b815260206004820152601b60248201527f4d61726b7570206d757374206265206c657373207468616e2032250000000000604482015260640161099a565b50600655565b6116de612984565b6116e66129bc565b806116f0816119c0565b61170c5760405162461bcd60e51b815260040161099a906136db565b6001600160a01b0382166000908152600160205260409020548311156117445760405162461bcd60e51b815260040161099a90613952565b600080836001600160a01b03166379502c556040518163ffffffff1660e01b8152600401608060405180830381865afa158015611785573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117a99190613712565b50509150915060004283116117bf5760006117c9565b6117c9428461387d565b600754604051633580ec1360e11b81526001600160a01b03888116600483015292935060009290911690636b01d82690602401602060405180830381865afa158015611819573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061183d9190613890565b90506000811180156118565750670de0b6b3a764000081105b6118a25760405162461bcd60e51b815260206004820181905260248201527f446973636f756e742072617465206f7574206f662076616c69642072616e6765604482015260640161099a565b60006301da9c00670de0b6b3a7640000886001600160a01b031663ef4474cd6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156118f0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119149190613890565b61191e91906138a9565b61192891906138a9565b90506000836006548461193b919061387d565b61194591906138a9565b61195b6301da9c00670de0b6b3a76400006138a9565b61196591906138c0565b9050600061197382846138d3565b9050600081116119955760405162461bcd60e51b815260040161099a906138f5565b6119a189878c846129ed565b5050505050505050610d076001600080516020613a9883398151915255565b6001600160a01b03811660009081526020819052604081205460ff16156119e957506000919050565b60405163e7e4b8db60e01b81526001600160a01b0383811660048301527f0000000000000000000000000000000000000000000000000000000000000000169063e7e4b8db90602401602060405180830381865afa158015611a4f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a73919061399c565b611a7f57506000919050565b6000826001600160a01b03166379502c556040518163ffffffff1660e01b8152600401608060405180830381865afa158015611abf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ae39190613712565b505050905042811015611af95750600092915050565b50600192915050565b600080516020613ab8833981519152611b1a8161261f565b600082905060006001600160a01b0316816001600160a01b0316635c2e63fc6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611b68573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b8c91906139fe565b6001600160a01b031603611b9f57600080fd5b6007546040516399146dff60e01b81526001600160a01b03918216600482015284821660248201527f0000000000000000000000000000000000000000000000000000000000000000909116906399146dff90604401600060405180830381600087803b158015611c0f57600080fd5b505af1158015611c23573d6000803e3d6000fd5b5050600780546001600160a01b0319166001600160a01b03949094169390931790925550505050565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a008054600160401b810460ff16159067ffffffffffffffff16600081158015611c925750825b905060008267ffffffffffffffff166001148015611caf5750303b155b905081158015611cbd575080155b15611cdb5760405163f92ee8a960e01b815260040160405180910390fd5b845467ffffffffffffffff191660011785558315611d0557845460ff60401b1916600160401b1785555b611d0d612d87565b611d15612d87565b611d1d612d8f565b611d25612d9f565b600780546001600160a01b0319166001600160a01b038a1617905560016005556003602052633b9aca007f37c5eec85d84da1cf053e48828b531c27553684966639a8ba393ecfe725880fd5573c02aaa39b223fe8d0a0e5c4f27ead9083c756cc26000526706f05b59d3b200007f67aa9b7d2b6d14f3837d07b1073399a41e4104b1d98f169f02cc04f44f14f4b055611dcc600080516020613ab88339815191528861262c565b50611df77f793a6c9b7e0a9549c74edc2f9ae0dc50903dfaa9a56fb0116b27a8c71de3e2c68761262c565b508315610a3a57845460ff60401b19168555604051600181527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d29060200160405180910390a15050505050505050565b611e5082610bda565b611e598161261f565b610c1883836126d1565b611e6b612984565b611e736129bc565b6005548210611ebd5760405162461bcd60e51b8152602060048201526016602482015275131a5cdd1a5b99c8191bd95cc81b9bdd08195e1a5cdd60521b604482015260640161099a565b600082815260026020526040902080546001600160a01b0316331480611ef65750611ef6600080516020613ab8833981519152336115eb565b611f525760405162461bcd60e51b815260206004820152602760248201527f4f6e6c79207468652073656c6c65722063616e2063616e63656c2074686973206044820152666c697374696e6760c81b606482015260840161099a565b600281015460018083015483546001600160a01b03918216600081815260209490945260408420805491949390921692859291611f9090849061387d565b90915550611fa090508287612daf565b6000806000846001600160a01b03166379502c556040518163ffffffff1660e01b8152600401608060405180830381865afa158015611fe3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120079190613712565b506040516370a0823160e01b815230600482015292955090935091506000906001600160a01b038716906370a0823190602401602060405180830381865afa158015612057573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061207b9190613890565b90508681101561245e5760405163a9059cbb60e01b81526001600160a01b0386811660048301526024820183905282919088169063a9059cbb906044016020604051808303816000875af11580156120d7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120fb919061399c565b6121475760405162461bcd60e51b815260206004820152601960248201527f5265706f546f6b656e207472616e73666572206661696c656400000000000000604482015260640161099a565b6000612153828a61387d565b90506000886001600160a01b031663ef4474cd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015612195573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121b99190613890565b90506000670de0b6b3a76400006121d083856138a9565b6121da91906138d3565b90506000869050806001600160a01b0316633dcaa6c66040518163ffffffff1660e01b8152600401602060405180830381865afa15801561221f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122439190613890565b60000361230e5760405163a9059cbb60e01b81526001600160a01b038b811660048301526024820184905289169063a9059cbb906044016020604051808303816000875af1158015612299573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122bd919061399c565b6123095760405162461bcd60e51b815260206004820152601d60248201527f5075726368617365546f6b656e207472616e73666572206661696c6564000000604482015260640161099a565b612454565b6000670de0b6b3a7640000826001600160a01b0316633dcaa6c66040518163ffffffff1660e01b8152600401602060405180830381865afa158015612357573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061237b9190613890565b61238590856138a9565b61238f91906138d3565b60405163a9059cbb60e01b81526001600160a01b038d8116600483015260248201839052919250908a169063a9059cbb906044016020604051808303816000875af11580156123e2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612406919061399c565b6124525760405162461bcd60e51b815260206004820152601d60248201527f5075726368617365546f6b656e207472616e73666572206661696c6564000000604482015260640161099a565b505b50505050506124ed565b60405163a9059cbb60e01b81526001600160a01b0386811660048301526024820189905287169063a9059cbb906044016020604051808303816000875af11580156124ad573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124d1919061399c565b6124ed5760405162461bcd60e51b815260040161099a906139b9565b881580156124fa57504284105b1561257757816001600160a01b0316637e237e898689841061251c578961251e565b835b6040516001600160e01b031960e085901b1681526001600160a01b0390921660048301526024820152604401600060405180830381600087803b15801561256457600080fd5b505af1925050508015612575575060015b505b6040516387eca36960e01b8152600481018b90526001600160a01b038681166024830152604482018990527f000000000000000000000000000000000000000000000000000000000000000016906387eca36990606401600060405180830381600087803b1580156125e857600080fd5b505af11580156125fc573d6000803e3d6000fd5b505050505050505050505050610d076001600080516020613a9883398151915255565b6126298133612ed0565b50565b6000600080516020613a5883398151915261264784846115eb565b6126c7576000848152602082815260408083206001600160a01b03871684529091529020805460ff1916600117905561267d3390565b6001600160a01b0316836001600160a01b0316857f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a46001915050610930565b6000915050610930565b6000600080516020613a588339815191526126ec84846115eb565b156126c7576000848152602082815260408083206001600160a01b0387168085529252808320805460ff1916905551339287917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a46001915050610930565b612755612f09565b600080516020613a78833981519152805460ff191681557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a150565b306001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016148061283457507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316612828600080516020613a38833981519152546001600160a01b031690565b6001600160a01b031614155b156128525760405163703e46dd60e11b815260040160405180910390fd5b565b7f793a6c9b7e0a9549c74edc2f9ae0dc50903dfaa9a56fb0116b27a8c71de3e2c6610d078161261f565b816001600160a01b03166352d1902d6040518163ffffffff1660e01b8152600401602060405180830381865afa9250505080156128d8575060408051601f3d908101601f191682019092526128d591810190613890565b60015b61290057604051634c9c8ce360e01b81526001600160a01b038316600482015260240161099a565b600080516020613a38833981519152811461293157604051632a87526960e21b81526004810182905260240161099a565b610c518383612f39565b306001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146128525760405163703e46dd60e11b815260040160405180910390fd5b600080516020613a988339815191528054600119016129b657604051633ee5aeb560e01b815260040160405180910390fd5b60029055565b600080516020613a788339815191525460ff16156128525760405163d93c066560e01b815260040160405180910390fd5b6000846001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015612a2d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612a519190613767565b612a5c90600a61386e565b90506000846001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015612a9e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612ac29190613767565b612acd90600a61386e565b6001600160a01b0387166000908152600460205260409020805491925085915b8015801590612afc5750600083115b15612cb557600081815260026020526040902060018101546001600160a01b038b8116911614612b655760405162461bcd60e51b81526020600482015260146024820152732ab732bc3832b1ba32b2103932b837aa37b5b2b760611b604482015260640161099a565b6000816002015411612bb95760405162461bcd60e51b815260206004820152601860248201527f556e657870656374656420656d707479206c697374696e670000000000000000604482015260640161099a565b600081600201548511612bcc5784612bd2565b81600201545b90506000670de0b6b3a7640000612be9838b6138a9565b612bf391906138d3565b905087612c0088836138a9565b612c0a91906138d3565b905081836002016000828254612c20919061387d565b90915550506001600160a01b038c1660009081526001602052604081208054849290612c4d90849061387d565b90915550612c5d9050828761387d565b83546001850154919750612c839186918e916001600160a01b0391821691168686612f8f565b8260020154600003612ca5576003830154612c9e8d86612daf565b9350612cad565b826003015493505b505050612aed565b8215612d1f5760405162461bcd60e51b815260206004820152603360248201527f4e6f7420656e6f75676820746f6b656e7320617661696c61626c6520746f2066604482015272756c66696c6c2074686520707572636861736560681b606482015260840161099a565b505050505050505050565b6001600080516020613a9883398151915255565b612d466129bc565b600080516020613a78833981519152805460ff191660011781557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2583361278f565b61285261318f565b612d9761318f565b6128526131d8565b612da761318f565b6128526131e0565b60008181526002602090815260408083206001600160a01b0380871680865260049094529190932060018401549092911614612e245760405162461bcd60e51b81526020600482015260146024820152732ab732bc3832b1ba32b2103932b837aa37b5b2b760611b604482015260640161099a565b600482015415612e50576003808301546004840154600090815260026020526040902090910155612e58565b600382015481555b600382015415612e84576004808301546003840154600090815260026020526040902090910155612e8f565b600482015460018201555b50506000908152600260208190526040822080546001600160a01b031990811682556001820180549091169055908101829055600381018290556004015550565b612eda82826115eb565b610d075760405163e2517d3f60e01b81526001600160a01b03821660048201526024810183905260440161099a565b600080516020613a788339815191525460ff1661285257604051638dfc202b60e01b815260040160405180910390fd5b612f4282613201565b6040516001600160a01b038316907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a2805115612f8757610c518282613266565b610d076132dc565b60405163f709642b60e01b8152600481018790523360248201526001600160a01b03858116604483015284811660648301526084820184905286811660a483015260c482018390527f0000000000000000000000000000000000000000000000000000000000000000169063f709642b9060e401600060405180830381600087803b15801561301d57600080fd5b505af1158015613031573d6000803e3d6000fd5b50506040516323b872dd60e01b81523360048201526001600160a01b03878116602483015260448201859052881692506323b872dd91506064016020604051808303816000875af115801561308a573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906130ae919061399c565b6130fa5760405162461bcd60e51b815260206004820152601760248201527f5061796d656e74207472616e73666572206661696c6564000000000000000000604482015260640161099a565b60405163a9059cbb60e01b8152336004820152602481018390526001600160a01b0384169063a9059cbb906044016020604051808303816000875af1158015613147573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061316b919061399c565b6131875760405162461bcd60e51b815260040161099a906139b9565b505050505050565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a0054600160401b900460ff1661285257604051631afcd79f60e31b815260040160405180910390fd5b612d2a61318f565b6131e861318f565b600080516020613a78833981519152805460ff19169055565b806001600160a01b03163b60000361323757604051634c9c8ce360e01b81526001600160a01b038216600482015260240161099a565b600080516020613a3883398151915280546001600160a01b0319166001600160a01b0392909216919091179055565b6060600080846001600160a01b0316846040516132839190613a1b565b600060405180830381855af49150503d80600081146132be576040519150601f19603f3d011682016040523d82523d6000602084013e6132c3565b606091505b50915091506132d38583836132fb565b95945050505050565b34156128525760405163b398979f60e01b815260040160405180910390fd5b6060826133105761330b8261335a565b613353565b815115801561332757506001600160a01b0384163b155b1561335057604051639996b31560e01b81526001600160a01b038516600482015260240161099a565b50805b9392505050565b80511561336a5780518082602001fd5b604051630a12f52160e11b815260040160405180910390fd5b60006020828403121561339557600080fd5b81356001600160e01b03198116811461335357600080fd5b6001600160a01b038116811461262957600080fd5b600080604083850312156133d557600080fd5b82356133e0816133ad565b946020939093013593505050565b60006020828403121561340057600080fd5b5035919050565b801515811461262957600080fd5b6000806040838503121561342857600080fd5b8235613433816133ad565b9150602083013561344381613407565b809150509250929050565b60006020828403121561346057600080fd5b8135613353816133ad565b6000806040838503121561347e57600080fd5b823591506020830135613443816133ad565b634e487b7160e01b600052604160045260246000fd5b600080604083850312156134b957600080fd5b82356134c4816133ad565b9150602083013567ffffffffffffffff808211156134e157600080fd5b818501915085601f8301126134f557600080fd5b81358181111561350757613507613490565b604051601f8201601f19908116603f0116810190838211818310171561352f5761352f613490565b8160405282815288602084870101111561354857600080fd5b8260208601602083013760006020848301015280955050505050509250929050565b60008060006040848603121561357f57600080fd5b833567ffffffffffffffff8082111561359757600080fd5b818601915086601f8301126135ab57600080fd5b8135818111156135ba57600080fd5b8760208260051b85010111156135cf57600080fd5b602092830195509350508401356135e581613407565b809150509250925092565b60005b8381101561360b5781810151838201526020016135f3565b50506000910152565b60208152600082518060208401526136338160408501602087016135f0565b601f01601f19169190910160400192915050565b60008060006060848603121561365c57600080fd5b8335613667816133ad565b92506020840135613677816133ad565b915060408401356135e5816133ad565b6000806040838503121561369a57600080fd5b82359150602083013561344381613407565b634e487b7160e01b600052601160045260246000fd5b6000600182016136d4576136d46136ac565b5060010190565b6020808252601a908201527f5265706f546f6b656e206973206e6f742076616c696461746564000000000000604082015260600190565b6000806000806080858703121561372857600080fd5b84519350602085015161373a816133ad565b604086015190935061374b816133ad565b606086015190925061375c816133ad565b939692955090935050565b60006020828403121561377957600080fd5b815160ff8116811461335357600080fd5b600181815b808511156137c55781600019048211156137ab576137ab6136ac565b808516156137b857918102915b93841c939080029061378f565b509250929050565b6000826137dc57506001610930565b816137e957506000610930565b81600181146137ff576002811461380957613825565b6001915050610930565b60ff84111561381a5761381a6136ac565b50506001821b610930565b5060208310610133831016604e8410600b8410161715613848575081810a610930565b613852838361378a565b8060001904821115613866576138666136ac565b029392505050565b600061335360ff8416836137cd565b81810381811115610930576109306136ac565b6000602082840312156138a257600080fd5b5051919050565b8082028115828204841417610930576109306136ac565b80820180821115610930576109306136ac565b6000826138f057634e487b7160e01b600052601260045260246000fd5b500490565b6020808252603d908201527f4e6f2076616c6964207072696365506572546f6b656e2063616c63756c61746560408201527f6420666f722074686520737065636966696564207265706f546f6b656e000000606082015260800190565b6020808252602a908201527f4465736972656420616d6f756e74206578636565647320746f74616c206c697360408201526974656420746f6b656e7360b01b606082015260800190565b6000602082840312156139ae57600080fd5b815161335381613407565b602080825260159082015274151bdad95b881d1c985b9cd9995c8819985a5b1959605a1b604082015260600190565b634e487b7160e01b600052603260045260246000fd5b600060208284031215613a1057600080fd5b8151613353816133ad565b60008251613a2d8184602087016135f0565b919091019291505056fe360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc02dd7bc7dec4dceedda775e58dd541e08a116c6c53815c0bd028192f7b626800cd5ed15c6e187e77e9aee88184c21f4f2182ab5827cb3b7e07fbedcd63f033009b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f00a49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c21775a2646970667358221220fb01600483387d660e9f7b1c485edb6241d93dbece14ebe1e663038b30cc7c3364736f6c6343000814003300000000000000000000000021fc7b250ccaeecdb2abb38e04617d1f24d98772000000000000000000000000e544defaa15e00611fcb2a03fe913938a5ed5686
Deployed Bytecode
0x6080604052600436106102675760003560e01c8063776f119611610144578063add5ba4b116100b6578063c0c53b8b1161007a578063c0c53b8b146107d0578063d547741f146107f0578063d6725d0c14610810578063dd68f53a14610828578063de74e57b14610848578063f9cb30cd146108d257600080fd5b8063add5ba4b14610730578063ae77c23714610750578063b6769b6f14610770578063b7bd869c14610790578063bb347b17146107b057600080fd5b806389a302711161010857806389a302711461064d57806391d148541461067557806396ef72af14610695578063a217fddf146106b5578063ad3cb1cc146106ca578063ad5c46481461070857600080fd5b8063776f1196146105945780637a5f3359146105af5780638456cb59146105cf57806385e1c724146105e45780638911ac641461060457600080fd5b806336568abe116101dd57806354c885e0116101a157806354c885e0146104875780635c2e63fc146104b75780635c975abb146105035780635d7a85561461052857806361b8ce8c1461055c57806375b238fc1461057257600080fd5b806336568abe146104145780633f4ba83a14610434578063478cb783146104495780634f1ef2861461045f57806352d1902d1461047257600080fd5b8063166d98cf1161022f578063166d98cf14610353578063190e0def14610380578063201a6625146103a0578063248a9ca3146103d45780632b3ba681146103295780632f2ff15d146103f457600080fd5b806301ffc9a71461026c57806308ca9d3c146102a1578063107a274a146102c3578063123451341461030957806314e3a39814610329575b600080fd5b34801561027857600080fd5b5061028c610287366004613383565b6108ff565b60405190151581526020015b60405180910390f35b3480156102ad57600080fd5b506102c16102bc3660046133c2565b610936565b005b3480156102cf57600080fd5b506102e36102de3660046133ee565b610a44565b604080516001600160a01b03948516815293909216602084015290820152606001610298565b34801561031557600080fd5b506102c1610324366004613415565b610ac6565b34801561033557600080fd5b50610345670de0b6b3a764000081565b604051908152602001610298565b34801561035f57600080fd5b5061034561036e36600461344e565b60016020526000908152604090205481565b34801561038c57600080fd5b5061034561039b36600461344e565b610b86565b3480156103ac57600080fd5b506103457f793a6c9b7e0a9549c74edc2f9ae0dc50903dfaa9a56fb0116b27a8c71de3e2c681565b3480156103e057600080fd5b506103456103ef3660046133ee565b610bda565b34801561040057600080fd5b506102c161040f36600461346b565b610bfc565b34801561042057600080fd5b506102c161042f36600461346b565b610c1e565b34801561044057600080fd5b506102c1610c56565b34801561045557600080fd5b5061034560065481565b6102c161046d3660046134a6565b610cec565b34801561047e57600080fd5b50610345610d0b565b34801561049357600080fd5b5061028c6104a236600461344e565b60006020819052908152604090205460ff1681565b3480156104c357600080fd5b506104eb7f00000000000000000000000021fc7b250ccaeecdb2abb38e04617d1f24d9877281565b6040516001600160a01b039091168152602001610298565b34801561050f57600080fd5b50600080516020613a788339815191525460ff1661028c565b34801561053457600080fd5b506104eb7f000000000000000000000000e544defaa15e00611fcb2a03fe913938a5ed568681565b34801561056857600080fd5b5061034560055481565b34801561057e57600080fd5b50610345600080516020613ab883398151915281565b3480156105a057600080fd5b5061034566470de4df82000081565b3480156105bb57600080fd5b506102c16105ca36600461346b565b610d28565b3480156105db57600080fd5b506102c161112f565b3480156105f057600080fd5b506102c16105ff3660046133c2565b6111aa565b34801561061057600080fd5b5061063861061f36600461344e565b6004602052600090815260409020805460019091015482565b60408051928352602083019190915201610298565b34801561065957600080fd5b506104eb73a0b86991c6218b36c1d19d4a2e9eb0ce3606eb4881565b34801561068157600080fd5b5061028c61069036600461346b565b6115eb565b3480156106a157600080fd5b506102c16106b036600461356a565b611623565b3480156106c157600080fd5b50610345600081565b3480156106d657600080fd5b506106fb604051806040016040528060058152602001640352e302e360dc1b81525081565b6040516102989190613614565b34801561071457600080fd5b506104eb73c02aaa39b223fe8d0a0e5c4f27ead9083c756cc281565b34801561073c57600080fd5b506102c161074b3660046133ee565b611662565b34801561075c57600080fd5b506102c161076b36600461346b565b6116d6565b34801561077c57600080fd5b5061028c61078b36600461344e565b6119c0565b34801561079c57600080fd5b506102c16107ab36600461344e565b611b02565b3480156107bc57600080fd5b506007546104eb906001600160a01b031681565b3480156107dc57600080fd5b506102c16107eb366004613647565b611c4c565b3480156107fc57600080fd5b506102c161080b36600461346b565b611e47565b34801561081c57600080fd5b506103456301da9c0081565b34801561083457600080fd5b506102c1610843366004613687565b611e63565b34801561085457600080fd5b5061089f6108633660046133ee565b6002602081905260009182526040909120805460018201549282015460038301546004909301546001600160a01b039283169490921692909185565b604080516001600160a01b039687168152959094166020860152928401919091526060830152608082015260a001610298565b3480156108de57600080fd5b506103456108ed36600461344e565b60036020526000908152604090205481565b60006001600160e01b03198216637965db0b60e01b148061093057506301ffc9a760e01b6001600160e01b03198316145b92915050565b600080516020613ab883398151915261094e8161261f565b600082116109a35760405162461bcd60e51b815260206004820152601d60248201527f416d6f756e74206d7573742062652067726561746572207468616e203000000060448201526064015b60405180910390fd5b6001600160a01b038381166000908152600360205260409081902080549085905590516368d374b560e11b8152600481018290526024810185905290917f000000000000000000000000e544defaa15e00611fcb2a03fe913938a5ed5686169063d1a6e96a90604401600060405180830381600087803b158015610a2657600080fd5b505af1158015610a3a573d6000803e3d6000fd5b5050505050505050565b60008060006005548410610a935760405162461bcd60e51b8152602060048201526016602482015275131a5cdd1a5b99c8191bd95cc81b9bdd08195e1a5cdd60521b604482015260640161099a565b50505060009081526002602081905260409091208054600182015491909201546001600160a01b03928316939290911691565b600080516020613ab8833981519152610ade8161261f565b6001600160a01b0383811660008181526020819052604090819020805460ff19168615159081179091559051637948ecd560e01b8152600481019290925260248201527f000000000000000000000000e544defaa15e00611fcb2a03fe913938a5ed568690911690637948ecd590604401600060405180830381600087803b158015610b6957600080fd5b505af1158015610b7d573d6000803e3d6000fd5b50505050505050565b6001600160a01b038116600090815260046020526040812080548291905b8015610bd15782610bb4816136c2565b60009283526002602052604090922060030154919350610ba49050565b50909392505050565b6000908152600080516020613a58833981519152602052604090206001015490565b610c0582610bda565b610c0e8161261f565b610c18838361262c565b50505050565b6001600160a01b0381163314610c475760405163334bd91960e11b815260040160405180910390fd5b610c5182826126d1565b505050565b600080516020613ab8833981519152610c6e8161261f565b610c7661274d565b7f000000000000000000000000e544defaa15e00611fcb2a03fe913938a5ed56866001600160a01b0316639bc29da96040518163ffffffff1660e01b8152600401600060405180830381600087803b158015610cd157600080fd5b505af1158015610ce5573d6000803e3d6000fd5b5050505050565b610cf46127ad565b610cfd82612854565b610d07828261287e565b5050565b6000610d1561293b565b50600080516020613a3883398151915290565b610d30612984565b610d386129bc565b80610d42816119c0565b610d5e5760405162461bcd60e51b815260040161099a906136db565b600080836001600160a01b03166379502c556040518163ffffffff1660e01b8152600401608060405180830381865afa158015610d9f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dc39190613712565b5050915091506000846001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015610e09573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e2d9190613767565b610e3890600a61386e565b90506000826001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015610e7a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e9e9190613767565b610ea990600a61386e565b90506000428511610ebb576000610ec5565b610ec5428661387d565b600754604051633580ec1360e11b81526001600160a01b038a8116600483015292935060009290911690636b01d82690602401602060405180830381865afa158015610f15573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f399190613890565b9050600081118015610f525750670de0b6b3a764000081105b610f9e5760405162461bcd60e51b815260206004820181905260248201527f446973636f756e742072617465206f7574206f662076616c69642072616e6765604482015260640161099a565b60006301da9c00670de0b6b3a76400008a6001600160a01b031663ef4474cd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610fec573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110109190613890565b61101a91906138a9565b61102491906138a9565b905060008360065484611037919061387d565b61104191906138a9565b6110576301da9c00670de0b6b3a76400006138a9565b61106191906138c0565b9050600061106f82846138d3565b9050600081116110915760405162461bcd60e51b815260040161099a906138f5565b600061109d87836138a9565b88670de0b6b3a76400008f6110b291906138a9565b6110bc91906138a9565b6110c691906138d3565b6001600160a01b038d166000908152600160205260409020549091508111156111015760405162461bcd60e51b815260040161099a90613952565b61110d8c8a83856129ed565b5050505050505050505050610d076001600080516020613a9883398151915255565b600080516020613ab88339815191526111478161261f565b61114f612d3e565b7f000000000000000000000000e544defaa15e00611fcb2a03fe913938a5ed56866001600160a01b031663f6e51b396040518163ffffffff1660e01b8152600401600060405180830381600087803b158015610cd157600080fd5b6111b2612984565b6111ba6129bc565b816111c4816119c0565b6111e05760405162461bcd60e51b815260040161099a906136db565b600082116112305760405162461bcd60e51b815260206004820152601d60248201527f416d6f756e74206d7573742062652067726561746572207468616e2030000000604482015260640161099a565b60008390506000816001600160a01b03166379502c556040518163ffffffff1660e01b8152600401608060405180830381865afa158015611275573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112999190613712565b50506001600160a01b038116600090815260036020526040902054909250151590506113195760405162461bcd60e51b815260206004820152602960248201527f4e6f206d696d696e696d756d206c697374696e6720616d6f756e7420736574206044820152683337b9103a37b5b2b760b91b606482015260840161099a565b6001600160a01b0381166000908152600360205260409020548410156113945760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206973206c657373207468616e206d696e696d756d206c6973746044820152691a5b99c8185b5bdd5b9d60b21b606482015260840161099a565b6040516323b872dd60e01b8152336004820152306024820152604481018590526001600160a01b038616906323b872dd906064016020604051808303816000875af11580156113e7573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061140b919061399c565b6114275760405162461bcd60e51b815260040161099a906139b9565b6005805460009182611438836136c2565b909155506040805160a0810182523381526001600160a01b0389811660208084018281528486018c8152600060608701818152608088018281528a835260028087528a842099518a54908a166001600160a01b0319918216178b5595516001808c01805492909b169190971617909855925196880196909655945160038701555160049586015591835292909252919091209081015491925090156114ff576001810180546000908152600260205260408082206003018590559154848252919020600401555b600181018290558054600003611513578181555b6001600160a01b0387166000908152600160205260408120805488929061153b9084906138c0565b9091555050604051632842fe6760e01b8152600481018390523360248201526001600160a01b038881166044830152606482018890527f000000000000000000000000e544defaa15e00611fcb2a03fe913938a5ed56861690632842fe6790608401600060405180830381600087803b1580156115b757600080fd5b505af11580156115cb573d6000803e3d6000fd5b505050505050505050610d076001600080516020613a9883398151915255565b6000918252600080516020613a58833981519152602090815260408084206001600160a01b0393909316845291905290205460ff1690565b60005b82811015610c1857611650848483818110611643576116436139e8565b9050602002013583611e63565b8061165a816136c2565b915050611626565b600080516020613ab883398151915261167a8161261f565b66470de4df82000082106116d05760405162461bcd60e51b815260206004820152601b60248201527f4d61726b7570206d757374206265206c657373207468616e2032250000000000604482015260640161099a565b50600655565b6116de612984565b6116e66129bc565b806116f0816119c0565b61170c5760405162461bcd60e51b815260040161099a906136db565b6001600160a01b0382166000908152600160205260409020548311156117445760405162461bcd60e51b815260040161099a90613952565b600080836001600160a01b03166379502c556040518163ffffffff1660e01b8152600401608060405180830381865afa158015611785573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117a99190613712565b50509150915060004283116117bf5760006117c9565b6117c9428461387d565b600754604051633580ec1360e11b81526001600160a01b03888116600483015292935060009290911690636b01d82690602401602060405180830381865afa158015611819573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061183d9190613890565b90506000811180156118565750670de0b6b3a764000081105b6118a25760405162461bcd60e51b815260206004820181905260248201527f446973636f756e742072617465206f7574206f662076616c69642072616e6765604482015260640161099a565b60006301da9c00670de0b6b3a7640000886001600160a01b031663ef4474cd6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156118f0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119149190613890565b61191e91906138a9565b61192891906138a9565b90506000836006548461193b919061387d565b61194591906138a9565b61195b6301da9c00670de0b6b3a76400006138a9565b61196591906138c0565b9050600061197382846138d3565b9050600081116119955760405162461bcd60e51b815260040161099a906138f5565b6119a189878c846129ed565b5050505050505050610d076001600080516020613a9883398151915255565b6001600160a01b03811660009081526020819052604081205460ff16156119e957506000919050565b60405163e7e4b8db60e01b81526001600160a01b0383811660048301527f00000000000000000000000021fc7b250ccaeecdb2abb38e04617d1f24d98772169063e7e4b8db90602401602060405180830381865afa158015611a4f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a73919061399c565b611a7f57506000919050565b6000826001600160a01b03166379502c556040518163ffffffff1660e01b8152600401608060405180830381865afa158015611abf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ae39190613712565b505050905042811015611af95750600092915050565b50600192915050565b600080516020613ab8833981519152611b1a8161261f565b600082905060006001600160a01b0316816001600160a01b0316635c2e63fc6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611b68573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b8c91906139fe565b6001600160a01b031603611b9f57600080fd5b6007546040516399146dff60e01b81526001600160a01b03918216600482015284821660248201527f000000000000000000000000e544defaa15e00611fcb2a03fe913938a5ed5686909116906399146dff90604401600060405180830381600087803b158015611c0f57600080fd5b505af1158015611c23573d6000803e3d6000fd5b5050600780546001600160a01b0319166001600160a01b03949094169390931790925550505050565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a008054600160401b810460ff16159067ffffffffffffffff16600081158015611c925750825b905060008267ffffffffffffffff166001148015611caf5750303b155b905081158015611cbd575080155b15611cdb5760405163f92ee8a960e01b815260040160405180910390fd5b845467ffffffffffffffff191660011785558315611d0557845460ff60401b1916600160401b1785555b611d0d612d87565b611d15612d87565b611d1d612d8f565b611d25612d9f565b600780546001600160a01b0319166001600160a01b038a1617905560016005556003602052633b9aca007f37c5eec85d84da1cf053e48828b531c27553684966639a8ba393ecfe725880fd5573c02aaa39b223fe8d0a0e5c4f27ead9083c756cc26000526706f05b59d3b200007f67aa9b7d2b6d14f3837d07b1073399a41e4104b1d98f169f02cc04f44f14f4b055611dcc600080516020613ab88339815191528861262c565b50611df77f793a6c9b7e0a9549c74edc2f9ae0dc50903dfaa9a56fb0116b27a8c71de3e2c68761262c565b508315610a3a57845460ff60401b19168555604051600181527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d29060200160405180910390a15050505050505050565b611e5082610bda565b611e598161261f565b610c1883836126d1565b611e6b612984565b611e736129bc565b6005548210611ebd5760405162461bcd60e51b8152602060048201526016602482015275131a5cdd1a5b99c8191bd95cc81b9bdd08195e1a5cdd60521b604482015260640161099a565b600082815260026020526040902080546001600160a01b0316331480611ef65750611ef6600080516020613ab8833981519152336115eb565b611f525760405162461bcd60e51b815260206004820152602760248201527f4f6e6c79207468652073656c6c65722063616e2063616e63656c2074686973206044820152666c697374696e6760c81b606482015260840161099a565b600281015460018083015483546001600160a01b03918216600081815260209490945260408420805491949390921692859291611f9090849061387d565b90915550611fa090508287612daf565b6000806000846001600160a01b03166379502c556040518163ffffffff1660e01b8152600401608060405180830381865afa158015611fe3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120079190613712565b506040516370a0823160e01b815230600482015292955090935091506000906001600160a01b038716906370a0823190602401602060405180830381865afa158015612057573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061207b9190613890565b90508681101561245e5760405163a9059cbb60e01b81526001600160a01b0386811660048301526024820183905282919088169063a9059cbb906044016020604051808303816000875af11580156120d7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120fb919061399c565b6121475760405162461bcd60e51b815260206004820152601960248201527f5265706f546f6b656e207472616e73666572206661696c656400000000000000604482015260640161099a565b6000612153828a61387d565b90506000886001600160a01b031663ef4474cd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015612195573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121b99190613890565b90506000670de0b6b3a76400006121d083856138a9565b6121da91906138d3565b90506000869050806001600160a01b0316633dcaa6c66040518163ffffffff1660e01b8152600401602060405180830381865afa15801561221f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122439190613890565b60000361230e5760405163a9059cbb60e01b81526001600160a01b038b811660048301526024820184905289169063a9059cbb906044016020604051808303816000875af1158015612299573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122bd919061399c565b6123095760405162461bcd60e51b815260206004820152601d60248201527f5075726368617365546f6b656e207472616e73666572206661696c6564000000604482015260640161099a565b612454565b6000670de0b6b3a7640000826001600160a01b0316633dcaa6c66040518163ffffffff1660e01b8152600401602060405180830381865afa158015612357573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061237b9190613890565b61238590856138a9565b61238f91906138d3565b60405163a9059cbb60e01b81526001600160a01b038d8116600483015260248201839052919250908a169063a9059cbb906044016020604051808303816000875af11580156123e2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612406919061399c565b6124525760405162461bcd60e51b815260206004820152601d60248201527f5075726368617365546f6b656e207472616e73666572206661696c6564000000604482015260640161099a565b505b50505050506124ed565b60405163a9059cbb60e01b81526001600160a01b0386811660048301526024820189905287169063a9059cbb906044016020604051808303816000875af11580156124ad573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124d1919061399c565b6124ed5760405162461bcd60e51b815260040161099a906139b9565b881580156124fa57504284105b1561257757816001600160a01b0316637e237e898689841061251c578961251e565b835b6040516001600160e01b031960e085901b1681526001600160a01b0390921660048301526024820152604401600060405180830381600087803b15801561256457600080fd5b505af1925050508015612575575060015b505b6040516387eca36960e01b8152600481018b90526001600160a01b038681166024830152604482018990527f000000000000000000000000e544defaa15e00611fcb2a03fe913938a5ed568616906387eca36990606401600060405180830381600087803b1580156125e857600080fd5b505af11580156125fc573d6000803e3d6000fd5b505050505050505050505050610d076001600080516020613a9883398151915255565b6126298133612ed0565b50565b6000600080516020613a5883398151915261264784846115eb565b6126c7576000848152602082815260408083206001600160a01b03871684529091529020805460ff1916600117905561267d3390565b6001600160a01b0316836001600160a01b0316857f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a46001915050610930565b6000915050610930565b6000600080516020613a588339815191526126ec84846115eb565b156126c7576000848152602082815260408083206001600160a01b0387168085529252808320805460ff1916905551339287917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a46001915050610930565b612755612f09565b600080516020613a78833981519152805460ff191681557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a150565b306001600160a01b037f0000000000000000000000005babc066a5e08faa89e3d5c9c2d8613be9bd383b16148061283457507f0000000000000000000000005babc066a5e08faa89e3d5c9c2d8613be9bd383b6001600160a01b0316612828600080516020613a38833981519152546001600160a01b031690565b6001600160a01b031614155b156128525760405163703e46dd60e11b815260040160405180910390fd5b565b7f793a6c9b7e0a9549c74edc2f9ae0dc50903dfaa9a56fb0116b27a8c71de3e2c6610d078161261f565b816001600160a01b03166352d1902d6040518163ffffffff1660e01b8152600401602060405180830381865afa9250505080156128d8575060408051601f3d908101601f191682019092526128d591810190613890565b60015b61290057604051634c9c8ce360e01b81526001600160a01b038316600482015260240161099a565b600080516020613a38833981519152811461293157604051632a87526960e21b81526004810182905260240161099a565b610c518383612f39565b306001600160a01b037f0000000000000000000000005babc066a5e08faa89e3d5c9c2d8613be9bd383b16146128525760405163703e46dd60e11b815260040160405180910390fd5b600080516020613a988339815191528054600119016129b657604051633ee5aeb560e01b815260040160405180910390fd5b60029055565b600080516020613a788339815191525460ff16156128525760405163d93c066560e01b815260040160405180910390fd5b6000846001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015612a2d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612a519190613767565b612a5c90600a61386e565b90506000846001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015612a9e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612ac29190613767565b612acd90600a61386e565b6001600160a01b0387166000908152600460205260409020805491925085915b8015801590612afc5750600083115b15612cb557600081815260026020526040902060018101546001600160a01b038b8116911614612b655760405162461bcd60e51b81526020600482015260146024820152732ab732bc3832b1ba32b2103932b837aa37b5b2b760611b604482015260640161099a565b6000816002015411612bb95760405162461bcd60e51b815260206004820152601860248201527f556e657870656374656420656d707479206c697374696e670000000000000000604482015260640161099a565b600081600201548511612bcc5784612bd2565b81600201545b90506000670de0b6b3a7640000612be9838b6138a9565b612bf391906138d3565b905087612c0088836138a9565b612c0a91906138d3565b905081836002016000828254612c20919061387d565b90915550506001600160a01b038c1660009081526001602052604081208054849290612c4d90849061387d565b90915550612c5d9050828761387d565b83546001850154919750612c839186918e916001600160a01b0391821691168686612f8f565b8260020154600003612ca5576003830154612c9e8d86612daf565b9350612cad565b826003015493505b505050612aed565b8215612d1f5760405162461bcd60e51b815260206004820152603360248201527f4e6f7420656e6f75676820746f6b656e7320617661696c61626c6520746f2066604482015272756c66696c6c2074686520707572636861736560681b606482015260840161099a565b505050505050505050565b6001600080516020613a9883398151915255565b612d466129bc565b600080516020613a78833981519152805460ff191660011781557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2583361278f565b61285261318f565b612d9761318f565b6128526131d8565b612da761318f565b6128526131e0565b60008181526002602090815260408083206001600160a01b0380871680865260049094529190932060018401549092911614612e245760405162461bcd60e51b81526020600482015260146024820152732ab732bc3832b1ba32b2103932b837aa37b5b2b760611b604482015260640161099a565b600482015415612e50576003808301546004840154600090815260026020526040902090910155612e58565b600382015481555b600382015415612e84576004808301546003840154600090815260026020526040902090910155612e8f565b600482015460018201555b50506000908152600260208190526040822080546001600160a01b031990811682556001820180549091169055908101829055600381018290556004015550565b612eda82826115eb565b610d075760405163e2517d3f60e01b81526001600160a01b03821660048201526024810183905260440161099a565b600080516020613a788339815191525460ff1661285257604051638dfc202b60e01b815260040160405180910390fd5b612f4282613201565b6040516001600160a01b038316907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a2805115612f8757610c518282613266565b610d076132dc565b60405163f709642b60e01b8152600481018790523360248201526001600160a01b03858116604483015284811660648301526084820184905286811660a483015260c482018390527f000000000000000000000000e544defaa15e00611fcb2a03fe913938a5ed5686169063f709642b9060e401600060405180830381600087803b15801561301d57600080fd5b505af1158015613031573d6000803e3d6000fd5b50506040516323b872dd60e01b81523360048201526001600160a01b03878116602483015260448201859052881692506323b872dd91506064016020604051808303816000875af115801561308a573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906130ae919061399c565b6130fa5760405162461bcd60e51b815260206004820152601760248201527f5061796d656e74207472616e73666572206661696c6564000000000000000000604482015260640161099a565b60405163a9059cbb60e01b8152336004820152602481018390526001600160a01b0384169063a9059cbb906044016020604051808303816000875af1158015613147573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061316b919061399c565b6131875760405162461bcd60e51b815260040161099a906139b9565b505050505050565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a0054600160401b900460ff1661285257604051631afcd79f60e31b815260040160405180910390fd5b612d2a61318f565b6131e861318f565b600080516020613a78833981519152805460ff19169055565b806001600160a01b03163b60000361323757604051634c9c8ce360e01b81526001600160a01b038216600482015260240161099a565b600080516020613a3883398151915280546001600160a01b0319166001600160a01b0392909216919091179055565b6060600080846001600160a01b0316846040516132839190613a1b565b600060405180830381855af49150503d80600081146132be576040519150601f19603f3d011682016040523d82523d6000602084013e6132c3565b606091505b50915091506132d38583836132fb565b95945050505050565b34156128525760405163b398979f60e01b815260040160405180910390fd5b6060826133105761330b8261335a565b613353565b815115801561332757506001600160a01b0384163b155b1561335057604051639996b31560e01b81526001600160a01b038516600482015260240161099a565b50805b9392505050565b80511561336a5780518082602001fd5b604051630a12f52160e11b815260040160405180910390fd5b60006020828403121561339557600080fd5b81356001600160e01b03198116811461335357600080fd5b6001600160a01b038116811461262957600080fd5b600080604083850312156133d557600080fd5b82356133e0816133ad565b946020939093013593505050565b60006020828403121561340057600080fd5b5035919050565b801515811461262957600080fd5b6000806040838503121561342857600080fd5b8235613433816133ad565b9150602083013561344381613407565b809150509250929050565b60006020828403121561346057600080fd5b8135613353816133ad565b6000806040838503121561347e57600080fd5b823591506020830135613443816133ad565b634e487b7160e01b600052604160045260246000fd5b600080604083850312156134b957600080fd5b82356134c4816133ad565b9150602083013567ffffffffffffffff808211156134e157600080fd5b818501915085601f8301126134f557600080fd5b81358181111561350757613507613490565b604051601f8201601f19908116603f0116810190838211818310171561352f5761352f613490565b8160405282815288602084870101111561354857600080fd5b8260208601602083013760006020848301015280955050505050509250929050565b60008060006040848603121561357f57600080fd5b833567ffffffffffffffff8082111561359757600080fd5b818601915086601f8301126135ab57600080fd5b8135818111156135ba57600080fd5b8760208260051b85010111156135cf57600080fd5b602092830195509350508401356135e581613407565b809150509250925092565b60005b8381101561360b5781810151838201526020016135f3565b50506000910152565b60208152600082518060208401526136338160408501602087016135f0565b601f01601f19169190910160400192915050565b60008060006060848603121561365c57600080fd5b8335613667816133ad565b92506020840135613677816133ad565b915060408401356135e5816133ad565b6000806040838503121561369a57600080fd5b82359150602083013561344381613407565b634e487b7160e01b600052601160045260246000fd5b6000600182016136d4576136d46136ac565b5060010190565b6020808252601a908201527f5265706f546f6b656e206973206e6f742076616c696461746564000000000000604082015260600190565b6000806000806080858703121561372857600080fd5b84519350602085015161373a816133ad565b604086015190935061374b816133ad565b606086015190925061375c816133ad565b939692955090935050565b60006020828403121561377957600080fd5b815160ff8116811461335357600080fd5b600181815b808511156137c55781600019048211156137ab576137ab6136ac565b808516156137b857918102915b93841c939080029061378f565b509250929050565b6000826137dc57506001610930565b816137e957506000610930565b81600181146137ff576002811461380957613825565b6001915050610930565b60ff84111561381a5761381a6136ac565b50506001821b610930565b5060208310610133831016604e8410600b8410161715613848575081810a610930565b613852838361378a565b8060001904821115613866576138666136ac565b029392505050565b600061335360ff8416836137cd565b81810381811115610930576109306136ac565b6000602082840312156138a257600080fd5b5051919050565b8082028115828204841417610930576109306136ac565b80820180821115610930576109306136ac565b6000826138f057634e487b7160e01b600052601260045260246000fd5b500490565b6020808252603d908201527f4e6f2076616c6964207072696365506572546f6b656e2063616c63756c61746560408201527f6420666f722074686520737065636966696564207265706f546f6b656e000000606082015260800190565b6020808252602a908201527f4465736972656420616d6f756e74206578636565647320746f74616c206c697360408201526974656420746f6b656e7360b01b606082015260800190565b6000602082840312156139ae57600080fd5b815161335381613407565b602080825260159082015274151bdad95b881d1c985b9cd9995c8819985a5b1959605a1b604082015260600190565b634e487b7160e01b600052603260045260246000fd5b600060208284031215613a1057600080fd5b8151613353816133ad565b60008251613a2d8184602087016135f0565b919091019291505056fe360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc02dd7bc7dec4dceedda775e58dd541e08a116c6c53815c0bd028192f7b626800cd5ed15c6e187e77e9aee88184c21f4f2182ab5827cb3b7e07fbedcd63f033009b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f00a49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c21775a2646970667358221220fb01600483387d660e9f7b1c485edb6241d93dbece14ebe1e663038b30cc7c3364736f6c63430008140033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
00000000000000000000000021fc7b250ccaeecdb2abb38e04617d1f24d98772000000000000000000000000e544defaa15e00611fcb2a03fe913938a5ed5686
-----Decoded View---------------
Arg [0] : termController (address): 0x21FC7B250CCAeECDb2abb38e04617D1f24D98772
Arg [1] : repoTokenLinkedListEventEmitter (address): 0xe544DEFAA15e00611fcB2a03Fe913938A5ed5686
-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 00000000000000000000000021fc7b250ccaeecdb2abb38e04617d1f24d98772
Arg [1] : 000000000000000000000000e544defaa15e00611fcb2a03fe913938a5ed5686
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 31 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
Loading...
Loading
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.