Contract 0x159e02795eaD816cE0792F932BE7B36444F82dC6

Txn Hash
Method
Block
From
To
Value
0x8d0d139955191597d949a2e1d6ac7c82d93cf4778a610711c2f209127d485bb4Claim295385362022-01-29 14:51:16156 days 9 hrs ago0x8846fd3d899eaf7bb7fbafa9c3a0b57f836d848f IN  0x159e02795ead816ce0792f932be7b36444f82dc60 Ether0.00021694 2.5
0xae9f594d1ec705ae96cc894dd4aa36aea03b8ea320bec12366ce676e5edb3e2aClaim295385342022-01-29 14:51:04156 days 9 hrs ago0x8846fd3d899eaf7bb7fbafa9c3a0b57f836d848f IN  0x159e02795ead816ce0792f932be7b36444f82dc60 Ether0.00021694 2.5
0x88da275eccc630fd1cb240086a4c6d1ee89739447216f84e1cb0b0ada437852dClaim295385302022-01-29 14:50:48156 days 9 hrs ago0x8846fd3d899eaf7bb7fbafa9c3a0b57f836d848f IN  0x159e02795ead816ce0792f932be7b36444f82dc60 Ether0.00021691 2.5
0xbd9cf4a434a0359b7f6dc827b6fca1df4d1c47653b3ef698262d89214631c879Deposit294599002022-01-25 14:08:16160 days 10 hrs ago0xfd9656df3e4dca84c260137aecba416050aea145 IN  0x159e02795ead816ce0792f932be7b36444f82dc60 Ether0.00110979 10
0x1f24fdf2f158d17421c0147eb47cdfe0e62c909a672dfbb7f892cd17647098cdWithdraw294597012022-01-25 13:54:56160 days 10 hrs ago0xfd9656df3e4dca84c260137aecba416050aea145 IN  0x159e02795ead816ce0792f932be7b36444f82dc60 Ether0.00105146 10
0x8078fc43d51ce88fcf3b7f22300ded7f8920441145c7e59a0ce70ea0630ed182Withdraw294594452022-01-25 13:37:48160 days 11 hrs ago0xfd9656df3e4dca84c260137aecba416050aea145 IN  0x159e02795ead816ce0792f932be7b36444f82dc60 Ether0.00105146 10
0xa6c47c8df57224ec9de4176c67b5e2b330312fb1babbeaf496f28f58dbd8f809Claim291331192022-01-06 18:49:40179 days 5 hrs ago0x8846fd3d899eaf7bb7fbafa9c3a0b57f836d848f IN  0x159e02795ead816ce0792f932be7b36444f82dc60 Ether0.00021694 2.5
0x6676b3a7cf6a2135f58b3c3c24525ac42c2a03f400e7ac3f2c5ce7293b7560fdClaim291331152022-01-06 18:49:20179 days 5 hrs ago0x8846fd3d899eaf7bb7fbafa9c3a0b57f836d848f IN  0x159e02795ead816ce0792f932be7b36444f82dc60 Ether0.00021691 2.5
0xc25bbe422da7c9d0ba5d70ec79b52f8563bd467e07c0f0f9842434f11cf4e063Claim290489032022-01-01 5:28:56184 days 19 hrs ago0x1b2dfe7a543e32db849a1b6d0f7a79c1f4a4e03a IN  0x159e02795ead816ce0792f932be7b36444f82dc60 Ether0.00067686 7.8
0x6fe52d2eb5e46a983120ea208529add65a3d25009c12e2eb5dd7d8fc24735bffClaim290489012022-01-01 5:28:40184 days 19 hrs ago0x1b2dfe7a543e32db849a1b6d0f7a79c1f4a4e03a IN  0x159e02795ead816ce0792f932be7b36444f82dc60 Ether0.00067686 7.8
0xf82b2c446a58dab5d0f36c27f793ff1be1a526b60158e66a991c4d1a903015b3Claim290488982022-01-01 5:28:24184 days 19 hrs ago0x1b2dfe7a543e32db849a1b6d0f7a79c1f4a4e03a IN  0x159e02795ead816ce0792f932be7b36444f82dc60 Ether0.00067677 7.8
0xd87e41a1ad82415ef88574ca36d31b966f895c45f42399b0d57b3e015293ffeaClaim289763602021-12-27 12:37:04189 days 12 hrs ago0x7a0e8c55a12481380fc761697e70633664a70182 IN  0x159e02795ead816ce0792f932be7b36444f82dc60 Ether0.00021694 2.5
0x246f5ca5604752bd056c73b35b2843db520dbf2ad15eea84e8c1a68ed19a1b33Claim289763602021-12-27 12:37:04189 days 12 hrs ago0x7a0e8c55a12481380fc761697e70633664a70182 IN  0x159e02795ead816ce0792f932be7b36444f82dc60 Ether0.00021694 2.5
0xb092f195f2ff7c94d6c63cd28e371e4e6166c92b47fe97f89139b82663155e37Claim289763582021-12-27 12:36:48189 days 12 hrs ago0x7a0e8c55a12481380fc761697e70633664a70182 IN  0x159e02795ead816ce0792f932be7b36444f82dc60 Ether0.00021694 2.5
0xcac52198a6fb98efc50a64296d83d1f8cb239e2ca915197cbb9188f253e9144bClaim289763562021-12-27 12:36:32189 days 12 hrs ago0x7a0e8c55a12481380fc761697e70633664a70182 IN  0x159e02795ead816ce0792f932be7b36444f82dc60 Ether0.00021691 2.5
0x03f9204b218a696e9a223524fa047c13e076f0098c2267d529e0e72bb958db9bClaim289471052021-12-25 14:47:44191 days 9 hrs ago0xa671f9e3f71dc217b2f3220b7a92cc89ff004510 IN  0x159e02795ead816ce0792f932be7b36444f82dc60 Ether0.00021694 2.5
0xd46a6da0f7708230c27dcf60057cb50e11e2b0e58668bf5d96832c487fa694d7Claim289471032021-12-25 14:47:32191 days 9 hrs ago0xa671f9e3f71dc217b2f3220b7a92cc89ff004510 IN  0x159e02795ead816ce0792f932be7b36444f82dc60 Ether0.00021694 2.5
0xbf41a2ad9d899492970f297423ee16c7acb0dc4455f9fd1b1c3246ec4348eeb7Claim289471012021-12-25 14:47:16191 days 9 hrs ago0xa671f9e3f71dc217b2f3220b7a92cc89ff004510 IN  0x159e02795ead816ce0792f932be7b36444f82dc60 Ether0.00021691 2.5
0xdba4c59babdb84c1c2cb065832e574c9ba7d15e75c0b7a992ab7caddb61c69d5Claim287658532021-12-14 14:44:32202 days 9 hrs ago0x7a0e8c55a12481380fc761697e70633664a70182 IN  0x159e02795ead816ce0792f932be7b36444f82dc60 Ether0.00021694 2.5
0x4a64b6247a32a4c82cafe0ce8abb75d0cfe0a83b521024e36ff5259c172aeb05Claim287658522021-12-14 14:44:24202 days 10 hrs ago0x7a0e8c55a12481380fc761697e70633664a70182 IN  0x159e02795ead816ce0792f932be7b36444f82dc60 Ether0.00021694 2.5
0xb428d12e1e622354c9ddbdfffe6857e5d086bc6179c96bb089ad7069f7fba580Claim287658512021-12-14 14:44:16202 days 10 hrs ago0x7a0e8c55a12481380fc761697e70633664a70182 IN  0x159e02795ead816ce0792f932be7b36444f82dc60 Ether0.00021694 2.5
0x1a02827edd59753bed3cc3088700e5039e271f77bd4b59442b5d6fec6b834ddcClaim287658482021-12-14 14:44:00202 days 10 hrs ago0x7a0e8c55a12481380fc761697e70633664a70182 IN  0x159e02795ead816ce0792f932be7b36444f82dc60 Ether0.00021691 2.5
0x2aeb635b708ba3ac2dcf3e4af32235ba8fa8ab170ec82c02870b2d02e077984aClaim287315682021-12-12 11:26:40204 days 13 hrs ago0x200a9dbd54f3a755dc647d1472209e037e43ff10 IN  0x159e02795ead816ce0792f932be7b36444f82dc60 Ether0.00021691 2.5
0xa98d71a9b53a71897fe6788d25a9c0f33c3716c5ecaf08cfb4a323cc7c268e5aClaim286503222021-12-06 13:19:24210 days 11 hrs ago0x77c9e49073d9830723195f3788570c2c36c97688 IN  0x159e02795ead816ce0792f932be7b36444f82dc60 Ether0.00043389 5
0xf4ec39eca874396ff8609d7165a01b80712ee9cb4f1935b871a8984d6913df4dClaim286290252021-12-04 20:13:28212 days 4 hrs ago0x8846fd3d899eaf7bb7fbafa9c3a0b57f836d848f IN  0x159e02795ead816ce0792f932be7b36444f82dc60 Ether0.0008677810
[ Download CSV Export 
Latest 25 internal transaction
Parent Txn Hash Block From To Value
0x8d0d139955191597d949a2e1d6ac7c82d93cf4778a610711c2f209127d485bb4295385362022-01-29 14:51:16156 days 9 hrs ago 0x159e02795ead816ce0792f932be7b36444f82dc6 0x0bce57a3b09cd2bde97970beceaef5990ff386b10 Ether
0x8d0d139955191597d949a2e1d6ac7c82d93cf4778a610711c2f209127d485bb4295385362022-01-29 14:51:16156 days 9 hrs ago 0x159e02795ead816ce0792f932be7b36444f82dc6 0x0bce57a3b09cd2bde97970beceaef5990ff386b10 Ether
0x8d0d139955191597d949a2e1d6ac7c82d93cf4778a610711c2f209127d485bb4295385362022-01-29 14:51:16156 days 9 hrs ago 0x159e02795ead816ce0792f932be7b36444f82dc6 0x8f64022b225cc620577a8a0d2c7b9ed19718832d0 Ether
0xae9f594d1ec705ae96cc894dd4aa36aea03b8ea320bec12366ce676e5edb3e2a295385342022-01-29 14:51:04156 days 9 hrs ago 0x159e02795ead816ce0792f932be7b36444f82dc6 0x0bce57a3b09cd2bde97970beceaef5990ff386b10 Ether
0xae9f594d1ec705ae96cc894dd4aa36aea03b8ea320bec12366ce676e5edb3e2a295385342022-01-29 14:51:04156 days 9 hrs ago 0x159e02795ead816ce0792f932be7b36444f82dc6 0x0bce57a3b09cd2bde97970beceaef5990ff386b10 Ether
0xae9f594d1ec705ae96cc894dd4aa36aea03b8ea320bec12366ce676e5edb3e2a295385342022-01-29 14:51:04156 days 9 hrs ago 0x159e02795ead816ce0792f932be7b36444f82dc6 0xfb7d894418fe9e477eb3c76e769eac958a7f9fef0 Ether
0x88da275eccc630fd1cb240086a4c6d1ee89739447216f84e1cb0b0ada437852d295385302022-01-29 14:50:48156 days 9 hrs ago 0x159e02795ead816ce0792f932be7b36444f82dc6 0x0bce57a3b09cd2bde97970beceaef5990ff386b10 Ether
0x88da275eccc630fd1cb240086a4c6d1ee89739447216f84e1cb0b0ada437852d295385302022-01-29 14:50:48156 days 9 hrs ago 0x159e02795ead816ce0792f932be7b36444f82dc6 0x0bce57a3b09cd2bde97970beceaef5990ff386b10 Ether
0x88da275eccc630fd1cb240086a4c6d1ee89739447216f84e1cb0b0ada437852d295385302022-01-29 14:50:48156 days 9 hrs ago 0x159e02795ead816ce0792f932be7b36444f82dc6 0x7f7dac0b08bc0fd439717a086240d6c504f30c870 Ether
0xbd9cf4a434a0359b7f6dc827b6fca1df4d1c47653b3ef698262d89214631c879294599002022-01-25 14:08:16160 days 10 hrs ago 0x159e02795ead816ce0792f932be7b36444f82dc6 0x7f7dac0b08bc0fd439717a086240d6c504f30c870 Ether
0xbd9cf4a434a0359b7f6dc827b6fca1df4d1c47653b3ef698262d89214631c879294599002022-01-25 14:08:16160 days 10 hrs ago 0x159e02795ead816ce0792f932be7b36444f82dc6 0x0bce57a3b09cd2bde97970beceaef5990ff386b10 Ether
0xbd9cf4a434a0359b7f6dc827b6fca1df4d1c47653b3ef698262d89214631c879294599002022-01-25 14:08:16160 days 10 hrs ago 0x159e02795ead816ce0792f932be7b36444f82dc6 0x0bce57a3b09cd2bde97970beceaef5990ff386b10 Ether
0xbd9cf4a434a0359b7f6dc827b6fca1df4d1c47653b3ef698262d89214631c879294599002022-01-25 14:08:16160 days 10 hrs ago 0x159e02795ead816ce0792f932be7b36444f82dc6 0x7f7dac0b08bc0fd439717a086240d6c504f30c870 Ether
0x1f24fdf2f158d17421c0147eb47cdfe0e62c909a672dfbb7f892cd17647098cd294597012022-01-25 13:54:56160 days 10 hrs ago 0x159e02795ead816ce0792f932be7b36444f82dc6 0x7f7dac0b08bc0fd439717a086240d6c504f30c870 Ether
0x1f24fdf2f158d17421c0147eb47cdfe0e62c909a672dfbb7f892cd17647098cd294597012022-01-25 13:54:56160 days 10 hrs ago 0x159e02795ead816ce0792f932be7b36444f82dc6 0x0bce57a3b09cd2bde97970beceaef5990ff386b10 Ether
0x1f24fdf2f158d17421c0147eb47cdfe0e62c909a672dfbb7f892cd17647098cd294597012022-01-25 13:54:56160 days 10 hrs ago 0x159e02795ead816ce0792f932be7b36444f82dc6 0x0bce57a3b09cd2bde97970beceaef5990ff386b10 Ether
0x1f24fdf2f158d17421c0147eb47cdfe0e62c909a672dfbb7f892cd17647098cd294597012022-01-25 13:54:56160 days 10 hrs ago 0x159e02795ead816ce0792f932be7b36444f82dc6 0x7f7dac0b08bc0fd439717a086240d6c504f30c870 Ether
0x8078fc43d51ce88fcf3b7f22300ded7f8920441145c7e59a0ce70ea0630ed182294594452022-01-25 13:37:48160 days 11 hrs ago 0x159e02795ead816ce0792f932be7b36444f82dc6 0x7f7dac0b08bc0fd439717a086240d6c504f30c870 Ether
0x8078fc43d51ce88fcf3b7f22300ded7f8920441145c7e59a0ce70ea0630ed182294594452022-01-25 13:37:48160 days 11 hrs ago 0x159e02795ead816ce0792f932be7b36444f82dc6 0x0bce57a3b09cd2bde97970beceaef5990ff386b10 Ether
0x8078fc43d51ce88fcf3b7f22300ded7f8920441145c7e59a0ce70ea0630ed182294594452022-01-25 13:37:48160 days 11 hrs ago 0x159e02795ead816ce0792f932be7b36444f82dc6 0x0bce57a3b09cd2bde97970beceaef5990ff386b10 Ether
0x8078fc43d51ce88fcf3b7f22300ded7f8920441145c7e59a0ce70ea0630ed182294594452022-01-25 13:37:48160 days 11 hrs ago 0x159e02795ead816ce0792f932be7b36444f82dc6 0x7f7dac0b08bc0fd439717a086240d6c504f30c870 Ether
0xa6c47c8df57224ec9de4176c67b5e2b330312fb1babbeaf496f28f58dbd8f809291331192022-01-06 18:49:40179 days 5 hrs ago 0x159e02795ead816ce0792f932be7b36444f82dc6 0x0bce57a3b09cd2bde97970beceaef5990ff386b10 Ether
0xa6c47c8df57224ec9de4176c67b5e2b330312fb1babbeaf496f28f58dbd8f809291331192022-01-06 18:49:40179 days 5 hrs ago 0x159e02795ead816ce0792f932be7b36444f82dc6 0x0bce57a3b09cd2bde97970beceaef5990ff386b10 Ether
0xa6c47c8df57224ec9de4176c67b5e2b330312fb1babbeaf496f28f58dbd8f809291331192022-01-06 18:49:40179 days 5 hrs ago 0x159e02795ead816ce0792f932be7b36444f82dc6 0x8f64022b225cc620577a8a0d2c7b9ed19718832d0 Ether
0x6676b3a7cf6a2135f58b3c3c24525ac42c2a03f400e7ac3f2c5ce7293b7560fd291331152022-01-06 18:49:20179 days 5 hrs ago 0x159e02795ead816ce0792f932be7b36444f82dc6 0x0bce57a3b09cd2bde97970beceaef5990ff386b10 Ether
[ Download CSV Export 
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
EntropySponsorFarm

Compiler Version
v0.8.2+commit.661d1103

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion
File 1 of 7 : EntropySponsorFarm.sol
// SPDX-License-Identifier: GPL 3.0
pragma solidity ^0.8.2;

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

contract EntropySponsorFarm is Ownable {
	using SafeMath for uint256;
	using SafeERC20 for IERC20;
	// Info of each user.
	struct UserInfo {
		uint256 amount; // How many sponsor tokens the user has provided.
		uint256 rewardDebt; // Reward debt. See explanation below.
		//
		// We do some fancy math here. Basically, any point in time, the amount of ENTROPYs
		// entitled to a user but is pending to be distributed is:
		//
		//   pending reward = (user.amount * pool.accEntropyPerShare) - user.rewardDebt
		//
		// Whenever a user deposits or withdraws sponsor tokens to a pool. Here's what happens:
		//   1. The pool's `accEntropyPerShare` (and `lastRewardBlock`) gets updated.
		//   2. User receives the pending reward sent to his/her address.
		//   3. User's `amount` gets updated.
		//   4. User's `rewardDebt` gets updated.
	}
	// Info of each pool.
	struct PoolInfo {
		uint256 allocPoint; // How many allocation points assigned to this pool. ENTROPYs to distribute per block.
		uint256 lastRewardBlock; // Last block number that ENTROPYs distribution occurs.
		uint256 accEntropyPerShare; // Accumulated ENTROPYs per share, times 1e12. See below.
	}
	// The ENTROPY TOKEN!
	IERC20 public immutable entropy;
	// ENTROPY tokens created per block.
	uint256 public entropyPerBlock;
	// Info of each pool.
	PoolInfo[] public poolInfo;
	// Info of sponsor token.
	IERC20[] public sponsorToken;
	// check if the sponsor token already been added or not
	mapping(address => bool) public isTokenAdded;
	// check the pool ID from a specific sponsor token
	mapping(address => uint256) public getPoolID;
	// Info of each user that stakes sponsor tokens.
	mapping(uint256 => mapping(address => UserInfo)) public userInfo;
	// Total allocation poitns. Must be the sum of all allocation points in all pools.
	uint256 public totalAllocPoint = 0;

	// user actions event
	event Deposit(address indexed user, uint256 indexed pid, uint256 amount);
	event Withdraw(address indexed user, uint256 indexed pid, uint256 amount);
	event Claim(address indexed user, uint256 indexed pid, uint256 amount);
	event EmergencyWithdraw(address indexed user, uint256 indexed pid, uint256 amount);
	// admin actions event
	event LogPoolAddition(uint256 indexed pid, uint256 allocPoint, IERC20 indexed sponsorToken, bool withUpdate);
	event LogSetPool(uint256 indexed pid, uint256 allocPoint, IERC20 indexed sponsorToken, bool withUpdate);
	event LogUpdatePool(uint256 indexed pid, uint256 lastRewardBlock, IERC20 indexed sponsorToken, uint256 accEntropyPerShare);

	modifier validatePoolByPid(uint256 _pid) {
		require(_pid < poolInfo.length, "SPFARM: Pool does not exist");
		_;
	}

	constructor(address _entropy, uint256 _entropyPerBlock) {
		entropy = IERC20(_entropy);
		entropyPerBlock = _entropyPerBlock;
	}

	function poolLength() external view returns (uint256) {
		return poolInfo.length;
	}

	// Add a new sponsor token to the pool. Can only be called by the owner.
	function add(
		uint256 _allocPoint,
		address _sponsorToken,
		bool _withUpdate
	) external onlyOwner {
		require(isTokenAdded[_sponsorToken] == false, "SPFARM: SPONSOR TOKEN ALREADY IN POOL");
		isTokenAdded[_sponsorToken] = true;
		if (_withUpdate) {
			massUpdatePools();
		}
		uint256 lastRewardBlock = block.number;
		totalAllocPoint = totalAllocPoint.add(_allocPoint);
		sponsorToken.push(IERC20(_sponsorToken));
		poolInfo.push(PoolInfo({ allocPoint: _allocPoint, lastRewardBlock: lastRewardBlock, accEntropyPerShare: 0 }));
		getPoolID[_sponsorToken] = poolInfo.length.sub(1);
		emit LogPoolAddition(poolInfo.length.sub(1), _allocPoint, IERC20(_sponsorToken), _withUpdate);
	}

	// Update the given pool's ENTROPY allocation point. Can only be called by the owner.
	function set(
		uint256 _pid,
		uint256 _allocPoint,
		bool _withUpdate
	) external onlyOwner validatePoolByPid(_pid) {
		if (_withUpdate) {
			massUpdatePools();
		}
		totalAllocPoint = totalAllocPoint.sub(poolInfo[_pid].allocPoint).add(_allocPoint);
		poolInfo[_pid].allocPoint = _allocPoint;
		emit LogSetPool(_pid, _allocPoint, sponsorToken[_pid], _withUpdate);
	}

	// View function to see pending ENTROPYs on frontend.
	function pendingEntropy(uint256 _pid, address _user) external view validatePoolByPid(_pid) returns (uint256) {
		PoolInfo storage pool = poolInfo[_pid];
		UserInfo storage user = userInfo[_pid][_user];
		uint256 accEntropyPerShare = pool.accEntropyPerShare;
		uint256 sponsorSupply = sponsorToken[_pid].balanceOf(address(this));
		if (block.number > pool.lastRewardBlock && sponsorSupply != 0) {
			uint256 blocks = block.number.sub(pool.lastRewardBlock);
			uint256 entropyReward = blocks.mul(entropyPerBlock).mul(pool.allocPoint).div(totalAllocPoint);
			accEntropyPerShare = accEntropyPerShare.add(entropyReward.mul(1e12).div(sponsorSupply));
		}
		return user.amount.mul(accEntropyPerShare).div(1e12).sub(user.rewardDebt);
	}

	// Update reward vairables for all pools. Be careful of gas spending!
	function massUpdatePools() public {
		uint256 length = poolInfo.length;
		for (uint256 pid = 0; pid < length; ++pid) {
			updatePool(pid);
		}
	}

	// Update reward variables of the given pool to be up-to-date.
	function updatePool(uint256 _pid) public validatePoolByPid(_pid) {
		PoolInfo storage pool = poolInfo[_pid];
		if (block.number <= pool.lastRewardBlock) {
			return;
		}
		uint256 sponsorSupply = sponsorToken[_pid].balanceOf(address(this));
		if (sponsorSupply == 0) {
			pool.lastRewardBlock = block.number;
			return;
		}
		uint256 blocks = block.number.sub(pool.lastRewardBlock);
		uint256 entropyReward = blocks.mul(entropyPerBlock).mul(pool.allocPoint).div(totalAllocPoint);
		pool.accEntropyPerShare = pool.accEntropyPerShare.add(entropyReward.mul(1e12).div(sponsorSupply));
		pool.lastRewardBlock = block.number;
		emit LogUpdatePool(_pid, pool.lastRewardBlock, sponsorToken[_pid], pool.accEntropyPerShare);
	}

	// Deposit sponsor tokens to MasterChef for ENTROPY allocation.
	function deposit(uint256 _pid, uint256 _amount) external validatePoolByPid(_pid) {
		PoolInfo storage pool = poolInfo[_pid];
		UserInfo storage user = userInfo[_pid][msg.sender];
		updatePool(_pid);
		if (user.amount > 0) {
			uint256 pending = user.amount.mul(pool.accEntropyPerShare).div(1e12).sub(user.rewardDebt);
			safeEntropyTransfer(msg.sender, pending);
		}
		sponsorToken[_pid].safeTransferFrom(address(msg.sender), address(this), _amount);
		user.amount = user.amount.add(_amount);
		user.rewardDebt = user.amount.mul(pool.accEntropyPerShare).div(1e12);
		emit Deposit(msg.sender, _pid, _amount);
	}

	// Withdraw sponsor tokens from MasterChef.
	function withdraw(uint256 _pid, uint256 _amount) external validatePoolByPid(_pid) {
		PoolInfo storage pool = poolInfo[_pid];
		UserInfo storage user = userInfo[_pid][msg.sender];
		require(user.amount >= _amount, "SPFARM: INSUFFICIENT BALANCE");
		updatePool(_pid);

		uint256 pending = user.amount.mul(pool.accEntropyPerShare).div(1e12).sub(user.rewardDebt);
		safeEntropyTransfer(msg.sender, pending);
		emit Claim(msg.sender, _pid, pending);

		user.amount = user.amount.sub(_amount);
		user.rewardDebt = user.amount.mul(pool.accEntropyPerShare).div(1e12);
		sponsorToken[_pid].safeTransfer(address(msg.sender), _amount);
		emit Withdraw(msg.sender, _pid, _amount);
	}

	// Claim mint entropy tokens
	function claim(uint256 _pid) external validatePoolByPid(_pid) {
		PoolInfo storage pool = poolInfo[_pid];
		UserInfo storage user = userInfo[_pid][msg.sender];
		updatePool(_pid);
		uint256 accumulatedEntropy = user.amount.mul(pool.accEntropyPerShare).div(1e12);
		uint256 pending = accumulatedEntropy.sub(user.rewardDebt);
		user.rewardDebt = accumulatedEntropy;
		safeEntropyTransfer(msg.sender, pending);
		emit Claim(msg.sender, _pid, pending);
	}

	// Withdraw without caring about rewards. EMERGENCY ONLY.
	function emergencyWithdraw(uint256 _pid) external validatePoolByPid(_pid) {
		UserInfo storage user = userInfo[_pid][msg.sender];

		uint256 amount = user.amount;
		user.amount = 0;
		user.rewardDebt = 0;

		sponsorToken[_pid].safeTransfer(address(msg.sender), amount);
		emit EmergencyWithdraw(msg.sender, _pid, user.amount);
	}

	// Safe entropy transfer function, just in case if rounding error causes pool to not have enough ENTROPYs.
	function safeEntropyTransfer(address _to, uint256 _amount) private {
		uint256 entropyBal = entropy.balanceOf(address(this));
		if (_amount > entropyBal) {
			entropy.transfer(_to, entropyBal);
		} else {
			entropy.transfer(_to, _amount);
		}
	}
}

File 2 of 7 : 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 7 : 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 7 : 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 5 of 7 : 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 6 of 7 : 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 7 of 7 : 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"
      ]
    }
  },
  "metadata": {
    "useLiteralContent": true
  },
  "libraries": {}
}

