MATIC Price: $0.726362 (+0.48%)
Gas: 53 GWei
 

Overview

MATIC Balance

Polygon PoS Chain LogoPolygon PoS Chain LogoPolygon PoS Chain Logo0 MATIC

MATIC Value

$0.00

Sponsored

Transaction Hash
Method
Block
From
To
Value
0x60806040392878392023-02-14 16:06:36464 days ago1676390796IN
 Create: PartyFacet
0 MATIC2.46706851632.92198823

Parent Transaction Hash Block From To Value
View All Internal Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
PartyFacet

Compiler Version
v0.8.17+commit.8df45f5f

Optimization Enabled:
Yes with 2000 runs

Other Settings:
default evmVersion
File 1 of 20 : PartyFacet.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;

import {IPartyFacet} from "../interfaces/IPartyFacet.sol";
import {IERC20} from "../interfaces/IERC20.sol";

import {LibParty} from "../libraries/LibParty.sol";
import {LibSignatures} from "../libraries/LibSignatures.sol";
import {Modifiers, PartyInfo, TokenGate} from "../libraries/LibAppStorage.sol";

/// "Party manager is not kickable"
error OwnerNotKickable();
/// "Non-member user is not kickable"
error UserNotKickable();
/// "Manager user is not kickable. Need to remove role first"
error ManagerNotKickable();
/// "User needs invitation to join private party"
error NeedsInvitation();

/**
 * @title PartyFacet
 * @author PartyFinance
 * @notice Facet that contains the main actions to interact with a Party
 */
contract PartyFacet is Modifiers, IPartyFacet, IERC20 {
    /***************
    PARTY STATE GETTER
    ***************/
    // @inheritdoc IERC20
    function name() external view override returns (string memory) {
        return s.name;
    }

    // @inheritdoc IERC20
    function symbol() external view override returns (string memory) {
        return s.symbol;
    }

    // @inheritdoc IERC20
    function decimals() external pure override returns (uint8) {
        return 18;
    }

    // @inheritdoc IERC20
    function totalSupply() external view override returns (uint256) {
        return s.totalSupply;
    }

    // @inheritdoc IERC20
    function balanceOf(
        address account
    ) external view override returns (uint256) {
        return s.balances[account];
    }

    // @inheritdoc IPartyState
    function denominationAsset() external view override returns (address) {
        return s.denominationAsset;
    }

    // @inheritdoc IPartyState
    function creator() external view override returns (address) {
        return s.creator;
    }

    // @inheritdoc IPartyState
    function members(address account) external view override returns (bool) {
        return s.members[account];
    }

    // @inheritdoc IPartyState
    function managers(address account) external view override returns (bool) {
        return s.managers[account];
    }

    // @inheritdoc IPartyState
    function getTokens() external view override returns (address[] memory) {
        return s.tokens;
    }

    // @inheritdoc IPartyState
    function getTokenGates()
        external
        view
        override
        returns (TokenGate[] memory)
    {
        return s.tokenGates;
    }

    // @inheritdoc IPartyState
    function partyInfo() external view override returns (PartyInfo memory) {
        return s.partyInfo;
    }

    // @inheritdoc IPartyState
    function closed() external view override returns (bool) {
        return s.closed;
    }

    /***************
    ACCESS ACTIONS
    ***************/
    // @inheritdoc IPartyCreatorActions
    function handleManager(address manager, bool setManager) external override {
        if (s.creator == address(0)) {
            // Patch for Facet upgrade
            require(s.managers[msg.sender], "Only Party Managers allowed");
            /// @dev Previously, parties didn't have the `creator` state, so for those parties the state will be zero address.
            s.creator = msg.sender;
        }
        require(s.creator == msg.sender, "Only Party Creator allowed");
        s.managers[manager] = setManager;
        // Emit Party managers change event
        emit PartyManagersChange(manager, setManager);
    }

    /***************
    PARTY ACTIONS
    ***************/
    // @inheritdoc IPartyActions
    function joinParty(
        address user,
        uint256 amount,
        LibSignatures.Allocation memory allocation,
        LibSignatures.Sig memory approval
    ) external override notMember isAlive {
        // Handle request for private parties
        if (!s.partyInfo.isPublic) {
            if (!s.acceptedRequests[user]) {
                revert NeedsInvitation();
            }
            delete s.acceptedRequests[user];
        }

        // Performs token gating
        LibParty.ensureTokenGate(user);

        // Add user as member
        s.members[user] = true;

        // Deposit, collect fees and mint party tokens
        (uint256 fee, uint256 mintedPT) = LibParty.mintPartyTokens(
            user,
            amount,
            allocation,
            approval
        );

        // Emit Join event
        emit Join(user, s.denominationAsset, amount, fee, mintedPT);
    }

    // @inheritdoc IPartyMemberActions
    function deposit(
        address user,
        uint256 amount,
        LibSignatures.Allocation memory allocation,
        LibSignatures.Sig memory approval
    ) external override isAlive {
        require(s.members[user], "Only Party Members allowed");
        // Deposit, collect fees and mint party tokens
        (uint256 fee, uint256 mintedPT) = LibParty.mintPartyTokens(
            user,
            amount,
            allocation,
            approval
        );
        // Emit Deposit event
        emit Deposit(user, s.denominationAsset, amount, fee, mintedPT);
    }

    // @inheritdoc IPartyMemberActions
    function withdraw(
        uint256 amountPT,
        LibSignatures.Allocation memory allocation,
        LibSignatures.Sig memory approval,
        bool liquidate
    ) external override onlyMember {
        // Withdraw, collect fees and burn party tokens
        LibParty.redeemPartyTokens(
            amountPT,
            msg.sender,
            allocation,
            approval,
            liquidate
        );
        // Emit Withdraw event
        emit Withdraw(msg.sender, amountPT);
    }

    // @inheritdoc IPartyManagerActions
    function swapToken(
        LibSignatures.Allocation memory allocation,
        LibSignatures.Sig memory approval
    ) external override onlyManager {
        // Swap token
        (uint256 soldAmount, uint256 boughtAmount, uint256 fee) = LibParty
            .swapToken(allocation, approval);

        // Emit SwapToken event
        emit SwapToken(
            msg.sender,
            address(allocation.sellTokens[0]),
            address(allocation.buyTokens[0]),
            soldAmount,
            boughtAmount,
            fee
        );
    }

    // @inheritdoc IPartyManagerActions
    function kickMember(
        address kickingMember,
        LibSignatures.Allocation memory allocation,
        LibSignatures.Sig memory approval,
        bool liquidate
    ) external override onlyManager {
        if (s.creator == kickingMember) revert OwnerNotKickable();
        if (!s.members[kickingMember]) revert UserNotKickable();
        if (s.managers[kickingMember]) revert ManagerNotKickable();
        // Get total PT from kicking member
        uint256 kickingMemberPT = s.balances[kickingMember];
        LibParty.redeemPartyTokens(
            kickingMemberPT,
            kickingMember,
            allocation,
            approval,
            liquidate
        );
        // Remove user as a member
        delete s.members[kickingMember];
        // Emit Kick event
        emit Kick(msg.sender, kickingMember, kickingMemberPT);
    }

    // @inheritdoc IPartyMemberActions
    function leaveParty(
        LibSignatures.Allocation memory allocation,
        LibSignatures.Sig memory approval,
        bool liquidate
    ) external override onlyMember {
        // Get total PT from member
        uint256 leavingMemberPT = s.balances[msg.sender];
        LibParty.redeemPartyTokens(
            leavingMemberPT,
            msg.sender,
            allocation,
            approval,
            liquidate
        );
        // Remove user as a member
        delete s.members[msg.sender];
        // Emit Leave event
        emit Leave(msg.sender, leavingMemberPT);
    }

    // @inheritdoc IPartyCreatorActions
    function closeParty() external override onlyCreator isAlive {
        s.closed = true;
        // Emit Close event
        emit Close(msg.sender, s.totalSupply);
    }

    // @inheritdoc IPartyCreatorActions
    function editPartyInfo(
        PartyInfo memory _partyInfo
    ) external override onlyCreator {
        s.partyInfo = _partyInfo;
        emit PartyInfoEdit(
            _partyInfo.name,
            _partyInfo.bio,
            _partyInfo.img,
            _partyInfo.model,
            _partyInfo.purpose,
            _partyInfo.isPublic,
            _partyInfo.minDeposit,
            _partyInfo.maxDeposit
        );
    }

    // @inheritdoc IPartyManagerActions
    function editTokenGates(
        TokenGate[] memory _tokenGates
    ) external override onlyManager {
        delete s.tokenGates;
        for (uint i = 0; i < _tokenGates.length; i++) {
            s.tokenGates.push(_tokenGates[i]);
        }
        emit PartyTokenGateChange();
    }
}

File 2 of 20 : IPartyFacet.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;

import {IPartyActions} from "./party/IPartyActions.sol";
import {IPartyEvents} from "./party/IPartyEvents.sol";
import {IPartyMemberActions} from "./party/IPartyMemberActions.sol";
import {IPartyManagerActions} from "./party/IPartyManagerActions.sol";
import {IPartyCreatorActions} from "./party/IPartyCreatorActions.sol";
import {IPartyState} from "./party/IPartyState.sol";

/**
 * @title Interface for PartyFacet
 * @dev The party interface is broken up into smaller chunks
 */
interface IPartyFacet is
    IPartyActions,
    IPartyEvents,
    IPartyCreatorActions,
    IPartyManagerActions,
    IPartyMemberActions,
    IPartyState
{

}

File 2 of 20 : LibParty.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;

import {IERC20Metadata} from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";

import {LibAppStorage, AppStorage} from "./LibAppStorage.sol";
import {LibERC20} from "./LibERC20.sol";
import {LibSignatures} from "./LibSignatures.sol";
import {LibSharedStructs} from "./LibSharedStructs.sol";
import {LibAddressArray} from "./LibAddressArray.sol";

/// "Deposit is not enough"
error DepositNotEnough();
/// "Deposit exceeds maximum required"
error DepositExceeded();
/// "User balance is not enough"
error UserBalanceNotEnough();
/// "Failed approve reset"
error FailedAproveReset();
/// "Failed approving sellToken"
error FailedAprove();
/// "0x Protocol: SWAP_CALL_FAILED"
error ZeroXFail();
/// "Invalid approval signature"
error InvalidSignature();
/// "Only one swap at a time"
error InvalidSwap();
/// "The user doesn't hold enough balance for the party `tokenGates`"
error TokenGateRestriction();
/// "Calling `balanceOf(address)` to token address failed"
error FetchTokenBalanceFail();

