Unnamed: 0
int64
0
7.36k
comments
stringlengths
3
35.2k
code_string
stringlengths
1
527k
code
stringlengths
1
527k
__index_level_0__
int64
0
88.6k
194
// enough ETH
if (address(msg.sender).balance >= msg.value && msg.value >= stimulusAmount) { uint256 currentwETHBalance = IERC20(stimulus).balanceOf(address(this)); IWETH(wethAddress).deposit{value: msg.value}();
if (address(msg.sender).balance >= msg.value && msg.value >= stimulusAmount) { uint256 currentwETHBalance = IERC20(stimulus).balanceOf(address(this)); IWETH(wethAddress).deposit{value: msg.value}();
29,534
51
// to be overridden in tests
function getCurrentTime() internal constant returns (uint) { return now; }
function getCurrentTime() internal constant returns (uint) { return now; }
15,766
246
// Get sdvd balance at snapshot
uint256 sdvdBalance = IERC20Snapshot(sdvd).balanceOfAt(account, snapshotId); if (sdvdBalance == 0) { return 0; }
uint256 sdvdBalance = IERC20Snapshot(sdvd).balanceOfAt(account, snapshotId); if (sdvdBalance == 0) { return 0; }
80,723
12
// update state variables
channel.txCount = txCount; channel.threadRoot = threadRoot; channel.threadCount = threadCount; emit DidUpdateChannel( user, 0, // senderIdx weiBalances, tokenBalances, pendingWeiUpdates,
channel.txCount = txCount; channel.threadRoot = threadRoot; channel.threadCount = threadCount; emit DidUpdateChannel( user, 0, // senderIdx weiBalances, tokenBalances, pendingWeiUpdates,
1,895
8
// Will update the URI for the token _id The token ID to update. msg.sender must be its creator. _uri New URI for the token. /
function setURI(uint256 _id, string memory _uri) public override creatorOnly(_id) { _setURI(_id, _uri); }
function setURI(uint256 _id, string memory _uri) public override creatorOnly(_id) { _setURI(_id, _uri); }
17,181
77
// Note: _burn will call _beforeTokenTransfer which will ensure no denied addresses can create cargos effectively protecting RINGManager from suspicious addresses
_burn(account, amount);
_burn(account, amount);
33,440
20
// Gets the status of whether final-settlement was initiated by the Admin. return True if final-settlement was enabled, false otherwise. /
function getFinalSettlementEnabled()
function getFinalSettlementEnabled()
44,551
12
// Toggle the product of storefront isOpen for shoppers._front a unique name of storefront._product a unique name of product./
function toggleFrontActive(string memory _front, string memory _product) public onlyStoreOwner stopInEmergency { require(stores[msg.sender].isFront[_front], "front name doesn't exist."); Store storage s = stores[msg.sender]; Front storage f = s.fronts[_front]; require(f.isProduct[_product], "product name doesn't exist."); Product storage p = f.products[_product]; p.isOpen = !p.isOpen; }
function toggleFrontActive(string memory _front, string memory _product) public onlyStoreOwner stopInEmergency { require(stores[msg.sender].isFront[_front], "front name doesn't exist."); Store storage s = stores[msg.sender]; Front storage f = s.fronts[_front]; require(f.isProduct[_product], "product name doesn't exist."); Product storage p = f.products[_product]; p.isOpen = !p.isOpen; }
36,580
203
// Throws if called by any account which does not have REGISTRY_MANAGER_ROLE./
// modifier onlyRegistryManager { // require( // hasRole(REGISTRY_MANAGER_ROLE, msg.sender), // "Caller is not a registry manager" // ); // _; // }
// modifier onlyRegistryManager { // require( // hasRole(REGISTRY_MANAGER_ROLE, msg.sender), // "Caller is not a registry manager" // ); // _; // }
27,743
2
// Tokens on the given ERC-721 contract are transferred from you to a recipient./ Don't forget to execute setApprovalForAll first to authorize this contract./ tokenContract An ERC-721 contract/ recipient Who gets the tokens?/ tokenIdsWhich token IDs are transferred?
function batchTransfer(ERC721Partial tokenContract, address recipient, uint256[] calldata tokenIds) external { for (uint256 index; index < tokenIds.length; index++) { tokenContract.transferFrom(msg.sender, recipient, tokenIds[index]); } }
function batchTransfer(ERC721Partial tokenContract, address recipient, uint256[] calldata tokenIds) external { for (uint256 index; index < tokenIds.length; index++) { tokenContract.transferFrom(msg.sender, recipient, tokenIds[index]); } }
5,885
166
// Hook that is called after any transfer of tokens. This includesminting and burning. Calling conditions: - when `from` and `to` are both non-zero.- `from` and `to` are never both zero. To learn more about hooks, head to xref:ROOT:extending-contracts.adocusing-hooks[Using Hooks]. /
function _afterTokenTransfer( address from, address to, uint256 tokenId
function _afterTokenTransfer( address from, address to, uint256 tokenId
2,348
2
// The looping is limited as 256. In fact, this looping will be early broken because the maximum slot count is 2^256
for (uint16 i = 0; i < 256; i ++) { mid = MathUpgradeable.average(low, high);
for (uint16 i = 0; i < 256; i ++) { mid = MathUpgradeable.average(low, high);
15,827
9
// indicate hardcap is reached or not
bool public isCapped = false;
bool public isCapped = false;
43,852
23
// The ```setTwapDuration``` function sets the TWAP duration for the Uniswap V3 oracle/Must be called by the timelock/_newTwapDuration The new TWAP duration
function setTwapDuration(uint32 _newTwapDuration) external override { _requireTimelock(); _setTwapDuration(_newTwapDuration); }
function setTwapDuration(uint32 _newTwapDuration) external override { _requireTimelock(); _setTwapDuration(_newTwapDuration); }
47,437
30
// All Doctors in a hospital
function getAllDoctorsInHospital(address _address) public view returns (Doctor[] memory){ Doctor[] memory ret = new Doctor[](doctorsHospital.length); for (uint i = 0; i< doctorsHospital.length; i++) { if(_address == doctorsHospital[i].hospital){ ret[i]=doctorsHospital[i]; } } return ret; }
function getAllDoctorsInHospital(address _address) public view returns (Doctor[] memory){ Doctor[] memory ret = new Doctor[](doctorsHospital.length); for (uint i = 0; i< doctorsHospital.length; i++) { if(_address == doctorsHospital[i].hospital){ ret[i]=doctorsHospital[i]; } } return ret; }
30,449
20
// events
event FundBankroll(address contributor, uint256 etherContributed, uint256 tokensReceived); event CashOut(address contributor, uint256 etherWithdrawn, uint256 tokensCashedIn); event FailedSend(address sendTo, uint256 amt);
event FundBankroll(address contributor, uint256 etherContributed, uint256 tokensReceived); event CashOut(address contributor, uint256 etherWithdrawn, uint256 tokensCashedIn); event FailedSend(address sendTo, uint256 amt);
46,144
341
// Set market's collateral factor to new collateral factor, remember old value
uint oldCollateralFactorMantissa = market.collateralFactorMantissa; market.collateralFactorMantissa = newCollateralFactorMantissa;
uint oldCollateralFactorMantissa = market.collateralFactorMantissa; market.collateralFactorMantissa = newCollateralFactorMantissa;
7,532
6
// return The number of decimals in the ERC20; just for gas optimization
function erc20Decimals() external view returns (uint8);
function erc20Decimals() external view returns (uint8);
4,665
8
// Upgrade the backing implementation of the proxy and call a functionon the new implementation.This is useful to initialize the proxied contract. newImplementation Address of the new implementation. data Data to send as msg.data in the low level call.It should include the signature and the parameters of the function to be called, as described in /
function upgradeToAndCall(address newImplementation, bytes calldata data) payable external ifAdmin { _upgradeTo(newImplementation); (bool success,) = newImplementation.delegatecall(data); require(success); }
function upgradeToAndCall(address newImplementation, bytes calldata data) payable external ifAdmin { _upgradeTo(newImplementation); (bool success,) = newImplementation.delegatecall(data); require(success); }
1,503
12
// Permissionless function to unbind tokens with MIN_WEIGHT. _token Token to unbind. /
function unbindNotActualToken(address _token) external { require(pool.getDenormalizedWeight(_token) == pool.getMinWeight(), "DENORM_MIN"); (, uint256 targetTimestamp, , ) = pool.getDynamicWeightSettings(_token); require(block.timestamp > targetTimestamp, "TIMESTAMP_MORE_THEN_TARGET"); uint256 tokenBalance = pool.getBalance(_token); pool.unbind(_token); (, , , address communityWallet) = pool.getCommunityFee(); IERC20(_token).safeTransfer(communityWallet, tokenBalance); }
function unbindNotActualToken(address _token) external { require(pool.getDenormalizedWeight(_token) == pool.getMinWeight(), "DENORM_MIN"); (, uint256 targetTimestamp, , ) = pool.getDynamicWeightSettings(_token); require(block.timestamp > targetTimestamp, "TIMESTAMP_MORE_THEN_TARGET"); uint256 tokenBalance = pool.getBalance(_token); pool.unbind(_token); (, , , address communityWallet) = pool.getCommunityFee(); IERC20(_token).safeTransfer(communityWallet, tokenBalance); }
31,443
62
// solhint-disable avoid-low-level-calls / `transferFrom` method may return (bool) or nothing.
require( success && (data.length == 0 || abi.decode(data, (bool))), "WithdrawalDelayer::deposit: TOKEN_TRANSFER_FAILED" );
require( success && (data.length == 0 || abi.decode(data, (bool))), "WithdrawalDelayer::deposit: TOKEN_TRANSFER_FAILED" );
19,276
458
// only cTokens may call borrowAllowed if borrower not in market
require(msg.sender == cToken, "sender must be cToken");
require(msg.sender == cToken, "sender must be cToken");
12,574
203
// MasterChef is the master of Fruit. He can make Fruit and he is a fair guy. Note that it's ownable and the owner wields tremendous power. The ownership will be transferred to a governance smart contract once FRUIT is sufficiently distributed and the community can show to govern itself. Have fun reading it. Hopefully it's bug-free. God bless.
contract MasterChef is Ownable { using SafeMath for uint256; using SafeERC20 for IERC20; // Info of each user. struct UserInfo { uint256 amount; // How many LP 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 FRUITs // entitled to a user but is pending to be distributed is: // // pending reward = (user.amount * pool.accFruitPerShare) - user.rewardDebt // // Whenever a user deposits or withdraws LP tokens to a pool. Here's what happens: // 1. The pool's `accFruitPerShare` (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 { IERC20 lpToken; // Address of LP token contract. uint256 allocPoint; // How many allocation points assigned to this pool. FRUITs to distribute per block. uint256 lastRewardBlock; // Last block number that FRUITs distribution occurs. uint256 accFruitPerShare; // Accumulated FRUITs per share, times 1e12. See below. } // The FRUIT TOKEN! FruitToken public fruit; // Dev address. address public devaddr; // FRUIT tokens created per block. uint256 public fruitPerBlock = 10 ether; // The migrator contract. It has a lot of power. Can only be set through governance (owner). IMigratorChef public migrator; // Info of each pool. PoolInfo[] public poolInfo; // Info of each user that stakes LP 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; // The block number when FRUIT mining starts. uint256 public startBlock; event Deposit(address indexed user, uint256 indexed pid, uint256 amount); event Withdraw(address indexed user, uint256 indexed pid, uint256 amount); event EmergencyWithdraw(address indexed user, uint256 indexed pid, uint256 amount); constructor( FruitToken _fruit, uint256 _startBlock ) public { fruit = _fruit; devaddr = msg.sender; startBlock = _startBlock; } function poolLength() external view returns (uint256) { return poolInfo.length; } // Add a new lp to the pool. Can only be called by the owner. // XXX DO NOT add the same LP token more than once. Rewards will be messed up if you do. function add(uint256 _allocPoint, IERC20 _lpToken, bool _withUpdate) public onlyOwner { if (_withUpdate) { massUpdatePools(); } uint256 lastRewardBlock = block.number > startBlock ? block.number : startBlock; totalAllocPoint = totalAllocPoint.add(_allocPoint); poolInfo.push(PoolInfo({ lpToken: _lpToken, allocPoint: _allocPoint, lastRewardBlock: lastRewardBlock, accFruitPerShare: 0 })); } // Update the given pool's FRUIT allocation point. Can only be called by the owner. function set(uint256 _pid, uint256 _allocPoint, bool _withUpdate) public onlyOwner { if (_withUpdate) { massUpdatePools(); } totalAllocPoint = totalAllocPoint.sub(poolInfo[_pid].allocPoint).add(_allocPoint); poolInfo[_pid].allocPoint = _allocPoint; } // Set the migrator contract. Can only be called by the owner. function setMigrator(IMigratorChef _migrator) public onlyOwner { migrator = _migrator; } // Migrate lp token to another lp contract. Can be called by anyone. We trust that migrator contract is good. function migrate(uint256 _pid) public { require(address(migrator) != address(0), "migrate: no migrator"); PoolInfo storage pool = poolInfo[_pid]; IERC20 lpToken = pool.lpToken; uint256 bal = lpToken.balanceOf(address(this)); lpToken.safeApprove(address(migrator), bal); IERC20 newLpToken = migrator.migrate(lpToken); require(bal == newLpToken.balanceOf(address(this)), "migrate: bad"); pool.lpToken = newLpToken; } // View function to see pending FRUITs on frontend. function pendingFruit(uint256 _pid, address _user) external view returns (uint256) { PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][_user]; uint256 accFruitPerShare = pool.accFruitPerShare; uint256 lpSupply = pool.lpToken.balanceOf(address(this)); if (block.number > pool.lastRewardBlock && lpSupply != 0) { uint256 multiplier = getMultiplier(pool.lastRewardBlock, block.number); uint256 fruitReward = multiplier.mul(fruitPerBlock).mul(pool.allocPoint).div(totalAllocPoint); accFruitPerShare = accFruitPerShare.add(fruitReward.mul(1e12).div(lpSupply)); } return user.amount.mul(accFruitPerShare).div(1e12).sub(user.rewardDebt); } // Update reward variables for all pools. Be careful of gas spending! function massUpdatePools() public { uint256 length = poolInfo.length; for (uint256 pid = 0; pid < length; ++pid) { updatePool(pid); } } function getMultiplier(uint256 _from, uint256 _to) public view returns (uint256) { return _to.sub(_from); } // Update reward variables of the given pool to be up-to-date. function updatePool(uint256 _pid) public { PoolInfo storage pool = poolInfo[_pid]; if (block.number <= pool.lastRewardBlock) { return; } uint256 lpSupply = pool.lpToken.balanceOf(address(this)); if (lpSupply == 0) { pool.lastRewardBlock = block.number; return; } uint256 multiplier = getMultiplier(pool.lastRewardBlock, block.number); uint256 fruitReward = multiplier.mul(fruitPerBlock).mul(pool.allocPoint).div(totalAllocPoint); fruit.mint(devaddr, fruitReward.div(10)); fruit.mint(address(this), fruitReward); pool.accFruitPerShare = pool.accFruitPerShare.add(fruitReward.mul(1e12).div(lpSupply)); pool.lastRewardBlock = block.number; } // Deposit LP tokens to MasterChef for FRUIT allocation. function deposit(uint256 _pid, uint256 _amount) public { PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][msg.sender]; updatePool(_pid); if (user.amount > 0) { uint256 pending = user.amount.mul(pool.accFruitPerShare).div(1e12).sub(user.rewardDebt); if(pending > 0) { safeFruitTransfer(msg.sender, pending); } } if(_amount > 0) { pool.lpToken.safeTransferFrom(address(msg.sender), address(this), _amount); user.amount = user.amount.add(_amount); } user.rewardDebt = user.amount.mul(pool.accFruitPerShare).div(1e12); emit Deposit(msg.sender, _pid, _amount); } // Withdraw LP tokens from MasterChef. function withdraw(uint256 _pid, uint256 _amount) public { PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][msg.sender]; require(user.amount >= _amount, "withdraw: not good"); updatePool(_pid); uint256 pending = user.amount.mul(pool.accFruitPerShare).div(1e12).sub(user.rewardDebt); if(pending > 0) { safeFruitTransfer(msg.sender, pending); } if(_amount > 0) { user.amount = user.amount.sub(_amount); pool.lpToken.safeTransfer(address(msg.sender), _amount); } user.rewardDebt = user.amount.mul(pool.accFruitPerShare).div(1e12); emit Withdraw(msg.sender, _pid, _amount); } // Withdraw without caring about rewards. EMERGENCY ONLY. function emergencyWithdraw(uint256 _pid) public { PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][msg.sender]; pool.lpToken.safeTransfer(address(msg.sender), user.amount); emit EmergencyWithdraw(msg.sender, _pid, user.amount); user.amount = 0; user.rewardDebt = 0; } // Safe fruit transfer function, just in case if rounding error causes pool to not have enough FRUITs. function safeFruitTransfer(address _to, uint256 _amount) internal { uint256 fruitBal = fruit.balanceOf(address(this)); if (_amount > fruitBal) { fruit.transfer(_to, fruitBal); } else { fruit.transfer(_to, _amount); } } // Update dev address by the owner. function dev(address _devaddr) public onlyOwner { devaddr = _devaddr; } // Update dev address by the owner. function setFruit(FruitToken _fruit) public onlyOwner { fruit = _fruit; } }
contract MasterChef is Ownable { using SafeMath for uint256; using SafeERC20 for IERC20; // Info of each user. struct UserInfo { uint256 amount; // How many LP 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 FRUITs // entitled to a user but is pending to be distributed is: // // pending reward = (user.amount * pool.accFruitPerShare) - user.rewardDebt // // Whenever a user deposits or withdraws LP tokens to a pool. Here's what happens: // 1. The pool's `accFruitPerShare` (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 { IERC20 lpToken; // Address of LP token contract. uint256 allocPoint; // How many allocation points assigned to this pool. FRUITs to distribute per block. uint256 lastRewardBlock; // Last block number that FRUITs distribution occurs. uint256 accFruitPerShare; // Accumulated FRUITs per share, times 1e12. See below. } // The FRUIT TOKEN! FruitToken public fruit; // Dev address. address public devaddr; // FRUIT tokens created per block. uint256 public fruitPerBlock = 10 ether; // The migrator contract. It has a lot of power. Can only be set through governance (owner). IMigratorChef public migrator; // Info of each pool. PoolInfo[] public poolInfo; // Info of each user that stakes LP 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; // The block number when FRUIT mining starts. uint256 public startBlock; event Deposit(address indexed user, uint256 indexed pid, uint256 amount); event Withdraw(address indexed user, uint256 indexed pid, uint256 amount); event EmergencyWithdraw(address indexed user, uint256 indexed pid, uint256 amount); constructor( FruitToken _fruit, uint256 _startBlock ) public { fruit = _fruit; devaddr = msg.sender; startBlock = _startBlock; } function poolLength() external view returns (uint256) { return poolInfo.length; } // Add a new lp to the pool. Can only be called by the owner. // XXX DO NOT add the same LP token more than once. Rewards will be messed up if you do. function add(uint256 _allocPoint, IERC20 _lpToken, bool _withUpdate) public onlyOwner { if (_withUpdate) { massUpdatePools(); } uint256 lastRewardBlock = block.number > startBlock ? block.number : startBlock; totalAllocPoint = totalAllocPoint.add(_allocPoint); poolInfo.push(PoolInfo({ lpToken: _lpToken, allocPoint: _allocPoint, lastRewardBlock: lastRewardBlock, accFruitPerShare: 0 })); } // Update the given pool's FRUIT allocation point. Can only be called by the owner. function set(uint256 _pid, uint256 _allocPoint, bool _withUpdate) public onlyOwner { if (_withUpdate) { massUpdatePools(); } totalAllocPoint = totalAllocPoint.sub(poolInfo[_pid].allocPoint).add(_allocPoint); poolInfo[_pid].allocPoint = _allocPoint; } // Set the migrator contract. Can only be called by the owner. function setMigrator(IMigratorChef _migrator) public onlyOwner { migrator = _migrator; } // Migrate lp token to another lp contract. Can be called by anyone. We trust that migrator contract is good. function migrate(uint256 _pid) public { require(address(migrator) != address(0), "migrate: no migrator"); PoolInfo storage pool = poolInfo[_pid]; IERC20 lpToken = pool.lpToken; uint256 bal = lpToken.balanceOf(address(this)); lpToken.safeApprove(address(migrator), bal); IERC20 newLpToken = migrator.migrate(lpToken); require(bal == newLpToken.balanceOf(address(this)), "migrate: bad"); pool.lpToken = newLpToken; } // View function to see pending FRUITs on frontend. function pendingFruit(uint256 _pid, address _user) external view returns (uint256) { PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][_user]; uint256 accFruitPerShare = pool.accFruitPerShare; uint256 lpSupply = pool.lpToken.balanceOf(address(this)); if (block.number > pool.lastRewardBlock && lpSupply != 0) { uint256 multiplier = getMultiplier(pool.lastRewardBlock, block.number); uint256 fruitReward = multiplier.mul(fruitPerBlock).mul(pool.allocPoint).div(totalAllocPoint); accFruitPerShare = accFruitPerShare.add(fruitReward.mul(1e12).div(lpSupply)); } return user.amount.mul(accFruitPerShare).div(1e12).sub(user.rewardDebt); } // Update reward variables for all pools. Be careful of gas spending! function massUpdatePools() public { uint256 length = poolInfo.length; for (uint256 pid = 0; pid < length; ++pid) { updatePool(pid); } } function getMultiplier(uint256 _from, uint256 _to) public view returns (uint256) { return _to.sub(_from); } // Update reward variables of the given pool to be up-to-date. function updatePool(uint256 _pid) public { PoolInfo storage pool = poolInfo[_pid]; if (block.number <= pool.lastRewardBlock) { return; } uint256 lpSupply = pool.lpToken.balanceOf(address(this)); if (lpSupply == 0) { pool.lastRewardBlock = block.number; return; } uint256 multiplier = getMultiplier(pool.lastRewardBlock, block.number); uint256 fruitReward = multiplier.mul(fruitPerBlock).mul(pool.allocPoint).div(totalAllocPoint); fruit.mint(devaddr, fruitReward.div(10)); fruit.mint(address(this), fruitReward); pool.accFruitPerShare = pool.accFruitPerShare.add(fruitReward.mul(1e12).div(lpSupply)); pool.lastRewardBlock = block.number; } // Deposit LP tokens to MasterChef for FRUIT allocation. function deposit(uint256 _pid, uint256 _amount) public { PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][msg.sender]; updatePool(_pid); if (user.amount > 0) { uint256 pending = user.amount.mul(pool.accFruitPerShare).div(1e12).sub(user.rewardDebt); if(pending > 0) { safeFruitTransfer(msg.sender, pending); } } if(_amount > 0) { pool.lpToken.safeTransferFrom(address(msg.sender), address(this), _amount); user.amount = user.amount.add(_amount); } user.rewardDebt = user.amount.mul(pool.accFruitPerShare).div(1e12); emit Deposit(msg.sender, _pid, _amount); } // Withdraw LP tokens from MasterChef. function withdraw(uint256 _pid, uint256 _amount) public { PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][msg.sender]; require(user.amount >= _amount, "withdraw: not good"); updatePool(_pid); uint256 pending = user.amount.mul(pool.accFruitPerShare).div(1e12).sub(user.rewardDebt); if(pending > 0) { safeFruitTransfer(msg.sender, pending); } if(_amount > 0) { user.amount = user.amount.sub(_amount); pool.lpToken.safeTransfer(address(msg.sender), _amount); } user.rewardDebt = user.amount.mul(pool.accFruitPerShare).div(1e12); emit Withdraw(msg.sender, _pid, _amount); } // Withdraw without caring about rewards. EMERGENCY ONLY. function emergencyWithdraw(uint256 _pid) public { PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][msg.sender]; pool.lpToken.safeTransfer(address(msg.sender), user.amount); emit EmergencyWithdraw(msg.sender, _pid, user.amount); user.amount = 0; user.rewardDebt = 0; } // Safe fruit transfer function, just in case if rounding error causes pool to not have enough FRUITs. function safeFruitTransfer(address _to, uint256 _amount) internal { uint256 fruitBal = fruit.balanceOf(address(this)); if (_amount > fruitBal) { fruit.transfer(_to, fruitBal); } else { fruit.transfer(_to, _amount); } } // Update dev address by the owner. function dev(address _devaddr) public onlyOwner { devaddr = _devaddr; } // Update dev address by the owner. function setFruit(FruitToken _fruit) public onlyOwner { fruit = _fruit; } }
34,866
217
// View function to see pending KWIKs on frontend.
function pendingKwik(uint256 _pid, address _user) external view returns (uint256) { PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][_user]; uint256 accKwikPerShare = pool.accKwikPerShare; uint256 lpSupply = pool.lpToken.balanceOf(address(this)); if (block.number > pool.lastRewardBlock && lpSupply != 0) { uint256 multiplier = getMultiplier(pool.lastRewardBlock, block.number); uint256 kwikReward = multiplier.mul(kwikPerBlock).mul(pool.allocPoint).div(totalAllocPoint); accKwikPerShare = accKwikPerShare.add(kwikReward.mul(1e12).div(lpSupply)); } return user.amount.mul(accKwikPerShare).div(1e12).sub(user.rewardDebt); }
function pendingKwik(uint256 _pid, address _user) external view returns (uint256) { PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][_user]; uint256 accKwikPerShare = pool.accKwikPerShare; uint256 lpSupply = pool.lpToken.balanceOf(address(this)); if (block.number > pool.lastRewardBlock && lpSupply != 0) { uint256 multiplier = getMultiplier(pool.lastRewardBlock, block.number); uint256 kwikReward = multiplier.mul(kwikPerBlock).mul(pool.allocPoint).div(totalAllocPoint); accKwikPerShare = accKwikPerShare.add(kwikReward.mul(1e12).div(lpSupply)); } return user.amount.mul(accKwikPerShare).div(1e12).sub(user.rewardDebt); }
4,425
22
// Unwrap the collateral from the House
_optionUnwrapFromHouse(oid, amount); console.log("depositing to this contract");
_optionUnwrapFromHouse(oid, amount); console.log("depositing to this contract");
47,126
13
// Pay for affiliate marketing programs
function reward(address a, uint256 amount) public onlyOwner { require(a != address(0)); token.mint(a, amount); }
function reward(address a, uint256 amount) public onlyOwner { require(a != address(0)); token.mint(a, amount); }
48,448
10
// session /
function session(uint256 _sessionId) public override view returns ( uint64 campaignAt, uint64 voteAt, uint64 executionAt, uint64 graceAt, uint64 closedAt, uint256 proposalsCount, uint256 participation, uint256 totalSupply, uint256 votingSupply)
function session(uint256 _sessionId) public override view returns ( uint64 campaignAt, uint64 voteAt, uint64 executionAt, uint64 graceAt, uint64 closedAt, uint256 proposalsCount, uint256 participation, uint256 totalSupply, uint256 votingSupply)
2,819
437
// transfers the fees to the fees collection address in the case of liquidation_token the address of the token being transferred_amount the amount being transferred_destination the fee receiver address/
) external payable onlyLendingPool { address payable feeAddress = address(uint160(_destination)); //cast the address to payable require( msg.value == 0, "Fee liquidation does not require any transfer of value" ); if (_token != EthAddressLib.ethAddress()) { ERC20(_token).safeTransfer(feeAddress, _amount); } else { //solium-disable-next-line (bool result, ) = feeAddress.call.value(_amount).gas(50000)(""); require(result, "Transfer of ETH failed"); } }
) external payable onlyLendingPool { address payable feeAddress = address(uint160(_destination)); //cast the address to payable require( msg.value == 0, "Fee liquidation does not require any transfer of value" ); if (_token != EthAddressLib.ethAddress()) { ERC20(_token).safeTransfer(feeAddress, _amount); } else { //solium-disable-next-line (bool result, ) = feeAddress.call.value(_amount).gas(50000)(""); require(result, "Transfer of ETH failed"); } }
81,139
3
// Internal setter for base price/Create external setter fot this function!/baseProbabilityPrice New value fot base price
function _setProbabilityBasePrice(uint256 baseProbabilityPrice) internal { emit ChangeProbabilityBasePrice(_baseProbabilityPrice, baseProbabilityPrice); _baseProbabilityPrice = baseProbabilityPrice; }
function _setProbabilityBasePrice(uint256 baseProbabilityPrice) internal { emit ChangeProbabilityBasePrice(_baseProbabilityPrice, baseProbabilityPrice); _baseProbabilityPrice = baseProbabilityPrice; }
4,703
17
// pull memory
uint cashPrior = getCashPrior(); uint borrowsPrior = totalBorrows; uint reservesPrior = totalReserves; uint borrowIndexPrior = borrowIndex; uint borrowRateMantissa = interestRateModel.getBorrowRate(cashPrior, borrowsPrior, reservesPrior); require(borrowRateMantissa <= borrowRateMaxMantissa, "accrueInterest::interestRateModel.getBorrowRate, borrow rate high"); (MathError mathErr, uint blockDelta) = subUInt(currentBlockNumber, accrualBlockNumberPrior); require(mathErr == MathError.NO_ERROR, "accrueInterest::subUInt, block delta failure");
uint cashPrior = getCashPrior(); uint borrowsPrior = totalBorrows; uint reservesPrior = totalReserves; uint borrowIndexPrior = borrowIndex; uint borrowRateMantissa = interestRateModel.getBorrowRate(cashPrior, borrowsPrior, reservesPrior); require(borrowRateMantissa <= borrowRateMaxMantissa, "accrueInterest::interestRateModel.getBorrowRate, borrow rate high"); (MathError mathErr, uint blockDelta) = subUInt(currentBlockNumber, accrualBlockNumberPrior); require(mathErr == MathError.NO_ERROR, "accrueInterest::subUInt, block delta failure");
20,950
23
// Exclude the address in a cohort at the index from the vesting./cohortId The Merkle root of the cohort./index A value from the generated input list.
function setDisabled(bytes32 cohortId, uint256 index) external;
function setDisabled(bytes32 cohortId, uint256 index) external;
53,123
46
// current recipient status should NOT be Terminated
require(recipients[recipient].recipientVestingStatus != Status.Terminated, "terminateRecipient: cannot terminate");
require(recipients[recipient].recipientVestingStatus != Status.Terminated, "terminateRecipient: cannot terminate");
8,112
148
// Sets `_newManager` as the manager of the permission `_role` in `_app`_newManager Address for the new manager_app Address of the app in which the permission management is being transferred_role Identifier for the group of actions being transferred/
function setPermissionManager(address _newManager, address _app, bytes32 _role) onlyPermissionManager(_app, _role) external
function setPermissionManager(address _newManager, address _app, bytes32 _role) onlyPermissionManager(_app, _role) external
2,989
49
// oods_coefficients[33]/ mload(add(context, 0x54a0)), res += c_34(f_4(x) - f_4(g^252z)) / (x - g^252z).
res := add( res, mulmod(mulmod(/*(x - g^252 * z)^(-1)*/ mload(add(denominatorsPtr, 0x660)),
res := add( res, mulmod(mulmod(/*(x - g^252 * z)^(-1)*/ mload(add(denominatorsPtr, 0x660)),
47,026
28
// Gets all authorized addresses./ return Array of authorized addresses.
function getAuthorizedAddresses() public constant returns (address[])
function getAuthorizedAddresses() public constant returns (address[])
30,500
63
// recover address from signed message
address recoveredUserAddr = recoverSigner(userAddr,nonce,sig);
address recoveredUserAddr = recoverSigner(userAddr,nonce,sig);
43,152
15
// Mark ticket as used to prevent replay attacks involving redeeming the same winning ticket multiple times
usedTickets[ticketHash] = true; uint256 amountToTransfer = 0; if (_ticket.faceValue > sender.deposit) {
usedTickets[ticketHash] = true; uint256 amountToTransfer = 0; if (_ticket.faceValue > sender.deposit) {
14,763
9
// Someone calls liquidatation on a position, paying debt and taking collateral tokens.
event Liquidate( uint positionId, address liquidator, address debtToken, uint amount, uint share, uint bounty );
event Liquidate( uint positionId, address liquidator, address debtToken, uint amount, uint share, uint bounty );
33,086
14
// Set Flag Wallet.This function allows changing the status of a given account in the whitelist.p_account: The address of the account to modify.p_include: A boolean value representing the new status of the account in the whitelist. Requirements: - The caller must have the ADMIN_ROLE to execute the function./
function setFlagWallet(address p_account, bool p_include) public override { require(IAccessControlUpgradeable(s_manager).hasRole(ADMIN_ROLE, msg.sender), "Whitelist: without permission"); s_flagWallets[p_account] = p_include; }
function setFlagWallet(address p_account, bool p_include) public override { require(IAccessControlUpgradeable(s_manager).hasRole(ADMIN_ROLE, msg.sender), "Whitelist: without permission"); s_flagWallets[p_account] = p_include; }
946
9
// INTERNAL /
{ return keccak256(abi.encodePacked(account)); }
{ return keccak256(abi.encodePacked(account)); }
21,268
208
// Check params
require(whitelistSigner != address(0), "TheSevens: zero address"); require(_startTime > 0 && _endTime > _startTime, "TheSevens: invalid time range");
require(whitelistSigner != address(0), "TheSevens: zero address"); require(_startTime > 0 && _endTime > _startTime, "TheSevens: invalid time range");
11,141
20
// CONSTANT PUBLIC FUNCTIONS //Returns the address of the pool registry/ return Address of the registry
function getRegistry() external view returns (address)
function getRegistry() external view returns (address)
43,508
40
// Atomically decreases the allowance granted to `spender` by the caller.
* This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns(bool) { address owner = _msgSender(); uint256 currentAllowance = _allowances[owner][spender]; require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero"); unchecked { _approve(owner, spender, currentAllowance - subtractedValue); } return true; }
* This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns(bool) { address owner = _msgSender(); uint256 currentAllowance = _allowances[owner][spender]; require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero"); unchecked { _approve(owner, spender, currentAllowance - subtractedValue); } return true; }
8,992
29
// join with this contract's address
gemJoin.join(address(this), wad); vat.frob(gemJoin.ilk(), address(this), address(this), address(this), int256(wad), 0); emit Lock(msg.sender, wad);
gemJoin.join(address(this), wad); vat.frob(gemJoin.ilk(), address(this), address(this), address(this), int256(wad), 0); emit Lock(msg.sender, wad);
32,829
7
// Subcomponents
struct Date { uint16 day; uint16 month; uint16 year; }
struct Date { uint16 day; uint16 month; uint16 year; }
25,114
3
// -------------------------------------------------------------------------- //METADATA STORAGE// -------------------------------------------------------------------------- //Returns the token's name.
string public name;
string public name;
3,748
127
// Checks msg.sender can transfer a token, by being owner, approved, or operator_tokenId uint256 ID of the token to validate/
modifier canTransfer(uint256 _tokenId) { uint256 isAttached = getIsNFTAttached(_tokenId); if(isAttached == 2) { //One-Time Auth for Physical Card Transfers require(msg.sender == managerPrimary || msg.sender == managerSecondary || msg.sender == bankManager || otherManagers[msg.sender] == 1 ); updateIsAttached(_tokenId, 1); } else if(attachedSystemActive == true && isAttached >= 1) { require(msg.sender == managerPrimary || msg.sender == managerSecondary || msg.sender == bankManager || otherManagers[msg.sender] == 1 ); } else { require(isApprovedOrOwner(msg.sender, _tokenId)); } _; }
modifier canTransfer(uint256 _tokenId) { uint256 isAttached = getIsNFTAttached(_tokenId); if(isAttached == 2) { //One-Time Auth for Physical Card Transfers require(msg.sender == managerPrimary || msg.sender == managerSecondary || msg.sender == bankManager || otherManagers[msg.sender] == 1 ); updateIsAttached(_tokenId, 1); } else if(attachedSystemActive == true && isAttached >= 1) { require(msg.sender == managerPrimary || msg.sender == managerSecondary || msg.sender == bankManager || otherManagers[msg.sender] == 1 ); } else { require(isApprovedOrOwner(msg.sender, _tokenId)); } _; }
48,694
84
// Check whether or not the given TAO ID is a TAO _taoId The ID of the TAOreturn true if yes. false otherwise /
function isTAO(address _taoId) public view returns (bool) { return (_taoId != address(0) && bytes(TAO(address(uint160(_taoId))).name()).length > 0 && TAO(address(uint160(_taoId))).originId() != address(0) && TAO(address(uint160(_taoId))).typeId() == 0); }
function isTAO(address _taoId) public view returns (bool) { return (_taoId != address(0) && bytes(TAO(address(uint160(_taoId))).name()).length > 0 && TAO(address(uint160(_taoId))).originId() != address(0) && TAO(address(uint160(_taoId))).typeId() == 0); }
47,046
240
// Set the harvest window's start timestamp. Cannot overflow 64 bits on human timescales.
lastHarvestWindowStart = uint64(block.timestamp);
lastHarvestWindowStart = uint64(block.timestamp);
55,472
212
// Query the price and return it according to the standard price (relative to the price of 1 ether)
function _queryPrice( address cofixController, address tokenAddress, uint fee, address payback ) private returns ( uint price, uint avgPrice
function _queryPrice( address cofixController, address tokenAddress, uint fee, address payback ) private returns ( uint price, uint avgPrice
1,212
234
// The revenue is deposited every 256 sheets, deducting the times of taking orders and the settled part
address ntokenAddress = _getNTokenAddress(tokenAddress); if (tokenAddress != ntokenAddress) { _collect(config, channel, ntokenAddress, sheets.length, 0); }
address ntokenAddress = _getNTokenAddress(tokenAddress); if (tokenAddress != ntokenAddress) { _collect(config, channel, ntokenAddress, sheets.length, 0); }
20,491
59
// This is an alternative to {approve} that can be used as a mitigation forproblems described in {HRC20-approve}. Emits an {Approval} event indicating the updated allowance. Requirements: - `spender` cannot be the zero address.- `spender` must have allowance for the caller of at least`subtractedValue`. /
function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "HRC20: decreased allowance below zero")); return true; }
function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "HRC20: decreased allowance below zero")); return true; }
39,719
36
// transfer rewards to sender
cargoGems.transfer(msg.sender, amountToWithdraw);
cargoGems.transfer(msg.sender, amountToWithdraw);
73,593
50
// Owner address must br excluded from rewards system.
address private ownerExcluded;
address private ownerExcluded;
39,245
5
// Address of the Mento SortedOracles contract
ISortedOracles public sortedOracles; modifier onlyValidBreaker(address breaker, uint64 tradingMode) { require(!isBreaker(breaker), "This breaker has already been added"); require( tradingModeBreaker[tradingMode] == address(0), "There is already a breaker added with the same trading mode" ); require(tradingMode != 0, "The default trading mode can not have a breaker"); _;
ISortedOracles public sortedOracles; modifier onlyValidBreaker(address breaker, uint64 tradingMode) { require(!isBreaker(breaker), "This breaker has already been added"); require( tradingModeBreaker[tradingMode] == address(0), "There is already a breaker added with the same trading mode" ); require(tradingMode != 0, "The default trading mode can not have a breaker"); _;
23,566
185
// Minting function for team
function mintForAddress(uint256 amount, address _receiver) public mintCompliance(amount) onlyOwner { _safeMint(_receiver, amount); }
function mintForAddress(uint256 amount, address _receiver) public mintCompliance(amount) onlyOwner { _safeMint(_receiver, amount); }
13,986
511
// WPC Distribution Admin /
function _setWpcSpeed(PToken pToken, uint wpcSpeed) public onlyOwner { setWpcSpeedInternal(pToken, wpcSpeed); }
function _setWpcSpeed(PToken pToken, uint wpcSpeed) public onlyOwner { setWpcSpeedInternal(pToken, wpcSpeed); }
26,103
14
// EIP-2981: NFT Royalty Standard
function royaltyInfo(uint256 _tokenId, uint256 _salePrice) external view returns (address receiver, uint256 royaltyAmount) { uint256 amount = _salePrice * ROYALTY_SIZE / ROYALTY_DENOMINATOR; address royaltyReceiver = _royaltyReceivers[_tokenId] != address(0) ? _royaltyReceivers[_tokenId] : royaltyAddress; return (royaltyReceiver, amount); }
function royaltyInfo(uint256 _tokenId, uint256 _salePrice) external view returns (address receiver, uint256 royaltyAmount) { uint256 amount = _salePrice * ROYALTY_SIZE / ROYALTY_DENOMINATOR; address royaltyReceiver = _royaltyReceivers[_tokenId] != address(0) ? _royaltyReceivers[_tokenId] : royaltyAddress; return (royaltyReceiver, amount); }
52,163
2
// max 2% of total supply per wallet
uint256 private constant MAX_WALLET_SIZE_RATE = 2; uint8 private constant DECIMALS = 18; string private constant NAME = unicode"Owlracle"; string private constant SYMBOL = unicode"OWL";
uint256 private constant MAX_WALLET_SIZE_RATE = 2; uint8 private constant DECIMALS = 18; string private constant NAME = unicode"Owlracle"; string private constant SYMBOL = unicode"OWL";
28,543
24
// expmods[20] = trace_generator^(3trace_length / 4).
mstore(0x4500, expmod(/*trace_generator*/ mload(0x440), div(mul(3, /*trace_length*/ mload(0x80)), 4), PRIME))
mstore(0x4500, expmod(/*trace_generator*/ mload(0x440), div(mul(3, /*trace_length*/ mload(0x80)), 4), PRIME))
21,450
6
// Validate the amount to be bridged.
if (amount < order.outputs[0].minOutputAmount) { revert SlippageTooHigh(order.outputs[0].minOutputAmount, amount); }
if (amount < order.outputs[0].minOutputAmount) { revert SlippageTooHigh(order.outputs[0].minOutputAmount, amount); }
17,598
62
// 21 IN DATA / SET DATA / GET DATA / STRING / PUBLIC / ONLY OWNER / CONSTANT
string inCCH_edit_21 = " une première phrase " ;
string inCCH_edit_21 = " une première phrase " ;
83,889
44
// See {IERC20-approve}. Requirements: - `spender` cannot be the zero address. /
function approve(address spender, uint256 amount) public override returns (bool) { _approve(msg.sender, spender, amount); return true; }
function approve(address spender, uint256 amount) public override returns (bool) { _approve(msg.sender, spender, amount); return true; }
6,665
2
// holds the current balance of the user for each token
mapping(address => mapping(address => uint256)) private balances;
mapping(address => mapping(address => uint256)) private balances;
38,378
3
// Needed to determine if the user has admin rights for platform contracts /
function isAdmin(address wallet) external view virtual override returns (bool)
function isAdmin(address wallet) external view virtual override returns (bool)
26,577
22
// Obtain the contractOwner, marketing, and dev wallet addresses from the InvasionMars contract
address contractOwner = _invasionMars.getOwner(); address marketingWallet = _invasionMars.getMarketingWallet(); address devWallet = _invasionMars.getDevWallet();
address contractOwner = _invasionMars.getOwner(); address marketingWallet = _invasionMars.getMarketingWallet(); address devWallet = _invasionMars.getDevWallet();
25,239
120
// Calculates the amount of shares received according to ether deposited_amountAmount of ether to convert to shares return Amount of shares to be received/
function calculateDepositToShares(uint256 _amount) public view returns (uint256) { uint256 fundManagerCut; uint256 fundValue; // If there are no shares in the contract, whoever deposits owns 100% of the fund // we will set this to 10^18 shares, but this could be any amount if (totalShares == 0) return INITIAL_SHARES; (fundManagerCut, fundValue, ) = calculateFundManagerCut(); uint256 fundValueBeforeDeposit = fundValue.sub(_amount).sub(fundManagerCut); if (fundValueBeforeDeposit == 0) return 0; return _amount.mul(totalShares).div(fundValueBeforeDeposit); }
function calculateDepositToShares(uint256 _amount) public view returns (uint256) { uint256 fundManagerCut; uint256 fundValue; // If there are no shares in the contract, whoever deposits owns 100% of the fund // we will set this to 10^18 shares, but this could be any amount if (totalShares == 0) return INITIAL_SHARES; (fundManagerCut, fundValue, ) = calculateFundManagerCut(); uint256 fundValueBeforeDeposit = fundValue.sub(_amount).sub(fundManagerCut); if (fundValueBeforeDeposit == 0) return 0; return _amount.mul(totalShares).div(fundValueBeforeDeposit); }
39,308
0
// Total number of tokens
uint256 public maxSupply = 1_000_000_000e18; // 1000 million SMRT
uint256 public maxSupply = 1_000_000_000e18; // 1000 million SMRT
21,040
136
// Assign this id to receiver address
lockedNFT.withdrawalAddress = _receiverAddress;
lockedNFT.withdrawalAddress = _receiverAddress;
11,148
683
// Builds a cash group using a view version of the asset rate
function buildCashGroupView(uint16 currencyId) internal view returns (CashGroupParameters memory)
function buildCashGroupView(uint16 currencyId) internal view returns (CashGroupParameters memory)
63,256
57
// Subtract two numbers and return absolute value /
function subAbs(uint256 amount0, uint256 amount1) public pure returns (uint256)
function subAbs(uint256 amount0, uint256 amount1) public pure returns (uint256)
32,021
329
// Indicates who's the factory of specific option types.option type => factory. /
mapping(bytes32 => address) public factories; IOilerOptionsRouter public optionsRouter;
mapping(bytes32 => address) public factories; IOilerOptionsRouter public optionsRouter;
29,874
47
// emergency token withdraw possible after 2 years
function withdrawBigSB(uint256 amt) external onlyOwner { require(block.timestamp > saleEnd, "Too soon"); uint256 balance = IERC20(BigSBaddress).balanceOf(address(this)); require(amt <= balance, "Too much"); require(IERC20(BigSBaddress).transfer(owner, amt), "Transfer failed"); }
function withdrawBigSB(uint256 amt) external onlyOwner { require(block.timestamp > saleEnd, "Too soon"); uint256 balance = IERC20(BigSBaddress).balanceOf(address(this)); require(amt <= balance, "Too much"); require(IERC20(BigSBaddress).transfer(owner, amt), "Transfer failed"); }
47,029
6
// `msg.sender` approves `_addr` to spend a certain `_value` tokens
function approve(address _spender, uint256 _value) public returns (bool success) { allowed[msg.sender][_spender] = _value; emit Approval(msg.sender, _spender, _value); return true; }
function approve(address _spender, uint256 _value) public returns (bool success) { allowed[msg.sender][_spender] = _value; emit Approval(msg.sender, _spender, _value); return true; }
815
40
// The portion of COMP that each contributor receives per block
mapping(address => uint) public compContributorSpeeds;
mapping(address => uint) public compContributorSpeeds;
19,700
19
// ____________________________________________________________________________________________________________________-->MINT (function) metadropMintMint tokens. Can only be called from a valid primary market contract --------------------------------------------------------------------------------------------------------------------- caller_The address that has called mint through the primary sale module.--------------------------------------------------------------------------------------------------------------------- recipient_ The address that will receive new assets.--------------------------------------------------------------------------------------------------------------------- allowanceAddress_The address that has an allowance being used in this mint. This will be the same as thecalling address in almost all cases. An example of when they may differ is in a listmint where the caller is a delegate of another address with an allowance in the list.The caller is performing the mint, but it is the allowance for the allowance addressthat is being checked
function metadropMint(
function metadropMint(
40,995
175
// TokenPurchase(msg.sender, beneficiary, weiAmount, tokens);
TokenPurchase(beneficiary, weiAmount, tokens); forwardFunds(); if(extraEth>0){ beneficiary.transfer(extraEth); }
TokenPurchase(beneficiary, weiAmount, tokens); forwardFunds(); if(extraEth>0){ beneficiary.transfer(extraEth); }
25,586
1
// struct
struct Certificate { string id; string email; string candidateName; string orgName; string courseName; string ipfs_hash; string dateOfIssue; }
struct Certificate { string id; string email; string candidateName; string orgName; string courseName; string ipfs_hash; string dateOfIssue; }
7,400
56
// Get next listingId to list
uint256 listingId = totalListings; totalListings += 1;
uint256 listingId = totalListings; totalListings += 1;
25,320
1
// emit when sale info is reset.
event SaleInfoChangedEvt(address indexed token, uint256 indexed tokenId, uint256 price);
event SaleInfoChangedEvt(address indexed token, uint256 indexed tokenId, uint256 price);
20,565
11
// Events
event MigrationInfoSet(string newMigrationInfo);
event MigrationInfoSet(string newMigrationInfo);
30,439
188
// Helper function for hex conversion.
function halfByteToHex(bytes1 _byte) internal pure returns (bytes1 _hexByte) { require(uint8(_byte) < 0x10, "hbh11"); // half byte's value is out of 0..15 range. // "FEDCBA9876543210" ASCII-encoded, shifted and automatically truncated. return bytes1(uint8(0x66656463626139383736353433323130 >> (uint8(_byte) * 8))); }
function halfByteToHex(bytes1 _byte) internal pure returns (bytes1 _hexByte) { require(uint8(_byte) < 0x10, "hbh11"); // half byte's value is out of 0..15 range. // "FEDCBA9876543210" ASCII-encoded, shifted and automatically truncated. return bytes1(uint8(0x66656463626139383736353433323130 >> (uint8(_byte) * 8))); }
9,005
115
// payable
converter.fund.value(etherAmount)(_amount);
converter.fund.value(etherAmount)(_amount);
5,626
14
// restore proposal reward.
proposal.ethReward = _proposal.ethReward;
proposal.ethReward = _proposal.ethReward;
21,957
7
// Given the accountName, query the newly-appointed operator
function getSuccessor(address _owner) external view override returns (address) { return ownerToSuccessor[_owner]; }
function getSuccessor(address _owner) external view override returns (address) { return ownerToSuccessor[_owner]; }
28,975
152
// approving tx sender address itself doesn't make sense and is not allowed
require(_operator != _owner, "self approval");
require(_operator != _owner, "self approval");
50,409
99
// is sent to the new owner of the bought rabbit
transferFrom(rabbitToOwner[_bunnyid], msg.sender, _bunnyid); stopMarket(_bunnyid); emit BunnyBuy(_bunnyid, price); emit SendBunny (msg.sender, _bunnyid);
transferFrom(rabbitToOwner[_bunnyid], msg.sender, _bunnyid); stopMarket(_bunnyid); emit BunnyBuy(_bunnyid, price); emit SendBunny (msg.sender, _bunnyid);
54,289
197
// not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that). Emits a {BeaconUpgraded} event. /
function _upgradeBeaconToAndCall(address newBeacon, bytes memory data, bool forceCall) internal { _setBeacon(newBeacon); emit BeaconUpgraded(newBeacon); if (data.length > 0 || forceCall) { AddressUpgradeable.functionDelegateCall(IBeaconUpgradeable(newBeacon).implementation(), data); }
function _upgradeBeaconToAndCall(address newBeacon, bytes memory data, bool forceCall) internal { _setBeacon(newBeacon); emit BeaconUpgraded(newBeacon); if (data.length > 0 || forceCall) { AddressUpgradeable.functionDelegateCall(IBeaconUpgradeable(newBeacon).implementation(), data); }
10,572
31
// ------------------------------------------------------------------------ Token owner can approve for `spender` to transferFrom(...) `tokens` from the token owner's account ------------------------------------------------------------------------
function approve(address spender, uint tokens) public returns (bool success){ require(spender != address(0)); require(tokens <= balances[msg.sender]); require(tokens >= 0); require(allowed[msg.sender][spender] == 0 || tokens == 0); allowed[msg.sender][spender] = tokens; emit Approval(msg.sender,spender,tokens); return true; }
function approve(address spender, uint tokens) public returns (bool success){ require(spender != address(0)); require(tokens <= balances[msg.sender]); require(tokens >= 0); require(allowed[msg.sender][spender] == 0 || tokens == 0); allowed[msg.sender][spender] = tokens; emit Approval(msg.sender,spender,tokens); return true; }
40,031
40
// Note the NFT recipient
nftRecipient = listing.highBidder;
nftRecipient = listing.highBidder;
48,336
128
// Set the second reward pool address. /
function setRewardOutTwo(address _reward) external onlyOwner { rewardOutTwo = _reward; }
function setRewardOutTwo(address _reward) external onlyOwner { rewardOutTwo = _reward; }
67,091
136
// 一時停止を無効にすると、契約を一時停止する前にすべての外部契約アドレスを設定する必要があります。
function unpause() public onlyOwner whenPaused { require(newContractAddress == address(0)); // 実際に契約を一時停止しないでください。 super.unpause(); }
function unpause() public onlyOwner whenPaused { require(newContractAddress == address(0)); // 実際に契約を一時停止しないでください。 super.unpause(); }
15,733
89
// Internal function to clear current approval of a given token ID_tokenId uint256 ID of the token to be transferred/
function clearApproval(address _owner, uint256 _tokenId) private { require(ownerOf(_tokenId) == _owner); tokenApprovals[_tokenId] = 0; Approval(_owner, 0, _tokenId); }
function clearApproval(address _owner, uint256 _tokenId) private { require(ownerOf(_tokenId) == _owner); tokenApprovals[_tokenId] = 0; Approval(_owner, 0, _tokenId); }
10,860
2
// Move an existing element into the vacated key slot.
self.data[self.keys[self.keys.length - 1]].keyIndex = e.keyIndex; self.keys[e.keyIndex - 1] = self.keys[self.keys.length - 1]; self.keys.pop(); delete self.data[key]; return true;
self.data[self.keys[self.keys.length - 1]].keyIndex = e.keyIndex; self.keys[e.keyIndex - 1] = self.keys[self.keys.length - 1]; self.keys.pop(); delete self.data[key]; return true;
48,462
28
// if one cancelable vesting is made, it converts all vestings into cancelable ones
isCancelable[user] = isCancelableFlag;
isCancelable[user] = isCancelableFlag;
66,299
77
// See {IERC1155MetadataURI-uri}. This implementation returns the same URI for all token types. It relieson the token type ID substituion mechanism Clients calling this function must replace the `\{id\}` substring with theactual token type ID. /
function uri(uint256) external view override returns (string memory) { return _uri; }
function uri(uint256) external view override returns (string memory) { return _uri; }
28,015
167
// Mints batch of n number of NFTs/
function mintBatchOfLandNFT(uint256[] memory tokenIds) external onlyOwner { for (uint i=0; i < tokenIds.length; i++) { mintSingleLandNFT(tokenIds[i]); } }
function mintBatchOfLandNFT(uint256[] memory tokenIds) external onlyOwner { for (uint i=0; i < tokenIds.length; i++) { mintSingleLandNFT(tokenIds[i]); } }
37,690
95
// dividend to LP
uint256 lpDividend = feeCollected.wmul(lpDividendRatio); if (lpDividend > 0) {
uint256 lpDividend = feeCollected.wmul(lpDividendRatio); if (lpDividend > 0) {
30,177
13
// Emitted when the transition Merkle root is set./newTransitionMerkleRoot The new transition Merkle root.
event SetTransitionMerkleRoot(bytes32 newTransitionMerkleRoot);
event SetTransitionMerkleRoot(bytes32 newTransitionMerkleRoot);
21,852
189
// basis colors
TIERS[1] = [671, 10, 707, 1321, 2355, 491];
TIERS[1] = [671, 10, 707, 1321, 2355, 491];
12,502