Contract ABI

[{"inputs":[{"internalType":"address","name":"_entropy","type":"address"},{"internalType":"uint256","name":"_entropyPerBlock","type":"uint256"}],"stateMutability":"nonpayable","type":"constructor"},{"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":"Claim","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":"Deposit","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":"EmergencyWithdraw","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"pid","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"allocPoint","type":"uint256"},{"indexed":true,"internalType":"contract IERC20","name":"sponsorToken","type":"address"},{"indexed":false,"internalType":"bool","name":"withUpdate","type":"bool"}],"name":"LogPoolAddition","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"pid","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"allocPoint","type":"uint256"},{"indexed":true,"internalType":"contract IERC20","name":"sponsorToken","type":"address"},{"indexed":false,"internalType":"bool","name":"withUpdate","type":"bool"}],"name":"LogSetPool","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"pid","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"lastRewardBlock","type":"uint256"},{"indexed":true,"internalType":"contract IERC20","name":"sponsorToken","type":"address"},{"indexed":false,"internalType":"uint256","name":"accEntropyPerShare","type":"uint256"}],"name":"LogUpdatePool","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":"Withdraw","type":"event"},{"inputs":[{"internalType":"uint256","name":"_allocPoint","type":"uint256"},{"internalType":"address","name":"_sponsorToken","type":"address"},{"internalType":"bool","name":"_withUpdate","type":"bool"}],"name":"add","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"}],"name":"claim","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"deposit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"}],"name":"emergencyWithdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"entropy","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"entropyPerBlock","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"getPoolID","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"isTokenAdded","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"massUpdatePools","outputs":[],"stateMutability":"nonpayable","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":"pendingEntropy","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"poolInfo","outputs":[{"internalType":"uint256","name":"allocPoint","type":"uint256"},{"internalType":"uint256","name":"lastRewardBlock","type":"uint256"},{"internalType":"uint256","name":"accEntropyPerShare","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"poolLength","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"},{"internalType":"uint256","name":"_allocPoint","type":"uint256"},{"internalType":"bool","name":"_withUpdate","type":"bool"}],"name":"set","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"sponsorToken","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalAllocPoint","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","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":"rewardDebt","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"}]

