ETH Price: $2,632.62 (+2.60%)

Contract

0x5ecf6DB89C6B597d40D5C7cEed50120a77fec383
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Token Holdings

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Transfer Ownersh...141836812022-02-11 8:29:06991 days ago1644568146IN
0x5ecf6DB8...a77fec383
0 ETH0.0012597143.83912991
Withdraw139397932022-01-04 15:31:171029 days ago1641310277IN
0x5ecf6DB8...a77fec383
0 ETH0.00640679103.21388049
Setup Vesting Re...138027182021-12-14 10:20:491050 days ago1639477249IN
0x5ecf6DB8...a77fec383
0 ETH0.0041738845
Setup Vesting Re...138027152021-12-14 10:20:051050 days ago1639477205IN
0x5ecf6DB8...a77fec383
0 ETH0.0041738845
Setup Vesting Re...138027152021-12-14 10:20:051050 days ago1639477205IN
0x5ecf6DB8...a77fec383
0 ETH0.0040473445
Withdraw137539202021-12-06 18:40:141058 days ago1638816014IN
0x5ecf6DB8...a77fec383
0 ETH0.0054251190.30867537
Withdraw134148142021-10-14 6:44:471111 days ago1634193887IN
0x5ecf6DB8...a77fec383
0 ETH0.0055963793.15951895
Withdraw133356742021-10-01 20:44:121124 days ago1633121052IN
0x5ecf6DB8...a77fec383
0 ETH0.00655853105.65843213
Withdraw133217812021-09-29 16:36:451126 days ago1632933405IN
0x5ecf6DB8...a77fec383
0 ETH0.01882565237.77868911
Withdraw132938322021-09-25 8:21:231130 days ago1632558083IN
0x5ecf6DB8...a77fec383
0 ETH0.0021399735.62283395
Withdraw132627652021-09-20 13:06:071135 days ago1632143167IN
0x5ecf6DB8...a77fec383
0 ETH0.00732945118.07798729
Claim Fund Raisi...132621872021-09-20 10:51:421135 days ago1632135102IN
0x5ecf6DB8...a77fec383
0 ETH0.0041144548.45719043
Claim Fund Raisi...132621872021-09-20 10:51:421135 days ago1632135102IN
0x5ecf6DB8...a77fec383
0 ETH0.0043470448.45719043
Claim Fund Raisi...132621872021-09-20 10:51:421135 days ago1632135102IN
0x5ecf6DB8...a77fec383
0 ETH0.0051756648.45719043
Setup Vesting Re...132621692021-09-20 10:47:241135 days ago1632134844IN
0x5ecf6DB8...a77fec383
0 ETH0.0136738770
Setup Vesting Re...132621642021-09-20 10:46:211135 days ago1632134781IN
0x5ecf6DB8...a77fec383
0 ETH0.0136738770
Setup Vesting Re...132621622021-09-20 10:45:331135 days ago1632134733IN
0x5ecf6DB8...a77fec383
0 ETH0.0148708770
Withdraw132368872021-09-16 12:56:521139 days ago1631797012IN
0x5ecf6DB8...a77fec383
0 ETH0.0030239150.33734099
Withdraw132236912021-09-14 11:50:141141 days ago1631620214IN
0x5ecf6DB8...a77fec383
0 ETH0.0023614738.04344597
Withdraw132236882021-09-14 11:49:461141 days ago1631620186IN
0x5ecf6DB8...a77fec383
0 ETH0.0022823436.7688023
Withdraw132236742021-09-14 11:47:451141 days ago1631620065IN
0x5ecf6DB8...a77fec383
0 ETH0.0024083738.79908067
Withdraw132236412021-09-14 11:41:091141 days ago1631619669IN
0x5ecf6DB8...a77fec383
0 ETH0.0013937244.54795972
Withdraw132236412021-09-14 11:41:091141 days ago1631619669IN
0x5ecf6DB8...a77fec383
0 ETH0.0027652244.54795972
Withdraw132207862021-09-14 1:10:401141 days ago1631581840IN
0x5ecf6DB8...a77fec383
0 ETH0.0038290161.68572883
Withdraw132181092021-09-13 15:18:081142 days ago1631546288IN
0x5ecf6DB8...a77fec383
0 ETH0.00651766105
View all transactions

Latest 1 internal transaction

Advanced mode:
Parent Transaction Hash Block From To
130324052021-08-15 22:11:461171 days ago1629065506
0x5ecf6DB8...a77fec383
 Contract Creation0 ETH
Loading...
Loading

Similar Match Source Code
This contract matches the deployed Bytecode of the Source Code for Contract 0x7aFBbDb9...fe9aED004
The constructor portion of the code might be different and could alter the actual behaviour of the contract

Contract Name:
LaunchPoolERC20FundRaisingNftLockedWithVesting

Compiler Version
v0.8.0+commit.c7dfd78e

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion
File 1 of 11 : LaunchPoolERC20FundRaisingNftLockedWithVesting.sol
// SPDX-License-Identifier: MIT

pragma solidity 0.8.0;

import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/token/ERC1155/IERC1155.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@openzeppelin/contracts/access/Ownable.sol";

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