library LibParty {
    /**
     * @notice Emitted when quotes are filled by 0x for allocation of funds
     * @dev SwapToken is not included on this event, since its have the same information
     * @param member Address of the user
     * @param sellTokens Array of sell tokens
     * @param buyTokens Array of buy tokens
     * @param soldAmounts Array of sold amount of tokens
     * @param boughtAmounts Array of bought amount of tokens
     * @param partyValueDA The party value in denomination asset prior to the allocation
     */
    event AllocationFilled(
        address member,
        address[] sellTokens,
        address[] buyTokens,
        uint256[] soldAmounts,
        uint256[] boughtAmounts,
        uint256 partyValueDA
    );

    /**
     * @notice Emitted when a member redeems shares from a party
     * @param member Address of the user
     * @param burnedPT Burned party tokens for redemption
     * @param liquidate Redemption by liquitating shares into denomination asset
     * @param redeemedAssets Array of asset addresses
     * @param redeemedAmounts Array of asset amounts
     * @param redeemedFees Array of asset fees
     * @param redeemedNetAmounts Array of net asset amounts
     */
    event RedeemedShares(
        address member,
        uint256 burnedPT,
        bool liquidate,
        address[] redeemedAssets,
        uint256[] redeemedAmounts,
        uint256[] redeemedFees,
        uint256[] redeemedNetAmounts
    );

    /***************
    PLATFORM COLLECTOR
    ***************/
    /**
     * @notice Retrieves the Platform fee to be taken from an amount
     * @param amount Base amount to calculate fees
     */
    function getPlatformFee(
        uint256 amount,
        uint256 feeBps
    ) internal pure returns (uint256 fee) {
        fee = (amount * feeBps) / 10000;
    }

    /**
     * @notice Transfers a fee amount of an ERC20 token to the platform collector address
     * @param amount Base amount to calculate fees
     * @param token ERC-20 token address
     */
    function collectPlatformFee(
        uint256 amount,
        address token
    ) internal returns (uint256 fee) {
        AppStorage storage s = LibAppStorage.diamondStorage();
        fee = getPlatformFee(amount, s.platformFee);
        IERC20Metadata(token).transfer(s.platformFeeCollector, fee);
    }

    /**
     * @notice Ensures that the user has all the requirements from the `tokenGates` array
     * @param user Address of the user
     */
    function ensureTokenGate(address user) internal view {
        AppStorage storage s = LibAppStorage.diamondStorage();
        for (uint i = 0; i < s.tokenGates.length; i++) {
            (bool success, bytes memory encodedBalance) = s
                .tokenGates[i]
                .token
                .staticcall(
                    abi.encodeWithSignature("balanceOf(address)", user)
                );
            if (success && encodedBalance.length >= 32) {
                if (
                    abi.decode(encodedBalance, (uint256)) >=
                    s.tokenGates[i].amount
                ) {
                    continue;
                } else {
                    revert TokenGateRestriction();
                }
            } else {
                revert FetchTokenBalanceFail();
            }
        }
    }

    /***************
    PARTY TOKEN FUNCTIONS
    ***************/
    /**
     * @notice Swap a token using 0x Protocol
     * @param allocation The swap allocation
     * @param approval The platform signature approval for the allocation
     */
    function swapToken(
        LibSignatures.Allocation memory allocation,
        LibSignatures.Sig memory approval
    ) internal returns (uint256 soldAmount, uint256 boughtAmount, uint256 fee) {
        AppStorage storage s = LibAppStorage.diamondStorage();
        if (allocation.sellTokens.length != 1) revert InvalidSwap();
        // -> Validate authenticity of assets allocation
        if (
            !LibSignatures.isValidAllocation(
                msg.sender,
                s.platformSentinel,
                allocation,
                approval
            )
        ) {
            revert InvalidSignature();
        }
        // Fill 0x Quote
        LibSharedStructs.FilledQuote memory filledQuote = fillQuote(
            allocation.sellTokens[0],
            allocation.sellAmounts[0],
            allocation.buyTokens[0],
            allocation.spenders[0],
            allocation.swapsTargets[0],
            allocation.swapsCallData[0]
        );
        soldAmount = filledQuote.soldAmount;
        boughtAmount = filledQuote.boughtAmount;
        // Collect fees
        fee = collectPlatformFee(
            filledQuote.boughtAmount,
            allocation.buyTokens[0]
        );
        // Check if bought asset is new
        if (!LibAddressArray.contains(s.tokens, allocation.buyTokens[0])) {
            // Adding new asset to list
            s.tokens.push(allocation.buyTokens[0]);
        }
    }

    /**
     * @notice Mints PartyTokens in exchange for a deposit
     * @param user User address
     * @param amountDA The deposit amount in DA
     * @param allocation The deposit allocation
     * @param approval The platform signature approval for the allocation
     */
    function mintPartyTokens(
        address user,
        uint256 amountDA,
        LibSignatures.Allocation memory allocation,
        LibSignatures.Sig memory approval
    ) internal returns (uint256 fee, uint256 mintedPT) {
        AppStorage storage s = LibAppStorage.diamondStorage();
        // 1) Handle deposit amount is between min-max range
        if (amountDA < s.partyInfo.minDeposit) revert DepositNotEnough();
        if (s.partyInfo.maxDeposit > 0 && amountDA > s.partyInfo.maxDeposit)
            revert DepositExceeded();

        // 2) Calculate Platform Fee
        fee = getPlatformFee(amountDA, s.platformFee);

        // 3) Transfer DA from user (deposit + fees)
        IERC20Metadata(s.denominationAsset).transferFrom(
            user,
            address(this),
            amountDA + fee
        );

        // 4) Collect protocol fees
        collectPlatformFee(amountDA, s.denominationAsset);

        // 5) Allocate deposit assets
        allocateAssets(user, allocation, approval, s.platformSentinel);

        // 6) Mint PartyTokens to user
        if (s.totalSupply == 0 || allocation.partyTotalSupply == 0) {
            mintedPT =
                amountDA *
                10 ** (18 - IERC20Metadata(s.denominationAsset).decimals());
        } else {
            uint256 adjPartyValueDA = allocation.partyValueDA;
            /// Handle any totalSupply changes
            /// @dev Which will indicate the the allocated partyValueDA was updated in the same block by another tx
            if (allocation.partyTotalSupply != s.totalSupply) {
                // Since there has been a change in the totalSupply, we need to get the adjusted party value in DA
                /// @dev Example case:
                //          - allocation.totalSupply: 500
                //          - allocation.partyValueDA is 1000
                //          - totalSupply is 750
                //       This means that the current partyValueDA is no longer 1000, since there was a change in the totalSupply.
                //       The totalSupply delta is 50%. So the current partyValueDA should be 1500.
                adjPartyValueDA =
                    (adjPartyValueDA * s.totalSupply) /
                    allocation.partyTotalSupply;
            }
            mintedPT = (s.totalSupply * amountDA) / adjPartyValueDA;
        }
        LibERC20._mint(user, mintedPT);
    }

    /**
     * @notice Redeems funds in exchange for PartyTokens
     * @param amountPT The PartyTokens amount
     * @param _memberAddress The member's address to redeem PartyTokens in
     * @param allocation The withdraw allocation
     * @param approval The platform signature approval for the allocation
     * @param liquidate Whether to withdraw by swapping funds into DA or not
     */
    function redeemPartyTokens(
        uint256 amountPT,
        address _memberAddress,
        LibSignatures.Allocation memory allocation,
        LibSignatures.Sig memory approval,
        bool liquidate
    ) internal {
        AppStorage storage s = LibAppStorage.diamondStorage();

        // 1) Check if user has PartyTokens balance to redeem
        if (amountPT > s.balances[_memberAddress])
            revert UserBalanceNotEnough();

        // 2) Get the total supply of PartyTokens
        uint256 totalSupply = s.totalSupply;

        // 3) Burn PartyTokens
        LibERC20._burn(_memberAddress, amountPT);

        if (amountPT > 0) {
            // 4) Handle holdings redemption: liquidate holdings or redeem as it is
            if (liquidate) {
                liquidateHoldings(
                    amountPT,
                    totalSupply,
                    _memberAddress,
                    allocation,
                    approval,
                    s.denominationAsset,
                    s.platformSentinel
                );
            } else {
                redeemHoldings(amountPT, totalSupply, _memberAddress, s.tokens);
            }
        }
    }

    /***************
    HELPER FUNCTIONS
    ***************/
    /**
     * @notice Redeems assets without liquidating them
     * @param amountPT The PartyTokens amount
     * @param totalSupply The current totalSupply of the PartyTokens
     * @param _memberAddress The member's address to redeem PartyTokens in
     * @param tokens Current tokens in the party
     */
    function redeemHoldings(
        uint256 amountPT,
        uint256 totalSupply,
        address _memberAddress,
        address[] storage tokens
    ) private {
        uint256[] memory redeemedAmounts = new uint256[](tokens.length);
        uint256[] memory redeemedFees = new uint256[](tokens.length);
        uint256[] memory redeemedNetAmounts = new uint256[](tokens.length);

        // 1) Handle token holdings
        for (uint256 i = 0; i < tokens.length; ) {
            // 2) Get token amount to redeem
            uint256 tBalance = IERC20Metadata(tokens[i]).balanceOf(
                address(this)
            );
            redeemedAmounts[i] = ((tBalance * amountPT) / totalSupply);

            if (redeemedAmounts[i] > 0) {
                // 3) Collect fees
                redeemedFees[i] = collectPlatformFee(
                    redeemedAmounts[i],
                    tokens[i]
                );
                redeemedNetAmounts[i] = (redeemedAmounts[i] - redeemedFees[i]);

                // 4) Transfer relative asset funds to user
                IERC20Metadata(tokens[i]).transfer(
                    _memberAddress,
                    redeemedNetAmounts[i]
                );
            }
            unchecked {
                i++;
            }
        }
        emit RedeemedShares(
            _memberAddress,
            amountPT,
            false,
            tokens,
            redeemedAmounts,
            redeemedFees,
            redeemedNetAmounts
        );
    }

    /**
     * @notice Redeems assets by liquidating them into DA
     * @param amountPT The PartyTokens amount
     * @param totalSupply The current totalSupply of the PartyTokens
     * @param _memberAddress The member's address to redeem PartyTokens in
     * @param allocation The liquidation allocation
     * @param approval The platform signature approval for the allocation
     * @param denominationAsset The party's denomination asset address
     * @param sentinel The platform sentinel address
     */
    function liquidateHoldings(
        uint256 amountPT,
        uint256 totalSupply,
        address _memberAddress,
        LibSignatures.Allocation memory allocation,
        LibSignatures.Sig memory approval,
        address denominationAsset,
        address sentinel
    ) private {
        uint256[] memory redeemedAmounts = new uint256[](1);
        uint256[] memory redeemedFees = new uint256[](1);
        uint256[] memory redeemedNetAmounts = new uint256[](1);

        // 1) Get the portion of denomination asset to withdraw (before allocation)
        uint256 daBalance = IERC20Metadata(denominationAsset).balanceOf(
            address(this)
        );
        redeemedAmounts[0] = ((daBalance * amountPT) / totalSupply);

        // 2) Swap member's share of other assets into the denomination asset
        LibSharedStructs.Allocated memory allocated = allocateAssets(
            _memberAddress,
            allocation,
            approval,
            sentinel
        );

        // 3) Iterate through allocation and accumulate pending withdrawal for the user
        for (uint256 i = 0; i < allocated.boughtAmounts.length; ) {
            // Double check that bought tokens are same as DA
            if (allocated.buyTokens[i] == denominationAsset) {
                redeemedAmounts[0] += allocated.boughtAmounts[i];
            }
            unchecked {
                i++;
            }
        }

        // 4) Collect fees
        redeemedFees[0] = collectPlatformFee(
            redeemedAmounts[0],
            denominationAsset
        );

        // 5) Transfer relative DA funds to user
        redeemedNetAmounts[0] = redeemedAmounts[0] - redeemedFees[0];
        IERC20Metadata(denominationAsset).transfer(
            _memberAddress,
            redeemedNetAmounts[0]
        );

        emit RedeemedShares(
            _memberAddress,
            amountPT,
            true,
            allocated.sellTokens,
            redeemedAmounts,
            redeemedFees,
            redeemedNetAmounts
        );
    }

    /**
     * @notice Allocates multiple 0x quotes
     * @param sender The user's address
     * @param allocation The allocation
     * @param approval The platform signature approval for the allocation
     * @param sentinel The platform sentinel address
     */
    function allocateAssets(
        address sender,
        LibSignatures.Allocation memory allocation,
        LibSignatures.Sig memory approval,
        address sentinel
    ) private returns (LibSharedStructs.Allocated memory allocated) {
        if (
            !LibSignatures.isValidAllocation(
                sender,
                sentinel,
                allocation,
                approval
            )
        ) {
            revert InvalidSignature();
        }

        // Declaring array with a known length
        allocated.sellTokens = new address[](allocation.sellTokens.length);
        allocated.buyTokens = new address[](allocation.sellTokens.length);
        allocated.soldAmounts = new uint256[](allocation.sellTokens.length);
        allocated.boughtAmounts = new uint256[](allocation.sellTokens.length);
        for (uint256 i = 0; i < allocation.sellTokens.length; ) {
            LibSharedStructs.FilledQuote memory filledQuote = fillQuote(
                allocation.sellTokens[i],
                allocation.sellAmounts[i],
                allocation.buyTokens[i],
                allocation.spenders[i],
                allocation.swapsTargets[i],
                allocation.swapsCallData[i]
            );
            allocated.sellTokens[i] = address(allocation.sellTokens[i]);
            allocated.buyTokens[i] = address(allocation.buyTokens[i]);
            allocated.soldAmounts[i] = filledQuote.soldAmount;
            allocated.boughtAmounts[i] = filledQuote.boughtAmount;
            unchecked {
                i++;
            }
        }

        // Emit AllocationFilled
        emit AllocationFilled(
            sender,
            allocated.sellTokens,
            allocated.buyTokens,
            allocated.soldAmounts,
            allocated.boughtAmounts,
            allocation.partyValueDA
        );
    }

    /**
     * @notice Swap a token held by this contract using a 0x-API quote.
     * @param sellToken The token address to sell
     * @param sellAmount The token amount to sell
     * @param buyToken The token address to buy
     * @param spender The spender address
     * @param swapTarget The swap target to interact (0x Exchange Proxy)
     * @param swapCallData The swap calldata to pass
     */
    function fillQuote(
        address sellToken,
        uint256 sellAmount,
        address buyToken,
        address spender,
        address payable swapTarget,
        bytes memory swapCallData
    ) private returns (LibSharedStructs.FilledQuote memory filledQuote) {
        if (!IERC20Metadata(sellToken).approve(spender, 0))
            revert FailedAproveReset();
        if (!IERC20Metadata(sellToken).approve(spender, sellAmount))
            revert FailedAprove();

        // Track initial balance of the sellToken to determine how much we've sold.
        filledQuote.initialSellBalance = IERC20Metadata(sellToken).balanceOf(
            address(this)
        );

        // Track initial balance of the buyToken to determine how much we've bought.
        filledQuote.initialBuyBalance = IERC20Metadata(buyToken).balanceOf(
            address(this)
        );
        // Execute 0xSwap
        (bool success, ) = swapTarget.call{value: msg.value}(swapCallData);
        if (!success) revert ZeroXFail();

        // Get how much we've sold.
        filledQuote.soldAmount =
            filledQuote.initialSellBalance -
            IERC20Metadata(sellToken).balanceOf(address(this));

        // Get how much we've bought.
        filledQuote.boughtAmount =
            IERC20Metadata(buyToken).balanceOf(address(this)) -
            filledQuote.initialBuyBalance;
    }
}

File 2 of 20 : LibSignatures.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;

import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";

library LibSignatures {
    /**
     * @notice A struct containing the recovered Signature
     */
    struct Sig {
        bytes32 r;
        bytes32 s;
        uint8 v;
    }
    /**
     * @notice A struct containing the Allocation info
     * @dev For the array members, need to have the same length.
     * @param sellTokens Array of ERC-20 token addresses to sell
     * @param sellAmounts Array of ERC-20 token amounts to sell
     * @param buyTokens Array of ERC-20 token addresses to buy
     * @param spenders Array of the spenders addresses
     * @param swapTargets Array of the targets to interact with (0x Exchange Proxy)
     * @param swapsCallDAta Array of bytes containing the calldata
     * @param partyValueDA Current value of the Party in denomination asset
     * @param partyTotalSupply Current total supply of the Party
     * @param expiresAt Block timestamp expiration date
     */
    struct Allocation {
        address[] sellTokens;
        uint256[] sellAmounts;
        address[] buyTokens;
        address[] spenders;
        address payable[] swapsTargets;
        bytes[] swapsCallData;
        uint256 partyValueDA;
        uint256 partyTotalSupply;
        uint256 expiresAt;
    }

    /**
     * @notice Returns the address that signed a hashed message with a signature
     */
    function recover(bytes32 _hash, bytes calldata _signature)
        internal
        pure
        returns (address)
    {
        return ECDSA.recover(_hash, _signature);
    }

    /**
     * @notice Returns an Ethereum Signed Message.
     * @dev Produces a hash corresponding to the one signed with the
     * [eth_sign JSON-RPC method](https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]) as part of EIP-191.
     */
    function getMessageHash(bytes memory _abiEncoded)
        internal
        pure
        returns (bytes32)
    {
        return
            keccak256(
                abi.encodePacked(
                    "\x19Ethereum Signed Message:\n32",
                    keccak256(_abiEncoded)
                )
            );
    }

    /**
     * @notice Verifies the tx signature against the PartyFi Sentinel address
     * @dev Used by the deposit, join, kick, leave and swap actions
     * @param user The user involved in the allocation
     * @param signer The PartyFi Sentinel singer address
     * @param allocation The allocation struct to verify
     * @param rsv The values for the transaction's signature
     */
    function isValidAllocation(
        address user,
        address signer,
        Allocation memory allocation,
        Sig memory rsv
    ) internal view returns (bool) {
        // 1. Checks if the allocation hasn't expire
        if (allocation.expiresAt < block.timestamp) return false;

        // 2. Hashes the allocation struct to get the allocation hash
        bytes32 allocationHash = getMessageHash(
            abi.encodePacked(
                address(this),
                user,
                allocation.sellTokens,
                allocation.sellAmounts,
                allocation.buyTokens,
                allocation.spenders,
                allocation.swapsTargets,
                allocation.partyValueDA,
                allocation.partyTotalSupply,
                allocation.expiresAt
            )
        );

        // 3. Validates if the recovered signer is the PartyFi Sentinel
        return ECDSA.recover(allocationHash, rsv.v, rsv.r, rsv.s) == signer;
    }
}

File 2 of 20 : IERC20.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;

interface IERC20 {
    /**
     * @notice Queries the Party ERC-20 token name
     * @return Token name metadata
     */
    function name() external view returns (string memory);

    /**
     * @notice Queries the Party ERC-20 token symbol
     * @return Token symbol metadata
     */
    function symbol() external view returns (string memory);

    /**
     * @notice Queries the Party ERC-20 token decimals
     * @return Token decimals metadata
     */
    function decimals() external pure returns (uint8);

    /**
     * @notice Queries the Party ERC-20 total minted supply
     * @return Token total supply
     */
    function totalSupply() external view returns (uint256);

    /**
     * @notice Queries the Party ERC-20 balance of a given account
     * @param account Address
     * @return Token balance of a given ccount
     */
    function balanceOf(address account) external view returns (uint256);
}

File 2 of 20 : LibAppStorage.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;

import {LibMeta} from "./LibMeta.sol";

/**
 * @notice A struct containing the Party info tracked in storage.
 * @param name Name of the Party
 * @param bio Description of the Party
 * @param img Image URL of the Party (path to storage without protocol/domain)
 * @param model Model of the Party: "Democracy", "Monarchy", "WeightedDemocracy", "Republic"
 * @param purpose Purpose of the Party: "Trading", "YieldFarming", "LiquidityProviding", "NFT"
 * @param isPublic Visibility of the Party. (Private parties requires an accepted join request)
 * @param minDeposit Minimum deposit allowed in denomination asset
 * @param maxDeposit Maximum deposit allowed in denomination asset
 */
struct PartyInfo {
    string name;
    string bio;
    string img;
    string model;
    string purpose;
    bool isPublic;
    uint256 minDeposit;
    uint256 maxDeposit;
}

/**
 * @notice A struct containing the Announcement info tracked in storage.
 * @param title Title of the Announcement
 * @param bio Content of the Announcement
 * @param img Any external URL to include in the Announcement
 * @param model Model of the Party: "Democracy", "Monarchy", "WeightedDemocracy", "Republic"
 * @param created Block timestamp date of the Announcement creation
 * @param updated Block timestamp date of any Announcement edition
 */
struct Announcement {
    string title;
    string content;
    string url;
    string img;
    uint256 created;
    uint256 updated;
}

/**
 * @notice A struct containing the TokenGate info tracked in storage.
 * @param token Address of the asset
 * @param amount Required amount to hold
 */
struct TokenGate {
    address token;
    uint256 amount;
}

struct AppStorage {
    //
    // Party vault token
    //
    string name;
    string symbol;
    uint256 totalSupply;
    mapping(address => uint256) balances;
    mapping(address => mapping(address => uint256)) allowances;
    //
    // Denomination token asset for deposit/withdraws
    //
    address denominationAsset;
    //
    // Party info
    //
    PartyInfo partyInfo;
    bool closed; // Party life status
    //
    // Party access
    //
    mapping(address => bool) managers; // Maping to get if address is a manager
    mapping(address => bool) members; // Maping to get if address is a member
    //
    // Party ERC-20 holdings
    //
    address[] tokens; // Array of current party tokens holdings
    //
    // Party Announcements
    //
    Announcement[] announcements;
    //
    // Party Join Requests
    //
    address[] joinRequests; // Array of users that requested to join the party
    mapping(address => bool) acceptedRequests; // Mapping of requests accepted by a manager
    //
    // PLATFORM
    //
    uint256 platformFee; // Platform fee (in bps, 50 bps -> 0.5%)
    address platformFeeCollector; // Platform fee collector
    address platformSentinel; // Platform sentinel
    address platformFactory; // Platform factory
    //
    // Extended Party access
    //
    address creator; // Creator of the Party
    //
    // Token gating
    //
    TokenGate[] tokenGates;
}

library LibAppStorage {
    function diamondStorage() internal pure returns (AppStorage storage ds) {
        assembly {
            ds.slot := 0
        }
    }
}

contract Modifiers {
    AppStorage internal s;

    modifier onlyCreator() {
        require(s.creator == LibMeta.msgSender(), "Only Party Creator allowed");
        _;
    }

    modifier onlyManager() {
        require(s.managers[LibMeta.msgSender()], "Only Party Managers allowed");
        _;
    }

    modifier onlyMember() {
        require(s.members[LibMeta.msgSender()], "Only Party Members allowed");
        _;
    }

    modifier notMember() {
        require(
            !s.members[LibMeta.msgSender()],
            "Only non Party Members allowed"
        );
        _;
    }

    modifier onlyFactory() {
        require(
            LibMeta.msgSender() == s.platformFactory,
            "Only Factory allowed"
        );
        _;
    }

    modifier isAlive() {
        require(!s.closed, "Party is closed");
        _;
    }
}

File 2 of 20 : IPartyActions.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;