60a0604052600060075534801561001557600080fd5b5060405162001ac838038062001ac8833981016040819052610036916100aa565b61003f3361005a565b60609190911b6001600160601b0319166080526001556100e2565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600080604083850312156100bc578182fd5b82516001600160a01b03811681146100d2578283fd5b6020939093015192949293505050565b60805160601c6119b262000116600039600081816101ca015281816111900152818161124201526112ea01526119b26000f3fe608060405234801561001057600080fd5b50600436106101375760003560e01c8063630b5ba1116100b85780638da5cb5b1161007c5780638da5cb5b1461027c57806393f1a40b1461028d578063a36532b2146102d4578063b6506a9714610307578063e2bbb15814610327578063f2fde38b1461033a57610137565b8063630b5ba11461023d57806364482f79146102455780636c0106fa14610258578063715018a61461026b57806384bfdcba1461027357610137565b8063441a3e70116100ff578063441a3e70146101b257806347ce07cc146101c557806351eb05a6146102045780635312ea8e1461021757806362c9a43d1461022a57610137565b8063081e3eda1461013c5780631526fe271461015357806317caf6f1146101815780631eaaa0451461018a578063379607f51461019f575b600080fd5b6002545b6040519081526020015b60405180910390f35b610166610161366004611700565b61034d565b6040805193845260208401929092529082015260600161014a565b61014060075481565b61019d61019836600461175b565b610380565b005b61019d6101ad366004611700565b6105ce565b61019d6101c036600461179a565b6106df565b6101ec7f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b03909116815260200161014a565b61019d610212366004611700565b6108c5565b61019d610225366004611700565b610ad9565b6101ec610238366004611700565b610b85565b61019d610baf565b61019d6102533660046117bb565b610bd6565b610140610266366004611730565b610d2b565b61019d610f06565b61014060015481565b6000546001600160a01b03166101ec565b6102bf61029b366004611730565b60066020908152600092835260408084209091529082529020805460019091015482565b6040805192835260208301919091520161014a565b6102f76102e23660046116ca565b60046020526000908152604090205460ff1681565b604051901515815260200161014a565b6101406103153660046116ca565b60056020526000908152604090205481565b61019d61033536600461179a565b610f3c565b61019d6103483660046116ca565b6110a6565b6002818154811061035d57600080fd5b600091825260209091206003909102018054600182015460029092015490925083565b6000546001600160a01b031633146103b35760405162461bcd60e51b81526004016103aa90611837565b60405180910390fd5b6001600160a01b03821660009081526004602052604090205460ff161561042a5760405162461bcd60e51b815260206004820152602560248201527f53504641524d3a2053504f4e534f5220544f4b454e20414c524541445920494e604482015264081413d3d360da1b60648201526084016103aa565b6001600160a01b0382166000908152600460205260409020805460ff19166001179055801561045b5761045b610baf565b600754439061046a9085611141565b60075560038054600180820183557fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b90910180546001600160a01b0319166001600160a01b038716179055604080516060810182528781526020810185815260009282018381526002805480870182559481905292517f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ace9490960293840195909555517f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5acf83015592517f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ad090910155905461056391611154565b6001600160a01b03841660008181526005602052604090209190915560025461058d906001611154565b6040805187815285151560208201527fad5b09333e221a3ab1ec48f5594f2ba9fd1c56d813d8928281574015e18c0a5b91015b60405180910390a350505050565b600254819081106105f15760405162461bcd60e51b81526004016103aa9061186c565b60006002838154811061061457634e487b7160e01b600052603260045260246000fd5b60009182526020808320868452600682526040808520338652909252922060039091029091019150610645846108c5565b600061067164e8d4a5100061066b8560020154856000015461116090919063ffffffff16565b9061116c565b9050600061068c83600101548361115490919063ffffffff16565b60018401839055905061069f3382611178565b604051818152869033907f34fcbac0073d7c3d388e51312faf357774904998eeb8fca628b9e6f65ee1cbf7906020015b60405180910390a3505050505050565b600254829081106107025760405162461bcd60e51b81526004016103aa9061186c565b60006002848154811061072557634e487b7160e01b600052603260045260246000fd5b60009182526020808320878452600682526040808520338652909252922080546003909202909201925084111561079e5760405162461bcd60e51b815260206004820152601c60248201527f53504641524d3a20494e53554646494349454e542042414c414e43450000000060448201526064016103aa565b6107a7856108c5565b60006107db82600101546107d564e8d4a5100061066b8760020154876000015461116090919063ffffffff16565b90611154565b90506107e73382611178565b604051818152869033907f34fcbac0073d7c3d388e51312faf357774904998eeb8fca628b9e6f65ee1cbf79060200160405180910390a3815461082a9086611154565b80835560028401546108479164e8d4a510009161066b9190611160565b826001018190555061089133866003898154811061087557634e487b7160e01b600052603260045260246000fd5b6000918252602090912001546001600160a01b0316919061136d565b604051858152869033907ff279e6a1f5e320cca91135676d9cb6e44ca8a08c0b88342bcdb1144f6511b568906020016106cf565b600254819081106108e85760405162461bcd60e51b81526004016103aa9061186c565b60006002838154811061090b57634e487b7160e01b600052603260045260246000fd5b906000526020600020906003020190508060010154431161092c5750610ad5565b60006003848154811061094f57634e487b7160e01b600052603260045260246000fd5b6000918252602090912001546040516370a0823160e01b81523060048201526001600160a01b03909116906370a082319060240160206040518083038186803b15801561099b57600080fd5b505afa1580156109af573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109d39190611718565b9050806109e7575043600190910155610ad5565b6000610a0083600101544361115490919063ffffffff16565b90506000610a2d60075461066b8660000154610a276001548761116090919063ffffffff16565b90611160565b9050610a50610a458461066b8464e8d4a51000611160565b600286015490611141565b60028501554360018501556003805487908110610a7d57634e487b7160e01b600052603260045260246000fd5b600091825260209182902001546001860154600287015460408051928352938201526001600160a01b039091169188917f6249d10e9027bf710bc27387709e839bc4166063108ed277ab28a32cec45031191016106cf565b5050565b60025481908110610afc5760405162461bcd60e51b81526004016103aa9061186c565b600082815260066020908152604080832033808552925282208054838255600182019390935560038054919392610b4f92909184918890811061087557634e487b7160e01b600052603260045260246000fd5b8154604051908152849033907fbb757047c2b5f3974fe26b7c10f732e7bce710b0952a71082702781e62ae0595906020016105c0565b60038181548110610b9557600080fd5b6000918252602090912001546001600160a01b0316905081565b60025460005b81811015610ad557610bc6816108c5565b610bcf8161193d565b9050610bb5565b6000546001600160a01b03163314610c005760405162461bcd60e51b81526004016103aa90611837565b60025483908110610c235760405162461bcd60e51b81526004016103aa9061186c565b8115610c3157610c31610baf565b610c7983610c7360028781548110610c5957634e487b7160e01b600052603260045260246000fd5b600091825260209091206003909102015460075490611154565b90611141565b6007819055508260028581548110610ca157634e487b7160e01b600052603260045260246000fd5b90600052602060002090600302016000018190555060038481548110610cd757634e487b7160e01b600052603260045260246000fd5b6000918252602091829020015460408051868152851515938101939093526001600160a01b039091169186917f95895a6ab1df54420d241b55243258a33e61b2194db66c1179ec521aae8e186591016105c0565b60025460009083908110610d515760405162461bcd60e51b81526004016103aa9061186c565b600060028581548110610d7457634e487b7160e01b600052603260045260246000fd5b600091825260208083208884526006825260408085206001600160a01b038a168652909252908320600392830290910160028101548354919550919391929089908110610dd157634e487b7160e01b600052603260045260246000fd5b6000918252602090912001546040516370a0823160e01b81523060048201526001600160a01b03909116906370a082319060240160206040518083038186803b158015610e1d57600080fd5b505afa158015610e31573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e559190611718565b9050836001015443118015610e6957508015155b15610ed2576000610e8785600101544361115490919063ffffffff16565b90506000610eae60075461066b8860000154610a276001548761116090919063ffffffff16565b9050610ecd610ec68461066b8464e8d4a51000611160565b8590611141565b935050505b610efa83600101546107d564e8d4a5100061066b86886000015461116090919063ffffffff16565b98975050505050505050565b6000546001600160a01b03163314610f305760405162461bcd60e51b81526004016103aa90611837565b610f3a60006113d0565b565b60025482908110610f5f5760405162461bcd60e51b81526004016103aa9061186c565b600060028481548110610f8257634e487b7160e01b600052603260045260246000fd5b60009182526020808320878452600682526040808520338652909252922060039091029091019150610fb3856108c5565b805415610ff6576000610fe882600101546107d564e8d4a5100061066b8760020154876000015461116090919063ffffffff16565b9050610ff43382611178565b505b61103a3330866003898154811061101d57634e487b7160e01b600052603260045260246000fd5b6000918252602090912001546001600160a01b0316929190611420565b80546110469085611141565b80825560028301546110639164e8d4a510009161066b9190611160565b6001820155604051848152859033907f90890809c654f11d6e72a28fa60149770a0d11ec6c92319d6ceb2bb0a4ea1a159060200160405180910390a35050505050565b6000546001600160a01b031633146110d05760405162461bcd60e51b81526004016103aa90611837565b6001600160a01b0381166111355760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016103aa565b61113e816113d0565b50565b600061114d82846118a3565b9392505050565b600061114d82846118fa565b600061114d82846118db565b600061114d82846118bb565b6040516370a0823160e01b81523060048201526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906370a082319060240160206040518083038186803b1580156111da57600080fd5b505afa1580156111ee573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112129190611718565b9050808211156112c45760405163a9059cbb60e01b81526001600160a01b038481166004830152602482018390527f0000000000000000000000000000000000000000000000000000000000000000169063a9059cbb90604401602060405180830381600087803b15801561128657600080fd5b505af115801561129a573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112be91906116e4565b50611368565b60405163a9059cbb60e01b81526001600160a01b038481166004830152602482018490527f0000000000000000000000000000000000000000000000000000000000000000169063a9059cbb90604401602060405180830381600087803b15801561132e57600080fd5b505af1158015611342573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061136691906116e4565b505b505050565b6040516001600160a01b03831660248201526044810182905261136890849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152611458565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6040516001600160a01b03808516602483015283166044820152606481018290526113669085906323b872dd60e01b90608401611399565b60006114ad826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b031661152a9092919063ffffffff16565b80519091501561136857808060200190518101906114cb91906116e4565b6113685760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016103aa565b60606115398484600085611541565b949350505050565b6060824710156115a25760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016103aa565b6115ab85611670565b6115f75760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016103aa565b600080866001600160a01b0316858760405161161391906117e8565b60006040518083038185875af1925050503d8060008114611650576040519150601f19603f3d011682016040523d82523d6000602084013e611655565b606091505b509150915061166582828661167a565b979650505050505050565b803b15155b919050565b6060831561168957508161114d565b8251156116995782518084602001fd5b8160405162461bcd60e51b81526004016103aa9190611804565b80356001600160a01b038116811461167557600080fd5b6000602082840312156116db578081fd5b61114d826116b3565b6000602082840312156116f5578081fd5b815161114d8161196e565b600060208284031215611711578081fd5b5035919050565b600060208284031215611729578081fd5b5051919050565b60008060408385031215611742578081fd5b82359150611752602084016116b3565b90509250929050565b60008060006060848603121561176f578081fd5b8335925061177f602085016116b3565b9150604084013561178f8161196e565b809150509250925092565b600080604083850312156117ac578182fd5b50508035926020909101359150565b6000806000606084860312156117cf578283fd5b8335925060208401359150604084013561178f8161196e565b600082516117fa818460208701611911565b9190910192915050565b6000602082528251806020840152611823816040850160208701611911565b601f01601f19169190910160400192915050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b6020808252601b908201527f53504641524d3a20506f6f6c20646f6573206e6f742065786973740000000000604082015260600190565b600082198211156118b6576118b6611958565b500190565b6000826118d657634e487b7160e01b81526012600452602481fd5b500490565b60008160001904831182151516156118f5576118f5611958565b500290565b60008282101561190c5761190c611958565b500390565b60005b8381101561192c578181015183820152602001611914565b838111156113665750506000910152565b600060001982141561195157611951611958565b5060010190565b634e487b7160e01b600052601160045260246000fd5b801515811461113e57600080fdfea26469706673582212200cc4e371f4ccd1e0d3c396285118e17dd75a0c297d227213c10e115a3e1c0e4264736f6c634300080200330000000000000000000000000bce57a3b09cd2bde97970beceaef5990ff386b1000000000000000000000000000000000000000000000001158e460913d00000

Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)

0000000000000000000000000bce57a3b09cd2bde97970beceaef5990ff386b1000000000000000000000000000000000000000000000001158e460913d00000

-----Decoded View---------------
Arg [0] : _entropy (address): 0x0bce57a3b09cd2bde97970beceaef5990ff386b1
Arg [1] : _entropyPerBlock (uint256): 20000000000000000000

-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 0000000000000000000000000bce57a3b09cd2bde97970beceaef5990ff386b1
Arg [1] : 000000000000000000000000000000000000000000000001158e460913d00000


Block Transaction Difficulty Gas Used Reward
Block Uncle Number Difficulty Gas Used Reward
Loading

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