/// @title Fund raising platform facilitated by launch pool
/// @author BlockRocket.tech
/// @dev Fork of MasterChef.sol from SushiSwap
/// @dev Only the owner can add new pools
contract LaunchPoolERC20FundRaisingNftLockedWithVesting is Ownable, ReentrancyGuard {
    using SafeMath for uint256;
    using SafeERC20 for IERC20;

    /// @dev Details about each user in a pool
    struct UserInfo {
        uint256 amount;     // How many tokens are staked in a pool
        uint256 pledgeFundingAmount; // Based on staked tokens, the funding that has come from the user (or not if they choose to pull out)
        uint256 rewardDebtRewards; // Reward debt. See explanation below.
        uint256 tokenAllocDebt;
        //
        // We do some fancy math here. Basically, once vesting has started in a pool (if they have deposited), the amount of reward tokens
        // entitled to a user but is pending to be distributed is:
        //
        //   pending reward = (user.amount * pool.accRewardPerShare) - user.rewardDebtRewards
        //
        // The amount can never change once the staking period has ended
    }

    /// @dev Info of each pool.
    struct PoolInfo {
        IERC20 rewardToken; // Address of the reward token contract.
        IERC20 fundRaisingToken; // Address of the fund raising token contract.
        uint256 tokenAllocationStartBlock; // Block when users stake counts towards earning reward token allocation
        uint256 stakingEndBlock; // Before this block, staking is permitted
        uint256 pledgeFundingEndBlock; // Between stakingEndBlock and this number pledge funding is permitted
        uint256 targetRaise; // Amount that the project wishes to raise
        uint256 maxStakingAmountPerUser; // Max. amount of tokens that can be staked per account/user
        uint256[] whitelistTokenIds; // List of whitelisted nft token ids that users must hold to be able to stake
    }

    /// @dev staking token is fixed for all pools
    IERC20 public stakingToken;

    /// @dev nft token contract for all pools
    IERC1155 public nftToken;

    /// @dev Container for holding all rewards
    FundRaisingGuild public rewardGuildBank;

    /// @dev List of pools that users can stake into
    PoolInfo[] public poolInfo;

    // Pool to accumulated share counters
    mapping(uint256 => uint256) public poolIdToAccPercentagePerShare;
    mapping(uint256 => uint256) public poolIdToLastPercentageAllocBlock;

    // Number of reward tokens distributed per block for this pool
    mapping(uint256 => uint256) public poolIdToRewardPerBlock;

    // Last block number that reward token distribution took place
    mapping(uint256 => uint256) public poolIdToLastRewardBlock;

    // Block number when rewards start
    mapping(uint256 => uint256) public poolIdToRewardStartBlock;

    // Block number when cliff ends
    mapping(uint256 => uint256) public poolIdToRewardCliffEndBlock;

    // Block number when rewards end
    mapping(uint256 => uint256) public poolIdToRewardEndBlock;

    // Per LPOOL token staked, how much reward token earned in pool that users will get
    mapping(uint256 => uint256) public poolIdToAccRewardPerShareVesting;

    // Total rewards being distributed up to rewardEndBlock
    mapping(uint256 => uint256) public poolIdToMaxRewardTokensAvailableForVesting;

    // Total amount staked into the pool
    mapping(uint256 => uint256) public poolIdToTotalStaked;

    // Total amount of funding received by stakers after stakingEndBlock and before pledgeFundingEndBlock
    mapping(uint256 => uint256) public poolIdToTotalRaised;

    // For every staker that funded their pledge, the sum of all of their allocated percentages
    mapping(uint256 => uint256) public poolIdToTotalFundedPercentageOfTargetRaise;

    // True when funds have been claimed
    mapping(uint256 => bool) public poolIdToFundsClaimed;

    /// @dev Per pool, info of each user that stakes ERC20 tokens.
    /// @dev Pool ID => User Address => User Info
    mapping(uint256 => mapping(address => UserInfo)) public userInfo;

    // Available before staking ends for any given project. Essentitally 100% to 18 dp
    uint256 public constant TOTAL_TOKEN_ALLOCATION_POINTS = (100 * (10 ** 18));

    event ContractDeployed(address indexed guildBank);
    event PoolAdded(uint256 indexed pid);
    event Pledge(address indexed user, uint256 indexed pid, uint256 amount);
    event PledgeFunded(address indexed user, uint256 indexed pid, uint256 amount);
    event RewardsSetUp(uint256 indexed pid, uint256 amount, uint256 rewardEndBlock);
    event RewardClaimed(address indexed user, uint256 indexed pid, uint256 amount);
    event Withdraw(address indexed user, uint256 indexed pid, uint256 amount);
    event FundRaisingClaimed(uint256 indexed pid, address indexed recipient, uint256 amount);

    /// @param _stakingToken Address of the staking token for all pools
    constructor(IERC20 _stakingToken, IERC1155 _nftToken) public {
        require(address(_stakingToken) != address(0), "constructor: _stakingToken must not be zero address");
        require(address(_nftToken) != address(0), "constructor: _nftToken must not be zero address");

        stakingToken = _stakingToken;
        nftToken = _nftToken;
        rewardGuildBank = new FundRaisingGuild(address(this));

        emit ContractDeployed(address(rewardGuildBank));
    }

    /// @dev Returns the number of pools that have been added by the owner
    /// @return Number of pools
    function numberOfPools() external view returns (uint256) {
        return poolInfo.length;
    }

    /// @dev Can only be called by the contract owner
    function add(
        IERC20 _rewardToken,
        IERC20 _fundRaisingToken,
        uint256 _tokenAllocationStartBlock,
        uint256 _stakingEndBlock,
        uint256 _pledgeFundingEndBlock,
        uint256 _targetRaise,
        uint256 _maxStakingAmountPerUser,
        bool _withUpdate,
        uint256[] memory _whitelistTokenIds
    ) public onlyOwner {
        address rewardTokenAddress = address(_rewardToken);
        require(rewardTokenAddress != address(0), "add: _rewardToken is zero address");
        address fundRaisingTokenAddress = address(_fundRaisingToken);
        require(fundRaisingTokenAddress != address(0), "add: _fundRaisingToken is zero address");
        require(_tokenAllocationStartBlock < _stakingEndBlock, "add: _tokenAllocationStartBlock must be before staking end");
        require(_stakingEndBlock < _pledgeFundingEndBlock, "add: staking end must be before funding end");
        require(_targetRaise > 0, "add: Invalid raise amount");

        if (_withUpdate) {
            massUpdatePools();
        }

        poolInfo.push(PoolInfo({
            rewardToken : _rewardToken,
            fundRaisingToken : _fundRaisingToken,
            tokenAllocationStartBlock: _tokenAllocationStartBlock,
            stakingEndBlock: _stakingEndBlock,
            pledgeFundingEndBlock: _pledgeFundingEndBlock,
            targetRaise: _targetRaise,
            maxStakingAmountPerUser: _maxStakingAmountPerUser,
            whitelistTokenIds:_whitelistTokenIds
        }));

        poolIdToLastPercentageAllocBlock[poolInfo.length.sub(1)] = _tokenAllocationStartBlock;

        emit PoolAdded(poolInfo.length.sub(1));
    }

    // step 1
    function pledge(uint256 _pid, uint256 _amount) external nonReentrant {
        require(_pid < poolInfo.length, "pledge: Invalid PID");

        PoolInfo storage pool = poolInfo[_pid];
        UserInfo storage user = userInfo[_pid][msg.sender];

        require(_amount > 0, "pledge: No pledge specified");
        require(block.number <= pool.stakingEndBlock, "pledge: Staking no longer permitted");
        if(pool.whitelistTokenIds.length > 0) {
            // loop through the list and check users balance of those NFTs
            bool holdsNft = false;
            for (uint256 i = 0; i < pool.whitelistTokenIds.length; ++i) {
                if(nftToken.balanceOf(msg.sender, pool.whitelistTokenIds[i]) > 0) {
                    holdsNft = true;
                    break;
                }
            }
            // add require that they have one in their balance
            require(holdsNft, "pledge: user does not hold required NFT to participate");
        }

        require(user.amount.add(_amount) <= pool.maxStakingAmountPerUser, "pledge: can not exceed max staking amount per user");

        updatePool(_pid);

        user.amount = user.amount.add(_amount);
        user.tokenAllocDebt = user.tokenAllocDebt.add(_amount.mul(poolIdToAccPercentagePerShare[_pid]).div(1e18));

        poolIdToTotalStaked[_pid] = poolIdToTotalStaked[_pid].add(_amount);

        stakingToken.safeTransferFrom(address(msg.sender), address(this), _amount);

        emit Pledge(msg.sender, _pid, _amount);
    }

    function getPledgeFundingAmount(uint256 _pid) public view returns (uint256) {
        require(_pid < poolInfo.length, "getPledgeFundingAmount: Invalid PID");
        PoolInfo memory pool = poolInfo[_pid];
        UserInfo memory user = userInfo[_pid][msg.sender];

        (uint256 accPercentPerShare,) = getAccPercentagePerShareAndLastAllocBlock(_pid);

        uint256 userPercentageAllocated = user.amount.mul(accPercentPerShare).div(1e18).sub(user.tokenAllocDebt);
        return userPercentageAllocated.mul(pool.targetRaise).div(TOTAL_TOKEN_ALLOCATION_POINTS);
    }

    // step 2
    function fundPledge(uint256 _pid) external nonReentrant {
        require(_pid < poolInfo.length, "fundPledge: Invalid PID");

        updatePool(_pid);

        PoolInfo storage pool = poolInfo[_pid];
        UserInfo storage user = userInfo[_pid][msg.sender];

        require(user.pledgeFundingAmount == 0, "fundPledge: Pledge has already been funded");
        if(pool.whitelistTokenIds.length > 0) {
            // loop through the list and check users balance of those NFTs
            bool holdsNft = false;
            for (uint256 i = 0; i < pool.whitelistTokenIds.length; ++i) {
                if(nftToken.balanceOf(msg.sender, pool.whitelistTokenIds[i]) > 0) {
                    holdsNft = true;
                    break;
                }
            }
            // add require that they have one in their balance
            require(holdsNft, "fundPledge: user does not hold required NFT to participate");
        }
        require(block.number > pool.stakingEndBlock, "fundPledge: Staking is still taking place");
        require(block.number <= pool.pledgeFundingEndBlock, "fundPledge: Deadline has passed to fund your pledge");

        require(user.amount > 0, "fundPledge: Must have staked");
        uint256 pledgeFundingAmount = getPledgeFundingAmount(_pid);
        require(pledgeFundingAmount > 0, "fundPledge: must have positive pledge amount");

        // this will fail if the sender does not have the right amount of the token
        pool.fundRaisingToken.safeTransferFrom(msg.sender, address(this), pledgeFundingAmount);
        
        poolIdToTotalRaised[_pid] = poolIdToTotalRaised[_pid].add(pledgeFundingAmount);

        (uint256 accPercentPerShare,) = getAccPercentagePerShareAndLastAllocBlock(_pid);
        uint256 userPercentageAllocated = user.amount.mul(accPercentPerShare).div(1e18).sub(user.tokenAllocDebt);
        poolIdToTotalFundedPercentageOfTargetRaise[_pid] = poolIdToTotalFundedPercentageOfTargetRaise[_pid].add(userPercentageAllocated);

        user.pledgeFundingAmount = pledgeFundingAmount; // ensures pledges can only be done once

        stakingToken.safeTransfer(address(msg.sender), user.amount);

        emit PledgeFunded(msg.sender, _pid, pledgeFundingAmount);
    }

    // pre-step 3 for project
    function getTotalRaisedVsTarget(uint256 _pid) external view returns (uint256 raised, uint256 target) {
        return (poolIdToTotalRaised[_pid], poolInfo[_pid].targetRaise);
    }

    // step 3
    function setupVestingRewards(uint256 _pid, uint256 _rewardAmount,  uint256 _rewardStartBlock, uint256 _rewardCliffEndBlock, uint256 _rewardEndBlock)
    external nonReentrant onlyOwner {
        require(_pid < poolInfo.length, "setupVestingRewards: Invalid PID");
        require(_rewardStartBlock > block.number, "setupVestingRewards: start block in the past");
        require(_rewardCliffEndBlock >= _rewardStartBlock, "setupVestingRewards: Cliff must be after or equal to start block");
        require(_rewardEndBlock > _rewardCliffEndBlock, "setupVestingRewards: end block must be after cliff block");

        PoolInfo storage pool = poolInfo[_pid];

        require(block.number > pool.pledgeFundingEndBlock, "setupVestingRewards: Stakers are still pledging");

        uint256 vestingLength = _rewardEndBlock.sub(_rewardStartBlock);

        poolIdToMaxRewardTokensAvailableForVesting[_pid] = _rewardAmount;
        poolIdToRewardPerBlock[_pid] = _rewardAmount.div(vestingLength);

        poolIdToRewardStartBlock[_pid] = _rewardStartBlock;
        poolIdToLastRewardBlock[_pid] = _rewardStartBlock;

        poolIdToRewardCliffEndBlock[_pid] = _rewardCliffEndBlock;

        poolIdToRewardEndBlock[_pid] = _rewardEndBlock;

        pool.rewardToken.safeTransferFrom(msg.sender, address(rewardGuildBank), _rewardAmount);

        emit RewardsSetUp(_pid, _rewardAmount, _rewardEndBlock);
    }

    function pendingRewards(uint256 _pid, address _user) external view returns (uint256) {
        require(_pid < poolInfo.length, "pendingRewards: invalid _pid");

        UserInfo memory user = userInfo[_pid][_user];

        // If they have staked but have not funded their pledge, they are not entitled to rewards
        if (user.pledgeFundingAmount == 0) {
            return 0;
        }

        uint256 accRewardPerShare = poolIdToAccRewardPerShareVesting[_pid];
        uint256 rewardEndBlock = poolIdToRewardEndBlock[_pid];
        uint256 lastRewardBlock = poolIdToLastRewardBlock[_pid];
        uint256 rewardPerBlock = poolIdToRewardPerBlock[_pid];
        if (block.number > lastRewardBlock && rewardEndBlock != 0 && poolIdToTotalStaked[_pid] != 0) {
            uint256 maxEndBlock = block.number <= rewardEndBlock ? block.number : rewardEndBlock;
            uint256 multiplier = getMultiplier(lastRewardBlock, maxEndBlock);
            uint256 reward = multiplier.mul(rewardPerBlock);
            accRewardPerShare = accRewardPerShare.add(reward.mul(1e18).div(poolIdToTotalFundedPercentageOfTargetRaise[_pid]));
        }

        (uint256 accPercentPerShare,) = getAccPercentagePerShareAndLastAllocBlock(_pid);
        uint256 userPercentageAllocated = user.amount.mul(accPercentPerShare).div(1e18).sub(user.tokenAllocDebt);
        return userPercentageAllocated.mul(accRewardPerShare).div(1e18).sub(user.rewardDebtRewards);
    }

    function massUpdatePools() public {
        for (uint256 pid = 0; pid < poolInfo.length; pid++) {
            updatePool(pid);
        }
    }

    function updatePool(uint256 _pid) public {
        require(_pid < poolInfo.length, "updatePool: invalid _pid");

        PoolInfo storage poolInfo = poolInfo[_pid];

        // staking not started
        if (block.number < poolInfo.tokenAllocationStartBlock) {
            return;
        }

        // if no one staked, nothing to do
        if (poolIdToTotalStaked[_pid] == 0) {
            poolIdToLastPercentageAllocBlock[_pid] = block.number;
            return;
        }

        // token allocation not finished
        uint256 maxEndBlockForPercentAlloc = block.number <= poolInfo.stakingEndBlock ? block.number : poolInfo.stakingEndBlock;
        uint256 blocksSinceLastPercentAlloc = getMultiplier(poolIdToLastPercentageAllocBlock[_pid], maxEndBlockForPercentAlloc);

        if (poolIdToRewardEndBlock[_pid] == 0 && blocksSinceLastPercentAlloc > 0) {
            (uint256 accPercentPerShare, uint256 lastAllocBlock) = getAccPercentagePerShareAndLastAllocBlock(_pid);
            poolIdToAccPercentagePerShare[_pid] = accPercentPerShare;
            poolIdToLastPercentageAllocBlock[_pid] = lastAllocBlock;
        }

        // project has not sent rewards
        if (poolIdToRewardEndBlock[_pid] == 0) {
            return;
        }

        // cliff has not passed for pool
        if (block.number < poolIdToRewardCliffEndBlock[_pid]) {
            return;
        }

        uint256 rewardEndBlock = poolIdToRewardEndBlock[_pid];
        uint256 lastRewardBlock = poolIdToLastRewardBlock[_pid];
        uint256 maxEndBlock = block.number <= rewardEndBlock ? block.number : rewardEndBlock;
        uint256 multiplier = getMultiplier(lastRewardBlock, maxEndBlock);

        // No point in doing any more logic as the rewards have ended
        if (multiplier == 0) {
            return;
        }

        uint256 rewardPerBlock = poolIdToRewardPerBlock[_pid];
        uint256 reward = multiplier.mul(rewardPerBlock);

        poolIdToAccRewardPerShareVesting[_pid] = poolIdToAccRewardPerShareVesting[_pid].add(reward.mul(1e18).div(poolIdToTotalFundedPercentageOfTargetRaise[_pid]));
        poolIdToLastRewardBlock[_pid] = maxEndBlock;
    }

    function getAccPercentagePerShareAndLastAllocBlock(uint256 _pid) internal view returns (uint256 accPercentPerShare, uint256 lastAllocBlock) {
        PoolInfo memory poolInfo = poolInfo[_pid];
        uint256 tokenAllocationPeriodInBlocks = poolInfo.stakingEndBlock.sub(poolInfo.tokenAllocationStartBlock);

        uint256 allocationAvailablePerBlock = TOTAL_TOKEN_ALLOCATION_POINTS.div(tokenAllocationPeriodInBlocks);

        uint256 maxEndBlockForPercentAlloc = block.number <= poolInfo.stakingEndBlock ? block.number : poolInfo.stakingEndBlock;
        uint256 multiplier = getMultiplier(poolIdToLastPercentageAllocBlock[_pid], maxEndBlockForPercentAlloc);
        uint256 totalPercentageUnlocked = multiplier.mul(allocationAvailablePerBlock);

        return (
            poolIdToAccPercentagePerShare[_pid].add(totalPercentageUnlocked.mul(1e18).div(poolIdToTotalStaked[_pid])),
            maxEndBlockForPercentAlloc
        );
    }

    function claimReward(uint256 _pid) public nonReentrant {
        updatePool(_pid);

        require(block.number >= poolIdToRewardCliffEndBlock[_pid], "claimReward: Not past cliff");

        UserInfo storage user = userInfo[_pid][msg.sender];
        require(user.pledgeFundingAmount > 0, "claimReward: Nice try pal");

        PoolInfo storage pool = poolInfo[_pid];

        uint256 accRewardPerShare = poolIdToAccRewardPerShareVesting[_pid];

        (uint256 accPercentPerShare,) = getAccPercentagePerShareAndLastAllocBlock(_pid);
        uint256 userPercentageAllocated = user.amount.mul(accPercentPerShare).div(1e18).sub(user.tokenAllocDebt);
        uint256 pending = userPercentageAllocated.mul(accRewardPerShare).div(1e18).sub(user.rewardDebtRewards);

        if (pending > 0) {
            user.rewardDebtRewards = userPercentageAllocated.mul(accRewardPerShare).div(1e18);
            safeRewardTransfer(pool.rewardToken, msg.sender, pending);

            emit RewardClaimed(msg.sender, _pid, pending);
        }
    }

    // withdraw only permitted post `pledgeFundingEndBlock` and you can only take out full amount if you did not fund the pledge
    // functions like the old emergency withdraw as it does not concern itself with claiming rewards
    function withdraw(uint256 _pid) external nonReentrant {
        require(_pid < poolInfo.length, "withdraw: invalid _pid");

        PoolInfo storage pool = poolInfo[_pid];
        UserInfo storage user = userInfo[_pid][msg.sender];

        require(user.amount > 0, "withdraw: No stake to withdraw");
        require(user.pledgeFundingAmount == 0, "withdraw: Only allow non-funders to withdraw");
        require(block.number > pool.pledgeFundingEndBlock, "withdraw: Not yet permitted");

        uint256 withdrawAmount = user.amount;

        // remove the record for this user
        delete userInfo[_pid][msg.sender];

        stakingToken.safeTransfer(msg.sender, withdrawAmount);

        emit Withdraw(msg.sender, _pid, withdrawAmount);
    }

    function claimFundRaising(uint256 _pid) external nonReentrant onlyOwner {
        require(_pid < poolInfo.length, "claimFundRaising: invalid _pid");
        PoolInfo storage pool = poolInfo[_pid];

        uint256 rewardPerBlock = poolIdToRewardPerBlock[_pid];
        require(rewardPerBlock != 0, "claimFundRaising: rewards not yet sent");
        require(poolIdToFundsClaimed[_pid] == false, "claimFundRaising: Already claimed funds");

        poolIdToFundsClaimed[_pid] = true;
        // this will fail if the sender does not have the right amount of the token
        pool.fundRaisingToken.transfer(owner(), poolIdToTotalRaised[_pid]);

        emit FundRaisingClaimed(_pid, owner(), poolIdToTotalRaised[_pid]);
    }

    /// @dev Can only be called by the contract owner
    function updateNftTokenAddress(IERC1155 _nftToken) public onlyOwner {
        require(address(_nftToken) != address(0), "constructor: _nftToken must not be zero address");
        nftToken = _nftToken;
    }

    function poolIdToAllowedTokenIds(uint256 _pid) public view returns (uint256[] memory) {
        require(_pid < poolInfo.length, "poolIdToAllowedTokenIds: invalid _pid");
        return poolInfo[_pid].whitelistTokenIds;
    }

    ////////////
    // Private /
    ////////////

    /// @dev Safe reward transfer function, just in case if rounding error causes pool to not have enough rewards.

    function safeRewardTransfer(IERC20 _rewardToken, address _to, uint256 _amount) private {
        uint256 bal = rewardGuildBank.tokenBalance(_rewardToken);
        if (_amount > bal) {
            rewardGuildBank.withdrawTo(_rewardToken, _to, bal);
        } else {
            rewardGuildBank.withdrawTo(_rewardToken, _to, _amount);
        }
    }

    /// @dev Return reward multiplier over the given _from to _to block.
    /// @param _from Block number
    /// @param _to Block number
    /// @return Number of blocks that have passed
    function getMultiplier(uint256 _from, uint256 _to) private view returns (uint256) {
        return _to.sub(_from);
    }
}