// Libraries
import {LibSignatures} from "../../libraries/LibSignatures.sol";

/**
 * @notice Contains party methods that can be called by anyone
 * @dev Permissionless Party actions
 */
interface IPartyActions {
    /**
     * @notice Joins and deposits into the party
     * @dev For private parties, the joiner must have an accepted join request by a manager.
     *      The user must not be a member and the party must be opened
     *      In case the party has set a token gating, it will perform the check to ensure the user holds sufficient funds
     * @param user User address that will be joining the party
     * @param amount Deposit amount in denomination asset
     * @param allocation Desired allocation of the deposit
     * @param approval Verified sentinel signature of the desired deposit
     */
    function joinParty(
        address user,
        uint256 amount,
        LibSignatures.Allocation memory allocation,
        LibSignatures.Sig memory approval
    ) external;
}

File 2 of 20 : IPartyMemberActions.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;

// Libraries
import {LibSignatures} from "../../libraries/LibSignatures.sol";

/**
 * @notice Contains party methods that can be called by any member of the party
 * @dev Permissioned Party actions
 */
interface IPartyMemberActions {
    /**
     * @notice Deposits into the party
     * @dev The user must be a member and the party must be opened
     * @param user User address that will be making the deposit
     * @param amount Deposit amount in denomination asset
     * @param allocation Desired allocation of the deposit
     * @param approval Verified sentinel signature of the desired deposit
     */
    function deposit(
        address user,
        uint256 amount,
        LibSignatures.Allocation memory allocation,
        LibSignatures.Sig memory approval
    ) external;

    /**
     * @notice Withdraw funds from the party
     * @dev The user must be a member
     * @param amountPT Amount of PartyTokens of the requester to withdraw
     * @param allocation Desired allocation of the withdraw
     * @param approval Verified sentinel signature of the desired withdraw
     * @param liquidate Whether to liquidate assets (convert all owned assets into denomination asset) or to withdraw assets as it is
     */
    function withdraw(
        uint256 amountPT,
        LibSignatures.Allocation memory allocation,
        LibSignatures.Sig memory approval,
        bool liquidate
    ) external;

    /**
     * @notice Leave the party (withdraw all funds and remove membership)
     * @dev The user must be a member
     * @param allocation Desired allocation of the withdraw
     * @param approval Verified sentinel signature of the desired withdraw
     * @param liquidate Whether to liquidate assets (convert all owned assets into denomination asset) or to withdraw assets as it is
     */
    function leaveParty(
        LibSignatures.Allocation memory allocation,
        LibSignatures.Sig memory approval,
        bool liquidate
    ) external;
}

File 2 of 20 : IPartyEvents.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;

/**
 * @notice Contains all events emitted by the party
 * @dev Events emitted by a party
 */
interface IPartyEvents {
    /**
     * @notice Emitted exactly once by a party when #initialize is first called
     * @param partyCreator Address of the user that created the party
     * @param partyName Name of the party
     * @param isPublic Visibility of the party
     * @param dAsset Address of the denomination asset for the party
     * @param minDeposit Minimum deposit of the party
     * @param maxDeposit Maximum deposit of the party
     * @param mintedPT Minted party tokens for creating the party
     * @param bio Bio of the party
     * @param img Img url of the party
     * @param model Model of party created
     * @param purpose Purpose of party created
     */
    event PartyCreated(
        address partyCreator,
        string partyName,
        bool isPublic,
        address dAsset,
        uint256 minDeposit,
        uint256 maxDeposit,
        uint256 mintedPT,
        string bio,
        string img,
        string model,
        string purpose
    );

    /**
     * @notice Emitted when a user joins a party
     * @param member Address of the user
     * @param asset Address of the denomination asset
     * @param amount Amount of the deposit
     * @param fee Collected fee
     * @param mintedPT Minted party tokens for joining
     */
    event Join(
        address member,
        address asset,
        uint256 amount,
        uint256 fee,
        uint256 mintedPT
    );

    /**
     * @notice Emitted when a member deposits denomination assets into a party
     * @param member Address of the user
     * @param asset Address of the denomination asset
     * @param amount Amount of the deposit
     * @param fee Collected fee
     * @param mintedPT Minted party tokens for depositing
     */
    event Deposit(
        address member,
        address asset,
        uint256 amount,
        uint256 fee,
        uint256 mintedPT
    );

    /**
     * @notice Emitted when quotes are filled by 0x for allocation of funds
     * @dev SwapToken is not included on this event, since its have the same information
     * @param member Address of the user
     * @param sellTokens Array of sell tokens
     * @param buyTokens Array of buy tokens
     * @param soldAmounts Array of sold amount of tokens
     * @param boughtAmounts Array of bought amount of tokens
     * @param partyValueDA The party value in denomination asset prior to the allocation
     */
    event AllocationFilled(
        address member,
        address[] sellTokens,
        address[] buyTokens,
        uint256[] soldAmounts,
        uint256[] boughtAmounts,
        uint256 partyValueDA
    );

    /**
     * @notice Emitted when a member redeems shares from a party
     * @param member Address of the user
     * @param burnedPT Burned party tokens for redemption
     * @param liquidate Redemption by liquitating shares into denomination asset
     * @param redeemedAssets Array of asset addresses
     * @param redeemedAmounts Array of asset amounts
     * @param redeemedFees Array of asset fees
     * @param redeemedNetAmounts Array of net asset amounts
     */
    event RedeemedShares(
        address member,
        uint256 burnedPT,
        bool liquidate,
        address[] redeemedAssets,
        uint256[] redeemedAmounts,
        uint256[] redeemedFees,
        uint256[] redeemedNetAmounts
    );

    /**
     * @notice Emitted when a member withdraws from a party
     * @param member Address of the user
     * @param burnedPT Burned party tokens of member
     */
    event Withdraw(address member, uint256 burnedPT);

    /**
     * @notice Emitted when quotes are filled by 0x in the same tx
     * @param member Address of the user
     * @param sellToken Sell token address
     * @param buyToken Buy token address
     * @param soldAmount Sold amount of token
     * @param boughtAmount Bought amount of token
     * @param fee fee collected
     */
    event SwapToken(
        address member,
        address sellToken,
        address buyToken,
        uint256 soldAmount,
        uint256 boughtAmount,
        uint256 fee
    );

    /**
     * @notice Emitted when a member gets kicked from a party
     * @param kicker Address of the kicker (owner)
     * @param kicked Address of the kicked member
     * @param burnedPT Burned party tokens of member
     */
    event Kick(address kicker, address kicked, uint256 burnedPT);

    /**
     * @notice Emitted when a member leaves a party
     * @param member Address of the user
     * @param burnedPT Burned party tokens for withdrawing
     */
    event Leave(address member, uint256 burnedPT);

    /**
     * @notice Emitted when the owner closes a party
     * @param member Address of the user (should be party owner)
     * @param supply Total supply of party tokens when the party closed
     */
    event Close(address member, uint256 supply);

    /**
     * @notice Emitted when the party information changes after creation
     * @param name Name of the party
     * @param bio Bio of the party
     * @param img Img url of the party
     * @param model Model of party created
     * @param purpose Purpose of party created
     * @param isPublic Visibility of the party
     * @param minDeposit Minimum deposit of the party
     * @param maxDeposit Maximum deposit of the party
     */
    event PartyInfoEdit(
        string name,
        string bio,
        string img,
        string model,
        string purpose,
        bool isPublic,
        uint256 minDeposit,
        uint256 maxDeposit
    );

    /**
     * @notice Emitted when the party creator adds or remove a party manager
     * @param manager Address of the user
     * @param isManager Whether to set the user was set as manager or removed from it
     */
    event PartyManagersChange(address manager, bool isManager);

    /**
     * @notice Emitted when the party manager edits the token gating settings
     */
    event PartyTokenGateChange();
}

File 2 of 20 : IPartyState.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;

import {PartyInfo, TokenGate} from "../../libraries/LibAppStorage.sol";

/**
 * @notice Methods that compose the party and that are mutable
 */
interface IPartyState {
    /**
     * @notice Queries the Party denomination asset (ERC-20)
     * @dev The denomination asset is used for depositing into the party, which is an ERC-20 stablecoin
     * @return Denomination asset address
     */
    function denominationAsset() external view returns (address);

    /**
     * @notice Queries the Party's creator address
     * @return The address of the user who created the Party
     */
    function creator() external view returns (address);

    /**
     * @notice Queries the Party's member access of given address
     * @param account Address
     * @return Whether if the given address is a member
     */
    function members(address account) external view returns (bool);

    /**
     * @notice Queries the Party's manager access of given address
     * @param account Address
     * @return Whether if the given address is a manager
     */
    function managers(address account) external view returns (bool);

    /**
     * @notice Queries the ERC-20 tokens held in the Party
     * @dev Will display the tokens that were acquired through a Swap/LimitOrder method
     * @return Array of ERC-20 addresses
     */
    function getTokens() external view returns (address[] memory);

    /**
     * @notice Queries the token gates in the Party
     * @return Array of TokenGate structs
     */
    function getTokenGates() external view returns (TokenGate[] memory);

    /**
     * @notice Queries the party information
     * @return PartyInfo struct
     */
    function partyInfo() external view returns (PartyInfo memory);

    /**
     * @notice Queries if the Party is closed
     * @return Whether if the Party is already closed or not
     */
    function closed() external view returns (bool);
}

File 2 of 20 : IPartyCreatorActions.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;

// Libraries
import {LibSignatures} from "../../libraries/LibSignatures.sol";
import {PartyInfo} from "../../libraries/LibAppStorage.sol";

/**
 * @notice Contains party methods that can be called by the creator of the Party
 * @dev Permissioned Party actions
 */
interface IPartyCreatorActions {
    /**
     * @notice Close the party
     * @dev The user must be a creator and the party must be opened
     */
    function closeParty() external;

    /**
     * @notice Edits the party information
     * @dev The user must be a creator
     * @param _partyInfo PartyInfo struct
     */
    function editPartyInfo(PartyInfo memory _partyInfo) external;

    /**
     * @notice Handles the managers for the party
     * @dev The user must be the creator of the party
     * @param manager Address of the user
     * @param setManager Whether to set the user as manager or remove it
     */
    function handleManager(address manager, bool setManager) external;
}

File 2 of 20 : IPartyManagerActions.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;

// Libraries
import {LibSignatures} from "../../libraries/LibSignatures.sol";
import {PartyInfo, TokenGate} from "../../libraries/LibAppStorage.sol";

/**
 * @notice Contains party methods that can be called by any manager of the Party
 * @dev Permissioned Party actions
 */
interface IPartyManagerActions {
    /**
     * @notice Swap a token with the party's fund
     * @dev The user must be a manager. Only swaps a single asset.
     * @param allocation Desired allocation of the swap
     * @param approval Verified sentinel signature of the desired swap
     */
    function swapToken(
        LibSignatures.Allocation memory allocation,
        LibSignatures.Sig memory approval
    ) external;

    /**
     * @notice Kick a member from the party
     * @dev The user must be a manager
     * @param kickingMember address of the member to be kicked
     * @param allocation desired allocation of the withdraw
     * @param approval verified sentinel signature of the desired kick
     * @param liquidate whether to liquidate assets (convert all owned assets into denomination asset) or to transfer assets as it is
     */
    function kickMember(
        address kickingMember,
        LibSignatures.Allocation memory allocation,
        LibSignatures.Sig memory approval,
        bool liquidate
    ) external;

    /**
     * @notice Edits the token gating of the party
     * @dev The user must be a manager
     * @param _tokenGates Array of TokenGate structs
     */
    function editTokenGates(TokenGate[] memory _tokenGates) external;
}

File 2 of 20 : ECDSA.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.3) (utils/cryptography/ECDSA.sol)

pragma solidity ^0.8.0;

import "../Strings.sol";

/**
 * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.
 *
 * These functions can be used to verify that a message was signed by the holder
 * of the private keys of a given address.
 */
library ECDSA {
    enum RecoverError {
        NoError,
        InvalidSignature,
        InvalidSignatureLength,
        InvalidSignatureS,
        InvalidSignatureV
    }

    function _throwError(RecoverError error) private pure {
        if (error == RecoverError.NoError) {
            return; // no error: do nothing
        } else if (error == RecoverError.InvalidSignature) {
            revert("ECDSA: invalid signature");
        } else if (error == RecoverError.InvalidSignatureLength) {
            revert("ECDSA: invalid signature length");
        } else if (error == RecoverError.InvalidSignatureS) {
            revert("ECDSA: invalid signature 's' value");
        } else if (error == RecoverError.InvalidSignatureV) {
            revert("ECDSA: invalid signature 'v' value");
        }
    }

    /**
     * @dev Returns the address that signed a hashed message (`hash`) with
     * `signature` or error string. This address can then be used for verification purposes.
     *
     * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:
     * this function rejects them by requiring the `s` value to be in the lower
     * half order, and the `v` value to be either 27 or 28.
     *
     * IMPORTANT: `hash` _must_ be the result of a hash operation for the
     * verification to be secure: it is possible to craft signatures that
     * recover to arbitrary addresses for non-hashed data. A safe way to ensure
     * this is by receiving a hash of the original message (which may otherwise
     * be too long), and then calling {toEthSignedMessageHash} on it.
     *
     * Documentation for signature generation:
     * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]
     * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]
     *
     * _Available since v4.3._
     */
    function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {
        if (signature.length == 65) {
            bytes32 r;
            bytes32 s;
            uint8 v;
            // ecrecover takes the signature parameters, and the only way to get them
            // currently is to use assembly.
            /// @solidity memory-safe-assembly
            assembly {
                r := mload(add(signature, 0x20))
                s := mload(add(signature, 0x40))
                v := byte(0, mload(add(signature, 0x60)))
            }
            return tryRecover(hash, v, r, s);
        } else {
            return (address(0), RecoverError.InvalidSignatureLength);
        }
    }

    /**
     * @dev Returns the address that signed a hashed message (`hash`) with
     * `signature`. This address can then be used for verification purposes.
     *
     * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:
     * this function rejects them by requiring the `s` value to be in the lower
     * half order, and the `v` value to be either 27 or 28.
     *
     * IMPORTANT: `hash` _must_ be the result of a hash operation for the
     * verification to be secure: it is possible to craft signatures that
     * recover to arbitrary addresses for non-hashed data. A safe way to ensure
     * this is by receiving a hash of the original message (which may otherwise
     * be too long), and then calling {toEthSignedMessageHash} on it.
     */
    function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {
        (address recovered, RecoverError error) = tryRecover(hash, signature);
        _throwError(error);
        return recovered;
    }

    /**
     * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.
     *
     * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]
     *
     * _Available since v4.3._
     */
    function tryRecover(
        bytes32 hash,
        bytes32 r,
        bytes32 vs
    ) internal pure returns (address, RecoverError) {
        bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);
        uint8 v = uint8((uint256(vs) >> 255) + 27);
        return tryRecover(hash, v, r, s);
    }

    /**
     * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.
     *
     * _Available since v4.2._
     */
    function recover(
        bytes32 hash,
        bytes32 r,
        bytes32 vs
    ) internal pure returns (address) {
        (address recovered, RecoverError error) = tryRecover(hash, r, vs);
        _throwError(error);
        return recovered;
    }

    /**
     * @dev Overload of {ECDSA-tryRecover} that receives the `v`,
     * `r` and `s` signature fields separately.
     *
     * _Available since v4.3._
     */
    function tryRecover(
        bytes32 hash,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) internal pure returns (address, RecoverError) {
        // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature
        // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines
        // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most
        // signatures from current libraries generate a unique signature with an s-value in the lower half order.
        //
        // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value
        // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or
        // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept
        // these malleable signatures as well.
        if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {
            return (address(0), RecoverError.InvalidSignatureS);
        }
        if (v != 27 && v != 28) {
            return (address(0), RecoverError.InvalidSignatureV);
        }

        // If the signature is valid (and not malleable), return the signer address
        address signer = ecrecover(hash, v, r, s);
        if (signer == address(0)) {
            return (address(0), RecoverError.InvalidSignature);
        }

        return (signer, RecoverError.NoError);
    }

    /**
     * @dev Overload of {ECDSA-recover} that receives the `v`,
     * `r` and `s` signature fields separately.
     */
    function recover(
        bytes32 hash,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) internal pure returns (address) {
        (address recovered, RecoverError error) = tryRecover(hash, v, r, s);
        _throwError(error);
        return recovered;
    }

    /**
     * @dev Returns an Ethereum Signed Message, created from a `hash`. This
     * produces hash corresponding to the one signed with the
     * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]
     * JSON-RPC method as part of EIP-191.
     *
     * See {recover}.
     */
    function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) {
        // 32 is the length in bytes of hash,
        // enforced by the type signature above
        return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash));
    }

    /**
     * @dev Returns an Ethereum Signed Message, created from `s`. This
     * produces hash corresponding to the one signed with the
     * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]
     * JSON-RPC method as part of EIP-191.
     *
     * See {recover}.
     */
    function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {
        return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n", Strings.toString(s.length), s));
    }

    /**
     * @dev Returns an Ethereum Signed Typed Data, created from a
     * `domainSeparator` and a `structHash`. This produces hash corresponding
     * to the one signed with the
     * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]
     * JSON-RPC method as part of EIP-712.
     *
     * See {recover}.
     */
    function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) {
        return keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash));
    }
}

