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
26
// Ensure that the pledge is not already at max pledge depth and the project has not been canceled
require(_getPledgeLevel(p) < MAX_INTERPROJECT_LEVEL); require(!isProjectCanceled(idReceiver)); uint64 oldPledge = _findOrCreatePledge( p.owner, p.delegationChain, 0, 0, p.oldPledge, p.token,
require(_getPledgeLevel(p) < MAX_INTERPROJECT_LEVEL); require(!isProjectCanceled(idReceiver)); uint64 oldPledge = _findOrCreatePledge( p.owner, p.delegationChain, 0, 0, p.oldPledge, p.token,
4,067
309
// Internal mint function /
function _coreMint(uint256 amount) internal { uint256 tokenId; for(uint256 i = 0; i < amount; i++) { // Generate new tokenId _tokenIdCounter.increment(); tokenId = _tokenIdCounter.current(); // mint the tokenId for caller ...
function _coreMint(uint256 amount) internal { uint256 tokenId; for(uint256 i = 0; i < amount; i++) { // Generate new tokenId _tokenIdCounter.increment(); tokenId = _tokenIdCounter.current(); // mint the tokenId for caller ...
76,600
11
// Returns the quorum for a block number, in terms of number of votes: `supplynumerator / denominator`. /
function quorum(uint256 blockNumber) public view virtual override returns (uint256) { return (token.getPastTotalSupply(blockNumber) * quorumNumerator(blockNumber)) / quorumDenominator(); }
function quorum(uint256 blockNumber) public view virtual override returns (uint256) { return (token.getPastTotalSupply(blockNumber) * quorumNumerator(blockNumber)) / quorumDenominator(); }
22,141
29
// get affiliate ID from aff Code
_affID = pIDxAddr_[_affCode];
_affID = pIDxAddr_[_affCode];
20,805
69
// ERC20 compliant approve function _spender party that msg.sender approves for transferring funds _amount amount of token to approve for sendingreturn true for successful/
function approve(TokenStorage storage self, address _spender, uint _amount) public returns (bool) { self.allowed[msg.sender][_spender] = _amount; emit Approval(msg.sender, _spender, _amount); return true; }
function approve(TokenStorage storage self, address _spender, uint _amount) public returns (bool) { self.allowed[msg.sender][_spender] = _amount; emit Approval(msg.sender, _spender, _amount); return true; }
72,644
11
// Swap the token-to-unbind with the last token, then delete the last token
uint256 index = record.index; uint256 last = dynasetTokens.length - 1;
uint256 index = record.index; uint256 last = dynasetTokens.length - 1;
19,395
183
// Transfer want tokens strategy -> autoFarm
function withdraw(address _userAddress, uint256 _wantAmt) external returns (uint256); function inCaseTokensGetStuck( address _token, uint256 _amount, address _to ) external;
function withdraw(address _userAddress, uint256 _wantAmt) external returns (uint256); function inCaseTokensGetStuck( address _token, uint256 _amount, address _to ) external;
106
13
// claim rewards till now
uint256 claimableReward = stakes[account].multiplyDecimalPrecise(globalIntegral.sub(integrals[account])); claimableRewards[account] = claimableRewards[account].add(claimableReward);
uint256 claimableReward = stakes[account].multiplyDecimalPrecise(globalIntegral.sub(integrals[account])); claimableRewards[account] = claimableRewards[account].add(claimableReward);
42,208
25
// pop the samurai headoff the leve chain
pop(levelChain[samuraiHead.level]); if(samuraiHead.autoLevelUp) { levelUp(samuraiHeadId); } else {
pop(levelChain[samuraiHead.level]); if(samuraiHead.autoLevelUp) { levelUp(samuraiHeadId); } else {
26,068
52
// Storage of set values
bytes32[] _values;
bytes32[] _values;
1,378
523
// Reduce the unclaimed amount by the amount already claimed.
uint256 unclaimedAmount = claimAmount.sub(claim.amountClaimed); return unclaimedAmount;
uint256 unclaimedAmount = claimAmount.sub(claim.amountClaimed); return unclaimedAmount;
41,484
82
// PUBLIC FACING: External helper for the current day number since launch timereturn Current day number (zero-based) /
function currentDay() external view returns (uint256)
function currentDay() external view returns (uint256)
17,506
19
// Before Metropolis update require will not refund gas, but for some reason require statement around msg.value always throws
assert(msg.value > 0 finney);
assert(msg.value > 0 finney);
40,633
97
// ============================================================================= //=============================MultiSig Wallet================================= //============================================================================= //Multisignature wallet - Allows multiple parties to agree on transactions befo...
contract MultiSigWallet { //Load Gifto and IAMICOIN Contracts to this contract. //ERC20 private Gifto = ERC20(0x92e87a5622cf9955d1062822454701198a028a72); //ERC20 private IAMIToken = ERC20(0xee10a06b2a0cf7e04115edfbee46242136eb6ae1); uint constant public MAX_OWNER_COUNT = 50; event Confirmation(ad...
contract MultiSigWallet { //Load Gifto and IAMICOIN Contracts to this contract. //ERC20 private Gifto = ERC20(0x92e87a5622cf9955d1062822454701198a028a72); //ERC20 private IAMIToken = ERC20(0xee10a06b2a0cf7e04115edfbee46242136eb6ae1); uint constant public MAX_OWNER_COUNT = 50; event Confirmation(ad...
16,137
8
// Base Token for ERC20 compatibilityERC20 interface/
contract ERC20 { //function totalSupply() public view returns (uint256); function balanceOf(address who) public view returns (uint); function allowance(address owner, address spender) public view returns (uint); function transfer(address to, uint value) public returns (bool ok); function transferFro...
contract ERC20 { //function totalSupply() public view returns (uint256); function balanceOf(address who) public view returns (uint); function allowance(address owner, address spender) public view returns (uint); function transfer(address to, uint value) public returns (bool ok); function transferFro...
30,923
83
// reduce bidRate
uint256 _price = user[_user][_index].price;
uint256 _price = user[_user][_index].price;
35,047
20
// div 10000^6
expo = expo / (10**24); if (expo > SAT) return 0; return (SAT - expo).mul(_tAmount);
expo = expo / (10**24); if (expo > SAT) return 0; return (SAT - expo).mul(_tAmount);
65,136
125
// Update lockedTokens amount before using it in computations after.updateAccounting();
unlockTokens(); uint256 lockedTokens = totalLocked(); uint256 mintedLockedShares = (lockedTokens > 0) ? totalLockedShares.mul(amount).div(lockedTokens) : amount.mul(_initialSharesPerToken); UnlockSchedule memory schedule; schedule.initialLockedShares = m...
unlockTokens(); uint256 lockedTokens = totalLocked(); uint256 mintedLockedShares = (lockedTokens > 0) ? totalLockedShares.mul(amount).div(lockedTokens) : amount.mul(_initialSharesPerToken); UnlockSchedule memory schedule; schedule.initialLockedShares = m...
48,174
38
// Reverts if the actual amount passed does not match the expected amount expected amount that should match the actual amount data bytes /
modifier isActualAmount(uint256 expected, bytes calldata data) { // decode register function arguments to get actual amount (, , , , , , , , , uint96 amount, ) = abi.decode( data[4:], (string, bytes, address, uint32, address, uint8, bytes, bytes, bytes, uint96, address) ); if (expected != ...
modifier isActualAmount(uint256 expected, bytes calldata data) { // decode register function arguments to get actual amount (, , , , , , , , , uint96 amount, ) = abi.decode( data[4:], (string, bytes, address, uint32, address, uint8, bytes, bytes, bytes, uint96, address) ); if (expected != ...
18,971
1
// Multiplies two unsigned integers, reverts on overflow. /
function mul(uint256 a, uint256 b) internal pure returns (uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522 if (a == 0) { ...
function mul(uint256 a, uint256 b) internal pure returns (uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522 if (a == 0) { ...
9,623
29
// Sets the contract level metadata URI hash. contractURIHash The hash to the initial contract level metadata. /
function setContractURIHash(string memory contractURIHash) external override onlyAdmin
function setContractURIHash(string memory contractURIHash) external override onlyAdmin
9,369
92
// Creates `amount` tokens and assigns them to `msg.sender`, increasingthe total supply. Requirements - `msg.sender` must be the token owner /
function mint(uint256 amount) public onlyOwner returns (bool) { _mint(_msgSender(), amount); return true; }
function mint(uint256 amount) public onlyOwner returns (bool) { _mint(_msgSender(), amount); return true; }
2,394
12
// accumulate the ticks derived from the current pool into the running synthetic ticks, ensuring that intermediate tokens "cancel out"
bool add = (i == 0) || (previousTokenIn < tokenIn ? tokenIn < tokenOut : tokenOut < tokenIn); if (add) { syntheticAverageTick += averageTick; syntheticCurrentTick += currentTick; } else {
bool add = (i == 0) || (previousTokenIn < tokenIn ? tokenIn < tokenOut : tokenOut < tokenIn); if (add) { syntheticAverageTick += averageTick; syntheticCurrentTick += currentTick; } else {
24,793
125
// Minimum number of payTokens to open a position
uint128 public minPay;
uint128 public minPay;
10,835
15
// Internal function to generate a random registration ID for a member
function _generateRandomId() private view returns (string memory) { uint256 randomNumber = uint256(keccak256(abi.encodePacked(block.timestamp, block.basefee, msg.sender))) % 10000; string memory registrationId = string(abi.encodePacked(toString(randomNumber), "JAM")); return registrationId; ...
function _generateRandomId() private view returns (string memory) { uint256 randomNumber = uint256(keccak256(abi.encodePacked(block.timestamp, block.basefee, msg.sender))) % 10000; string memory registrationId = string(abi.encodePacked(toString(randomNumber), "JAM")); return registrationId; ...
28,790
14
// Set a new URI for the items metadata_baseuri token URI in string format/
function setBaseURI(string memory _baseuri) external onlyOwner { baseURI = _baseuri; }
function setBaseURI(string memory _baseuri) external onlyOwner { baseURI = _baseuri; }
18,390
43
// Pending request completed
delete currentRequestId[packId][receiver];
delete currentRequestId[packId][receiver];
37,260
37
// Splits the slice, setting `self` to everything after the first occurrence of `needle`, and returning everything before it. If `needle` does not occur in `self`, `self` is set to the empty slice, and the entirety of `self` is returned. self The slice to split. needle The text to search for in `self`.return The part o...
function split(slice memory self, slice memory needle) internal pure returns (slice memory token) { split(self, needle, token); }
function split(slice memory self, slice memory needle) internal pure returns (slice memory token) { split(self, needle, token); }
10,114
600
// Make sure received eth is enough
require(msg.value >= amountETH, 'Not enough ETH');
require(msg.value >= amountETH, 'Not enough ETH');
45,010
6
// not found
return;
return;
23,799
47
// ============ Init Functions ============
constructor( address _token, uint256 _startReleaseTime, uint256 _releaseDuration, uint256 _cliffRate
constructor( address _token, uint256 _startReleaseTime, uint256 _releaseDuration, uint256 _cliffRate
683
11
// Process disbursements.
for (uint256 i = 0; i < _numDisbursements; i++) { uint256 _amount = _disbursements[i].amount; address _addr = _disbursements[i].addr;
for (uint256 i = 0; i < _numDisbursements; i++) { uint256 _amount = _disbursements[i].amount; address _addr = _disbursements[i].addr;
14,350
187
// On monthly pools lender interest maybe be repayed in advance, therefore we should pay no interest
currentTs = block.timestamp; if (!isBulletLoan && accrualTs > currentTs) { currentTs = accrualTs; }
currentTs = block.timestamp; if (!isBulletLoan && accrualTs > currentTs) { currentTs = accrualTs; }
20,376
2
// Blocks data, in the form: blockHeaderHash => BlockHeader
mapping (uint => StoredBlockHeader) public blocks;
mapping (uint => StoredBlockHeader) public blocks;
31,489
69
// Discount (compared to the system coin's current redemption price) at which collateral is being sold
uint256 public discount = 0.95E18; // 5% discount // [wad]
uint256 public discount = 0.95E18; // 5% discount // [wad]
31,369
89
// Update the rewards and time
_updateStoredRewardsAndTime();
_updateStoredRewardsAndTime();
3,719
952
// 478
entry "head-first" : ENG_ADVERB
entry "head-first" : ENG_ADVERB
21,314
37
// Bonus levels per each round
mapping (uint256 => uint256) public bonusLevels;
mapping (uint256 => uint256) public bonusLevels;
64,639
186
// Returns the normalized variable debt per unit of asset asset The address of the underlying asset of the reservereturn The reserve normalized variable debt /
function getReserveNormalizedVariableDebt(address asset) external view returns (uint256);
function getReserveNormalizedVariableDebt(address asset) external view returns (uint256);
1,082
5
// Terminate flag
bool public terminated;
bool public terminated;
54,485
5
// Base client to interact with the registry.
contract ERC1820Client { ERC1820Registry constant ERC1820REGISTRY = ERC1820Registry( 0x1820a4B7618BdE71Dce8cdc73aAB6C95905faD24 ); function setInterfaceImplementation( string memory _interfaceLabel, address _implementation ) internal { bytes32 interfaceHash = keccak256(a...
contract ERC1820Client { ERC1820Registry constant ERC1820REGISTRY = ERC1820Registry( 0x1820a4B7618BdE71Dce8cdc73aAB6C95905faD24 ); function setInterfaceImplementation( string memory _interfaceLabel, address _implementation ) internal { bytes32 interfaceHash = keccak256(a...
12,625
20
// mapping(string => uint) storage tmp;
uint _patientId = patientId; string memory city = find_city(patientId); // we need to write a function to query the city if(isCityPresent[city] == 0){
uint _patientId = patientId; string memory city = find_city(patientId); // we need to write a function to query the city if(isCityPresent[city] == 0){
36,975
16
// Return bool indicating if this address is an active validator
return validators[_validatorAddress][currentValsetVersion];
return validators[_validatorAddress][currentValsetVersion];
34,755
50
// require(!_isBlackListedBot[recipient], "You have no power here!");require(!_isBlackListedBot[tx.origin], "You have no power here!");
_transfer(_msgSender(), recipient, amount); return true;
_transfer(_msgSender(), recipient, amount); return true;
23,026
29
// May be called from frontend to check if a refresh is required/advised Compare with characters.getNftVar(NFTVAR_POWER_DATA)
Characters characters = Characters(links[LINK_CHARACTERS]);
Characters characters = Characters(links[LINK_CHARACTERS]);
30,669
52
// Forward the fund to fund collection wallet.
wallet.transfer(msg.value);
wallet.transfer(msg.value);
24,094
2,504
// 1254
entry "stepmeal" : ENG_ADVERB
entry "stepmeal" : ENG_ADVERB
22,090
58
// unstaking possible after 72 hours
uint public constant cliffTime = 72 hours; uint public totalClaimedRewards = 0; EnumerableSet.AddressSet private holders;
uint public constant cliffTime = 72 hours; uint public totalClaimedRewards = 0; EnumerableSet.AddressSet private holders;
10,183
56
// add earned from the convex reward pool for the given token
d_reward = d_reward.add(IRewardStaking(reward.reward_pool).earned(address(this)));
d_reward = d_reward.add(IRewardStaking(reward.reward_pool).earned(address(this)));
30,368
772
// a raw call is required so we can return false if the call reverts, rather than reverting
bytes memory checkCalldata = abi.encodeWithSelector(sig, _who, _where, _what, _how); uint256 oracleCheckGas = ORACLE_CHECK_GAS; bool ok; assembly { ok := staticcall(oracleCheckGas, _oracleAddr, add(checkCalldata, 0x20), mload(checkCalldata), 0, 0) }
bytes memory checkCalldata = abi.encodeWithSelector(sig, _who, _where, _what, _how); uint256 oracleCheckGas = ORACLE_CHECK_GAS; bool ok; assembly { ok := staticcall(oracleCheckGas, _oracleAddr, add(checkCalldata, 0x20), mload(checkCalldata), 0, 0) }
14,473
73
// Updates external position unit for given borrow asset on SetToken /
function _updateBorrowPosition(ISetToken _setToken, IERC20 _underlyingAsset, int256 _newPositionUnit) internal { _setToken.editExternalPosition(address(_underlyingAsset), address(this), _newPositionUnit, ""); }
function _updateBorrowPosition(ISetToken _setToken, IERC20 _underlyingAsset, int256 _newPositionUnit) internal { _setToken.editExternalPosition(address(_underlyingAsset), address(this), _newPositionUnit, ""); }
14,131
3
// Prevents a contract from calling itself, directly or indirectly.Calling a `nonReentrant` function from another `nonReentrant`function is not supported. It is possible to prevent this from happeningby making the `nonReentrant` function external, and make it call a`private` function that does the actual work. /
modifier nonReentrant() { _guardCounter += 1; uint256 localCounter = _guardCounter; _; require(localCounter == _guardCounter, "ReentrancyGuard: reentrant call"); }
modifier nonReentrant() { _guardCounter += 1; uint256 localCounter = _guardCounter; _; require(localCounter == _guardCounter, "ReentrancyGuard: reentrant call"); }
1,448
87
// IStarNFT Galaxy Protocol Interface for operating with StarNFTs. /
interface IStarNFT is IERC1155 { /* ============ Events =============== */ // event PowahUpdated(uint256 indexed id, uint256 indexed oldPoints, uint256 indexed newPoints); /* ============ Functions ============ */ function isOwnerOf(address, uint256) external view returns (bool); // function starInf...
interface IStarNFT is IERC1155 { /* ============ Events =============== */ // event PowahUpdated(uint256 indexed id, uint256 indexed oldPoints, uint256 indexed newPoints); /* ============ Functions ============ */ function isOwnerOf(address, uint256) external view returns (bool); // function starInf...
5,979
167
// Deposits `amount` of `token` with `tokenId` from `from` into the `vault`/Virtual method to be implement in token specific UserAction contracts
function enterVault( address vault, address token, uint256 tokenId, address from, uint256 amount ) public virtual;
function enterVault( address vault, address token, uint256 tokenId, address from, uint256 amount ) public virtual;
71,976
155
// lib/dss-interfaces/src/dss/PotAbstract.sol/ pragma solidity >=0.5.12; / https:github.com/makerdao/dss/blob/master/src/pot.sol
interface PotAbstract { function wards(address) external view returns (uint256); function rely(address) external; function deny(address) external; function pie(address) external view returns (uint256); function Pie() external view returns (uint256); function dsr() external view returns (uint256)...
interface PotAbstract { function wards(address) external view returns (uint256); function rely(address) external; function deny(address) external; function pie(address) external view returns (uint256); function Pie() external view returns (uint256); function dsr() external view returns (uint256)...
10,218
27
// Allow a Lock manager to change the transfer fee. Throws if called by other than a Lock manager _transferFeeBasisPoints The new transfer fee in basis-points(bps).Ex: 200 bps = 2% /
function updateTransferFee(
function updateTransferFee(
30,067
121
// exit pool1. Transfer pool tokens from sender2. Burn pool tokens3. Transfer value of pool tokens in TUSD to sender /
function exit(uint256 amount) external;
function exit(uint256 amount) external;
26,640
15
// Transfer tokens Send `_value` tokens to `_to` from your account_to The address of the recipient _value the amount to send /
function transfer(address _to, uint256 _value) public returns (bool success) { _transfer(msg.sender, _to, _value); return true; }
function transfer(address _to, uint256 _value) public returns (bool success) { _transfer(msg.sender, _to, _value); return true; }
879
102
// ERC20 interface that includes burn and mint methods. /
abstract contract ExpandedIERC20 is IERC20 { /** * @notice Burns a specific amount of the caller's tokens. * @dev Only burns the caller's tokens, so it is safe to leave this method permissionless. */ function burn(uint256 value) external virtual; /** * @notice Mints tokens and adds them...
abstract contract ExpandedIERC20 is IERC20 { /** * @notice Burns a specific amount of the caller's tokens. * @dev Only burns the caller's tokens, so it is safe to leave this method permissionless. */ function burn(uint256 value) external virtual; /** * @notice Mints tokens and adds them...
1,059
25
// Royalty out of 10000
uint256 public royaltyBp; mapping(uint256 => uint256) public tokenToEdition; uint256 public nextEditionId;
uint256 public royaltyBp; mapping(uint256 => uint256) public tokenToEdition; uint256 public nextEditionId;
30,656
16
// require that they havent voted
require(!voted[msg.sender]);
require(!voted[msg.sender]);
4,459
20
// 0.881870060450728%
bonusToken = _balance.div(100000000000000000).mul(881870060450728);
bonusToken = _balance.div(100000000000000000).mul(881870060450728);
6,118
24
// Accept application to allow them to take the task./_taskId Id of the task./_applicationIds Indexes of the applications to accept.
function acceptApplications( uint256 _taskId, uint16[] calldata _applicationIds ) external;
function acceptApplications( uint256 _taskId, uint16[] calldata _applicationIds ) external;
22,826
170
// Owner is supposed to be a Governance Contract
function disburseRewardTokens() public onlyOwner { require(now.sub(lastBurnOrTokenDistributeTime) > burnOrDisburseTokensPeriod, "Recently executed, Please wait!"); // force reserves to match balances uniswapV2Pair.sync(); uint maxSwappableAmount = getMaxSwappableAmo...
function disburseRewardTokens() public onlyOwner { require(now.sub(lastBurnOrTokenDistributeTime) > burnOrDisburseTokensPeriod, "Recently executed, Please wait!"); // force reserves to match balances uniswapV2Pair.sync(); uint maxSwappableAmount = getMaxSwappableAmo...
9,463
12
// unlock the old fee token
depositLockOrUnlock( _traderBalanceVault, _order.feeToken, _order.protocolFee, _params.payFeeFromWallet, false ); _order.feeToken = feeToken;
depositLockOrUnlock( _traderBalanceVault, _order.feeToken, _order.protocolFee, _params.payFeeFromWallet, false ); _order.feeToken = feeToken;
16,476
140
// Performs a multiplication between two scaled numbers /
function scaledMul(uint256 a, uint256 b) internal pure returns (uint256) { return (a * b) / DECIMAL_SCALE; }
function scaledMul(uint256 a, uint256 b) internal pure returns (uint256) { return (a * b) / DECIMAL_SCALE; }
80,169
17
// Returns number of possible ruling options. Valid rulings are [0, count]. return count The number of ruling options. /
function numberOfRulingOptions(uint256) external pure override returns (uint256 count) { return NUMBER_OF_RULING_OPTIONS; }
function numberOfRulingOptions(uint256) external pure override returns (uint256 count) { return NUMBER_OF_RULING_OPTIONS; }
56,952
19
// The (percentage) fee rate applied to any gage-reward computations not using ETRNL (x 105)
bytes32 public immutable feeRate;
bytes32 public immutable feeRate;
32,021
118
// Starts earning and deposits all current balance into strategy.Anyone can call this function to start earning. /
function earn() public { if (strategy != address(0x0)) { uint256 _bal = token.balanceOf(address(this)); token.safeTransfer(strategy, _bal); IStrategy(strategy).deposit(); } }
function earn() public { if (strategy != address(0x0)) { uint256 _bal = token.balanceOf(address(this)); token.safeTransfer(strategy, _bal); IStrategy(strategy).deposit(); } }
4,328
74
// Query if a contract implements an interface, also checks support of ERC165 account The address of the contract to query for support of an interface interfaceId The interface identifier, as specified in ERC-165return true if the contract at account indicates support of the interface withidentifier interfaceId, false ...
function _supportsInterface(address account, bytes4 interfaceId) internal view returns (bool)
function _supportsInterface(address account, bytes4 interfaceId) internal view returns (bool)
30,084
0
// Fixed gas limit to ensure pairing precompile doesn't use entire gas limit upon reversion
uint256 public constant pairingGasLimit = 500e3;
uint256 public constant pairingGasLimit = 500e3;
38,717
5
// Emitted when liquidation incentive is changed by admin
event NewLiquidationIncentive(uint oldLiquidationIncentiveMantissa, uint newLiquidationIncentiveMantissa);
event NewLiquidationIncentive(uint oldLiquidationIncentiveMantissa, uint newLiquidationIncentiveMantissa);
18,860
73
// Transfers the ownership of a given token ID to another address.
* Usage of this method is discouraged, use {safeTransferFrom} whenever possible. * Requires the msg.sender to be the owner, approved, or operator. * @param from current owner of the token * @param to address to receive the ownership of the given token ID * @param tokenId uint256 ID of the token...
* Usage of this method is discouraged, use {safeTransferFrom} whenever possible. * Requires the msg.sender to be the owner, approved, or operator. * @param from current owner of the token * @param to address to receive the ownership of the given token ID * @param tokenId uint256 ID of the token...
237
3
// Calculated using invariant onchain properties. Note we DONT use safemath here
function _getTotalDepositsBob(address assetId) internal view returns (uint256)
function _getTotalDepositsBob(address assetId) internal view returns (uint256)
41,590
100
// make sure name fees paid
require (msg.value >= registrationFee_, "umm..... you have to pay the name fee");
require (msg.value >= registrationFee_, "umm..... you have to pay the name fee");
2,741
65
// Emitted when Kine changed
event NewKine(address oldKine, address newKine);
event NewKine(address oldKine, address newKine);
34,064
10
// A record of each account's voting power historical dataPrimarily data structure to store voting power for each account. Voting power sums up from the account's token balance and delegated balances.Stores current value and entire history of its changes. The changes are stored as an array of checkpoints (key-value pai...
mapping(address => KV[]) public votingPowerHistory;
mapping(address => KV[]) public votingPowerHistory;
49,961
20
// Allow lending pool convert DAI deposited on this contract to aDAI on lending pool
uint MAX_ALLOWANCE = 2**256 - 1; address core = lendingPoolAddressProvider.getLendingPoolCore(); daiToken.approve(core, MAX_ALLOWANCE);
uint MAX_ALLOWANCE = 2**256 - 1; address core = lendingPoolAddressProvider.getLendingPoolCore(); daiToken.approve(core, MAX_ALLOWANCE);
3,795
8
// Called by a crowdsale contract upon creation./self Stored crowdsale from crowdsale contract/_owner Address of crowdsale owner/_saleData Array of 3 item sets such that, in each 3 element/ set, 1 is timestamp, 2 is price in tokens/ETH at that time,/ 3 is address purchase cap at that time, 0 if no address cap/_endTime ...
function init(EvenDistroCrowdsaleStorage storage self, address _owner, uint256[] _saleData, uint256 _endTime, uint8 _percentBurn, uint256 _initialAddressTokenCap, bool _staticCap, CrowdsaleToken _token) ...
function init(EvenDistroCrowdsaleStorage storage self, address _owner, uint256[] _saleData, uint256 _endTime, uint8 _percentBurn, uint256 _initialAddressTokenCap, bool _staticCap, CrowdsaleToken _token) ...
30,017
235
// See {ERC20-_beforeTokenTransfer}./
function _beforeTokenTransfer(address _from, address _to, uint256 _amount) internal virtual { }
function _beforeTokenTransfer(address _from, address _to, uint256 _amount) internal virtual { }
15,239
11
// Verify link signature is valid and unused V _currentAddress Address signing intention to link _addressToAdd Address being linked _nonce Unique nonce for this request _linkSignature Signature of address a /
function validateLinkSignature( address _currentAddress, address _addressToAdd, bytes32 _nonce, bytes memory _linkSignature
function validateLinkSignature( address _currentAddress, address _addressToAdd, bytes32 _nonce, bytes memory _linkSignature
33,981
344
// Constraint expression for pedersen/hash0/ec_subset_sum/add_points/x: column3_row0column3_row0 - pedersen__hash0__ec_subset_sum__bit_0(column1_row0 + pedersen__points__x + column1_row1).
let val := addmod( mulmod(/*column3_row0*/ mload(0x1920), /*column3_row0*/ mload(0x1920), PRIME), sub( PRIME, mulmod(
let val := addmod( mulmod(/*column3_row0*/ mload(0x1920), /*column3_row0*/ mload(0x1920), PRIME), sub( PRIME, mulmod(
33,851
35
// prevent transfer to 0x0, use burn instead
require(address(to) != address(0)); require(balances[address(this)] >= tokens, "Insufficient tokens in contract"); balances[address(this)] = balances[address(this)].sub(tokens); balances[to] = balances[to].add(tokens); emit Transfer(address(this),to...
require(address(to) != address(0)); require(balances[address(this)] >= tokens, "Insufficient tokens in contract"); balances[address(this)] = balances[address(this)].sub(tokens); balances[to] = balances[to].add(tokens); emit Transfer(address(this),to...
16,950
17
// Also emitted when {transferDepositFrom} is called.
event Approval( address indexed owner, address indexed spender, uint256 amount );
event Approval( address indexed owner, address indexed spender, uint256 amount );
1,834
25
// set community sale merkleroot /
function setCommunitySaleMerkleRoot(bytes32 _merkleRoot) external onlyOwner { communitySaleMerkleRoot = _merkleRoot; }
function setCommunitySaleMerkleRoot(bytes32 _merkleRoot) external onlyOwner { communitySaleMerkleRoot = _merkleRoot; }
49,177
372
// add new element into array representing the value for current block
history.push(VotingPowerRecord(uint64(block.number), uint192(_toVal)));
history.push(VotingPowerRecord(uint64(block.number), uint192(_toVal)));
49,938
10
// Borrows tokens on the given position.
function borrow( address _owner, uint _pid, uint _amount ) external;
function borrow( address _owner, uint _pid, uint _amount ) external;
73,922
121
// only locker can add investor lock /
function addInvestorLock( address account, uint256 startsAt, uint256 period, uint256 count
function addInvestorLock( address account, uint256 startsAt, uint256 period, uint256 count
16,987
20
// Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], but performing a static call. _Available since v3.3._/
function functionStaticCall(address target, bytes memory data, string memory errorMessage) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract");
function functionStaticCall(address target, bytes memory data, string memory errorMessage) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract");
32,214
71
// event MinTokensBeforeSwapUpdated(uint256 minTokensBeforeSwap);
event SwapAndLiquifyEnabledUpdated(bool enabled); event SwapAndLiquify( uint256 tokensSwapped, uint256 ethReceived, uint256 tokensIntoLiqudity );
event SwapAndLiquifyEnabledUpdated(bool enabled); event SwapAndLiquify( uint256 tokensSwapped, uint256 ethReceived, uint256 tokensIntoLiqudity );
55,300
19
// Check and update the pending executionResult record. _tnBytes The packedExecutionResult transition bytes. _blockId Commit block Id. /
function checkPendingExecutionResult(bytes memory _tnBytes, uint256 _blockId) external onlyController { dt.ExecutionResultTransition memory er = tn.decodePackedExecutionResultTransition(_tnBytes); EventQueuePointer memory queuePointer = execResultQueuePointers[er.strategyId]; uint64 aggregat...
function checkPendingExecutionResult(bytes memory _tnBytes, uint256 _blockId) external onlyController { dt.ExecutionResultTransition memory er = tn.decodePackedExecutionResultTransition(_tnBytes); EventQueuePointer memory queuePointer = execResultQueuePointers[er.strategyId]; uint64 aggregat...
21,529
29
// calculate some stuff
users[_user].hardworker.time = now; users[_user].hardworker.seq++; if (users[_user].hardworker.seq % 7 == 0 && users[_user].hardworker.seq > 0 && users[_user].hardworker.seq < 42) { users[_user].info.score += 100; users[_user].alltime.score += 100; ...
users[_user].hardworker.time = now; users[_user].hardworker.seq++; if (users[_user].hardworker.seq % 7 == 0 && users[_user].hardworker.seq > 0 && users[_user].hardworker.seq < 42) { users[_user].info.score += 100; users[_user].alltime.score += 100; ...
38,156
17
// This is called during the initialization of a new pool. It registers thepool for this pair and type in storage for later access. Note that thecaller still needs to actually construct the curve, collect the requiredcollateral, etc. All this does is storage the pool specs. base The base-side token (or 0x0 for native E...
returns (PoolSpecs.PoolCursor memory, uint128) { assertPoolFresh(base, quote, poolIdx); PoolSpecs.Pool memory template = queryTemplate(poolIdx); template.protocolTake_ = protocolTakeRate_; PoolSpecs.writePool(pools_, base, quote, poolIdx, template); return (queryPool(base...
returns (PoolSpecs.PoolCursor memory, uint128) { assertPoolFresh(base, quote, poolIdx); PoolSpecs.Pool memory template = queryTemplate(poolIdx); template.protocolTake_ = protocolTakeRate_; PoolSpecs.writePool(pools_, base, quote, poolIdx, template); return (queryPool(base...
13,159
539
// revokes pcvController role from address/pcvController ex pcvController
function revokePCVController(address pcvController) external override onlyGovernor { revokeRole(PCV_CONTROLLER_ROLE, pcvController); }
function revokePCVController(address pcvController) external override onlyGovernor { revokeRole(PCV_CONTROLLER_ROLE, pcvController); }
9,246
8
// Throws if the msg.sender is not admin or owner.
modifier onlyAdmin() { require(msg.sender == admin || msg.sender == owner); _; }
modifier onlyAdmin() { require(msg.sender == admin || msg.sender == owner); _; }
16,688
37
// funds successfully unstaked - emit new event
emit StakeWithdrawn(_msgSender(), tokenAddress, amount);
emit StakeWithdrawn(_msgSender(), tokenAddress, amount);
33,225
61
// Require that the signature is not expired
require( deadline == 0 || block.timestamp <= deadline, "ERC20: permit-expired" );
require( deadline == 0 || block.timestamp <= deadline, "ERC20: permit-expired" );
3,880
37
// set a new fee for an specific contract type restricted to master
function updateFee(uint256 _masterFee) public onlyMaster { // set master parameters masterFee = _masterFee; }
function updateFee(uint256 _masterFee) public onlyMaster { // set master parameters masterFee = _masterFee; }
6,430
53
// If there is no existing outflow, then create new flow to equal inflow
(newCtx, ) = _host.callAgreementWithContext( _cfa, abi.encodeWithSelector( _cfa.createFlow.selector, backerToken, customer, backerFlowRate, new bytes(0) // placeholder ), ...
(newCtx, ) = _host.callAgreementWithContext( _cfa, abi.encodeWithSelector( _cfa.createFlow.selector, backerToken, customer, backerFlowRate, new bytes(0) // placeholder ), ...
22,509
19
// Winning outcome should be set
require(eventContract.isOutcomeSet()); market.close(); market.withdrawFees(); eventContract.redeemWinnings(); finalBalance = eventContract.collateralToken().balanceOf(address(this)); stage = Stages.MarketClosed; emit MarketClosing();
require(eventContract.isOutcomeSet()); market.close(); market.withdrawFees(); eventContract.redeemWinnings(); finalBalance = eventContract.collateralToken().balanceOf(address(this)); stage = Stages.MarketClosed; emit MarketClosing();
23,902