File 2 of 11 : IERC20.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @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 `recipient`.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transfer(address recipient, 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 `sender` to `recipient` 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 sender,
        address recipient,
        uint256 amount
    ) external returns (bool);

    /**
     * @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);
}

File 3 of 11 : SafeERC20.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "../IERC20.sol";
import "../../../utils/Address.sol";

/**
 * @title SafeERC20
 * @dev Wrappers around ERC20 operations that throw on failure (when the token
 * contract returns false). Tokens that return no value (and instead revert or
 * throw on failure) are also supported, non-reverting calls are assumed to be
 * successful.
 * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
 * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
 */
library SafeERC20 {
    using Address for address;

    function safeTransfer(
        IERC20 token,
        address to,
        uint256 value
    ) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
    }

    function safeTransferFrom(
        IERC20 token,
        address from,
        address to,
        uint256 value
    ) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
    }

    /**
     * @dev Deprecated. This function has issues similar to the ones found in
     * {IERC20-approve}, and its usage is discouraged.
     *
     * Whenever possible, use {safeIncreaseAllowance} and
     * {safeDecreaseAllowance} instead.
     */
    function safeApprove(
        IERC20 token,
        address spender,
        uint256 value
    ) internal {
        // safeApprove should only be called when setting an initial allowance,
        // or when resetting it to zero. To increase and decrease it, use
        // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
        require(
            (value == 0) || (token.allowance(address(this), spender) == 0),
            "SafeERC20: approve from non-zero to non-zero allowance"
        );
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
    }

    function safeIncreaseAllowance(
        IERC20 token,
        address spender,
        uint256 value
    ) internal {
        uint256 newAllowance = token.allowance(address(this), spender) + value;
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
    }

    function safeDecreaseAllowance(
        IERC20 token,
        address spender,
        uint256 value
    ) internal {
        unchecked {
            uint256 oldAllowance = token.allowance(address(this), spender);
            require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
            uint256 newAllowance = oldAllowance - value;
            _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
        }
    }

    /**
     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
     * on the return value: the return value is optional (but if data is returned, it must not be false).
     * @param token The token targeted by the call.
     * @param data The call data (encoded using abi.encode or one of its variants).
     */
    function _callOptionalReturn(IERC20 token, bytes memory data) private {
        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
        // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that
        // the target address contains contract code and also asserts for success in the low-level call.

        bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
        if (returndata.length > 0) {
            // Return data is optional
            require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
        }
    }
}