File 2 of 20 : Strings.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (utils/Strings.sol)

pragma solidity ^0.8.0;

/**
 * @dev String operations.
 */
library Strings {
    bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";
    uint8 private constant _ADDRESS_LENGTH = 20;

    /**
     * @dev Converts a `uint256` to its ASCII `string` decimal representation.
     */
    function toString(uint256 value) internal pure returns (string memory) {
        // Inspired by OraclizeAPI's implementation - MIT licence
        // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol

        if (value == 0) {
            return "0";
        }
        uint256 temp = value;
        uint256 digits;
        while (temp != 0) {
            digits++;
            temp /= 10;
        }
        bytes memory buffer = new bytes(digits);
        while (value != 0) {
            digits -= 1;
            buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));
            value /= 10;
        }
        return string(buffer);
    }

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
     */
    function toHexString(uint256 value) internal pure returns (string memory) {
        if (value == 0) {
            return "0x00";
        }
        uint256 temp = value;
        uint256 length = 0;
        while (temp != 0) {
            length++;
            temp >>= 8;
        }
        return toHexString(value, length);
    }

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
     */
    function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
        bytes memory buffer = new bytes(2 * length + 2);
        buffer[0] = "0";
        buffer[1] = "x";
        for (uint256 i = 2 * length + 1; i > 1; --i) {
            buffer[i] = _HEX_SYMBOLS[value & 0xf];
            value >>= 4;
        }
        require(value == 0, "Strings: hex length insufficient");
        return string(buffer);
    }

    /**
     * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.
     */
    function toHexString(address addr) internal pure returns (string memory) {
        return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);
    }
}

File 2 of 20 : LibMeta.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;

library LibMeta {
    function getChainID() internal view returns (uint256 id) {
        assembly {
            id := chainid()
        }
    }

    function msgSender() internal view returns (address sender_) {
        if (msg.sender == address(this)) {
            bytes memory array = msg.data;
            uint256 index = msg.data.length;
            assembly {
                // Load the 32 bytes word from memory with the address on the lower 20 bytes, and mask those.
                sender_ := and(
                    mload(add(array, index)),
                    0xffffffffffffffffffffffffffffffffffffffff
                )
            }
        } else {
            sender_ = msg.sender;
        }
    }
}

File 2 of 20 : LibERC20.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;

import {LibAppStorage, AppStorage} from "./LibAppStorage.sol";

library LibERC20 {
    event Transfer(address indexed from, address indexed to, uint256 amount);

    /**
     * @notice Mint tokens for a given account
     * @param account Address recipient
     * @param amount Amount of tokens to be minted
     */
    function _mint(address account, uint256 amount) internal {
        require(account != address(0), "ERC20: mint to the zero address");

        AppStorage storage s = LibAppStorage.diamondStorage();
        s.totalSupply += amount;
        s.balances[account] += amount;

        emit Transfer(address(0), account, amount);
    }

    /**
     * @notice Burn tokens held by given account
     * @param account Address of burned tokens
     * @param amount Amount of tokens to be burnt
     */
    function _burn(address account, uint256 amount) internal {
        require(account != address(0), "ERC20: burn from the zero address");

        AppStorage storage s = LibAppStorage.diamondStorage();
        uint256 balance = s.balances[account];
        require(balance >= amount, "ERC20: burn amount exceeds balance");
        unchecked {
            s.balances[account] = balance - amount;
        }
        s.totalSupply -= amount;

        emit Transfer(account, address(0), amount);
    }
}

File 2 of 20 : LibSharedStructs.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;

library LibSharedStructs {
    struct Allocation {
        address[] sellTokens;
        uint256[] sellAmounts;
        address[] buyTokens;
        address[] spenders;
        address payable[] swapsTargets;
        bytes[] swapsCallData;
        uint256 partyValueDA;
        uint256 partyTotalSupply;
        uint256 expiresAt;
    }

    struct FilledQuote {
        address sellToken;
        address buyToken;
        uint256 soldAmount;
        uint256 boughtAmount;
        uint256 initialSellBalance;
        uint256 initialBuyBalance;
    }

    struct Allocated {
        address[] sellTokens;
        address[] buyTokens;
        uint256[] soldAmounts;
        uint256[] boughtAmounts;
    }
}

File 2 of 20 : LibAddressArray.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;

library LibAddressArray {
    function contains(
        address[] memory self,
        address _address
    ) internal pure returns (bool contained) {
        for (uint256 i; i < self.length; ) {
            if (_address == self[i]) {
                return true;
            }
            unchecked {
                i++;
            }
        }
        return false;
    }
}

File 2 of 20 : IERC20Metadata.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)

pragma solidity ^0.8.0;

import "../IERC20.sol";

/**
 * @dev Interface for the optional metadata functions from the ERC20 standard.
 *
 * _Available since v4.1._
 */
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);
}

