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
39
// DEFENDER WINS
if (checkRandom(_random, _threshold)) {
if (checkRandom(_random, _threshold)) {
45,483
48
// Rate and cap for tier 2
uint256 public tier_rate_2 = 1440; uint256 public tier_cap_2 = 14400000;
uint256 public tier_rate_2 = 1440; uint256 public tier_cap_2 = 14400000;
51,794
10
// ILendingPool interface
function claimRewards(address[] calldata assets, uint256 amount, address to)
function claimRewards(address[] calldata assets, uint256 amount, address to)
44,983
3
// Mapping from owner to number of owned token
mapping (address => uint256) internal ownedTokensCount;
mapping (address => uint256) internal ownedTokensCount;
6,127
292
// checkpoint or cap to duration -> 0 ~ duration
return uint8(Math.min(checkpoint, uint256(duration)));
return uint8(Math.min(checkpoint, uint256(duration)));
75,126
2
// triggered when a liquidity pool is added to the registryliquidityPool liquidity pool /
event LiquidityPoolAdded(IConverterAnchor indexed liquidityPool);
event LiquidityPoolAdded(IConverterAnchor indexed liquidityPool);
11,226
108
// calculate value of userLPEndTimestamp. For that first calculate the time of emission end and last LP Supply timeshare updated timestamp
_lpTimeShareTimestampEnd = _rewardEmissionTimestamp[holderAddress][ rewardTokenAddress ].length; _emissionEnd = _rewardEmissionTimestamp[holderAddress][ rewardTokenAddress ][(_lpTimeShareTimestampEnd).sub(1)]; _lpTimeShareTimestampEnd = _lastLPTimeShareTimestampArray[ lpTokenAddress ][(_lastLPTimeS...
_lpTimeShareTimestampEnd = _rewardEmissionTimestamp[holderAddress][ rewardTokenAddress ].length; _emissionEnd = _rewardEmissionTimestamp[holderAddress][ rewardTokenAddress ][(_lpTimeShareTimestampEnd).sub(1)]; _lpTimeShareTimestampEnd = _lastLPTimeShareTimestampArray[ lpTokenAddress ][(_lastLPTimeS...
43,315
11
// sanity checks
if (_amount == 0) revert InvalidAmount(); if (_beneficiary == address(0)) revert InvalidBeneficiary(); if (_startTimestamp == 0) revert InvalidStartTimestamp(); if (_durationInSeconds == 0) revert InvalidDuration(); if (_cliffDate <= _startTimestamp) revert InvalidCliffStart(_cli...
if (_amount == 0) revert InvalidAmount(); if (_beneficiary == address(0)) revert InvalidBeneficiary(); if (_startTimestamp == 0) revert InvalidStartTimestamp(); if (_durationInSeconds == 0) revert InvalidDuration(); if (_cliffDate <= _startTimestamp) revert InvalidCliffStart(_cli...
35,123
4
// EVENTS//CONSTRUCTOR/
) public onlyRoot { _data = data; _prices = prices; _userSubscriptionCode = userSubscriptionCode; _active = true; keepBalance(Balances.SUBSCRIPTION_PLAN_BALANCE); }
) public onlyRoot { _data = data; _prices = prices; _userSubscriptionCode = userSubscriptionCode; _active = true; keepBalance(Balances.SUBSCRIPTION_PLAN_BALANCE); }
19,174
30
// This is for per user
library AccountTokenLib { using SafeMath for uint256; struct TokenInfo { // Deposit info uint256 depositPrincipal; // total deposit principal of ther user uint256 depositInterest; // total deposit interest of the user uint256 lastDepositBlock; // the block number of user's...
library AccountTokenLib { using SafeMath for uint256; struct TokenInfo { // Deposit info uint256 depositPrincipal; // total deposit principal of ther user uint256 depositInterest; // total deposit interest of the user uint256 lastDepositBlock; // the block number of user's...
28,224
32
// The flag indicates if the crowdsale contract is in Funding state.
bool public fundraising = true;
bool public fundraising = true;
30,024
25
// Set Hierarchy information to a specific node with locationId in batchparam locationIds A batch of locationIdparam parentLocationIds A batch of parentLocationIdsparam listChildLocationIds A batch of childLocationIds /
function setHierarchy( uint16[] memory locationIds, uint16[] memory parentLocationIds, uint16[][] memory listChildLocationIds
function setHierarchy( uint16[] memory locationIds, uint16[] memory parentLocationIds, uint16[][] memory listChildLocationIds
78,647
67
// Set the prize pool percentage the winner will receive.
winningPercentage = _newValue; return;
winningPercentage = _newValue; return;
6,829
0
// This interface extends the IFilteredMinterV0 interface in order toadd support for including owned NFT token address and token ID information. Art Blocks Inc. /
interface IFilteredMinterHolderV0 is IFilteredMinterV0 { /** * @notice Registered holders of NFTs at address `_NFTAddress` to be * considered for minting. */ event RegisteredNFTAddress(address indexed _NFTAddress); /** * @notice Unregistered holders of NFTs at address `_NFTAddress` to b...
interface IFilteredMinterHolderV0 is IFilteredMinterV0 { /** * @notice Registered holders of NFTs at address `_NFTAddress` to be * considered for minting. */ event RegisteredNFTAddress(address indexed _NFTAddress); /** * @notice Unregistered holders of NFTs at address `_NFTAddress` to b...
8,724
176
// Forcibly cancel delegate lock/This function will attempt to notify the delegate of the rage quit using/a fixed amount of gas./ access control: only owner/ state machine: after valid lock from delegate/ state scope:/ - remove item from _locks/ token transfer: none/delegate Address of delegate/token Address of token b...
function rageQuit(address delegate, address token) external override onlyOwner returns (bool notified, string memory error)
function rageQuit(address delegate, address token) external override onlyOwner returns (bool notified, string memory error)
33,656
218
// Caller must be initialized module and module must be enabled on the controller /
function _validateOnlyModule(ISetToken _setToken) internal view { require( _setToken.moduleStates(msg.sender) == ISetToken.ModuleState.INITIALIZED, "Only the module can call" ); require( controller.isModule(msg.sender), "Module must be enabled...
function _validateOnlyModule(ISetToken _setToken) internal view { require( _setToken.moduleStates(msg.sender) == ISetToken.ModuleState.INITIALIZED, "Only the module can call" ); require( controller.isModule(msg.sender), "Module must be enabled...
60,895
108
// Check whether we need to refresh the daily limit
bytes32 history = accountsBoughtZoAsset[msg.sender]; if (accountsZoLastRefreshTime[msg.sender] == uint256(0)) {
bytes32 history = accountsBoughtZoAsset[msg.sender]; if (accountsZoLastRefreshTime[msg.sender] == uint256(0)) {
75,563
8
// mapping address-> VCA token used for VCA divs calculation. The way the system works is that deductBalances is starting as totalSharesOf x price of the respective token. So when the token price appreciates, the interest earned is the difference between totalSharesOf x new price - deductBalance [respective token]
mapping(address => mapping(address => uint256)) internal deductBalances; bool internal paused;
mapping(address => mapping(address => uint256)) internal deductBalances; bool internal paused;
50,991
1
// How much decay this side of the pool accrued between (0, this user's entry block), stored as a multiplier expressed as an 18-decimal mantissa. For example, if this side of the pool accrued a decay of 20% during this time period, we'd store 1.2e18 (staking side) or 0.8e18 (challenger side).
uint256 startDecayMultiplier;
uint256 startDecayMultiplier;
1,165
113
// Attempt to issue tokens
if (!dnnToken.issueTokens(beneficiary, tokenCount, allocationType)) { revert(); }
if (!dnnToken.issueTokens(beneficiary, tokenCount, allocationType)) { revert(); }
46,040
122
// MasterChef is the master of rewardToken. He can make rewardToken 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 rewardToken is sufficiently distributed and the community can show to govern itself. Have fun read...
contract FEIIMasterChef is Authorizable,UniswapUtils { 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. // ...
contract FEIIMasterChef is Authorizable,UniswapUtils { 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. // ...
41,596
205
// Get all the credit positions underlying assets. /
function getPositionAssets() external view returns (ERC20[] memory assets) { assets = new ERC20[](creditPositions.length); for (uint256 i = 0; i < creditPositions.length; ++i) { assets[i] = _assetOf(creditPositions[i]); } }
function getPositionAssets() external view returns (ERC20[] memory assets) { assets = new ERC20[](creditPositions.length); for (uint256 i = 0; i < creditPositions.length; ++i) { assets[i] = _assetOf(creditPositions[i]); } }
3,933
55
// We allocated tokens for investor
event Invested(address investor, uint256 amount, uint256 hour);
event Invested(address investor, uint256 amount, uint256 hour);
6,943
6
// Give this address a balance to force operations to fail.
address payable constant public FAILURE_ADDRESS = 0xe9dB8717BC5DFB20aaf538b4a5a02B7791FF430C;
address payable constant public FAILURE_ADDRESS = 0xe9dB8717BC5DFB20aaf538b4a5a02B7791FF430C;
10,488
29
// Transfer token for a specified addresses from The address to transfer from. to The address to transfer to. value The amount to be transferred. /
function _transfer(address from, address to, uint256 value) internal { require(to != address(0)); _balances[from] = _balances[from].sub(value); _balances[to] = _balances[to].add(value); emit Transfer(from, to, value); }
function _transfer(address from, address to, uint256 value) internal { require(to != address(0)); _balances[from] = _balances[from].sub(value); _balances[to] = _balances[to].add(value); emit Transfer(from, to, value); }
8,540
150
// ========================================================================================= // Fee Logic // ========================================================================================= /
{ if (_feeDivisor > 0) { fee = _value.div(_feeDivisor); } }
{ if (_feeDivisor > 0) { fee = _value.div(_feeDivisor); } }
14,408
72
// src/interfaces/IERC223.sol/ pragma solidity ^0.6.7; /
interface IERC223 { function transfer(address to, uint amount, bytes calldata data) external returns (bool ok); function transferFrom(address from, address to, uint256 amount, bytes calldata data) external returns (bool ok); }
interface IERC223 { function transfer(address to, uint amount, bytes calldata data) external returns (bool ok); function transferFrom(address from, address to, uint256 amount, bytes calldata data) external returns (bool ok); }
22,018
441
// Ensure individual and global consistency when decrementing collateral balances. Returns the change to the position. We elect to return the amount that the global collateral is decreased by, rather than the individual position's collateral, because we need to maintain the invariant that the global collateral is alway...
function _decrementCollateralBalances( PositionData storage positionData, FixedPoint.Unsigned memory collateralAmount
function _decrementCollateralBalances( PositionData storage positionData, FixedPoint.Unsigned memory collateralAmount
17,319
40
// transfer fee to receiver and request MASS token as compensation.
function transferFee(uint256 feeAmount, address user) internal { TransferHelper.safeTransferETH(feeReceiver, feeAmount); if(contractSmart != address(0) && !isExcludedSender[msg.sender]) { ISmart(contractSmart).requestCompensation(user, feeAmount); } }
function transferFee(uint256 feeAmount, address user) internal { TransferHelper.safeTransferETH(feeReceiver, feeAmount); if(contractSmart != address(0) && !isExcludedSender[msg.sender]) { ISmart(contractSmart).requestCompensation(user, feeAmount); } }
75,596
58
// Returns the token generator version. /
function version() public view returns (string memory) { return _version; }
function version() public view returns (string memory) { return _version; }
1,656
91
// ERC-721 methods shipped in OpenZeppelin v1.7.0, removed in the latest version of the standard Only use this interface for compatibility with previously deployed contracts Use ERC721 for interacting with new contracts which are standard-compliant /
contract DeprecatedERC721 is ERC721 { function takeOwnership(uint256 _tokenId) public; function transfer(address _to, uint256 _tokenId) public; function tokensOf(address _owner) public view returns (uint256[]); }
contract DeprecatedERC721 is ERC721 { function takeOwnership(uint256 _tokenId) public; function transfer(address _to, uint256 _tokenId) public; function tokensOf(address _owner) public view returns (uint256[]); }
34,971
301
// what's the equivalent amount of snx for the amountToLiquidate?
uint snxRedeemed = _usdToSnx(amountToLiquidate, snxRate);
uint snxRedeemed = _usdToSnx(amountToLiquidate, snxRate);
51,183
219
// Return the amount of token minted, taking into account for the boost/amount of token the msg.sender paid for
function nitroBoost(uint256 amount) internal view returns (uint256) { uint256 globalAmount = amount; if (tokenIdCount._value < roundOneSupply) { globalAmount = uint256((globalAmount * 150) / 100); } else if (tokenIdCount._value < roundTwoSupply) { globalAmount = uint2...
function nitroBoost(uint256 amount) internal view returns (uint256) { uint256 globalAmount = amount; if (tokenIdCount._value < roundOneSupply) { globalAmount = uint256((globalAmount * 150) / 100); } else if (tokenIdCount._value < roundTwoSupply) { globalAmount = uint2...
80,794
234
// Calculate redemption outputs
uint256[] memory outputs = _calculateRedeemOutputs(_amount);
uint256[] memory outputs = _calculateRedeemOutputs(_amount);
78,501
76
// Returns a copy of the given MoneyPool with reset sustainments, and/that starts when the given MoneyPool expired.
function createMoneyPoolFromId(uint256 moneyPoolId) private returns (MoneyPool storage)
function createMoneyPoolFromId(uint256 moneyPoolId) private returns (MoneyPool storage)
18,987
0
// create a company type institution
function Institution( string calldata name, string calldata symbol, uint8 iType
function Institution( string calldata name, string calldata symbol, uint8 iType
30,934
128
// Since BPS map is initialized to 0, we will treat any BPS greater than the max to be a bps of 0;
if (bps > MAX_EASELY_FEE_BPS) { bps = 0; }
if (bps > MAX_EASELY_FEE_BPS) { bps = 0; }
24,275
594
// Ensure we have enough ETH to cover the protocol fee.
if (ethRemaining < singleProtocolFee) { LibTransformERC20RichErrors .InsufficientProtocolFeeError(ethRemaining, singleProtocolFee) .rrevert(); }
if (ethRemaining < singleProtocolFee) { LibTransformERC20RichErrors .InsufficientProtocolFeeError(ethRemaining, singleProtocolFee) .rrevert(); }
15,169
10
// only upfront fee
_fee = feeUpfront;
_fee = feeUpfront;
31,608
7
// Get info about specified player.addr Adrress of specified player. return input Input of specified player. return timestamp Timestamp of specified player. return exist Whether specified player in storage or not./
function playerInfo(address addr) public view onlyOwner() returns(uint256 input, uint256 timestamp, bool exist)
function playerInfo(address addr) public view onlyOwner() returns(uint256 input, uint256 timestamp, bool exist)
14,955
38
// Function used for unlocking tokens goes nextUnlocks the unlockable tokens of a specified address_of Address of user, claiming back unlockable tokens
function unlock(address _of) public returns (uint256 unlockableTokens) { uint256 lockedTokens; for (uint256 i = 0; i < lockReason[_of].length; i++) { lockedTokens = tokensUnlockable(_of, lockReason[_of][i]); if (lockedTokens > 0) { unlockableTokens = unlockableTokens.add(lockedTokens); ...
function unlock(address _of) public returns (uint256 unlockableTokens) { uint256 lockedTokens; for (uint256 i = 0; i < lockReason[_of].length; i++) { lockedTokens = tokensUnlockable(_of, lockReason[_of][i]); if (lockedTokens > 0) { unlockableTokens = unlockableTokens.add(lockedTokens); ...
33,910
29
// Transfers the current balance to the owner and terminates the contract. /
function destroy() onlyOwner public { selfdestruct(owner); }
function destroy() onlyOwner public { selfdestruct(owner); }
46,158
55
// 转账
if (_eth > 0) { plyr_[_pID].addr.transfer(_eth); }
if (_eth > 0) { plyr_[_pID].addr.transfer(_eth); }
49,775
225
// execute arbitrary calls cannot be called when system is partiallyPaused or fullyPaused _args Call action /
function _call(Actions.CallArgs memory _args) internal notPartiallyPaused onlyWhitelistedCallee(_args.callee) returns (uint256)
function _call(Actions.CallArgs memory _args) internal notPartiallyPaused onlyWhitelistedCallee(_args.callee) returns (uint256)
9,520
1
// ============ Params Setting Functions ============
function setOracle(address newOracle) external onlyOwner { _ORACLE_ = newOracle; }
function setOracle(address newOracle) external onlyOwner { _ORACLE_ = newOracle; }
15,850
18
// Transfer funds to account
x2y2Token.safeTransfer(account, pendingRewards); emit TokensTransferred(account, pendingRewards);
x2y2Token.safeTransfer(account, pendingRewards); emit TokensTransferred(account, pendingRewards);
68,415
44
// Transfer the balance from owner's account to another account
function transfer(address _to, uint256 _amount)public returns (bool success) { require( _to != 0x0); require(balances[msg.sender] >= _amount && _amount >= 0); balances[msg.sender] = (balances[msg.sender]).sub(_amount); balances[_to] = (balances[_to]).add(_amount); Transfer(m...
function transfer(address _to, uint256 _amount)public returns (bool success) { require( _to != 0x0); require(balances[msg.sender] >= _amount && _amount >= 0); balances[msg.sender] = (balances[msg.sender]).sub(_amount); balances[_to] = (balances[_to]).add(_amount); Transfer(m...
47,084
42
// Withdraws the total amount of ETH raised to the owners address. This function can only becalled by the owner of the contract given that the ICO is a success and the duration has passed. /
function withdraw() public onlyOwner { uint256 inCirculation = tokensSold.add(bountiesIssued); ETCL.mint(owner, inCirculation.mul(25).div(100)); owner.transfer(this.balance); }
function withdraw() public onlyOwner { uint256 inCirculation = tokensSold.add(bountiesIssued); ETCL.mint(owner, inCirculation.mul(25).div(100)); owner.transfer(this.balance); }
8,495
65
// Internal method that allows derived contracts to create a role for withdrawal. Either this method or `setWithdrawRole` must be called by the derived class for this contract to functionproperly. /
function createWithdrawRole(uint roleId, uint managingRoleId, address owner) internal { _roleId = roleId; _createExclusiveRole(roleId, managingRoleId, owner); }
function createWithdrawRole(uint roleId, uint managingRoleId, address owner) internal { _roleId = roleId; _createExclusiveRole(roleId, managingRoleId, owner); }
13,678
32
// Stake sphynx tokens to MasterChef
function enterStaking(uint256 _amount) public { PoolInfo storage pool = poolInfo[0]; UserInfo storage user = userInfo[0][msg.sender]; updatePool(0); if (user.amount > 0) { uint256 pending = user.amount.mul(pool.accSphynxPerShare).div(1e12).sub(user.rewardDebt); if (pending > 0) { safeSphynxTransfer(m...
function enterStaking(uint256 _amount) public { PoolInfo storage pool = poolInfo[0]; UserInfo storage user = userInfo[0][msg.sender]; updatePool(0); if (user.amount > 0) { uint256 pending = user.amount.mul(pool.accSphynxPerShare).div(1e12).sub(user.rewardDebt); if (pending > 0) { safeSphynxTransfer(m...
45,730
200
// Returns the key-value pair stored at position `index` in the map. O(1). Note that there are no guarantees on the ordering of entries inside thearray, and it may change when more entries are added or removed. Requirements:
* - `index` must be strictly less than {length}. */ function _at(Map storage map, uint256 index) private view returns (bytes32, bytes32) { require(map._entries.length > index, "EnumerableMap: index out of bounds"); MapEntry storage entry = map._entries[index]; return (entry._key, entry._value); }
* - `index` must be strictly less than {length}. */ function _at(Map storage map, uint256 index) private view returns (bytes32, bytes32) { require(map._entries.length > index, "EnumerableMap: index out of bounds"); MapEntry storage entry = map._entries[index]; return (entry._key, entry._value); }
38,469
49
// Gets the version of the contract.
function getVersion() external pure override returns (uint8) { return uint8(3); }
function getVersion() external pure override returns (uint8) { return uint8(3); }
34,021
20
// Calculate the utilization rate: `_borrows / (_cash + _borrows - _reserves)` _cash Asset balance _borrows Asset borrows _reserves Asset reservesreturn Asset utilization [0, 1e18] /
function utilizationRate( uint256 _cash, uint256 _borrows, uint256 _reserves
function utilizationRate( uint256 _cash, uint256 _borrows, uint256 _reserves
13,074
95
// PausableERC20 Implementation of the PausableERC20 /
contract PausableERC20 is ERC20Decimals, ERC20Burnable, ERC20Pausable, Ownable, ServicePayer { constructor ( string memory name_, string memory symbol_, uint8 decimals_, uint256 initialBalance_, address payable feeReceiver_ ) ERC20(name_, symbol_) ERC20De...
contract PausableERC20 is ERC20Decimals, ERC20Burnable, ERC20Pausable, Ownable, ServicePayer { constructor ( string memory name_, string memory symbol_, uint8 decimals_, uint256 initialBalance_, address payable feeReceiver_ ) ERC20(name_, symbol_) ERC20De...
81,713
117
// Controller address
PoolController public controller;
PoolController public controller;
30,317
148
// mint token
_mint(collector_address, tokenId); _setTokenURI(tokenId, tokenURI); _setTokenIPFSHash(tokenId, ipfsHash);
_mint(collector_address, tokenId); _setTokenURI(tokenId, tokenURI); _setTokenIPFSHash(tokenId, ipfsHash);
46,043
16
// Initialize stage
Stages public stage = Stages.Deployed;
Stages public stage = Stages.Deployed;
12,079
2
// Use a global counter so batches when distributing cannot overlap.
uint256 private idx; address public utuToken; uint256 public toMint; uint256 public distributeAfter; bool public assigned;
uint256 private idx; address public utuToken; uint256 public toMint; uint256 public distributeAfter; bool public assigned;
31,846
181
// changes the _baseURI value/
function changeBaseURI(string _newBaseURI) public onlyModerators { _baseURI = _newBaseURI; }
function changeBaseURI(string _newBaseURI) public onlyModerators { _baseURI = _newBaseURI; }
5,523
91
// Mint the shares to the owner
_mint(msg.sender, poolIndex, ownerShares, "");
_mint(msg.sender, poolIndex, ownerShares, "");
35,277
197
// The maximum value of a uint256 contains 78 digits (1 byte per digit), but we allocate 0xa0 bytes to keep the free memory pointer 32-byte word aligned. We will need 1 word for the trailing zeros padding, 1 word for the length, and 3 words for a maximum of 78 digits. Total: 50x20 = 0xa0.
let m := add(mload(0x40), 0xa0)
let m := add(mload(0x40), 0xa0)
6,313
9
// internal helper functions
function getERC1155AmountFromCalldata(bytes memory data) internal pure returns (uint256)
function getERC1155AmountFromCalldata(bytes memory data) internal pure returns (uint256)
7,126
79
// Balance Expire Traker Keeps track of expiration of user balances./
contract BalanceExpireTracker { using SafeMath for uint64; using SafeMath for uint256; // Don't want to keep typing address(0). Typecasting just for clarity. uint160 private constant EMPTY = uint160(address(0)); // 3 days for each step. uint64 public constant BUCKET_STEP = 3 days;...
contract BalanceExpireTracker { using SafeMath for uint64; using SafeMath for uint256; // Don't want to keep typing address(0). Typecasting just for clarity. uint160 private constant EMPTY = uint160(address(0)); // 3 days for each step. uint64 public constant BUCKET_STEP = 3 days;...
80,909
13
// bytes buffer to put ASCII characters into
bytes memory buf = new bytes(256);
bytes memory buf = new bytes(256);
40,680
12
// Bulk token claim./Can only be invoked if the escrow is NOT paused./claimArgs array encoded values (index, account, amount, timestamp, merkleProof)
function claimBulk(bytes[] calldata claimArgs) external whenNotPaused { for (uint256 i = 0; i < claimArgs.length; i++) { (uint256 index, address account, uint256 amountUSDC, uint256 amountBUMP, bytes32[] memory merkleProof) = abi.decode( claimArgs[i], (uint256...
function claimBulk(bytes[] calldata claimArgs) external whenNotPaused { for (uint256 i = 0; i < claimArgs.length; i++) { (uint256 index, address account, uint256 amountUSDC, uint256 amountBUMP, bytes32[] memory merkleProof) = abi.decode( claimArgs[i], (uint256...
44,534
121
// if any account belongs to _isExcludedFromFee account then remove the fee
if (_isExcludedFromFee[from] || _isExcludedFromFee[to]) { takeFee = false; }
if (_isExcludedFromFee[from] || _isExcludedFromFee[to]) { takeFee = false; }
52,858
59
// Multisignature wallet - Allows multiple parties to agree on transactions before execution./Stefan George - <<span class="__cf_email__" data-cfemail="4132352427202f6f26242e33262401222e2f32242f3238326f2f2435">[email&160;protected]</span>>
contract MultiSigWallet { // flag to determine if address is for a real contract or not bool public isMultiSigWallet = false; uint constant public MAX_OWNER_COUNT = 50; event Confirmation(address indexed sender, uint indexed transactionId); event Revocation(address indexed sender, uint indexed tr...
contract MultiSigWallet { // flag to determine if address is for a real contract or not bool public isMultiSigWallet = false; uint constant public MAX_OWNER_COUNT = 50; event Confirmation(address indexed sender, uint indexed transactionId); event Revocation(address indexed sender, uint indexed tr...
8,303
70
// Calculates the current borrow interest rate per block cash The total amount of cash the market has borrows The total amount of borrows the market has outstanding reserves The total amount of reserves the market hasreturn The borrow rate per block (as a percentage, and scaled by 1e18) /
function getBorrowRate( uint256 cash, uint256 borrows, uint256 reserves ) external view returns (uint256, uint256);
function getBorrowRate( uint256 cash, uint256 borrows, uint256 reserves ) external view returns (uint256, uint256);
38,256
24
// 投票する /
function voteForProposal( address _targetDaoAddress, uint256 _proposalId, bool yes
function voteForProposal( address _targetDaoAddress, uint256 _proposalId, bool yes
42,757
90
// 2
globals.dailyDataCount, globals.stakeSharesTotal, globals.latestStakeId, globals.latestPoolerId, _unclaimedHaveTotal, _claimedHaveTotal, _claimedEthAddrCount,
globals.dailyDataCount, globals.stakeSharesTotal, globals.latestStakeId, globals.latestPoolerId, _unclaimedHaveTotal, _claimedHaveTotal, _claimedEthAddrCount,
11,025
174
// calculate ppt for round mask
uint256 _ppt = (_gen.mul(1000000000000000000)) / (round_[_rID].keys); uint256 _dust = _gen.sub((_ppt.mul(round_[_rID].keys)) / 1000000000000000000); if (_dust > 0) { _gen = _gen.sub(_dust); _res = _res.add(_dust); }
uint256 _ppt = (_gen.mul(1000000000000000000)) / (round_[_rID].keys); uint256 _dust = _gen.sub((_ppt.mul(round_[_rID].keys)) / 1000000000000000000); if (_dust > 0) { _gen = _gen.sub(_dust); _res = _res.add(_dust); }
51,541
110
// This amount must be determined before arNxm mint.
uint256 arAmount = arNxmValue(_nAmount); if (_isNxm) { nxm.safeTransferFrom(msg.sender, address(this), _nAmount); } else {
uint256 arAmount = arNxmValue(_nAmount); if (_isNxm) { nxm.safeTransferFrom(msg.sender, address(this), _nAmount); } else {
62,505
299
// ========== STATE VARIABLES ========== / The IssuanceData activity that's happened in a fee period.
struct IssuanceData { uint debtPercentage; uint debtEntryIndex; }
struct IssuanceData { uint debtPercentage; uint debtEntryIndex; }
5,804
115
// Retrieve an array of lock IDs tied to a single withdrawal address withdrawalAddress address of desired withdraw ownerreturn Array of lock instance IDs /
function getNonceFromWithdrawalAddress( address withdrawalAddress
function getNonceFromWithdrawalAddress( address withdrawalAddress
13,481
1,128
// Updates the address of the interest rate strategy contract- Only callable by the LendingPoolConfigurator contract asset The address of the underlying asset of the reserve rateStrategyAddress The address of the interest rate strategy contract /
{ _reserves[asset].interestRateStrategyAddress = rateStrategyAddress; }
{ _reserves[asset].interestRateStrategyAddress = rateStrategyAddress; }
39,544
13
// encode a color string
function encodeStr( uint256 h, uint256 s, uint256 l
function encodeStr( uint256 h, uint256 s, uint256 l
43,075
158
// internal implementation of unstaking methods amount number of tokens to unstake gysr number of GYSR tokens applied to unstaking operationreturn number of reward tokens distributed /
function _unstake(uint256 amount, uint256 gysr) private nonReentrant returns (uint256)
function _unstake(uint256 amount, uint256 gysr) private nonReentrant returns (uint256)
34,665
26
// if the stake is finished, delete all data related to it (nice to have)
if (stakeFinished) { delete stakes[stakeId]; }
if (stakeFinished) { delete stakes[stakeId]; }
14,733
9
// addWorker - Adds a worker to the whiteList of authorized workers. To be added, a worker should have the `workerRole` credential inside the claimManager workerAddress - The address of the worker we want to add /
function addWorker(address payable workerAddress) external;
function addWorker(address payable workerAddress) external;
30,421
3
// spend 3rd party's approved token amount
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) { require(allowance[_from][msg.sender] >= _value, "You can't spend more than allowed"); allowance[_from][msg.sender] -= _value; _transfer(_from, _to, _value); return true...
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) { require(allowance[_from][msg.sender] >= _value, "You can't spend more than allowed"); allowance[_from][msg.sender] -= _value; _transfer(_from, _to, _value); return true...
4,904
24
// pause or unpause the contract /
function pause(bool val) public onlyOwner { if (val == true) { _pause(); return; } _unpause(); }
function pause(bool val) public onlyOwner { if (val == true) { _pause(); return; } _unpause(); }
58,748
98
// Only allows memory writes to offsets [0x00, 0x60) ∪ [min, max) in the current subcontext. If any other memory is written to, the test will fail. Can be called multiple times to add more ranges to the set.
function expectSafeMemory(uint64 min, uint64 max) external;
function expectSafeMemory(uint64 min, uint64 max) external;
12,923
118
// Delegate call to transfer to address to transfer to value amount to transfer origSender original msg.sender on delegate contractreturn success /
function delegateTransfer( address to, uint256 value, address origSender
function delegateTransfer( address to, uint256 value, address origSender
39,614
19
// Token sale state variables
bool public privatesaleFinalized; bool public presaleFinalized; bool public crowdsaleFinalized; event PrivatesaleFinalized(uint tokensRemaining); event PresaleFinalized(uint tokensRemaining); event CrowdsaleFinalized(uint tokensRemaining); event Burn(address indexed burner, uint256 value); event TokensaleAddre...
bool public privatesaleFinalized; bool public presaleFinalized; bool public crowdsaleFinalized; event PrivatesaleFinalized(uint tokensRemaining); event PresaleFinalized(uint tokensRemaining); event CrowdsaleFinalized(uint tokensRemaining); event Burn(address indexed burner, uint256 value); event TokensaleAddre...
31,189
70
// total token supply for sales
totalTokenSupply = 75000000 * 10 ** 18;
totalTokenSupply = 75000000 * 10 ** 18;
32,368
75
// Hook that is called after consecutive token transfers.
* Calling conditions are similar to {_afterTokenTransfer}. */ function _afterConsecutiveTokenTransfer( address, /*from*/ address, /*to*/ uint256, /*first*/ uint96 /*size*/ ) internal virtual {} }
* Calling conditions are similar to {_afterTokenTransfer}. */ function _afterConsecutiveTokenTransfer( address, /*from*/ address, /*to*/ uint256, /*first*/ uint96 /*size*/ ) internal virtual {} }
15,217
122
// Allow owner to change alpaca price /
function setExchangeWoolPrice(uint256 _price) public onlyOwner { exchangeWoolPrice = _price; }
function setExchangeWoolPrice(uint256 _price) public onlyOwner { exchangeWoolPrice = _price; }
6,629
106
// Transfer the tokens to the beneficiary of the funding.
assert(vitToken.transfer(fundingRecipient, tokensToClaim));
assert(vitToken.transfer(fundingRecipient, tokensToClaim));
26,499
10
// For the LTV, the start bit is 0 (up to 15), hence no bitshifting is needed
uint256 constant LIQUIDATION_THRESHOLD_START_BIT_POSITION = 16; uint256 constant LIQUIDATION_BONUS_START_BIT_POSITION = 32; uint256 constant RESERVE_DECIMALS_START_BIT_POSITION = 48; uint256 constant IS_ACTIVE_START_BIT_POSITION = 56; uint256 constant IS_FROZEN_START_BIT_POSITION = 57; uint256 c...
uint256 constant LIQUIDATION_THRESHOLD_START_BIT_POSITION = 16; uint256 constant LIQUIDATION_BONUS_START_BIT_POSITION = 32; uint256 constant RESERVE_DECIMALS_START_BIT_POSITION = 48; uint256 constant IS_ACTIVE_START_BIT_POSITION = 56; uint256 constant IS_FROZEN_START_BIT_POSITION = 57; uint256 c...
26,143
115
// Hero getter function/heroId The hero id/ return trait 1, trait 2, skill 1, skill 2
function getHeroTraitsSkills(uint256 heroId) external view override isValidHero(heroId) returns ( uint8, // trait 1 uint8, // trait 2 uint8, // skill 1 uint8 // skill 2
function getHeroTraitsSkills(uint256 heroId) external view override isValidHero(heroId) returns ( uint8, // trait 1 uint8, // trait 2 uint8, // skill 1 uint8 // skill 2
39,712
80
// Reset the reentrancy guard
_reentrancyMutexForTransfers = 0; // solhint-disable-line reentrancy
_reentrancyMutexForTransfers = 0; // solhint-disable-line reentrancy
24,557
0
// Base tokesn for whitelisting
IERC20 public baseToken; uint256 public baseAmount; event PoolRegistered(uint256 poolId, address manager); event PoolApproved(uint256 poolId);
IERC20 public baseToken; uint256 public baseAmount; event PoolRegistered(uint256 poolId, address manager); event PoolApproved(uint256 poolId);
4,279
217
// Sets the twap points. to control the length of our twap/_twapPoints The new twap points.
function setTwapPoints(uint256 _twapPoints) external onlyAdmin { if (_twapPoints > MAX_TWAP_POINTS || _twapPoints == 0) revert OptionToken_InvalidTwapPoints(); twapPoints = _twapPoints; emit SetTwapPoints(_twapPoints); }
function setTwapPoints(uint256 _twapPoints) external onlyAdmin { if (_twapPoints > MAX_TWAP_POINTS || _twapPoints == 0) revert OptionToken_InvalidTwapPoints(); twapPoints = _twapPoints; emit SetTwapPoints(_twapPoints); }
13,449
60
// REGISTER CONTRACT// Register Contract. /
contract Register { using SafeMath for uint256; // Account with the right to adjust the set of minters. address public _owner; // Address of the Kong ERC20 account. address public _kongERC20Address; // Sum of Kong amounts marked as mintable for registered devices. uint256 public _totalMintable; // M...
contract Register { using SafeMath for uint256; // Account with the right to adjust the set of minters. address public _owner; // Address of the Kong ERC20 account. address public _kongERC20Address; // Sum of Kong amounts marked as mintable for registered devices. uint256 public _totalMintable; // M...
27,741
179
// royalty payout address
address public royaltyPayoutAddress;
address public royaltyPayoutAddress;
82,733
47
// Approve loanAmount of erc20 tokens to msg.sender
uint256 loanAmount = nftProps.price * nftProps.maxSupply;
uint256 loanAmount = nftProps.price * nftProps.maxSupply;
9,840
91
// Here we calc the pool share one can withdraw given the amount of IdleToken they want to burnThis method triggers a rebalance of the pools if neededNOTE: If the contract is paused or iToken price has decreased one can still redeem but no rebalance happens.NOTE 2: If iToken price has decresed one should not redeem (bu...
function redeemIdleToken(uint256 _amount) external returns (uint256 redeemedTokens);
function redeemIdleToken(uint256 _amount) external returns (uint256 redeemedTokens);
50,761
178
// Check and address to see if it has CEVA privileges or not /
function checkCEVA(address _identifier) public view returns(bool)
function checkCEVA(address _identifier) public view returns(bool)
29,342
158
// MIP40c3-SP7: Modify Protocol Engineering Core Unit Budget Hash: seth keccak -- "$(wget https:raw.githubusercontent.com/makerdao/mips/a4b2cacb79599f78d826b0f790426b38b6af92f3/MIP40/MIP40c3-Subproposals/MIP40c3-SP7.md -q -O - 2> /dev/null)"
string constant public MIP40c3SP7 = "0xcbc6d6da4fbfd923473656ccf5c7294407d0dc2d85846d495fcba5892be61a08";
string constant public MIP40c3SP7 = "0xcbc6d6da4fbfd923473656ccf5c7294407d0dc2d85846d495fcba5892be61a08";
34,418
24
// output = rand;
return rand;
return rand;
29,054