File 4 of 11 : IERC1155.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "../../utils/introspection/IERC165.sol";

/**
 * @dev Required interface of an ERC1155 compliant contract, as defined in the
 * https://eips.ethereum.org/EIPS/eip-1155[EIP].
 *
 * _Available since v3.1._
 */
interface IERC1155 is IERC165 {
    /**
     * @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`.
     */
    event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);

    /**
     * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all
     * transfers.
     */
    event TransferBatch(
        address indexed operator,
        address indexed from,
        address indexed to,
        uint256[] ids,
        uint256[] values
    );

    /**
     * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to
     * `approved`.
     */
    event ApprovalForAll(address indexed account, address indexed operator, bool approved);

    /**
     * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.
     *
     * If an {URI} event was emitted for `id`, the standard
     * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value
     * returned by {IERC1155MetadataURI-uri}.
     */
    event URI(string value, uint256 indexed id);

    /**
     * @dev Returns the amount of tokens of token type `id` owned by `account`.
     *
     * Requirements:
     *
     * - `account` cannot be the zero address.
     */
    function balanceOf(address account, uint256 id) external view returns (uint256);

    /**
     * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.
     *
     * Requirements:
     *
     * - `accounts` and `ids` must have the same length.
     */
    function balanceOfBatch(address[] calldata accounts, uint256[] calldata ids)
        external
        view
        returns (uint256[] memory);

    /**
     * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,
     *
     * Emits an {ApprovalForAll} event.
     *
     * Requirements:
     *
     * - `operator` cannot be the caller.
     */
    function setApprovalForAll(address operator, bool approved) external;

    /**
     * @dev Returns true if `operator` is approved to transfer ``account``'s tokens.
     *
     * See {setApprovalForAll}.
     */
    function isApprovedForAll(address account, address operator) external view returns (bool);

    /**
     * @dev Transfers `amount` tokens of token type `id` from `from` to `to`.
     *
     * Emits a {TransferSingle} event.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - If the caller is not `from`, it must be have been approved to spend ``from``'s tokens via {setApprovalForAll}.
     * - `from` must have a balance of tokens of type `id` of at least `amount`.
     * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the
     * acceptance magic value.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 id,
        uint256 amount,
        bytes calldata data
    ) external;

    /**
     * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.
     *
     * Emits a {TransferBatch} event.
     *
     * Requirements:
     *
     * - `ids` and `amounts` must have the same length.
     * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the
     * acceptance magic value.
     */
    function safeBatchTransferFrom(
        address from,
        address to,
        uint256[] calldata ids,
        uint256[] calldata amounts,
        bytes calldata data
    ) external;
}

File 5 of 11 : ReentrancyGuard.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @dev Contract module that helps prevent reentrant calls to a function.
 *
 * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
 * available, which can be applied to functions to make sure there are no nested
 * (reentrant) calls to them.
 *
 * Note that because there is a single `nonReentrant` guard, functions marked as
 * `nonReentrant` may not call one another. This can be worked around by making
 * those functions `private`, and then adding `external` `nonReentrant` entry
 * points to them.
 *
 * TIP: If you would like to learn more about reentrancy and alternative ways
 * to protect against it, check out our blog post
 * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
 */
abstract contract ReentrancyGuard {
    // Booleans are more expensive than uint256 or any type that takes up a full
    // word because each write operation emits an extra SLOAD to first read the
    // slot's contents, replace the bits taken up by the boolean, and then write
    // back. This is the compiler's defense against contract upgrades and
    // pointer aliasing, and it cannot be disabled.

    // The values being non-zero value makes deployment a bit more expensive,
    // but in exchange the refund on every call to nonReentrant will be lower in
    // amount. Since refunds are capped to a percentage of the total
    // transaction's gas, it is best to keep them low in cases like this one, to
    // increase the likelihood of the full refund coming into effect.
    uint256 private constant _NOT_ENTERED = 1;
    uint256 private constant _ENTERED = 2;

    uint256 private _status;

    constructor() {
        _status = _NOT_ENTERED;
    }

    /**
     * @dev Prevents a contract from calling itself, directly or indirectly.
     * Calling a `nonReentrant` function from another `nonReentrant`
     * function is not supported. It is possible to prevent this from happening
     * by making the `nonReentrant` function external, and make it call a
     * `private` function that does the actual work.
     */
    modifier nonReentrant() {
        // On the first call to nonReentrant, _notEntered will be true
        require(_status != _ENTERED, "ReentrancyGuard: reentrant call");

        // Any calls to nonReentrant after this point will fail
        _status = _ENTERED;

        _;

        // By storing the original value once again, a refund is triggered (see
        // https://eips.ethereum.org/EIPS/eip-2200)
        _status = _NOT_ENTERED;
    }
}

File 6 of 11 : SafeMath.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

// CAUTION
// This version of SafeMath should only be used with Solidity 0.8 or later,
// because it relies on the compiler's built in overflow checks.

/**
 * @dev Wrappers over Solidity's arithmetic operations.
 *
 * NOTE: `SafeMath` is no longer needed starting with Solidity 0.8. The compiler
 * now has built in overflow checking.
 */