File 2 of 20 : IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @dev Emitted when `value` tokens are moved from one account (`from`) to
     * another (`to`).
     *
     * Note that `value` may be zero.
     */
    event Transfer(address indexed from, address indexed to, uint256 value);

    /**
     * @dev Emitted when the allowance of a `spender` for an `owner` is set by
     * a call to {approve}. `value` is the new allowance.
     */
    event Approval(address indexed owner, address indexed spender, uint256 value);

    /**
     * @dev Returns the amount of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

    /**
     * @dev Returns the amount of tokens owned by `account`.
     */
    function balanceOf(address account) external view returns (uint256);

    /**
     * @dev Moves `amount` tokens from the caller's account to `to`.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transfer(address to, uint256 amount) external returns (bool);

    /**
     * @dev Returns the remaining number of tokens that `spender` will be
     * allowed to spend on behalf of `owner` through {transferFrom}. This is
     * zero by default.
     *
     * This value changes when {approve} or {transferFrom} are called.
     */
    function allowance(address owner, address spender) external view returns (uint256);

    /**
     * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * IMPORTANT: Beware that changing an allowance with this method brings the risk
     * that someone may use both the old and the new allowance by unfortunate
     * transaction ordering. One possible solution to mitigate this race
     * condition is to first reduce the spender's allowance to 0 and set the
     * desired value afterwards:
     * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
     *
     * Emits an {Approval} event.
     */
    function approve(address spender, uint256 amount) external returns (bool);

    /**
     * @dev Moves `amount` tokens from `from` to `to` using the
     * allowance mechanism. `amount` is then deducted from the caller's
     * allowance.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(
        address from,
        address to,
        uint256 amount
    ) external returns (bool);
}

Settings
{
  "optimizer": {
    "enabled": true,
    "runs": 2000
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "metadata": {
    "useLiteralContent": true
  },
  "libraries": {}
}

Contract Security Audit

Contract ABI

[{"inputs":[],"name":"DepositExceeded","type":"error"},{"inputs":[],"name":"DepositNotEnough","type":"error"},{"inputs":[],"name":"FailedAprove","type":"error"},{"inputs":[],"name":"FailedAproveReset","type":"error"},{"inputs":[],"name":"FetchTokenBalanceFail","type":"error"},{"inputs":[],"name":"InvalidSignature","type":"error"},{"inputs":[],"name":"InvalidSwap","type":"error"},{"inputs":[],"name":"ManagerNotKickable","type":"error"},{"inputs":[],"name":"NeedsInvitation","type":"error"},{"inputs":[],"name":"OwnerNotKickable","type":"error"},{"inputs":[],"name":"TokenGateRestriction","type":"error"},{"inputs":[],"name":"UserBalanceNotEnough","type":"error"},{"inputs":[],"name":"UserNotKickable","type":"error"},{"inputs":[],"name":"ZeroXFail","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"member","type":"address"},{"indexed":false,"internalType":"address[]","name":"sellTokens","type":"address[]"},{"indexed":false,"internalType":"address[]","name":"buyTokens","type":"address[]"},{"indexed":false,"internalType":"uint256[]","name":"soldAmounts","type":"uint256[]"},{"indexed":false,"internalType":"uint256[]","name":"boughtAmounts","type":"uint256[]"},{"indexed":false,"internalType":"uint256","name":"partyValueDA","type":"uint256"}],"name":"AllocationFilled","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"member","type":"address"},{"indexed":false,"internalType":"uint256","name":"supply","type":"uint256"}],"name":"Close","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"member","type":"address"},{"indexed":false,"internalType":"address","name":"asset","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"fee","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"mintedPT","type":"uint256"}],"name":"Deposit","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"member","type":"address"},{"indexed":false,"internalType":"address","name":"asset","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"fee","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"mintedPT","type":"uint256"}],"name":"Join","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"kicker","type":"address"},{"indexed":false,"internalType":"address","name":"kicked","type":"address"},{"indexed":false,"internalType":"uint256","name":"burnedPT","type":"uint256"}],"name":"Kick","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"member","type":"address"},{"indexed":false,"internalType":"uint256","name":"burnedPT","type":"uint256"}],"name":"Leave","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"partyCreator","type":"address"},{"indexed":false,"internalType":"string","name":"partyName","type":"string"},{"indexed":false,"internalType":"bool","name":"isPublic","type":"bool"},{"indexed":false,"internalType":"address","name":"dAsset","type":"address"},{"indexed":false,"internalType":"uint256","name":"minDeposit","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"maxDeposit","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"mintedPT","type":"uint256"},{"indexed":false,"internalType":"string","name":"bio","type":"string"},{"indexed":false,"internalType":"string","name":"img","type":"string"},{"indexed":false,"internalType":"string","name":"model","type":"string"},{"indexed":false,"internalType":"string","name":"purpose","type":"string"}],"name":"PartyCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string","name":"name","type":"string"},{"indexed":false,"internalType":"string","name":"bio","type":"string"},{"indexed":false,"internalType":"string","name":"img","type":"string"},{"indexed":false,"internalType":"string","name":"model","type":"string"},{"indexed":false,"internalType":"string","name":"purpose","type":"string"},{"indexed":false,"internalType":"bool","name":"isPublic","type":"bool"},{"indexed":false,"internalType":"uint256","name":"minDeposit","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"maxDeposit","type":"uint256"}],"name":"PartyInfoEdit","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"manager","type":"address"},{"indexed":false,"internalType":"bool","name":"isManager","type":"bool"}],"name":"PartyManagersChange","type":"event"},{"anonymous":false,"inputs":[],"name":"PartyTokenGateChange","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"member","type":"address"},{"indexed":false,"internalType":"uint256","name":"burnedPT","type":"uint256"},{"indexed":false,"internalType":"bool","name":"liquidate","type":"bool"},{"indexed":false,"internalType":"address[]","name":"redeemedAssets","type":"address[]"},{"indexed":false,"internalType":"uint256[]","name":"redeemedAmounts","type":"uint256[]"},{"indexed":false,"internalType":"uint256[]","name":"redeemedFees","type":"uint256[]"},{"indexed":false,"internalType":"uint256[]","name":"redeemedNetAmounts","type":"uint256[]"}],"name":"RedeemedShares","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"member","type":"address"},{"indexed":false,"internalType":"address","name":"sellToken","type":"address"},{"indexed":false,"internalType":"address","name":"buyToken","type":"address"},{"indexed":false,"internalType":"uint256","name":"soldAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"boughtAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"fee","type":"uint256"}],"name":"SwapToken","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"member","type":"address"},{"indexed":false,"internalType":"uint256","name":"burnedPT","type":"uint256"}],"name":"Withdraw","type":"event"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"closeParty","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"closed","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"creator","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"denominationAsset","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"components":[{"internalType":"address[]","name":"sellTokens","type":"address[]"},{"internalType":"uint256[]","name":"sellAmounts","type":"uint256[]"},{"internalType":"address[]","name":"buyTokens","type":"address[]"},{"internalType":"address[]","name":"spenders","type":"address[]"},{"internalType":"address payable[]","name":"swapsTargets","type":"address[]"},{"internalType":"bytes[]","name":"swapsCallData","type":"bytes[]"},{"internalType":"uint256","name":"partyValueDA","type":"uint256"},{"internalType":"uint256","name":"partyTotalSupply","type":"uint256"},{"internalType":"uint256","name":"expiresAt","type":"uint256"}],"internalType":"struct LibSignatures.Allocation","name":"allocation","type":"tuple"},{"components":[{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"},{"internalType":"uint8","name":"v","type":"uint8"}],"internalType":"struct LibSignatures.Sig","name":"approval","type":"tuple"}],"name":"deposit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"bio","type":"string"},{"internalType":"string","name":"img","type":"string"},{"internalType":"string","name":"model","type":"string"},{"internalType":"string","name":"purpose","type":"string"},{"internalType":"bool","name":"isPublic","type":"bool"},{"internalType":"uint256","name":"minDeposit","type":"uint256"},{"internalType":"uint256","name":"maxDeposit","type":"uint256"}],"internalType":"struct PartyInfo","name":"_partyInfo","type":"tuple"}],"name":"editPartyInfo","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"internalType":"struct TokenGate[]","name":"_tokenGates","type":"tuple[]"}],"name":"editTokenGates","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"getTokenGates","outputs":[{"components":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"internalType":"struct TokenGate[]","name":"","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getTokens","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"manager","type":"address"},{"internalType":"bool","name":"setManager","type":"bool"}],"name":"handleManager","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"components":[{"internalType":"address[]","name":"sellTokens","type":"address[]"},{"internalType":"uint256[]","name":"sellAmounts","type":"uint256[]"},{"internalType":"address[]","name":"buyTokens","type":"address[]"},{"internalType":"address[]","name":"spenders","type":"address[]"},{"internalType":"address payable[]","name":"swapsTargets","type":"address[]"},{"internalType":"bytes[]","name":"swapsCallData","type":"bytes[]"},{"internalType":"uint256","name":"partyValueDA","type":"uint256"},{"internalType":"uint256","name":"partyTotalSupply","type":"uint256"},{"internalType":"uint256","name":"expiresAt","type":"uint256"}],"internalType":"struct LibSignatures.Allocation","name":"allocation","type":"tuple"},{"components":[{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"},{"internalType":"uint8","name":"v","type":"uint8"}],"internalType":"struct LibSignatures.Sig","name":"approval","type":"tuple"}],"name":"joinParty","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"kickingMember","type":"address"},{"components":[{"internalType":"address[]","name":"sellTokens","type":"address[]"},{"internalType":"uint256[]","name":"sellAmounts","type":"uint256[]"},{"internalType":"address[]","name":"buyTokens","type":"address[]"},{"internalType":"address[]","name":"spenders","type":"address[]"},{"internalType":"address payable[]","name":"swapsTargets","type":"address[]"},{"internalType":"bytes[]","name":"swapsCallData","type":"bytes[]"},{"internalType":"uint256","name":"partyValueDA","type":"uint256"},{"internalType":"uint256","name":"partyTotalSupply","type":"uint256"},{"internalType":"uint256","name":"expiresAt","type":"uint256"}],"internalType":"struct LibSignatures.Allocation","name":"allocation","type":"tuple"},{"components":[{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"},{"internalType":"uint8","name":"v","type":"uint8"}],"internalType":"struct LibSignatures.Sig","name":"approval","type":"tuple"},{"internalType":"bool","name":"liquidate","type":"bool"}],"name":"kickMember","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"address[]","name":"sellTokens","type":"address[]"},{"internalType":"uint256[]","name":"sellAmounts","type":"uint256[]"},{"internalType":"address[]","name":"buyTokens","type":"address[]"},{"internalType":"address[]","name":"spenders","type":"address[]"},{"internalType":"address payable[]","name":"swapsTargets","type":"address[]"},{"internalType":"bytes[]","name":"swapsCallData","type":"bytes[]"},{"internalType":"uint256","name":"partyValueDA","type":"uint256"},{"internalType":"uint256","name":"partyTotalSupply","type":"uint256"},{"internalType":"uint256","name":"expiresAt","type":"uint256"}],"internalType":"struct LibSignatures.Allocation","name":"allocation","type":"tuple"},{"components":[{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"},{"internalType":"uint8","name":"v","type":"uint8"}],"internalType":"struct LibSignatures.Sig","name":"approval","type":"tuple"},{"internalType":"bool","name":"liquidate","type":"bool"}],"name":"leaveParty","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"managers","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"members","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"partyInfo","outputs":[{"components":[{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"bio","type":"string"},{"internalType":"string","name":"img","type":"string"},{"internalType":"string","name":"model","type":"string"},{"internalType":"string","name":"purpose","type":"string"},{"internalType":"bool","name":"isPublic","type":"bool"},{"internalType":"uint256","name":"minDeposit","type":"uint256"},{"internalType":"uint256","name":"maxDeposit","type":"uint256"}],"internalType":"struct PartyInfo","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"address[]","name":"sellTokens","type":"address[]"},{"internalType":"uint256[]","name":"sellAmounts","type":"uint256[]"},{"internalType":"address[]","name":"buyTokens","type":"address[]"},{"internalType":"address[]","name":"spenders","type":"address[]"},{"internalType":"address payable[]","name":"swapsTargets","type":"address[]"},{"internalType":"bytes[]","name":"swapsCallData","type":"bytes[]"},{"internalType":"uint256","name":"partyValueDA","type":"uint256"},{"internalType":"uint256","name":"partyTotalSupply","type":"uint256"},{"internalType":"uint256","name":"expiresAt","type":"uint256"}],"internalType":"struct LibSignatures.Allocation","name":"allocation","type":"tuple"},{"components":[{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"},{"internalType":"uint8","name":"v","type":"uint8"}],"internalType":"struct LibSignatures.Sig","name":"approval","type":"tuple"}],"name":"swapToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amountPT","type":"uint256"},{"components":[{"internalType":"address[]","name":"sellTokens","type":"address[]"},{"internalType":"uint256[]","name":"sellAmounts","type":"uint256[]"},{"internalType":"address[]","name":"buyTokens","type":"address[]"},{"internalType":"address[]","name":"spenders","type":"address[]"},{"internalType":"address payable[]","name":"swapsTargets","type":"address[]"},{"internalType":"bytes[]","name":"swapsCallData","type":"bytes[]"},{"internalType":"uint256","name":"partyValueDA","type":"uint256"},{"internalType":"uint256","name":"partyTotalSupply","type":"uint256"},{"internalType":"uint256","name":"expiresAt","type":"uint256"}],"internalType":"struct LibSignatures.Allocation","name":"allocation","type":"tuple"},{"components":[{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"},{"internalType":"uint8","name":"v","type":"uint8"}],"internalType":"struct LibSignatures.Sig","name":"approval","type":"tuple"},{"internalType":"bool","name":"liquidate","type":"bool"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"}]

608060405234801561001057600080fd5b506145b4806100206000396000f3fe608060405234801561001057600080fd5b506004361061018d5760003560e01c806370a08231116100e3578063aa6ca8081161008c578063e54ffe8c11610066578063e54ffe8c14610349578063fdff9b4d1461035c578063ff70174a1461038857600080fd5b8063aa6ca8081461030e578063b8e662b414610323578063e2f67dcd1461033657600080fd5b80638dcf9024116100bd5780638dcf9024146102e0578063934fc219146102f357806395d89b411461030657600080fd5b806370a082311461029a57806378130407146102c357806389b4d143146102cb57600080fd5b80633223af9d11610145578063597e1fb51161011f578063597e1fb5146102675780636229a30b146102725780636eb3ab9f1461028757600080fd5b80633223af9d1461022e578063544255e214610243578063569a03bf1461025657600080fd5b806308ae4b0c1161017657806308ae4b0c146101d157806318160ddd1461020d578063313ce5671461021f57600080fd5b806302d05d3f1461019257806306fdde03146101bc575b600080fd5b6019546001600160a01b03165b6040516001600160a01b0390911681526020015b60405180910390f35b6101c461039b565b6040516101b3919061348d565b6101fd6101df3660046134b5565b6001600160a01b031660009081526010602052604090205460ff1690565b60405190151581526020016101b3565b6002545b6040519081526020016101b3565b604051601281526020016101b3565b61024161023c366004613985565b61042f565b005b610241610251366004613a19565b610625565b6005546001600160a01b031661019f565b600e5460ff166101fd565b61027a610791565b6040516101b39190613b3f565b610241610295366004613c09565b610aeb565b6102116102a83660046134b5565b6001600160a01b031660009081526003602052604090205490565b610241610c1f565b6102d3610d23565b6040516101b39190613c74565b6102416102ee366004613ccc565b610d9b565b610241610301366004613c09565b610ed4565b6101c46110b1565b6103166110c3565b6040516101b39190613dcf565b610241610331366004613de2565b611127565b610241610344366004613e1b565b611273565b610241610357366004613e6a565b6113a6565b6101fd61036a3660046134b5565b6001600160a01b03166000908152600f602052604090205460ff1690565b610241610396366004613e9e565b611468565b60606000800180546103ac90613f01565b80601f01602080910402602001604051908101604052809291908181526020018280546103d890613f01565b80156104255780601f106103fa57610100808354040283529160200191610425565b820191906000526020600020905b81548152906001019060200180831161040857829003601f168201915b5050505050905090565b600f600061043b611549565b6001600160a01b0316815260208101919091526040016000205460ff166104a95760405162461bcd60e51b815260206004820152601b60248201527f4f6e6c79205061727479204d616e616765727320616c6c6f776564000000000060448201526064015b60405180910390fd5b6019546001600160a01b038086169116036104f0576040517fcadd2a0000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001600160a01b03841660009081526010602052604090205460ff16610542576040517f8a7da65100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001600160a01b0384166000908152600f602052604090205460ff1615610595576040517fd04d9fa900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001600160a01b0384166000908152600360205260409020546105bb81868686866115a5565b6001600160a01b038516600081815260106020908152604091829020805460ff1916905581513381529081019290925281018290527f1c39d5af6eac27eb59e0765bb32a393ad07936da11f05eecc598c3b3fbd229fa906060015b60405180910390a15050505050565b61062d611549565b6019546001600160a01b0390811691161461068a5760405162461bcd60e51b815260206004820152601a60248201527f4f6e6c792050617274792043726561746f7220616c6c6f77656400000000000060448201526064016104a0565b80518190600690819061069d9082613f89565b50602082015160018201906106b29082613f89565b50604082015160028201906106c79082613f89565b50606082015160038201906106dc9082613f89565b50608082015160048201906106f19082613f89565b5060a08201518160050160006101000a81548160ff02191690831515021790555060c0820151816006015560e082015181600701559050507f9f018aa3a0d29fd37195cdae1b94db79562e3c71d94d3597f6b15d1aa081d861816000015182602001518360400151846060015185608001518660a001518760c001518860e00151604051610786989796959493929190614049565b60405180910390a150565b6107db604051806101000160405280606081526020016060815260200160608152602001606081526020016060815260200160001515815260200160008152602001600081525090565b60408051610100810190915260068054829082906107f890613f01565b80601f016020809104026020016040519081016040528092919081815260200182805461082490613f01565b80156108715780601f1061084657610100808354040283529160200191610871565b820191906000526020600020905b81548152906001019060200180831161085457829003601f168201915b5050505050815260200160018201805461088a90613f01565b80601f01602080910402602001604051908101604052809291908181526020018280546108b690613f01565b80156109035780601f106108d857610100808354040283529160200191610903565b820191906000526020600020905b8154815290600101906020018083116108e657829003601f168201915b5050505050815260200160028201805461091c90613f01565b80601f016020809104026020016040519081016040528092919081815260200182805461094890613f01565b80156109955780601f1061096a57610100808354040283529160200191610995565b820191906000526020600020905b81548152906001019060200180831161097857829003601f168201915b505050505081526020016003820180546109ae90613f01565b80601f01602080910402602001604051908101604052809291908181526020018280546109da90613f01565b8015610a275780601f106109fc57610100808354040283529160200191610a27565b820191906000526020600020905b815481529060010190602001808311610a0a57829003601f168201915b50505050508152602001600482018054610a4090613f01565b80601f0160208091040260200160405190810160405280929190818152602001828054610a6c90613f01565b8015610ab95780601f10610a8e57610100808354040283529160200191610ab9565b820191906000526020600020905b815481529060010190602001808311610a9c57829003601f168201915b5050509183525050600582015460ff161515602082015260068201546040820152600790910154606090910152919050565b600e5460ff1615610b3e5760405162461bcd60e51b815260206004820152600f60248201527f506172747920697320636c6f736564000000000000000000000000000000000060448201526064016104a0565b6001600160a01b03841660009081526010602052604090205460ff16610ba65760405162461bcd60e51b815260206004820152601a60248201527f4f6e6c79205061727479204d656d6265727320616c6c6f77656400000000000060448201526064016104a0565b600080610bb586868686611659565b600554604080516001600160a01b03808c16825290921660208301528101889052606081018390526080810182905291935091507f4e2ca0515ed1aef1395f66b5303bb5d6f1bf9d61a353fa53f73f8ac9973fa9f69060a0015b60405180910390a1505050505050565b610c27611549565b6019546001600160a01b03908116911614610c845760405162461bcd60e51b815260206004820152601a60248201527f4f6e6c792050617274792043726561746f7220616c6c6f77656400000000000060448201526064016104a0565b600e5460ff1615610cd75760405162461bcd60e51b815260206004820152600f60248201527f506172747920697320636c6f736564000000000000000000000000000000000060448201526064016104a0565b600e805460ff191660011790556002546040805133815260208101929092527f684222b0069d4a2e5e0d986611cc5182d543904c4e4264bf770d4e51faefc822910160405180910390a1565b60606000601a01805480602002602001604051908101604052809291908181526020016000905b82821015610d92576000848152602090819020604080518082019091526002850290910180546001600160a01b03168252600190810154828401529083529092019101610d4a565b50505050905090565b600f6000610da7611549565b6001600160a01b0316815260208101919091526040016000205460ff16610e105760405162461bcd60e51b815260206004820152601b60248201527f4f6e6c79205061727479204d616e616765727320616c6c6f776564000000000060448201526064016104a0565b610e1c601a60006133ea565b60005b8151811015610ea7576000601a01828281518110610e3f57610e3f6140ce565b6020908102919091018101518254600180820185556000948552938390208251600290920201805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0390921691909117815591015191015580610e9f816140fa565b915050610e1f565b506040517fbcf216305ea85f0e4cd7b0e22ea97230701d805613be2d918e2744eae66d4abf90600090a150565b60106000610ee0611549565b6001600160a01b0316815260208101919091526040016000205460ff1615610f4a5760405162461bcd60e51b815260206004820152601e60248201527f4f6e6c79206e6f6e205061727479204d656d6265727320616c6c6f776564000060448201526064016104a0565b600e5460ff1615610f9d5760405162461bcd60e51b815260206004820152600f60248201527f506172747920697320636c6f736564000000000000000000000000000000000060448201526064016104a0565b600b5460ff1661101a576001600160a01b03841660009081526014602052604090205460ff16610ff9576040517f439b576e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001600160a01b0384166000908152601460205260409020805460ff191690555b61102384611902565b6001600160a01b0384166000908152601060205260408120805460ff191660011790558061105386868686611659565b600554604080516001600160a01b03808c16825290921660208301528101889052606081018390526080810182905291935091507f330a0c3830f9c19654cc3b5701caa3230ec175384311f49b6a927dcc4b32ef4a9060a001610c0f565b6060600060010180546103ac90613f01565b6060600060110180548060200260200160405190810160405280929190818152602001828054801561042557602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311611100575050505050905090565b6019546001600160a01b03166111b657336000908152600f602052604090205460ff166111965760405162461bcd60e51b815260206004820152601b60248201527f4f6e6c79205061727479204d616e616765727320616c6c6f776564000000000060448201526064016104a0565b6019805473ffffffffffffffffffffffffffffffffffffffff1916331790555b6019546001600160a01b031633146112105760405162461bcd60e51b815260206004820152601a60248201527f4f6e6c792050617274792043726561746f7220616c6c6f77656400000000000060448201526064016104a0565b6001600160a01b0382166000818152600f6020908152604091829020805460ff19168515159081179091558251938452908301527f68f31d2f89e90802575fed1ff4379c24f4beed9d0d055fcd1f1e5cf2da5f697c910160405180910390a15050565b600f600061127f611549565b6001600160a01b0316815260208101919091526040016000205460ff166112e85760405162461bcd60e51b815260206004820152601b60248201527f4f6e6c79205061727479204d616e616765727320616c6c6f776564000000000060448201526064016104a0565b60008060006112f78585611aba565b9250925092507fe14f465c1f5191875f1473bbf0f8cc3ff0158a220fa5711eff06ff04a83a1b48338660000151600081518110611336576113366140ce565b60200260200101518760400151600081518110611355576113556140ce565b6020026020010151868686604051610616969594939291906001600160a01b03968716815294861660208601529290941660408401526060830152608082019290925260a081019190915260c00190565b601060006113b2611549565b6001600160a01b0316815260208101919091526040016000205460ff1661141b5760405162461bcd60e51b815260206004820152601a60248201527f4f6e6c79205061727479204d656d6265727320616c6c6f77656400000000000060448201526064016104a0565b61142884338585856115a5565b60408051338152602081018690527f884edad9ce6fa2440d8a54cc123490eb96d2768479d49ff9c7366125a942436491015b60405180910390a150505050565b60106000611474611549565b6001600160a01b0316815260208101919091526040016000205460ff166114dd5760405162461bcd60e51b815260206004820152601a60248201527f4f6e6c79205061727479204d656d6265727320616c6c6f77656400000000000060448201526064016104a0565b33600081815260036020526040902054906114fc9082908686866115a5565b33600081815260106020908152604091829020805460ff19169055815192835282018390527f61a26f7c17d8780c095ccfa67e689a13ee4e06ddce3da18956369f4a396100e8910161145a565b600030330361159f57600080368080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152505050503601516001600160a01b031691506115a29050565b50335b90565b6001600160a01b0384166000908152600360205260408120548611156115f7576040517fcfed16bd00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60028101546116068688611d47565b8615611650578215611641576005820154601783015461163c91899184918a918a918a916001600160a01b039182169116611ed1565b611650565b6116508782888560110161221b565b50505050505050565b600c546000908190819086101561169c576040517f2923ca2700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600d810154158015906116b25750600d81015486115b156116e9576040517ff7e7ebfe00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6116f78682601501546125cd565b60058201549093506001600160a01b03166323b872dd8830611719878b614114565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e086901b1681526001600160a01b03938416600482015292909116602483015260448201526064016020604051808303816000875af1158015611785573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117a99190614127565b5060058101546117c39087906001600160a01b03166125ed565b5060178101546117e1908890879087906001600160a01b031661269a565b50600281015415806117f5575060e0850151155b1561189a578060050160009054906101000a90046001600160a01b03166001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa15801561184f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118739190614144565b61187e906012614161565b61188990600a61425e565b611893908761426d565b91506118ee565b60c0850151600282015460e0870151146118cf5760e086015160028301546118c2908361426d565b6118cc9190614284565b90505b808783600201546118e0919061426d565b6118ea9190614284565b9250505b6118f88783612a48565b5094509492505050565b6000805b601a820154811015611ab55760008083601a01838154811061192a5761192a6140ce565b60009182526020909120600290910201546040516001600160a01b0387811660248301529091169060440160408051601f198184030181529181526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff166370a0823160e01b1790525161199f91906142a6565b600060405180830381855afa9150503d80600081146119da576040519150601f19603f3d011682016040523d82523d6000602084013e6119df565b606091505b50915091508180156119f357506020815110155b15611a715783601a018381548110611a0d57611a0d6140ce565b90600052602060002090600202016001015481806020019051810190611a3391906142c2565b10611a3f575050611aa3565b6040517f8b5b5fe000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040517fb3afa80000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b80611aad816140fa565b915050611906565b505050565b600080808080865151909150600114611aff576040517f1115766700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6017810154611b1a9033906001600160a01b03168888612b2e565b611b50576040517f8baa579f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000611c148760000151600081518110611b6c57611b6c6140ce565b60200260200101518860200151600081518110611b8b57611b8b6140ce565b60200260200101518960400151600081518110611baa57611baa6140ce565b60200260200101518a60600151600081518110611bc957611bc96140ce565b60200260200101518b60800151600081518110611be857611be86140ce565b60200260200101518c60a00151600081518110611c0757611c076140ce565b6020026020010151612bdc565b90508060400151945080606001519350611c5081606001518860400151600081518110611c4357611c436140ce565b60200260200101516125ed565b9250611cd682601101805480602002602001604051908101604052809291908181526020018280548015611cad57602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311611c8f575b50505050508860400151600081518110611cc957611cc96140ce565b6020026020010151613026565b611d3e57816011018760400151600081518110611cf557611cf56140ce565b602090810291909101810151825460018101845560009384529190922001805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b039092169190911790555b50509250925092565b6001600160a01b038216611dc35760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f2061646472657360448201527f730000000000000000000000000000000000000000000000000000000000000060648201526084016104a0565b6001600160a01b03821660009081526003602052604081205482811015611e525760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e60448201527f636500000000000000000000000000000000000000000000000000000000000060648201526084016104a0565b6001600160a01b038416600090815260038301602052604081208483039055600283018054859290611e859084906142db565b90915550506040518381526000906001600160a01b038616907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a350505050565b6040805160018082528183019092526000916020808301908036833750506040805160018082528183019092529293506000929150602080830190803683375050604080516001808252818301909252929350600092915060208083019080368337019050506040516370a0823160e01b81523060048201529091506000906001600160a01b038716906370a0823190602401602060405180830381865afa158015611f81573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fa591906142c2565b905089611fb28c8361426d565b611fbc9190614284565b84600081518110611fcf57611fcf6140ce565b6020026020010181815250506000611fe98a8a8a8961269a565b905060005b81606001515181101561208257876001600160a01b03168260200151828151811061201b5761201b6140ce565b60200260200101516001600160a01b03160361207a5781606001518181518110612047576120476140ce565b602002602001015186600081518110612062576120626140ce565b602002602001018181516120769190614114565b9052505b600101611fee565b506120a785600081518110612099576120996140ce565b6020026020010151886125ed565b846000815181106120ba576120ba6140ce565b602002602001018181525050836000815181106120d9576120d96140ce565b6020026020010151856000815181106120f4576120f46140ce565b602002602001015161210691906142db565b83600081518110612119576121196140ce565b602002602001018181525050866001600160a01b031663a9059cbb8b85600081518110612148576121486140ce565b60200260200101516040518363ffffffff1660e01b81526004016121819291906001600160a01b03929092168252602082015260400190565b6020604051808303816000875af11580156121a0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121c49190614127565b507f70f5c7374ba9bde970383c50f09c6d1e944af4354c0a890bdec9bb753e3db3cc8a8d60018460000151898989604051612205979695949392919061431e565b60405180910390a1505050505050505050505050565b805460009067ffffffffffffffff811115612238576122386134d2565b604051908082528060200260200182016040528015612261578160200160208202803683370190505b50825490915060009067ffffffffffffffff811115612282576122826134d2565b6040519080825280602002602001820160405280156122ab578160200160208202803683370190505b50835490915060009067ffffffffffffffff8111156122cc576122cc6134d2565b6040519080825280602002602001820160405280156122f5578160200160208202803683370190505b50905060005b845481101561257f576000858281548110612318576123186140ce565b6000918252602090912001546040516370a0823160e01b81523060048201526001600160a01b03909116906370a0823190602401602060405180830381865afa158015612369573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061238d91906142c2565b90508761239a8a8361426d565b6123a49190614284565b8583815181106123b6576123b66140ce565b60200260200101818152505060008583815181106123d6576123d66140ce565b602002602001015111156125765761242d8583815181106123f9576123f96140ce565b6020026020010151878481548110612413576124136140ce565b6000918252602090912001546001600160a01b03166125ed565b84838151811061243f5761243f6140ce565b60200260200101818152505083828151811061245d5761245d6140ce565b6020026020010151858381518110612477576124776140ce565b602002602001015161248991906142db565b83838151811061249b5761249b6140ce565b6020026020010181815250508582815481106124b9576124b96140ce565b9060005260206000200160009054906101000a90046001600160a01b03166001600160a01b031663a9059cbb888585815181106124f8576124f86140ce565b60200260200101516040518363ffffffff1660e01b81526004016125319291906001600160a01b03929092168252602082015260400190565b6020604051808303816000875af1158015612550573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125749190614127565b505b506001016122fb565b507f70f5c7374ba9bde970383c50f09c6d1e944af4354c0a890bdec9bb753e3db3cc85886000878787876040516125bc9796959493929190614396565b60405180910390a150505050505050565b60006127106125dc838561426d565b6125e69190614284565b9392505050565b6000806125fe8482601501546125cd565b60168201546040517fa9059cbb0000000000000000000000000000000000000000000000000000000081526001600160a01b0391821660048201526024810183905291935084169063a9059cbb906044016020604051808303816000875af115801561266e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906126929190614127565b505092915050565b6126c56040518060800160405280606081526020016060815260200160608152602001606081525090565b6126d185838686612b2e565b612707576040517f8baa579f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b83515167ffffffffffffffff811115612722576127226134d2565b60405190808252806020026020018201604052801561274b578160200160208202803683370190505b50815283515167ffffffffffffffff811115612769576127696134d2565b604051908082528060200260200182016040528015612792578160200160208202803683370190505b50602082015283515167ffffffffffffffff8111156127b3576127b36134d2565b6040519080825280602002602001820160405280156127dc578160200160208202803683370190505b50604082015283515167ffffffffffffffff8111156127fd576127fd6134d2565b604051908082528060200260200182016040528015612826578160200160208202803683370190505b50606082015260005b8451518110156129ea5760006128ea86600001518381518110612854576128546140ce565b602002602001015187602001518481518110612872576128726140ce565b602002602001015188604001518581518110612890576128906140ce565b6020026020010151896060015186815181106128ae576128ae6140ce565b60200260200101518a6080015187815181106128cc576128cc6140ce565b60200260200101518b60a001518881518110611c0757611c076140ce565b905085600001518281518110612902576129026140ce565b602002602001015183600001518381518110612920576129206140ce565b60200260200101906001600160a01b031690816001600160a01b03168152505085604001518281518110612956576129566140ce565b602002602001015183602001518381518110612974576129746140ce565b60200260200101906001600160a01b031690816001600160a01b0316815250508060400151836040015183815181106129af576129af6140ce565b6020026020010181815250508060600151836060015183815181106129d6576129d66140ce565b60209081029190910101525060010161282f565b507fe87c83c4570e12ac007ab11a4cc9e913d616a09c361bb0384b8ccd88aaee53c98582600001518360200151846040015185606001518960c00151604051612a3896959493929190614422565b60405180910390a1949350505050565b6001600160a01b038216612a9e5760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f20616464726573730060448201526064016104a0565b600081816002016000828254612ab49190614114565b90915550506001600160a01b038316600090815260038201602052604081208054849290612ae3908490614114565b90915550506040518281526001600160a01b038416906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a3505050565b6000428361010001511015612b4557506000612bd4565b6000612ba2308786600001518760200151886040015189606001518a608001518b60c001518c60e001518d6101000151604051602001612b8e9a999897969594939291906144c0565b604051602081830303815290604052613083565b9050846001600160a01b0316612bc6828560400151866000015187602001516130e6565b6001600160a01b0316149150505b949350505050565b612c276040518060c0016040528060006001600160a01b0316815260200160006001600160a01b03168152602001600081526020016000815260200160008152602001600081525090565b6040517f095ea7b30000000000000000000000000000000000000000000000000000000081526001600160a01b0385811660048301526000602483015288169063095ea7b3906044016020604051808303816000875af1158015612c8f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612cb39190614127565b612ce9576040517f927c952600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040517f095ea7b30000000000000000000000000000000000000000000000000000000081526001600160a01b0385811660048301526024820188905288169063095ea7b3906044016020604051808303816000875af1158015612d51573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612d759190614127565b612dab576040517f9a4a113500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040516370a0823160e01b81523060048201526001600160a01b038816906370a0823190602401602060405180830381865afa158015612def573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612e1391906142c2565b60808201526040516370a0823160e01b81523060048201526001600160a01b038616906370a0823190602401602060405180830381865afa158015612e5c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612e8091906142c2565b60a08201526040516000906001600160a01b038516903490612ea39086906142a6565b60006040518083038185875af1925050503d8060008114612ee0576040519150601f19603f3d011682016040523d82523d6000602084013e612ee5565b606091505b5050905080612f20576040517f1f6f86f900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040516370a0823160e01b81523060048201526001600160a01b038916906370a0823190602401602060405180830381865afa158015612f64573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612f8891906142c2565b8260800151612f9791906142db565b60408381019190915260a083015190516370a0823160e01b81523060048201526001600160a01b038816906370a0823190602401602060405180830381865afa158015612fe8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061300c91906142c2565b61301691906142db565b6060830152509695505050505050565b6000805b835181101561307757838181518110613045576130456140ce565b60200260200101516001600160a01b0316836001600160a01b03160361306f57600191505061307d565b60010161302a565b50600090505b92915050565b600081805190602001206040516020016130c991907f19457468657265756d205369676e6564204d6573736167653a0a3332000000008152601c810191909152603c0190565b604051602081830303815290604052805190602001209050919050565b60008060006130f78787878761310e565b91509150613104816131fb565b5095945050505050565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a083111561314557506000905060036131f2565b8460ff16601b1415801561315d57508460ff16601c14155b1561316e57506000905060046131f2565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa1580156131c2573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b0381166131eb576000600192509250506131f2565b9150600090505b94509492505050565b600081600481111561320f5761320f614568565b036132175750565b600181600481111561322b5761322b614568565b036132785760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e6174757265000000000000000060448201526064016104a0565b600281600481111561328c5761328c614568565b036132d95760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e6774680060448201526064016104a0565b60038160048111156132ed576132ed614568565b036133605760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c60448201527f756500000000000000000000000000000000000000000000000000000000000060648201526084016104a0565b600481600481111561337457613374614568565b036133e75760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202776272076616c60448201527f756500000000000000000000000000000000000000000000000000000000000060648201526084016104a0565b50565b50805460008255600202906000526020600020908101906133e791905b8082111561343957805473ffffffffffffffffffffffffffffffffffffffff1916815560006001820155600201613407565b5090565b60005b83811015613458578181015183820152602001613440565b50506000910152565b6000815180845261347981602086016020860161343d565b601f01601f19169290920160200192915050565b6020815260006125e66020830184613461565b6001600160a01b03811681146133e757600080fd5b6000602082840312156134c757600080fd5b81356125e6816134a0565b634e487b7160e01b600052604160045260246000fd5b604051610120810167ffffffffffffffff8111828210171561350c5761350c6134d2565b60405290565b604051610100810167ffffffffffffffff8111828210171561350c5761350c6134d2565b6040805190810167ffffffffffffffff8111828210171561350c5761350c6134d2565b604051601f8201601f1916810167ffffffffffffffff81118282101715613582576135826134d2565b604052919050565b600067ffffffffffffffff8211156135a4576135a46134d2565b5060051b60200190565b600082601f8301126135bf57600080fd5b813560206135d46135cf8361358a565b613559565b82815260059290921b840181019181810190868411156135f357600080fd5b8286015b8481101561361757803561360a816134a0565b83529183019183016135f7565b509695505050505050565b600082601f83011261363357600080fd5b813560206136436135cf8361358a565b82815260059290921b8401810191818101908684111561366257600080fd5b8286015b848110156136175780358352918301918301613666565b600082601f83011261368e57600080fd5b8135602061369e6135cf8361358a565b82815260059290921b840181019181810190868411156136bd57600080fd5b8286015b848110156136175780356136d4816134a0565b83529183019183016136c1565b600067ffffffffffffffff8311156136fb576136fb6134d2565b61370e6020601f19601f86011601613559565b905082815283838301111561372257600080fd5b828260208301376000602084830101529392505050565b600082601f83011261374a57600080fd5b8135602061375a6135cf8361358a565b82815260059290921b8401810191818101908684111561377957600080fd5b8286015b8481101561361757803567ffffffffffffffff81111561379d5760008081fd5b8701603f810189136137af5760008081fd5b6137c08986830135604084016136e1565b84525091830191830161377d565b600061012082840312156137e157600080fd5b6137e96134e8565b9050813567ffffffffffffffff8082111561380357600080fd5b61380f858386016135ae565b8352602084013591508082111561382557600080fd5b61383185838601613622565b6020840152604084013591508082111561384a57600080fd5b613856858386016135ae565b6040840152606084013591508082111561386f57600080fd5b61387b858386016135ae565b6060840152608084013591508082111561389457600080fd5b6138a08583860161367d565b608084015260a08401359150808211156138b957600080fd5b506138c684828501613739565b60a08301525060c082013560c082015260e082013560e082015261010080830135818301525092915050565b60ff811681146133e757600080fd5b60006060828403121561391357600080fd5b6040516060810181811067ffffffffffffffff82111715613936576139366134d2565b80604052508091508235815260208301356020820152604083013561395a816138f2565b6040919091015292915050565b80151581146133e757600080fd5b803561398081613967565b919050565b60008060008060c0858703121561399b57600080fd5b84356139a6816134a0565b9350602085013567ffffffffffffffff8111156139c257600080fd5b6139ce878288016137ce565b9350506139de8660408701613901565b915060a08501356139ee81613967565b939692955090935050565b600082601f830112613a0a57600080fd5b6125e6838335602085016136e1565b600060208284031215613a2b57600080fd5b813567ffffffffffffffff80821115613a4357600080fd5b908301906101008286031215613a5857600080fd5b613a60613512565b823582811115613a6f57600080fd5b613a7b878286016139f9565b825250602083013582811115613a9057600080fd5b613a9c878286016139f9565b602083015250604083013582811115613ab457600080fd5b613ac0878286016139f9565b604083015250606083013582811115613ad857600080fd5b613ae4878286016139f9565b606083015250608083013582811115613afc57600080fd5b613b08878286016139f9565b608083015250613b1a60a08401613975565b60a082015260c083013560c082015260e083013560e082015280935050505092915050565b6020815260008251610100806020850152613b5e610120850183613461565b91506020850151601f1980868503016040870152613b7c8483613461565b93506040870151915080868503016060870152613b998483613461565b93506060870151915080868503016080870152613bb68483613461565b935060808701519150808685030160a087015250613bd48382613461565b92505060a0850151613bea60c086018215159052565b5060c085015160e085015260e085015181850152508091505092915050565b60008060008060c08587031215613c1f57600080fd5b8435613c2a816134a0565b935060208501359250604085013567ffffffffffffffff811115613c4d57600080fd5b613c59878288016137ce565b925050613c698660608701613901565b905092959194509250565b602080825282518282018190526000919060409081850190868401855b82811015613cbf57815180516001600160a01b03168552860151868501529284019290850190600101613c91565b5091979650505050505050565b60006020808385031215613cdf57600080fd5b823567ffffffffffffffff811115613cf657600080fd5b8301601f81018513613d0757600080fd5b8035613d156135cf8261358a565b81815260069190911b82018301908381019087831115613d3457600080fd5b928401925b82841015613d805760408489031215613d525760008081fd5b613d5a613536565b8435613d65816134a0565b81528486013586820152825260409093019290840190613d39565b979650505050505050565b600081518084526020808501945080840160005b83811015613dc45781516001600160a01b031687529582019590820190600101613d9f565b509495945050505050565b6020815260006125e66020830184613d8b565b60008060408385031215613df557600080fd5b8235613e00816134a0565b91506020830135613e1081613967565b809150509250929050565b60008060808385031215613e2e57600080fd5b823567ffffffffffffffff811115613e4557600080fd5b613e51858286016137ce565b925050613e618460208501613901565b90509250929050565b60008060008060c08587031215613e8057600080fd5b84359350602085013567ffffffffffffffff8111156139c257600080fd5b600080600060a08486031215613eb357600080fd5b833567ffffffffffffffff811115613eca57600080fd5b613ed6868287016137ce565b935050613ee68560208601613901565b91506080840135613ef681613967565b809150509250925092565b600181811c90821680613f1557607f821691505b602082108103613f3557634e487b7160e01b600052602260045260246000fd5b50919050565b601f821115611ab557600081815260208120601f850160051c81016020861015613f625750805b601f850160051c820191505b81811015613f8157828155600101613f6e565b505050505050565b815167ffffffffffffffff811115613fa357613fa36134d2565b613fb781613fb18454613f01565b84613f3b565b602080601f831160018114613fec5760008415613fd45750858301515b600019600386901b1c1916600185901b178555613f81565b600085815260208120601f198616915b8281101561401b57888601518255948401946001909101908401613ffc565b50858210156140395787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b600061010080835261405d8184018c613461565b90508281036020840152614071818b613461565b90508281036040840152614085818a613461565b905082810360608401526140998189613461565b905082810360808401526140ad8188613461565b95151560a0840152505060c081019290925260e09091015295945050505050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019820361410d5761410d6140e4565b5060010190565b8082018082111561307d5761307d6140e4565b60006020828403121561413957600080fd5b81516125e681613967565b60006020828403121561415657600080fd5b81516125e6816138f2565b60ff828116828216039081111561307d5761307d6140e4565b600181815b808511156141b557816000190482111561419b5761419b6140e4565b808516156141a857918102915b93841c939080029061417f565b509250929050565b6000826141cc5750600161307d565b816141d95750600061307d565b81600181146141ef57600281146141f957614215565b600191505061307d565b60ff84111561420a5761420a6140e4565b50506001821b61307d565b5060208310610133831016604e8410600b8410161715614238575081810a61307d565b614242838361417a565b8060001904821115614256576142566140e4565b029392505050565b60006125e660ff8416836141bd565b808202811582820484141761307d5761307d6140e4565b6000826142a157634e487b7160e01b600052601260045260246000fd5b500490565b600082516142b881846020870161343d565b9190910192915050565b6000602082840312156142d457600080fd5b5051919050565b8181038181111561307d5761307d6140e4565b600081518084526020808501945080840160005b83811015613dc457815187529582019590820190600101614302565b6001600160a01b0388168152866020820152851515604082015260e06060820152600061434e60e0830187613d8b565b828103608084015261436081876142ee565b905082810360a084015261437481866142ee565b905082810360c084015261438881856142ee565b9a9950505050505050505050565b600060e082016001600160a01b03808b16845260208a81860152891515604086015260e06060860152828954808552610100870191508a60005282600020945060005b818110156143f75785548516835260019586019592840192016143d9565b5050858103608087015261440b818a6142ee565b935050505082810360a084015261437481866142ee565b6001600160a01b038716815260c06020820152600061444460c0830188613d8b565b82810360408401526144568188613d8b565b9050828103606084015261446a81876142ee565b9050828103608084015261447e81866142ee565b9150508260a0830152979650505050505050565b80516000906020808401838315613dc45781516001600160a01b031687529582019590820190600101613d9f565b60007fffffffffffffffffffffffffffffffffffffffff000000000000000000000000808d60601b168352808c60601b16601484015250614504602883018b614492565b89516020808c0160005b8381101561452a5781518552938201939082019060010161450e565b505061454861454261453c858e614492565b8c614492565b8a614492565b978852870195909552505050604083015250606001979650505050505050565b634e487b7160e01b600052602160045260246000fdfea26469706673582212206af4fe9b7c4a9e835d7d22c8bacffcbe23280fff29abab7f519342d667dfbe7664736f6c63430008110033

Deployed Bytecode

0x608060405234801561001057600080fd5b506004361061018d5760003560e01c806370a08231116100e3578063aa6ca8081161008c578063e54ffe8c11610066578063e54ffe8c14610349578063fdff9b4d1461035c578063ff70174a1461038857600080fd5b8063aa6ca8081461030e578063b8e662b414610323578063e2f67dcd1461033657600080fd5b80638dcf9024116100bd5780638dcf9024146102e0578063934fc219146102f357806395d89b411461030657600080fd5b806370a082311461029a57806378130407146102c357806389b4d143146102cb57600080fd5b80633223af9d11610145578063597e1fb51161011f578063597e1fb5146102675780636229a30b146102725780636eb3ab9f1461028757600080fd5b80633223af9d1461022e578063544255e214610243578063569a03bf1461025657600080fd5b806308ae4b0c1161017657806308ae4b0c146101d157806318160ddd1461020d578063313ce5671461021f57600080fd5b806302d05d3f1461019257806306fdde03146101bc575b600080fd5b6019546001600160a01b03165b6040516001600160a01b0390911681526020015b60405180910390f35b6101c461039b565b6040516101b3919061348d565b6101fd6101df3660046134b5565b6001600160a01b031660009081526010602052604090205460ff1690565b60405190151581526020016101b3565b6002545b6040519081526020016101b3565b604051601281526020016101b3565b61024161023c366004613985565b61042f565b005b610241610251366004613a19565b610625565b6005546001600160a01b031661019f565b600e5460ff166101fd565b61027a610791565b6040516101b39190613b3f565b610241610295366004613c09565b610aeb565b6102116102a83660046134b5565b6001600160a01b031660009081526003602052604090205490565b610241610c1f565b6102d3610d23565b6040516101b39190613c74565b6102416102ee366004613ccc565b610d9b565b610241610301366004613c09565b610ed4565b6101c46110b1565b6103166110c3565b6040516101b39190613dcf565b610241610331366004613de2565b611127565b610241610344366004613e1b565b611273565b610241610357366004613e6a565b6113a6565b6101fd61036a3660046134b5565b6001600160a01b03166000908152600f602052604090205460ff1690565b610241610396366004613e9e565b611468565b60606000800180546103ac90613f01565b80601f01602080910402602001604051908101604052809291908181526020018280546103d890613f01565b80156104255780601f106103fa57610100808354040283529160200191610425565b820191906000526020600020905b81548152906001019060200180831161040857829003601f168201915b5050505050905090565b600f600061043b611549565b6001600160a01b0316815260208101919091526040016000205460ff166104a95760405162461bcd60e51b815260206004820152601b60248201527f4f6e6c79205061727479204d616e616765727320616c6c6f776564000000000060448201526064015b60405180910390fd5b6019546001600160a01b038086169116036104f0576040517fcadd2a0000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001600160a01b03841660009081526010602052604090205460ff16610542576040517f8a7da65100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001600160a01b0384166000908152600f602052604090205460ff1615610595576040517fd04d9fa900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001600160a01b0384166000908152600360205260409020546105bb81868686866115a5565b6001600160a01b038516600081815260106020908152604091829020805460ff1916905581513381529081019290925281018290527f1c39d5af6eac27eb59e0765bb32a393ad07936da11f05eecc598c3b3fbd229fa906060015b60405180910390a15050505050565b61062d611549565b6019546001600160a01b0390811691161461068a5760405162461bcd60e51b815260206004820152601a60248201527f4f6e6c792050617274792043726561746f7220616c6c6f77656400000000000060448201526064016104a0565b80518190600690819061069d9082613f89565b50602082015160018201906106b29082613f89565b50604082015160028201906106c79082613f89565b50606082015160038201906106dc9082613f89565b50608082015160048201906106f19082613f89565b5060a08201518160050160006101000a81548160ff02191690831515021790555060c0820151816006015560e082015181600701559050507f9f018aa3a0d29fd37195cdae1b94db79562e3c71d94d3597f6b15d1aa081d861816000015182602001518360400151846060015185608001518660a001518760c001518860e00151604051610786989796959493929190614049565b60405180910390a150565b6107db604051806101000160405280606081526020016060815260200160608152602001606081526020016060815260200160001515815260200160008152602001600081525090565b60408051610100810190915260068054829082906107f890613f01565b80601f016020809104026020016040519081016040528092919081815260200182805461082490613f01565b80156108715780601f1061084657610100808354040283529160200191610871565b820191906000526020600020905b81548152906001019060200180831161085457829003601f168201915b5050505050815260200160018201805461088a90613f01565b80601f01602080910402602001604051908101604052809291908181526020018280546108b690613f01565b80156109035780601f106108d857610100808354040283529160200191610903565b820191906000526020600020905b8154815290600101906020018083116108e657829003601f168201915b5050505050815260200160028201805461091c90613f01565b80601f016020809104026020016040519081016040528092919081815260200182805461094890613f01565b80156109955780601f1061096a57610100808354040283529160200191610995565b820191906000526020600020905b81548152906001019060200180831161097857829003601f168201915b505050505081526020016003820180546109ae90613f01565b80601f01602080910402602001604051908101604052809291908181526020018280546109da90613f01565b8015610a275780601f106109fc57610100808354040283529160200191610a27565b820191906000526020600020905b815481529060010190602001808311610a0a57829003601f168201915b50505050508152602001600482018054610a4090613f01565b80601f0160208091040260200160405190810160405280929190818152602001828054610a6c90613f01565b8015610ab95780601f10610a8e57610100808354040283529160200191610ab9565b820191906000526020600020905b815481529060010190602001808311610a9c57829003601f168201915b5050509183525050600582015460ff161515602082015260068201546040820152600790910154606090910152919050565b600e5460ff1615610b3e5760405162461bcd60e51b815260206004820152600f60248201527f506172747920697320636c6f736564000000000000000000000000000000000060448201526064016104a0565b6001600160a01b03841660009081526010602052604090205460ff16610ba65760405162461bcd60e51b815260206004820152601a60248201527f4f6e6c79205061727479204d656d6265727320616c6c6f77656400000000000060448201526064016104a0565b600080610bb586868686611659565b600554604080516001600160a01b03808c16825290921660208301528101889052606081018390526080810182905291935091507f4e2ca0515ed1aef1395f66b5303bb5d6f1bf9d61a353fa53f73f8ac9973fa9f69060a0015b60405180910390a1505050505050565b610c27611549565b6019546001600160a01b03908116911614610c845760405162461bcd60e51b815260206004820152601a60248201527f4f6e6c792050617274792043726561746f7220616c6c6f77656400000000000060448201526064016104a0565b600e5460ff1615610cd75760405162461bcd60e51b815260206004820152600f60248201527f506172747920697320636c6f736564000000000000000000000000000000000060448201526064016104a0565b600e805460ff191660011790556002546040805133815260208101929092527f684222b0069d4a2e5e0d986611cc5182d543904c4e4264bf770d4e51faefc822910160405180910390a1565b60606000601a01805480602002602001604051908101604052809291908181526020016000905b82821015610d92576000848152602090819020604080518082019091526002850290910180546001600160a01b03168252600190810154828401529083529092019101610d4a565b50505050905090565b600f6000610da7611549565b6001600160a01b0316815260208101919091526040016000205460ff16610e105760405162461bcd60e51b815260206004820152601b60248201527f4f6e6c79205061727479204d616e616765727320616c6c6f776564000000000060448201526064016104a0565b610e1c601a60006133ea565b60005b8151811015610ea7576000601a01828281518110610e3f57610e3f6140ce565b6020908102919091018101518254600180820185556000948552938390208251600290920201805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0390921691909117815591015191015580610e9f816140fa565b915050610e1f565b506040517fbcf216305ea85f0e4cd7b0e22ea97230701d805613be2d918e2744eae66d4abf90600090a150565b60106000610ee0611549565b6001600160a01b0316815260208101919091526040016000205460ff1615610f4a5760405162461bcd60e51b815260206004820152601e60248201527f4f6e6c79206e6f6e205061727479204d656d6265727320616c6c6f776564000060448201526064016104a0565b600e5460ff1615610f9d5760405162461bcd60e51b815260206004820152600f60248201527f506172747920697320636c6f736564000000000000000000000000000000000060448201526064016104a0565b600b5460ff1661101a576001600160a01b03841660009081526014602052604090205460ff16610ff9576040517f439b576e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001600160a01b0384166000908152601460205260409020805460ff191690555b61102384611902565b6001600160a01b0384166000908152601060205260408120805460ff191660011790558061105386868686611659565b600554604080516001600160a01b03808c16825290921660208301528101889052606081018390526080810182905291935091507f330a0c3830f9c19654cc3b5701caa3230ec175384311f49b6a927dcc4b32ef4a9060a001610c0f565b6060600060010180546103ac90613f01565b6060600060110180548060200260200160405190810160405280929190818152602001828054801561042557602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311611100575050505050905090565b6019546001600160a01b03166111b657336000908152600f602052604090205460ff166111965760405162461bcd60e51b815260206004820152601b60248201527f4f6e6c79205061727479204d616e616765727320616c6c6f776564000000000060448201526064016104a0565b6019805473ffffffffffffffffffffffffffffffffffffffff1916331790555b6019546001600160a01b031633146112105760405162461bcd60e51b815260206004820152601a60248201527f4f6e6c792050617274792043726561746f7220616c6c6f77656400000000000060448201526064016104a0565b6001600160a01b0382166000818152600f6020908152604091829020805460ff19168515159081179091558251938452908301527f68f31d2f89e90802575fed1ff4379c24f4beed9d0d055fcd1f1e5cf2da5f697c910160405180910390a15050565b600f600061127f611549565b6001600160a01b0316815260208101919091526040016000205460ff166112e85760405162461bcd60e51b815260206004820152601b60248201527f4f6e6c79205061727479204d616e616765727320616c6c6f776564000000000060448201526064016104a0565b60008060006112f78585611aba565b9250925092507fe14f465c1f5191875f1473bbf0f8cc3ff0158a220fa5711eff06ff04a83a1b48338660000151600081518110611336576113366140ce565b60200260200101518760400151600081518110611355576113556140ce565b6020026020010151868686604051610616969594939291906001600160a01b03968716815294861660208601529290941660408401526060830152608082019290925260a081019190915260c00190565b601060006113b2611549565b6001600160a01b0316815260208101919091526040016000205460ff1661141b5760405162461bcd60e51b815260206004820152601a60248201527f4f6e6c79205061727479204d656d6265727320616c6c6f77656400000000000060448201526064016104a0565b61142884338585856115a5565b60408051338152602081018690527f884edad9ce6fa2440d8a54cc123490eb96d2768479d49ff9c7366125a942436491015b60405180910390a150505050565b60106000611474611549565b6001600160a01b0316815260208101919091526040016000205460ff166114dd5760405162461bcd60e51b815260206004820152601a60248201527f4f6e6c79205061727479204d656d6265727320616c6c6f77656400000000000060448201526064016104a0565b33600081815260036020526040902054906114fc9082908686866115a5565b33600081815260106020908152604091829020805460ff19169055815192835282018390527f61a26f7c17d8780c095ccfa67e689a13ee4e06ddce3da18956369f4a396100e8910161145a565b600030330361159f57600080368080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152505050503601516001600160a01b031691506115a29050565b50335b90565b6001600160a01b0384166000908152600360205260408120548611156115f7576040517fcfed16bd00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60028101546116068688611d47565b8615611650578215611641576005820154601783015461163c91899184918a918a918a916001600160a01b039182169116611ed1565b611650565b6116508782888560110161221b565b50505050505050565b600c546000908190819086101561169c576040517f2923ca2700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600d810154158015906116b25750600d81015486115b156116e9576040517ff7e7ebfe00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6116f78682601501546125cd565b60058201549093506001600160a01b03166323b872dd8830611719878b614114565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e086901b1681526001600160a01b03938416600482015292909116602483015260448201526064016020604051808303816000875af1158015611785573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117a99190614127565b5060058101546117c39087906001600160a01b03166125ed565b5060178101546117e1908890879087906001600160a01b031661269a565b50600281015415806117f5575060e0850151155b1561189a578060050160009054906101000a90046001600160a01b03166001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa15801561184f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118739190614144565b61187e906012614161565b61188990600a61425e565b611893908761426d565b91506118ee565b60c0850151600282015460e0870151146118cf5760e086015160028301546118c2908361426d565b6118cc9190614284565b90505b808783600201546118e0919061426d565b6118ea9190614284565b9250505b6118f88783612a48565b5094509492505050565b6000805b601a820154811015611ab55760008083601a01838154811061192a5761192a6140ce565b60009182526020909120600290910201546040516001600160a01b0387811660248301529091169060440160408051601f198184030181529181526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff166370a0823160e01b1790525161199f91906142a6565b600060405180830381855afa9150503d80600081146119da576040519150601f19603f3d011682016040523d82523d6000602084013e6119df565b606091505b50915091508180156119f357506020815110155b15611a715783601a018381548110611a0d57611a0d6140ce565b90600052602060002090600202016001015481806020019051810190611a3391906142c2565b10611a3f575050611aa3565b6040517f8b5b5fe000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040517fb3afa80000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b80611aad816140fa565b915050611906565b505050565b600080808080865151909150600114611aff576040517f1115766700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6017810154611b1a9033906001600160a01b03168888612b2e565b611b50576040517f8baa579f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000611c148760000151600081518110611b6c57611b6c6140ce565b60200260200101518860200151600081518110611b8b57611b8b6140ce565b60200260200101518960400151600081518110611baa57611baa6140ce565b60200260200101518a60600151600081518110611bc957611bc96140ce565b60200260200101518b60800151600081518110611be857611be86140ce565b60200260200101518c60a00151600081518110611c0757611c076140ce565b6020026020010151612bdc565b90508060400151945080606001519350611c5081606001518860400151600081518110611c4357611c436140ce565b60200260200101516125ed565b9250611cd682601101805480602002602001604051908101604052809291908181526020018280548015611cad57602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311611c8f575b50505050508860400151600081518110611cc957611cc96140ce565b6020026020010151613026565b611d3e57816011018760400151600081518110611cf557611cf56140ce565b602090810291909101810151825460018101845560009384529190922001805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b039092169190911790555b50509250925092565b6001600160a01b038216611dc35760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f2061646472657360448201527f730000000000000000000000000000000000000000000000000000000000000060648201526084016104a0565b6001600160a01b03821660009081526003602052604081205482811015611e525760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e60448201527f636500000000000000000000000000000000000000000000000000000000000060648201526084016104a0565b6001600160a01b038416600090815260038301602052604081208483039055600283018054859290611e859084906142db565b90915550506040518381526000906001600160a01b038616907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a350505050565b6040805160018082528183019092526000916020808301908036833750506040805160018082528183019092529293506000929150602080830190803683375050604080516001808252818301909252929350600092915060208083019080368337019050506040516370a0823160e01b81523060048201529091506000906001600160a01b038716906370a0823190602401602060405180830381865afa158015611f81573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fa591906142c2565b905089611fb28c8361426d565b611fbc9190614284565b84600081518110611fcf57611fcf6140ce565b6020026020010181815250506000611fe98a8a8a8961269a565b905060005b81606001515181101561208257876001600160a01b03168260200151828151811061201b5761201b6140ce565b60200260200101516001600160a01b03160361207a5781606001518181518110612047576120476140ce565b602002602001015186600081518110612062576120626140ce565b602002602001018181516120769190614114565b9052505b600101611fee565b506120a785600081518110612099576120996140ce565b6020026020010151886125ed565b846000815181106120ba576120ba6140ce565b602002602001018181525050836000815181106120d9576120d96140ce565b6020026020010151856000815181106120f4576120f46140ce565b602002602001015161210691906142db565b83600081518110612119576121196140ce565b602002602001018181525050866001600160a01b031663a9059cbb8b85600081518110612148576121486140ce565b60200260200101516040518363ffffffff1660e01b81526004016121819291906001600160a01b03929092168252602082015260400190565b6020604051808303816000875af11580156121a0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121c49190614127565b507f70f5c7374ba9bde970383c50f09c6d1e944af4354c0a890bdec9bb753e3db3cc8a8d60018460000151898989604051612205979695949392919061431e565b60405180910390a1505050505050505050505050565b805460009067ffffffffffffffff811115612238576122386134d2565b604051908082528060200260200182016040528015612261578160200160208202803683370190505b50825490915060009067ffffffffffffffff811115612282576122826134d2565b6040519080825280602002602001820160405280156122ab578160200160208202803683370190505b50835490915060009067ffffffffffffffff8111156122cc576122cc6134d2565b6040519080825280602002602001820160405280156122f5578160200160208202803683370190505b50905060005b845481101561257f576000858281548110612318576123186140ce565b6000918252602090912001546040516370a0823160e01b81523060048201526001600160a01b03909116906370a0823190602401602060405180830381865afa158015612369573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061238d91906142c2565b90508761239a8a8361426d565b6123a49190614284565b8583815181106123b6576123b66140ce565b60200260200101818152505060008583815181106123d6576123d66140ce565b602002602001015111156125765761242d8583815181106123f9576123f96140ce565b6020026020010151878481548110612413576124136140ce565b6000918252602090912001546001600160a01b03166125ed565b84838151811061243f5761243f6140ce565b60200260200101818152505083828151811061245d5761245d6140ce565b6020026020010151858381518110612477576124776140ce565b602002602001015161248991906142db565b83838151811061249b5761249b6140ce565b6020026020010181815250508582815481106124b9576124b96140ce565b9060005260206000200160009054906101000a90046001600160a01b03166001600160a01b031663a9059cbb888585815181106124f8576124f86140ce565b60200260200101516040518363ffffffff1660e01b81526004016125319291906001600160a01b03929092168252602082015260400190565b6020604051808303816000875af1158015612550573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125749190614127565b505b506001016122fb565b507f70f5c7374ba9bde970383c50f09c6d1e944af4354c0a890bdec9bb753e3db3cc85886000878787876040516125bc9796959493929190614396565b60405180910390a150505050505050565b60006127106125dc838561426d565b6125e69190614284565b9392505050565b6000806125fe8482601501546125cd565b60168201546040517fa9059cbb0000000000000000000000000000000000000000000000000000000081526001600160a01b0391821660048201526024810183905291935084169063a9059cbb906044016020604051808303816000875af115801561266e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906126929190614127565b505092915050565b6126c56040518060800160405280606081526020016060815260200160608152602001606081525090565b6126d185838686612b2e565b612707576040517f8baa579f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b83515167ffffffffffffffff811115612722576127226134d2565b60405190808252806020026020018201604052801561274b578160200160208202803683370190505b50815283515167ffffffffffffffff811115612769576127696134d2565b604051908082528060200260200182016040528015612792578160200160208202803683370190505b50602082015283515167ffffffffffffffff8111156127b3576127b36134d2565b6040519080825280602002602001820160405280156127dc578160200160208202803683370190505b50604082015283515167ffffffffffffffff8111156127fd576127fd6134d2565b604051908082528060200260200182016040528015612826578160200160208202803683370190505b50606082015260005b8451518110156129ea5760006128ea86600001518381518110612854576128546140ce565b602002602001015187602001518481518110612872576128726140ce565b602002602001015188604001518581518110612890576128906140ce565b6020026020010151896060015186815181106128ae576128ae6140ce565b60200260200101518a6080015187815181106128cc576128cc6140ce565b60200260200101518b60a001518881518110611c0757611c076140ce565b905085600001518281518110612902576129026140ce565b602002602001015183600001518381518110612920576129206140ce565b60200260200101906001600160a01b031690816001600160a01b03168152505085604001518281518110612956576129566140ce565b602002602001015183602001518381518110612974576129746140ce565b60200260200101906001600160a01b031690816001600160a01b0316815250508060400151836040015183815181106129af576129af6140ce565b6020026020010181815250508060600151836060015183815181106129d6576129d66140ce565b60209081029190910101525060010161282f565b507fe87c83c4570e12ac007ab11a4cc9e913d616a09c361bb0384b8ccd88aaee53c98582600001518360200151846040015185606001518960c00151604051612a3896959493929190614422565b60405180910390a1949350505050565b6001600160a01b038216612a9e5760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f20616464726573730060448201526064016104a0565b600081816002016000828254612ab49190614114565b90915550506001600160a01b038316600090815260038201602052604081208054849290612ae3908490614114565b90915550506040518281526001600160a01b038416906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a3505050565b6000428361010001511015612b4557506000612bd4565b6000612ba2308786600001518760200151886040015189606001518a608001518b60c001518c60e001518d6101000151604051602001612b8e9a999897969594939291906144c0565b604051602081830303815290604052613083565b9050846001600160a01b0316612bc6828560400151866000015187602001516130e6565b6001600160a01b0316149150505b949350505050565b612c276040518060c0016040528060006001600160a01b0316815260200160006001600160a01b03168152602001600081526020016000815260200160008152602001600081525090565b6040517f095ea7b30000000000000000000000000000000000000000000000000000000081526001600160a01b0385811660048301526000602483015288169063095ea7b3906044016020604051808303816000875af1158015612c8f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612cb39190614127565b612ce9576040517f927c952600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040517f095ea7b30000000000000000000000000000000000000000000000000000000081526001600160a01b0385811660048301526024820188905288169063095ea7b3906044016020604051808303816000875af1158015612d51573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612d759190614127565b612dab576040517f9a4a113500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040516370a0823160e01b81523060048201526001600160a01b038816906370a0823190602401602060405180830381865afa158015612def573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612e1391906142c2565b60808201526040516370a0823160e01b81523060048201526001600160a01b038616906370a0823190602401602060405180830381865afa158015612e5c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612e8091906142c2565b60a08201526040516000906001600160a01b038516903490612ea39086906142a6565b60006040518083038185875af1925050503d8060008114612ee0576040519150601f19603f3d011682016040523d82523d6000602084013e612ee5565b606091505b5050905080612f20576040517f1f6f86f900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040516370a0823160e01b81523060048201526001600160a01b038916906370a0823190602401602060405180830381865afa158015612f64573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612f8891906142c2565b8260800151612f9791906142db565b60408381019190915260a083015190516370a0823160e01b81523060048201526001600160a01b038816906370a0823190602401602060405180830381865afa158015612fe8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061300c91906142c2565b61301691906142db565b6060830152509695505050505050565b6000805b835181101561307757838181518110613045576130456140ce565b60200260200101516001600160a01b0316836001600160a01b03160361306f57600191505061307d565b60010161302a565b50600090505b92915050565b600081805190602001206040516020016130c991907f19457468657265756d205369676e6564204d6573736167653a0a3332000000008152601c810191909152603c0190565b604051602081830303815290604052805190602001209050919050565b60008060006130f78787878761310e565b91509150613104816131fb565b5095945050505050565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a083111561314557506000905060036131f2565b8460ff16601b1415801561315d57508460ff16601c14155b1561316e57506000905060046131f2565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa1580156131c2573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b0381166131eb576000600192509250506131f2565b9150600090505b94509492505050565b600081600481111561320f5761320f614568565b036132175750565b600181600481111561322b5761322b614568565b036132785760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e6174757265000000000000000060448201526064016104a0565b600281600481111561328c5761328c614568565b036132d95760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e6774680060448201526064016104a0565b60038160048111156132ed576132ed614568565b036133605760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c60448201527f756500000000000000000000000000000000000000000000000000000000000060648201526084016104a0565b600481600481111561337457613374614568565b036133e75760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202776272076616c60448201527f756500000000000000000000000000000000000000000000000000000000000060648201526084016104a0565b50565b50805460008255600202906000526020600020908101906133e791905b8082111561343957805473ffffffffffffffffffffffffffffffffffffffff1916815560006001820155600201613407565b5090565b60005b83811015613458578181015183820152602001613440565b50506000910152565b6000815180845261347981602086016020860161343d565b601f01601f19169290920160200192915050565b6020815260006125e66020830184613461565b6001600160a01b03811681146133e757600080fd5b6000602082840312156134c757600080fd5b81356125e6816134a0565b634e487b7160e01b600052604160045260246000fd5b604051610120810167ffffffffffffffff8111828210171561350c5761350c6134d2565b60405290565b604051610100810167ffffffffffffffff8111828210171561350c5761350c6134d2565b6040805190810167ffffffffffffffff8111828210171561350c5761350c6134d2565b604051601f8201601f1916810167ffffffffffffffff81118282101715613582576135826134d2565b604052919050565b600067ffffffffffffffff8211156135a4576135a46134d2565b5060051b60200190565b600082601f8301126135bf57600080fd5b813560206135d46135cf8361358a565b613559565b82815260059290921b840181019181810190868411156135f357600080fd5b8286015b8481101561361757803561360a816134a0565b83529183019183016135f7565b509695505050505050565b600082601f83011261363357600080fd5b813560206136436135cf8361358a565b82815260059290921b8401810191818101908684111561366257600080fd5b8286015b848110156136175780358352918301918301613666565b600082601f83011261368e57600080fd5b8135602061369e6135cf8361358a565b82815260059290921b840181019181810190868411156136bd57600080fd5b8286015b848110156136175780356136d4816134a0565b83529183019183016136c1565b600067ffffffffffffffff8311156136fb576136fb6134d2565b61370e6020601f19601f86011601613559565b905082815283838301111561372257600080fd5b828260208301376000602084830101529392505050565b600082601f83011261374a57600080fd5b8135602061375a6135cf8361358a565b82815260059290921b8401810191818101908684111561377957600080fd5b8286015b8481101561361757803567ffffffffffffffff81111561379d5760008081fd5b8701603f810189136137af5760008081fd5b6137c08986830135604084016136e1565b84525091830191830161377d565b600061012082840312156137e157600080fd5b6137e96134e8565b9050813567ffffffffffffffff8082111561380357600080fd5b61380f858386016135ae565b8352602084013591508082111561382557600080fd5b61383185838601613622565b6020840152604084013591508082111561384a57600080fd5b613856858386016135ae565b6040840152606084013591508082111561386f57600080fd5b61387b858386016135ae565b6060840152608084013591508082111561389457600080fd5b6138a08583860161367d565b608084015260a08401359150808211156138b957600080fd5b506138c684828501613739565b60a08301525060c082013560c082015260e082013560e082015261010080830135818301525092915050565b60ff811681146133e757600080fd5b60006060828403121561391357600080fd5b6040516060810181811067ffffffffffffffff82111715613936576139366134d2565b80604052508091508235815260208301356020820152604083013561395a816138f2565b6040919091015292915050565b80151581146133e757600080fd5b803561398081613967565b919050565b60008060008060c0858703121561399b57600080fd5b84356139a6816134a0565b9350602085013567ffffffffffffffff8111156139c257600080fd5b6139ce878288016137ce565b9350506139de8660408701613901565b915060a08501356139ee81613967565b939692955090935050565b600082601f830112613a0a57600080fd5b6125e6838335602085016136e1565b600060208284031215613a2b57600080fd5b813567ffffffffffffffff80821115613a4357600080fd5b908301906101008286031215613a5857600080fd5b613a60613512565b823582811115613a6f57600080fd5b613a7b878286016139f9565b825250602083013582811115613a9057600080fd5b613a9c878286016139f9565b602083015250604083013582811115613ab457600080fd5b613ac0878286016139f9565b604083015250606083013582811115613ad857600080fd5b613ae4878286016139f9565b606083015250608083013582811115613afc57600080fd5b613b08878286016139f9565b608083015250613b1a60a08401613975565b60a082015260c083013560c082015260e083013560e082015280935050505092915050565b6020815260008251610100806020850152613b5e610120850183613461565b91506020850151601f1980868503016040870152613b7c8483613461565b93506040870151915080868503016060870152613b998483613461565b93506060870151915080868503016080870152613bb68483613461565b935060808701519150808685030160a087015250613bd48382613461565b92505060a0850151613bea60c086018215159052565b5060c085015160e085015260e085015181850152508091505092915050565b60008060008060c08587031215613c1f57600080fd5b8435613c2a816134a0565b935060208501359250604085013567ffffffffffffffff811115613c4d57600080fd5b613c59878288016137ce565b925050613c698660608701613901565b905092959194509250565b602080825282518282018190526000919060409081850190868401855b82811015613cbf57815180516001600160a01b03168552860151868501529284019290850190600101613c91565b5091979650505050505050565b60006020808385031215613cdf57600080fd5b823567ffffffffffffffff811115613cf657600080fd5b8301601f81018513613d0757600080fd5b8035613d156135cf8261358a565b81815260069190911b82018301908381019087831115613d3457600080fd5b928401925b82841015613d805760408489031215613d525760008081fd5b613d5a613536565b8435613d65816134a0565b81528486013586820152825260409093019290840190613d39565b979650505050505050565b600081518084526020808501945080840160005b83811015613dc45781516001600160a01b031687529582019590820190600101613d9f565b509495945050505050565b6020815260006125e66020830184613d8b565b60008060408385031215613df557600080fd5b8235613e00816134a0565b91506020830135613e1081613967565b809150509250929050565b60008060808385031215613e2e57600080fd5b823567ffffffffffffffff811115613e4557600080fd5b613e51858286016137ce565b925050613e618460208501613901565b90509250929050565b60008060008060c08587031215613e8057600080fd5b84359350602085013567ffffffffffffffff8111156139c257600080fd5b600080600060a08486031215613eb357600080fd5b833567ffffffffffffffff811115613eca57600080fd5b613ed6868287016137ce565b935050613ee68560208601613901565b91506080840135613ef681613967565b809150509250925092565b600181811c90821680613f1557607f821691505b602082108103613f3557634e487b7160e01b600052602260045260246000fd5b50919050565b601f821115611ab557600081815260208120601f850160051c81016020861015613f625750805b601f850160051c820191505b81811015613f8157828155600101613f6e565b505050505050565b815167ffffffffffffffff811115613fa357613fa36134d2565b613fb781613fb18454613f01565b84613f3b565b602080601f831160018114613fec5760008415613fd45750858301515b600019600386901b1c1916600185901b178555613f81565b600085815260208120601f198616915b8281101561401b57888601518255948401946001909101908401613ffc565b50858210156140395787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b600061010080835261405d8184018c613461565b90508281036020840152614071818b613461565b90508281036040840152614085818a613461565b905082810360608401526140998189613461565b905082810360808401526140ad8188613461565b95151560a0840152505060c081019290925260e09091015295945050505050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019820361410d5761410d6140e4565b5060010190565b8082018082111561307d5761307d6140e4565b60006020828403121561413957600080fd5b81516125e681613967565b60006020828403121561415657600080fd5b81516125e6816138f2565b60ff828116828216039081111561307d5761307d6140e4565b600181815b808511156141b557816000190482111561419b5761419b6140e4565b808516156141a857918102915b93841c939080029061417f565b509250929050565b6000826141cc5750600161307d565b816141d95750600061307d565b81600181146141ef57600281146141f957614215565b600191505061307d565b60ff84111561420a5761420a6140e4565b50506001821b61307d565b5060208310610133831016604e8410600b8410161715614238575081810a61307d565b614242838361417a565b8060001904821115614256576142566140e4565b029392505050565b60006125e660ff8416836141bd565b808202811582820484141761307d5761307d6140e4565b6000826142a157634e487b7160e01b600052601260045260246000fd5b500490565b600082516142b881846020870161343d565b9190910192915050565b6000602082840312156142d457600080fd5b5051919050565b8181038181111561307d5761307d6140e4565b600081518084526020808501945080840160005b83811015613dc457815187529582019590820190600101614302565b6001600160a01b0388168152866020820152851515604082015260e06060820152600061434e60e0830187613d8b565b828103608084015261436081876142ee565b905082810360a084015261437481866142ee565b905082810360c084015261438881856142ee565b9a9950505050505050505050565b600060e082016001600160a01b03808b16845260208a81860152891515604086015260e06060860152828954808552610100870191508a60005282600020945060005b818110156143f75785548516835260019586019592840192016143d9565b5050858103608087015261440b818a6142ee565b935050505082810360a084015261437481866142ee565b6001600160a01b038716815260c06020820152600061444460c0830188613d8b565b82810360408401526144568188613d8b565b9050828103606084015261446a81876142ee565b9050828103608084015261447e81866142ee565b9150508260a0830152979650505050505050565b80516000906020808401838315613dc45781516001600160a01b031687529582019590820190600101613d9f565b60007fffffffffffffffffffffffffffffffffffffffff000000000000000000000000808d60601b168352808c60601b16601484015250614504602883018b614492565b89516020808c0160005b8381101561452a5781518552938201939082019060010161450e565b505061454861454261453c858e614492565b8c614492565b8a614492565b978852870195909552505050604083015250606001979650505050505050565b634e487b7160e01b600052602160045260246000fdfea26469706673582212206af4fe9b7c4a9e835d7d22c8bacffcbe23280fff29abab7f519342d667dfbe7664736f6c63430008110033

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
Loading...
Loading
Loading...
Loading

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
[ Download: CSV Export  ]

A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.