library SafeMath {
    /**
     * @dev Returns the addition of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            uint256 c = a + b;
            if (c < a) return (false, 0);
            return (true, c);
        }
    }

    /**
     * @dev Returns the substraction of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            if (b > a) return (false, 0);
            return (true, a - b);
        }
    }

    /**
     * @dev Returns the multiplication of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            // Gas optimization: this is cheaper than requiring 'a' not being zero, but the
            // benefit is lost if 'b' is also tested.
            // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
            if (a == 0) return (true, 0);
            uint256 c = a * b;
            if (c / a != b) return (false, 0);
            return (true, c);
        }
    }

    /**
     * @dev Returns the division of two unsigned integers, with a division by zero flag.
     *
     * _Available since v3.4._
     */
    function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            if (b == 0) return (false, 0);
            return (true, a / b);
        }
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
     *
     * _Available since v3.4._
     */
    function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            if (b == 0) return (false, 0);
            return (true, a % b);
        }
    }

    /**
     * @dev Returns the addition of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `+` operator.
     *
     * Requirements:
     *
     * - Addition cannot overflow.
     */
    function add(uint256 a, uint256 b) internal pure returns (uint256) {
        return a + b;
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting on
     * overflow (when the result is negative).
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     *
     * - Subtraction cannot overflow.
     */
    function sub(uint256 a, uint256 b) internal pure returns (uint256) {
        return a - b;
    }

    /**
     * @dev Returns the multiplication of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `*` operator.
     *
     * Requirements:
     *
     * - Multiplication cannot overflow.
     */
    function mul(uint256 a, uint256 b) internal pure returns (uint256) {
        return a * b;
    }

    /**
     * @dev Returns the integer division of two unsigned integers, reverting on
     * division by zero. The result is rounded towards zero.
     *
     * Counterpart to Solidity's `/` operator.
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function div(uint256 a, uint256 b) internal pure returns (uint256) {
        return a / b;
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * reverting when dividing by zero.
     *
     * Counterpart to Solidity's `%` operator. This function uses a `revert`
     * opcode (which leaves remaining gas untouched) while Solidity uses an
     * invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function mod(uint256 a, uint256 b) internal pure returns (uint256) {
        return a % b;
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting with custom message on
     * overflow (when the result is negative).
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {trySub}.
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     *
     * - Subtraction cannot overflow.
     */
    function sub(
        uint256 a,
        uint256 b,
        string memory errorMessage
    ) internal pure returns (uint256) {
        unchecked {
            require(b <= a, errorMessage);
            return a - b;
        }
    }

    /**
     * @dev Returns the integer division of two unsigned integers, reverting with custom message on
     * division by zero. The result is rounded towards zero.
     *
     * Counterpart to Solidity's `/` operator. Note: this function uses a
     * `revert` opcode (which leaves remaining gas untouched) while Solidity
     * uses an invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function div(
        uint256 a,
        uint256 b,
        string memory errorMessage
    ) internal pure returns (uint256) {
        unchecked {
            require(b > 0, errorMessage);
            return a / b;
        }
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * reverting with custom message when dividing by zero.
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {tryMod}.
     *
     * Counterpart to Solidity's `%` operator. This function uses a `revert`
     * opcode (which leaves remaining gas untouched) while Solidity uses an
     * invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function mod(
        uint256 a,
        uint256 b,
        string memory errorMessage
    ) internal pure returns (uint256) {
        unchecked {
            require(b > 0, errorMessage);
            return a % b;
        }
    }
}

File 7 of 11 : Ownable.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "../utils/Context.sol";

/**
 * @dev Contract module which provides a basic access control mechanism, where
 * there is an account (an owner) that can be granted exclusive access to
 * specific functions.
 *
 * By default, the owner account will be the one that deploys the contract. This
 * can later be changed with {transferOwnership}.
 *
 * This module is used through inheritance. It will make available the modifier
 * `onlyOwner`, which can be applied to your functions to restrict their use to
 * the owner.
 */
abstract contract Ownable is Context {
    address private _owner;

    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    constructor() {
        _setOwner(_msgSender());
    }

    /**
     * @dev Returns the address of the current owner.
     */
    function owner() public view virtual returns (address) {
        return _owner;
    }

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        require(owner() == _msgSender(), "Ownable: caller is not the owner");
        _;
    }

    /**
     * @dev Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions anymore. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby removing any functionality that is only available to the owner.
     */
    function renounceOwnership() public virtual onlyOwner {
        _setOwner(address(0));
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public virtual onlyOwner {
        require(newOwner != address(0), "Ownable: new owner is the zero address");
        _setOwner(newOwner);
    }

    function _setOwner(address newOwner) private {
        address oldOwner = _owner;
        _owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }
}

File 8 of 11 : FundRaisingGuild.sol
// SPDX-License-Identifier: MIT

pragma solidity 0.8.0;

import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";

contract FundRaisingGuild {
    using SafeERC20 for IERC20;

    address public stakingContract;

    constructor(address _stakingContract) public {
        stakingContract = _stakingContract;
    }

    function withdrawTo(IERC20 _token, address _recipient, uint256 _amount) external {
        require(msg.sender == stakingContract, "Guild.withdrawTo: Only staking contract");
        _token.safeTransfer(_recipient, _amount);
    }

    function tokenBalance(IERC20 _token) external returns (uint256) {
        return _token.balanceOf(address(this));
    }
}

File 9 of 11 : Address.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @dev Returns true if `account` is a contract.
     *
     * [IMPORTANT]
     * ====
     * It is unsafe to assume that an address for which this function returns
     * false is an externally-owned account (EOA) and not a contract.
     *
     * Among others, `isContract` will return false for the following
     * types of addresses:
     *
     *  - an externally-owned account
     *  - a contract in construction
     *  - an address where a contract will be created
     *  - an address where a contract lived, but was destroyed
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize, which returns 0 for contracts in
        // construction, since the code is only stored at the end of the
        // constructor execution.

        uint256 size;
        assembly {
            size := extcodesize(account)
        }
        return size > 0;
    }

    /**
     * @dev Replacement for Solidity's `transfer`: sends `amount` wei to
     * `recipient`, forwarding all available gas and reverting on errors.
     *
     * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
     * of certain opcodes, possibly making contracts go over the 2300 gas limit
     * imposed by `transfer`, making them unable to receive funds via
     * `transfer`. {sendValue} removes this limitation.
     *
     * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
     *
     * IMPORTANT: because control is transferred to `recipient`, care must be
     * taken to not create reentrancy vulnerabilities. Consider using
     * {ReentrancyGuard} or the
     * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
     */
    function sendValue(address payable recipient, uint256 amount) internal {
        require(address(this).balance >= amount, "Address: insufficient balance");

        (bool success, ) = recipient.call{value: amount}("");
        require(success, "Address: unable to send value, recipient may have reverted");
    }

    /**
     * @dev Performs a Solidity function call using a low level `call`. A
     * plain `call` is an unsafe replacement for a function call: use this
     * function instead.
     *
     * If `target` reverts with a revert reason, it is bubbled up by this
     * function (like regular Solidity function calls).
     *
     * Returns the raw returned data. To convert to the expected return value,
     * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
     *
     * Requirements:
     *
     * - `target` must be a contract.
     * - calling `target` with `data` must not revert.
     *
     * _Available since v3.1._
     */
    function functionCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionCall(target, data, "Address: low-level call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
     * `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        return functionCallWithValue(target, data, 0, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but also transferring `value` wei to `target`.
     *
     * Requirements:
     *
     * - the calling contract must have an ETH balance of at least `value`.
     * - the called Solidity function must be `payable`.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(
        address target,
        bytes memory data,
        uint256 value
    ) internal returns (bytes memory) {
        return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
    }

    /**
     * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
     * with `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(
        address target,
        bytes memory data,
        uint256 value,
        string memory errorMessage
    ) internal returns (bytes memory) {
        require(address(this).balance >= value, "Address: insufficient balance for call");
        require(isContract(target), "Address: call to non-contract");

        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return _verifyCallResult(success, returndata, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
        return functionStaticCall(target, data, "Address: low-level static call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        require(isContract(target), "Address: static call to non-contract");

        (bool success, bytes memory returndata) = target.staticcall(data);
        return _verifyCallResult(success, returndata, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionDelegateCall(target, data, "Address: low-level delegate call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        require(isContract(target), "Address: delegate call to non-contract");

        (bool success, bytes memory returndata) = target.delegatecall(data);
        return _verifyCallResult(success, returndata, errorMessage);
    }

    function _verifyCallResult(
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) private pure returns (bytes memory) {
        if (success) {
            return returndata;
        } else {
            // Look for revert reason and bubble it up if present
            if (returndata.length > 0) {
                // The easiest way to bubble the revert reason is using memory via assembly

                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert(errorMessage);
            }
        }
    }
}

File 10 of 11 : IERC165.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC165 standard, as defined in the
 * https://eips.ethereum.org/EIPS/eip-165[EIP].
 *
 * Implementers can declare support of contract interfaces, which can then be
 * queried by others ({ERC165Checker}).
 *
 * For an implementation, see {ERC165}.
 */
interface IERC165 {
    /**
     * @dev Returns true if this contract implements the interface defined by
     * `interfaceId`. See the corresponding
     * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
     * to learn more about how these ids are created.
     *
     * This function call must use less than 30 000 gas.
     */
    function supportsInterface(bytes4 interfaceId) external view returns (bool);
}

File 11 of 11 : Context.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/*
 * @dev Provides information about the current execution context, including the
 * sender of the transaction and its data. While these are generally available
 * via msg.sender and msg.data, they should not be accessed in such a direct
 * manner, since when dealing with meta-transactions the account sending and
 * paying for execution may not be the actual sender (as far as an application
 * is concerned).
 *
 * This contract is only required for intermediate, library-like contracts.
 */
abstract contract Context {
    function _msgSender() internal view virtual returns (address) {
        return msg.sender;
    }

    function _msgData() internal view virtual returns (bytes calldata) {
        return msg.data;
    }
}

Settings
{
  "optimizer": {
    "enabled": true,
    "runs": 200
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "abi"
      ]
    }
  },
  "libraries": {}
}

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"contract IERC20","name":"_stakingToken","type":"address"},{"internalType":"contract IERC1155","name":"_nftToken","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"guildBank","type":"address"}],"name":"ContractDeployed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"pid","type":"uint256"},{"indexed":true,"internalType":"address","name":"recipient","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"FundRaisingClaimed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"uint256","name":"pid","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Pledge","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"uint256","name":"pid","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"PledgeFunded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"pid","type":"uint256"}],"name":"PoolAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"uint256","name":"pid","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"RewardClaimed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"pid","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"rewardEndBlock","type":"uint256"}],"name":"RewardsSetUp","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"uint256","name":"pid","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Withdraw","type":"event"},{"inputs":[],"name":"TOTAL_TOKEN_ALLOCATION_POINTS","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"_rewardToken","type":"address"},{"internalType":"contract IERC20","name":"_fundRaisingToken","type":"address"},{"internalType":"uint256","name":"_tokenAllocationStartBlock","type":"uint256"},{"internalType":"uint256","name":"_stakingEndBlock","type":"uint256"},{"internalType":"uint256","name":"_pledgeFundingEndBlock","type":"uint256"},{"internalType":"uint256","name":"_targetRaise","type":"uint256"},{"internalType":"uint256","name":"_maxStakingAmountPerUser","type":"uint256"},{"internalType":"bool","name":"_withUpdate","type":"bool"},{"internalType":"uint256[]","name":"_whitelistTokenIds","type":"uint256[]"}],"name":"add","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"}],"name":"claimFundRaising","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"}],"name":"claimReward","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"}],"name":"fundPledge","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"}],"name":"getPledgeFundingAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"}],"name":"getTotalRaisedVsTarget","outputs":[{"internalType":"uint256","name":"raised","type":"uint256"},{"internalType":"uint256","name":"target","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"massUpdatePools","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"nftToken","outputs":[{"internalType":"contract IERC1155","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"numberOfPools","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"},{"internalType":"address","name":"_user","type":"address"}],"name":"pendingRewards","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"pledge","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"poolIdToAccPercentagePerShare","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"poolIdToAccRewardPerShareVesting","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"}],"name":"poolIdToAllowedTokenIds","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"poolIdToFundsClaimed","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"poolIdToLastPercentageAllocBlock","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"poolIdToLastRewardBlock","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"poolIdToMaxRewardTokensAvailableForVesting","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"poolIdToRewardCliffEndBlock","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"poolIdToRewardEndBlock","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"poolIdToRewardPerBlock","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"poolIdToRewardStartBlock","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"poolIdToTotalFundedPercentageOfTargetRaise","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"poolIdToTotalRaised","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"poolIdToTotalStaked","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"poolInfo","outputs":[{"internalType":"contract IERC20","name":"rewardToken","type":"address"},{"internalType":"contract IERC20","name":"fundRaisingToken","type":"address"},{"internalType":"uint256","name":"tokenAllocationStartBlock","type":"uint256"},{"internalType":"uint256","name":"stakingEndBlock","type":"uint256"},{"internalType":"uint256","name":"pledgeFundingEndBlock","type":"uint256"},{"internalType":"uint256","name":"targetRaise","type":"uint256"},{"internalType":"uint256","name":"maxStakingAmountPerUser","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"rewardGuildBank","outputs":[{"internalType":"contract FundRaisingGuild","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"},{"internalType":"uint256","name":"_rewardAmount","type":"uint256"},{"internalType":"uint256","name":"_rewardStartBlock","type":"uint256"},{"internalType":"uint256","name":"_rewardCliffEndBlock","type":"uint256"},{"internalType":"uint256","name":"_rewardEndBlock","type":"uint256"}],"name":"setupVestingRewards","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"stakingToken","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IERC1155","name":"_nftToken","type":"address"}],"name":"updateNftTokenAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"}],"name":"updatePool","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"address","name":"","type":"address"}],"name":"userInfo","outputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"pledgeFundingAmount","type":"uint256"},{"internalType":"uint256","name":"rewardDebtRewards","type":"uint256"},{"internalType":"uint256","name":"tokenAllocDebt","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"}]

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106102275760003560e01c806380cd692111610130578063b6139e0c116100b8578063d53e7bcb1161007c578063d53e7bcb146104a4578063db5dc29d146104b7578063de9b2e02146104ca578063f2fde38b146104dd578063fde327be146104f057610227565b8063b6139e0c1461044e578063b9641a2114610461578063ce99ad4214610481578063d06fcba814610489578063d18df53c1461049157610227565b806384a2398c116100ff57806384a2398c146103dc5780638da5cb5b146103ef57806393f1a40b146103f757806398e851901461041a578063ae169a501461043b57610227565b806380cd69211461039057806383876474146103a357806383d72dfd146103b65780638481a5ac146103c957610227565b80635d7c616b116101b35780636f682a53116101825780636f682a5314610345578063715018a61461034d57806372f702f314610355578063793d28091461036a5780637bd811a21461037d57610227565b80635d7c616b146102f757806361eacac114610317578063630b5ba11461032a57806367a499231461033257610227565b8063329f812e116101fa578063329f812e146102a357806344e7c4ea146102b65780634f669ca3146102c957806351eb05a6146102d1578063577f3525146102e457610227565b806307ac1ea81461022c5780631526fe27146102555780632530fd571461027b5780632e1a7d4d14610290575b600080fd5b61023f61023a36600461277f565b610503565b60405161024c919061347d565b60405180910390f35b61026861026336600461277f565b610515565b60405161024c97969594939291906128f5565b61028e61028936600461277f565b610571565b005b61028e61029e36600461277f565b6108fe565b61023f6102b136600461277f565b610a8f565b61023f6102c436600461277f565b610aa1565b61023f610ab3565b61028e6102df36600461277f565b610ac0565b61023f6102f236600461277f565b610ce3565b61030a61030536600461277f565b610cf5565b60405161024c91906128a6565b61028e610325366004612651565b610da1565b61028e6110ca565b61028e61034036600461277f565b6110f2565b61023f611328565b61028e61132e565b61035d611379565b60405161024c9190612855565b61023f61037836600461277f565b611388565b61023f61038b36600461277f565b61139a565b61023f61039e36600461277f565b611553565b61023f6103b136600461277f565b611565565b61028e6103c4366004612619565b611577565b61023f6103d736600461277f565b6115fe565b61023f6103ea36600461277f565b611610565b61035d611622565b61040a6104053660046127af565b611631565b60405161024c9493929190613494565b61042d61042836600461277f565b611663565b60405161024c929190613486565b61028e61044936600461277f565b6116b3565b61023f61045c36600461277f565b61187c565b61047461046f36600461277f565b61188e565b60405161024c91906128ea565b61035d6118a3565b61035d6118b2565b61023f61049f3660046127af565b6118c1565b61023f6104b236600461277f565b611a71565b61023f6104c536600461277f565b611a83565b61028e6104d83660046127ff565b611a95565b61028e6104eb366004612619565b611c9a565b61028e6104fe3660046127de565b611d08565b60106020526000908152604090205481565b6005818154811061052557600080fd5b600091825260209091206008909102018054600182015460028301546003840154600485015460058601546006909601546001600160a01b039586169750949093169491939092919087565b6002600154141561059d5760405162461bcd60e51b815260040161059490613366565b60405180910390fd5b600260015560055481106105c35760405162461bcd60e51b8152600401610594906130eb565b6105cc81610ac0565b6000600582815481106105ef57634e487b7160e01b600052603260045260246000fd5b600091825260208083208584526013825260408085203386529092529220600181015460089092029092019250156106395760405162461bcd60e51b815260040161059490612966565b600782015415610746576000805b6007840154811015610726576003546007850180546000926001600160a01b03169162fdd58e913391908690811061068f57634e487b7160e01b600052603260045260246000fd5b90600052602060002001546040518363ffffffff1660e01b81526004016106b792919061288d565b60206040518083038186803b1580156106cf57600080fd5b505afa1580156106e3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107079190612797565b11156107165760019150610726565b61071f81613549565b9050610647565b50806107445760405162461bcd60e51b815260040161059490612bb3565b505b816003015443116107695760405162461bcd60e51b815260040161059490612c5b565b816004015443111561078d5760405162461bcd60e51b815260040161059490613122565b80546107ab5760405162461bcd60e51b815260040161059490613175565b60006107b68461139a565b9050600081116107d85760405162461bcd60e51b815260040161059490612ed5565b60018301546107f2906001600160a01b0316333084611fe6565b60008481526010602052604090205461080b9082612044565b60008581526010602052604081209190915561082685612057565b5090506000610862846003015461085c670de0b6b3a764000061085686896000015461220990919063ffffffff16565b90612215565b90612221565b60008781526011602052604090205490915061087e9082612044565b6000878152601160205260409020556001840183905583546002546108b0916001600160a01b0390911690339061222d565b85336001600160a01b03167fc9159a3590ca213db39d57440dad22e9911926f07912368049e065ed57e38f4d856040516108ea919061347d565b60405180910390a350506001805550505050565b600260015414156109215760405162461bcd60e51b815260040161059490613366565b600260015560055481106109475760405162461bcd60e51b8152600401610594906129ff565b60006005828154811061096a57634e487b7160e01b600052603260045260246000fd5b6000918252602080832085845260138252604080852033865290925292208054600890920290920192506109b05760405162461bcd60e51b8152600401610594906131fb565b6001810154156109d25760405162461bcd60e51b815260040161059490613431565b816004015443116109f55760405162461bcd60e51b8152600401610594906130b4565b8054600084815260136020908152604080832033808552925282208281556001810183905560028082018490556003909101929092559054610a43916001600160a01b03909116908361222d565b83336001600160a01b03167ff279e6a1f5e320cca91135676d9cb6e44ca8a08c0b88342bcdb1144f6511b56883604051610a7d919061347d565b60405180910390a35050600180555050565b60076020526000908152604090205481565b600b6020526000908152604090205481565b68056bc75e2d6310000081565b6005548110610ae15760405162461bcd60e51b815260040161059490612e1a565b600060058281548110610b0457634e487b7160e01b600052603260045260246000fd5b906000526020600020906008020190508060020154431015610b265750610ce0565b6000828152600f6020526040902054610b5057506000818152600760205260409020439055610ce0565b60008160030154431115610b68578160030154610b6a565b435b60008481526007602052604081205491925090610b879083612251565b6000858152600c6020526040902054909150158015610ba65750600081115b15610bd857600080610bb786612057565b60008881526006602090815260408083209490945560079052919091205550505b6000848152600c6020526040902054610bf357505050610ce0565b6000848152600b6020526040902054431015610c1157505050610ce0565b6000848152600c60209081526040808320546009909252822054909143831015610c3b5782610c3d565b435b90506000610c4b8383612251565b905080610c5e5750505050505050610ce0565b60008881526008602052604081205490610c788383612209565b60008b815260116020526040902054909150610cb990610ca49061085684670de0b6b3a7640000612209565b60008c8152600d602052604090205490612044565b60008b8152600d602090815260408083209390935560099052209390935550505050505050505b50565b60096020526000908152604090205481565b6005546060908210610d195760405162461bcd60e51b815260040161059490612b37565b60058281548110610d3a57634e487b7160e01b600052603260045260246000fd5b9060005260206000209060080201600701805480602002602001604051908101604052809291908181526020018280548015610d9557602002820191906000526020600020905b815481526020019060010190808311610d81575b50505050509050919050565b610da961225d565b6001600160a01b0316610dba611622565b6001600160a01b031614610de05760405162461bcd60e51b815260040161059490612f64565b886001600160a01b038116610e075760405162461bcd60e51b815260040161059490612e51565b886001600160a01b038116610e2e5760405162461bcd60e51b815260040161059490612a76565b878910610e4d5760405162461bcd60e51b81526004016105949061339d565b868810610e6c5760405162461bcd60e51b815260040161059490612c10565b60008611610e8c5760405162461bcd60e51b815260040161059490612de3565b8315610e9a57610e9a6110ca565b60408051610100810182526001600160a01b03808e1682528c811660208084019182529383018d8152606084018d8152608085018d815260a086018d815260c087018d815260e088018c815260058054600181018255600091909152895160089091027f036b6384b5eca791c62761152d0c79bb0604c104a5fb6f4eb0703f3154bb3db081018054928b166001600160a01b031993841617815598517f036b6384b5eca791c62761152d0c79bb0604c104a5fb6f4eb0703f3154bb3db18201805491909b1692169190911790985594517f036b6384b5eca791c62761152d0c79bb0604c104a5fb6f4eb0703f3154bb3db288015592517f036b6384b5eca791c62761152d0c79bb0604c104a5fb6f4eb0703f3154bb3db387015590517f036b6384b5eca791c62761152d0c79bb0604c104a5fb6f4eb0703f3154bb3db4860155517f036b6384b5eca791c62761152d0c79bb0604c104a5fb6f4eb0703f3154bb3db5850155517f036b6384b5eca791c62761152d0c79bb0604c104a5fb6f4eb0703f3154bb3db68401555180519394919361105c937f036b6384b5eca791c62761152d0c79bb0604c104a5fb6f4eb0703f3154bb3db7019291909101906125b9565b50506005548a9150600790600090611075906001612221565b8152602081019190915260400160002055600554611094906001612221565b6040517f522b283dfad3650433b41164a9379b13dc60bbf24676affdc6a33c84dd3ac15d90600090a25050505050505050505050565b60005b600554811015610ce0576110e081610ac0565b806110ea81613549565b9150506110cd565b600260015414156111155760405162461bcd60e51b815260040161059490613366565b600260015561112261225d565b6001600160a01b0316611133611622565b6001600160a01b0316146111595760405162461bcd60e51b815260040161059490612f64565b600554811061117a5760405162461bcd60e51b8152600401610594906133fa565b60006005828154811061119d57634e487b7160e01b600052603260045260246000fd5b6000918252602080832085845260089182905260409093205491029091019150806111da5760405162461bcd60e51b815260040161059490612f99565b60008381526012602052604090205460ff16156112095760405162461bcd60e51b815260040161059490612a2f565b6000838152601260205260409020805460ff191660019081179091558201546001600160a01b031663a9059cbb61123e611622565b600086815260106020526040908190205490516001600160e01b031960e085901b16815261127092919060040161288d565b602060405180830381600087803b15801561128a57600080fd5b505af115801561129e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112c29190612635565b506112cb611622565b6001600160a01b0316837f90b6b0d5b4b6169cc45fd20c2536a9d57c31e428447bd18963c0210541a870896010600087815260200190815260200160002054604051611317919061347d565b60405180910390a350506001805550565b60055490565b61133661225d565b6001600160a01b0316611347611622565b6001600160a01b03161461136d5760405162461bcd60e51b815260040161059490612f64565b6113776000612261565b565b6002546001600160a01b031681565b60066020526000908152604090205481565b60055460009082106113be5760405162461bcd60e51b815260040161059490612e92565b6000600583815481106113e157634e487b7160e01b600052603260045260246000fd5b60009182526020918290206040805161010081018252600890930290910180546001600160a01b039081168452600182015416838501526002810154838301526003810154606084015260048101546080840152600581015460a0840152600681015460c08401526007810180548351818702810187019094528084529394919360e08601939283018282801561149757602002820191906000526020600020905b815481526020019060010190808311611483575b50505091909252505050600084815260136020908152604080832033845282528083208151608081018352815481526001820154938101939093526002810154918301919091526003015460608201529192506114f385612057565b5090506000611523836060015161085c670de0b6b3a764000061085686886000015161220990919063ffffffff16565b905061154968056bc75e2d631000006108568660a001518461220990919063ffffffff16565b9695505050505050565b600a6020526000908152604090205481565b60116020526000908152604090205481565b61157f61225d565b6001600160a01b0316611590611622565b6001600160a01b0316146115b65760405162461bcd60e51b815260040161059490612f64565b6001600160a01b0381166115dc5760405162461bcd60e51b8152600401610594906131ac565b600380546001600160a01b0319166001600160a01b0392909216919091179055565b600f6020526000908152604090205481565b600e6020526000908152604090205481565b6000546001600160a01b031690565b601360209081526000928352604080842090915290825290208054600182015460028301546003909301549192909184565b60008181526010602052604081205460058054839291908590811061169857634e487b7160e01b600052603260045260246000fd5b90600052602060002090600802016005015491509150915091565b600260015414156116d65760405162461bcd60e51b815260040161059490613366565b60026001556116e481610ac0565b6000818152600b60205260409020544310156117125760405162461bcd60e51b815260040161059490612dac565b60008181526013602090815260408083203384529091529020600181015461174c5760405162461bcd60e51b815260040161059490612d17565b60006005838154811061176f57634e487b7160e01b600052603260045260246000fd5b60009182526020808320868452600d909152604083205460089092020192509061179885612057565b50905060006117c8856003015461085c670de0b6b3a7640000610856868a6000015461220990919063ffffffff16565b905060006117f3866002015461085c670de0b6b3a7640000610856888761220990919063ffffffff16565b9050801561186f57611811670de0b6b3a76400006108568487612209565b6002870155845461182c906001600160a01b031633836122b1565b86336001600160a01b03167ff01da32686223933d8a18a391060918c7f11a3648639edd87ae013e2e273174383604051611866919061347d565b60405180910390a35b5050600180555050505050565b600d6020526000908152604090205481565b60126020526000908152604090205460ff1681565b6004546001600160a01b031681565b6003546001600160a01b031681565b60055460009083106118e55760405162461bcd60e51b815260040161059490612b7c565b60008381526013602090815260408083206001600160a01b03861684528252918290208251608081018452815481526001820154928101839052600282015493810193909352600301546060830152611942576000915050611a6b565b6000848152600d6020908152604080832054600c835281842054600984528285205460089094529190932054909190438210801561197f57508215155b801561199857506000888152600f602052604090205415155b15611a04576000834311156119ad57836119af565b435b905060006119bd8483612251565b905060006119cb8285612209565b60008c8152601160205260409020549091506119fe906119f79061085684670de0b6b3a7640000612209565b8890612044565b96505050505b6000611a0f89612057565b5090506000611a3f876060015161085c670de0b6b3a7640000610856868c6000015161220990919063ffffffff16565b6040880151909150611a619061085c670de0b6b3a7640000610856858b612209565b9750505050505050505b92915050565b60086020526000908152604090205481565b600c6020526000908152604090205481565b60026001541415611ab85760405162461bcd60e51b815260040161059490613366565b6002600155611ac561225d565b6001600160a01b0316611ad6611622565b6001600160a01b031614611afc5760405162461bcd60e51b815260040161059490612f64565b6005548510611b1d5760405162461bcd60e51b815260040161059490612abc565b438311611b3c5760405162461bcd60e51b815260040161059490613031565b82821015611b5c5760405162461bcd60e51b815260040161059490612d4e565b818111611b7b5760405162461bcd60e51b815260040161059490613309565b600060058681548110611b9e57634e487b7160e01b600052603260045260246000fd5b9060005260206000209060080201905080600401544311611bd15760405162461bcd60e51b8152600401610594906129b0565b6000611bdd8386612221565b6000888152600e602052604090208790559050611bfa8682612215565b600088815260086020908152604080832093909355600a815282822088905560098152828220889055600b8152828220879055600c9052208390556004548254611c53916001600160a01b039182169133911689611fe6565b867f6b3e2a45b4c3400bba4d35f24d9077cf482beda8d42883107c14352f26c791658785604051611c85929190613486565b60405180910390a25050600180555050505050565b611ca261225d565b6001600160a01b0316611cb3611622565b6001600160a01b031614611cd95760405162461bcd60e51b815260040161059490612f64565b6001600160a01b038116611cff5760405162461bcd60e51b815260040161059490612af1565b610ce081612261565b60026001541415611d2b5760405162461bcd60e51b815260040161059490613366565b60026001556005548210611d515760405162461bcd60e51b815260040161059490612ca4565b600060058381548110611d7457634e487b7160e01b600052603260045260246000fd5b6000918252602080832086845260138252604080852033865290925292206008909102909101915082611db95760405162461bcd60e51b81526004016105949061307d565b8160030154431115611ddd5760405162461bcd60e51b815260040161059490612f21565b600782015415611eea576000805b6007840154811015611eca576003546007850180546000926001600160a01b03169162fdd58e9133919086908110611e3357634e487b7160e01b600052603260045260246000fd5b90600052602060002001546040518363ffffffff1660e01b8152600401611e5b92919061288d565b60206040518083038186803b158015611e7357600080fd5b505afa158015611e87573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611eab9190612797565b1115611eba5760019150611eca565b611ec381613549565b9050611deb565b5080611ee85760405162461bcd60e51b815260040161059490613269565b505b60068201548154611efb9085612044565b1115611f195760405162461bcd60e51b815260040161059490612fdf565b611f2284610ac0565b8054611f2e9084612044565b8155600084815260066020526040902054611f6790611f5c90670de0b6b3a764000090610856908790612209565b600383015490612044565b60038201556000848152600f6020526040902054611f859084612044565b6000858152600f6020526040902055600254611fac906001600160a01b0316333086611fe6565b83336001600160a01b03167faba4f973c8f45a52365c8348704e79653e4b58ebd452f2d2115423a62ef7a3e185604051610a7d919061347d565b61203e846323b872dd60e01b85858560405160240161200793929190612869565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152612414565b50505050565b600061205082846134af565b9392505050565b60008060006005848154811061207d57634e487b7160e01b600052603260045260246000fd5b60009182526020918290206040805161010081018252600890930290910180546001600160a01b039081168452600182015416838501526002810154838301526003810154606084015260048101546080840152600581015460a0840152600681015460c08401526007810180548351818702810187019094528084529394919360e08601939283018282801561213357602002820191906000526020600020905b81548152602001906001019080831161211f575b5050505050815250509050600061215b8260400151836060015161222190919063ffffffff16565b9050600061217268056bc75e2d6310000083612215565b90506000836060015143111561218c57836060015161218e565b435b600088815260076020526040812054919250906121ab9083612251565b905060006121b98285612209565b60008a8152600f60205260409020549091506121fa906121e59061085684670de0b6b3a7640000612209565b60008b81526006602052604090205490612044565b97509195505050505050915091565b600061205082846134e7565b600061205082846134c7565b60006120508284613506565b61224c8363a9059cbb60e01b848460405160240161200792919061288d565b505050565b60006120508284612221565b3390565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6004805460405163776e4b3560e11b81526000926001600160a01b039092169163eedc966a916122e391889101612855565b602060405180830381600087803b1580156122fd57600080fd5b505af1158015612311573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123359190612797565b9050808211156123a957600480546040516361d9ad3f60e11b81526001600160a01b039091169163c3b35a7e916123729188918891879101612869565b600060405180830381600087803b15801561238c57600080fd5b505af11580156123a0573d6000803e3d6000fd5b5050505061203e565b600480546040516361d9ad3f60e11b81526001600160a01b039091169163c3b35a7e916123dc9188918891889101612869565b600060405180830381600087803b1580156123f657600080fd5b505af115801561240a573d6000803e3d6000fd5b5050505050505050565b6000612469826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166124a39092919063ffffffff16565b80519091501561224c57808060200190518101906124879190612635565b61224c5760405162461bcd60e51b8152600401610594906132bf565b60606124b284846000856124ba565b949350505050565b6060824710156124dc5760405162461bcd60e51b815260040161059490612cd1565b6124e58561257a565b6125015760405162461bcd60e51b815260040161059490613232565b600080866001600160a01b0316858760405161251d9190612839565b60006040518083038185875af1925050503d806000811461255a576040519150601f19603f3d011682016040523d82523d6000602084013e61255f565b606091505b509150915061256f828286612580565b979650505050505050565b3b151590565b6060831561258f575081612050565b82511561259f5782518084602001fd5b8160405162461bcd60e51b81526004016105949190612933565b8280548282559060005260206000209081019282156125f4579160200282015b828111156125f45782518255916020019190600101906125d9565b50612600929150612604565b5090565b5b808211156126005760008155600101612605565b60006020828403121561262a578081fd5b813561205081613590565b600060208284031215612646578081fd5b8151612050816135a5565b60008060008060008060008060006101208a8c03121561266f578485fd5b6126798a35613590565b8935985060208a013561268b81613590565b975060408a0135965060608a0135955060808a0135945060a08a0135935060c08a0135925060e08a01356126be816135a5565b91506101008a013567ffffffffffffffff808211156126db578283fd5b818c0191508c601f8301126126ee578283fd5b8135818111156127005761270061357a565b6040516020808302820101818110848211171561271f5761271f61357a565b8060405250809250818152602081019250602084018f60208085028701011115612747578586fd5b8594505b8285101561276a5780358452600194909401936020938401930161274b565b50809450505050509295985092959850929598565b600060208284031215612790578081fd5b5035919050565b6000602082840312156127a8578081fd5b5051919050565b600080604083850312156127c1578182fd5b8235915060208301356127d381613590565b809150509250929050565b600080604083850312156127f0578182fd5b50508035926020909101359150565b600080600080600060a08688031215612816578081fd5b505083359560208501359550604085013594606081013594506080013592509050565b6000825161284b81846020870161351d565b9190910192915050565b6001600160a01b0391909116815260200190565b6001600160a01b039384168152919092166020820152604081019190915260600190565b6001600160a01b03929092168252602082015260400190565b6020808252825182820181905260009190848201906040850190845b818110156128de578351835292840192918401916001016128c2565b50909695505050505050565b901515815260200190565b6001600160a01b03978816815295909616602086015260408501939093526060840191909152608083015260a082015260c081019190915260e00190565b600060208252825180602084015261295281604085016020870161351d565b601f01601f19169190910160400192915050565b6020808252602a908201527f66756e64506c656467653a20506c656467652068617320616c7265616479206260408201526919595b88199d5b99195960b21b606082015260800190565b6020808252602f908201527f736574757056657374696e67526577617264733a205374616b6572732061726560408201526e207374696c6c20706c656467696e6760881b606082015260800190565b6020808252601690820152751dda5d1a191c985dce881a5b9d985b1a590817dc1a5960521b604082015260600190565b60208082526027908201527f636c61696d46756e6452616973696e673a20416c726561647920636c61696d65604082015266642066756e647360c81b606082015260800190565b60208082526026908201527f6164643a205f66756e6452616973696e67546f6b656e206973207a65726f206160408201526564647265737360d01b606082015260800190565b6020808252818101527f736574757056657374696e67526577617264733a20496e76616c696420504944604082015260600190565b60208082526026908201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160408201526564647265737360d01b606082015260800190565b60208082526025908201527f706f6f6c4964546f416c6c6f776564546f6b656e4964733a20696e76616c69646040820152640817dc1a5960da1b606082015260800190565b6020808252601c908201527f70656e64696e67526577617264733a20696e76616c6964205f70696400000000604082015260600190565b6020808252603a908201527f66756e64506c656467653a207573657220646f6573206e6f7420686f6c64207260408201527f65717569726564204e465420746f207061727469636970617465000000000000606082015260800190565b6020808252602b908201527f6164643a207374616b696e6720656e64206d757374206265206265666f72652060408201526a199d5b991a5b99c8195b9960aa1b606082015260800190565b60208082526029908201527f66756e64506c656467653a205374616b696e67206973207374696c6c2074616b604082015268696e6720706c61636560b81b606082015260800190565b6020808252601390820152721c1b195919d94e88125b9d985b1a5908141251606a1b604082015260600190565b60208082526026908201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6040820152651c8818d85b1b60d21b606082015260800190565b60208082526019908201527f636c61696d5265776172643a204e696365207472792070616c00000000000000604082015260600190565b602080825260409082018190527f736574757056657374696e67526577617264733a20436c696666206d75737420908201527f6265206166746572206f7220657175616c20746f20737461727420626c6f636b606082015260800190565b6020808252601b908201527f636c61696d5265776172643a204e6f74207061737420636c6966660000000000604082015260600190565b60208082526019908201527f6164643a20496e76616c696420726169736520616d6f756e7400000000000000604082015260600190565b60208082526018908201527f757064617465506f6f6c3a20696e76616c6964205f7069640000000000000000604082015260600190565b60208082526021908201527f6164643a205f726577617264546f6b656e206973207a65726f206164647265736040820152607360f81b606082015260800190565b60208082526023908201527f676574506c6564676546756e64696e67416d6f756e743a20496e76616c69642060408201526214125160ea1b606082015260800190565b6020808252602c908201527f66756e64506c656467653a206d757374206861766520706f736974697665207060408201526b1b195919d948185b5bdd5b9d60a21b606082015260800190565b60208082526023908201527f706c656467653a205374616b696e67206e6f206c6f6e676572207065726d69746040820152621d195960ea1b606082015260800190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60208082526026908201527f636c61696d46756e6452616973696e673a2072657761726473206e6f742079656040820152651d081cd95b9d60d21b606082015260800190565b60208082526032908201527f706c656467653a2063616e206e6f7420657863656564206d6178207374616b6960408201527137339030b6b7bab73a103832b9103ab9b2b960711b606082015260800190565b6020808252602c908201527f736574757056657374696e67526577617264733a20737461727420626c6f636b60408201526b081a5b881d1a19481c185cdd60a21b606082015260800190565b6020808252601b908201527f706c656467653a204e6f20706c65646765207370656369666965640000000000604082015260600190565b6020808252601b908201527f77697468647261773a204e6f7420796574207065726d69747465640000000000604082015260600190565b60208082526017908201527f66756e64506c656467653a20496e76616c696420504944000000000000000000604082015260600190565b60208082526033908201527f66756e64506c656467653a20446561646c696e65206861732070617373656420604082015272746f2066756e6420796f757220706c6564676560681b606082015260800190565b6020808252601c908201527f66756e64506c656467653a204d7573742068617665207374616b656400000000604082015260600190565b6020808252602f908201527f636f6e7374727563746f723a205f6e6674546f6b656e206d757374206e6f742060408201526e6265207a65726f206164647265737360881b606082015260800190565b6020808252601e908201527f77697468647261773a204e6f207374616b6520746f2077697468647261770000604082015260600190565b6020808252601d908201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604082015260600190565b60208082526036908201527f706c656467653a207573657220646f6573206e6f7420686f6c64207265717569604082015275726564204e465420746f20706172746963697061746560501b606082015260800190565b6020808252602a908201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6040820152691bdd081cdd58d8d9595960b21b606082015260800190565b60208082526038908201527f736574757056657374696e67526577617264733a20656e6420626c6f636b206d60408201527f75737420626520616674657220636c69666620626c6f636b0000000000000000606082015260800190565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b6020808252603a908201527f6164643a205f746f6b656e416c6c6f636174696f6e5374617274426c6f636b2060408201527f6d757374206265206265666f7265207374616b696e6720656e64000000000000606082015260800190565b6020808252601e908201527f636c61696d46756e6452616973696e673a20696e76616c6964205f7069640000604082015260600190565b6020808252602c908201527f77697468647261773a204f6e6c7920616c6c6f77206e6f6e2d66756e6465727360408201526b20746f20776974686472617760a01b606082015260800190565b90815260200190565b918252602082015260400190565b93845260208401929092526040830152606082015260800190565b600082198211156134c2576134c2613564565b500190565b6000826134e257634e487b7160e01b81526012600452602481fd5b500490565b600081600019048311821515161561350157613501613564565b500290565b60008282101561351857613518613564565b500390565b60005b83811015613538578181015183820152602001613520565b8381111561203e5750506000910152565b600060001982141561355d5761355d613564565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b0381168114610ce057600080fd5b8015158114610ce057600080fdfea26469706673582212202eb1ef9d0ebc305316255e57a3e0c4c8d130da522d3cb0be0854f4ab6e8c0f7164736f6c63430008000033

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

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

Validator Index Block Amount
View All Withdrawals

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

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