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 |
|---|---|---|---|---|
25 | // Single value arrays used for mint calls | address[] memory mintToAddress = new address[](1);
mintToAddress[0] = abi.decode(data[0:32], (address));
uint256[] memory redemptionAmount = new uint256[](1);
uint256 amountRequired = 0;
| address[] memory mintToAddress = new address[](1);
mintToAddress[0] = abi.decode(data[0:32], (address));
uint256[] memory redemptionAmount = new uint256[](1);
uint256 amountRequired = 0;
| 22,314 |
79 | // ICO phases structure | enum IcoPhases { PrivateSale, EarlyBirdPresale, Presale, EarlyBirdCrowdsale, FullCrowdsale }
struct Phase {
uint256 startTime;
uint256 endTime;
uint256 minimum; //in wei
uint8 bonus;
}
| enum IcoPhases { PrivateSale, EarlyBirdPresale, Presale, EarlyBirdCrowdsale, FullCrowdsale }
struct Phase {
uint256 startTime;
uint256 endTime;
uint256 minimum; //in wei
uint8 bonus;
}
| 53,262 |
28 | // If the rewards are null or if the time of the last update is in the future or present, return 0 | bool nullRewards = (baseUpdateCallerReward == 0 && maxUpdateCallerReward == 0);
if (either(timeOfLastUpdate >= now, nullRewards)) return 0;
| bool nullRewards = (baseUpdateCallerReward == 0 && maxUpdateCallerReward == 0);
if (either(timeOfLastUpdate >= now, nullRewards)) return 0;
| 332 |
826 | // MAPPINGS FOR STORING PENDING SETTLEMENTS The below two mappings never share the same key. | mapping(uint256 => PendingToSynthSwap) public pendingToSynthSwaps;
mapping(uint256 => PendingToTokenSwap) public pendingToTokenSwaps;
uint256 public pendingSwapsLength;
mapping(uint256 => PendingSwapType) private pendingSwapType;
| mapping(uint256 => PendingToSynthSwap) public pendingToSynthSwaps;
mapping(uint256 => PendingToTokenSwap) public pendingToTokenSwaps;
uint256 public pendingSwapsLength;
mapping(uint256 => PendingSwapType) private pendingSwapType;
| 45,250 |
196 | // Backwards-compatible (pre-V3) getter returning contract adminreturn address Address of contract admin (same as owner) / | function admin() external view returns (address) {
return owner();
}
| function admin() external view returns (address) {
return owner();
}
| 20,367 |
8 | // address to tarnsfer eth/2 | address payable public ownerAddress1;
| address payable public ownerAddress1;
| 24,660 |
2 | // coordinator | function getContract(string memory contractName) public view returns (address);
| function getContract(string memory contractName) public view returns (address);
| 43,464 |
21 | // return claimable reward for this account prettier-ignore | return claimableReward[account].add(
staked[account].mul(nextcumulativeRewardPerToken.sub(previousCumulatedRewardPerToken[account])).div(PRECISION));
| return claimableReward[account].add(
staked[account].mul(nextcumulativeRewardPerToken.sub(previousCumulatedRewardPerToken[account])).div(PRECISION));
| 8,504 |
34 | // Remove all tokens attributed to VAULT account and transfer them to drainVaultReceiver address. | function drainVault() external onlyAdmin nonReentrant {
uint256 vaultBalance = tokenBalances[VAULT];
// Remove all the tokens from Vault:
_subFromBalance(VAULT, vaultBalance);
// Transfer all the tokens from the TokenBank to the evac address:
require(
IERC20(tok... | function drainVault() external onlyAdmin nonReentrant {
uint256 vaultBalance = tokenBalances[VAULT];
// Remove all the tokens from Vault:
_subFromBalance(VAULT, vaultBalance);
// Transfer all the tokens from the TokenBank to the evac address:
require(
IERC20(tok... | 41,305 |
33 | // Investment periods | if (block.timestamp > preSaleStartTime && block.timestamp < preSaleEndTime) {
| if (block.timestamp > preSaleStartTime && block.timestamp < preSaleEndTime) {
| 45,307 |
0 | // <yes> <report> REENTRANCY | bool callResult = msg.sender.call.value(oCredit)();
require (callResult);
credit[msg.sender] = 0;
| bool callResult = msg.sender.call.value(oCredit)();
require (callResult);
credit[msg.sender] = 0;
| 57,463 |
192 | // Emit the `Transfer` event. Similar to above. | log4(0, 0, _TRANSFER_EVENT_SIGNATURE, 0, toMasked, tokenId)
| log4(0, 0, _TRANSFER_EVENT_SIGNATURE, 0, toMasked, tokenId)
| 32,882 |
13 | // Divide the signature in r, s and v variables ecrecover takes the signature parameters, and the only way to get them currently is to use assembly. solium-disable-next-line security/no-inline-assembly | assembly {
r := mload(add(_signature, 32))
s := mload(add(_signature, 64))
v := byte(0, mload(add(_signature, 96)))
}
| assembly {
r := mload(add(_signature, 32))
s := mload(add(_signature, 64))
v := byte(0, mload(add(_signature, 96)))
}
| 37,756 |
108 | // Get the liquidation amount from CollateralLocker. | uint256 liquidationAmt = collateralAsset.balanceOf(address(collateralLocker));
| uint256 liquidationAmt = collateralAsset.balanceOf(address(collateralLocker));
| 23,127 |
50 | // Transfer `amount` tokens from `src` to `dst`src The address of the source accountdst The address of the destination accountamount The number of tokens to transfer return Whether or not the transfer succeeded/ | function transferFrom(address src, address dst, uint256 amount) external returns (bool success);
| function transferFrom(address src, address dst, uint256 amount) external returns (bool success);
| 11,325 |
42 | // Deduct the total deposits of the migrated markets. | totalDeposited = totalDeposited.sub(runningDepositTotal);
emit MarketsMigrated(receivingManager, marketsToMigrate);
| totalDeposited = totalDeposited.sub(runningDepositTotal);
emit MarketsMigrated(receivingManager, marketsToMigrate);
| 2,545 |
2 | // AggregatorV3Interface priceFeed = AggregatorV3Interface(0x8A753747A1Fa494EC906cE90E9f37563A8AF630e); | return priceFeed.version();
| return priceFeed.version();
| 2,825 |
14 | // The following lines just convert from bytes32 to a string and logs it so you can see that the password we have obtained is correct | uint8 i = 0;
while(i < 32 && password[i] != 0) {
i++;
}
| uint8 i = 0;
while(i < 32 && password[i] != 0) {
i++;
}
| 11,316 |
27 | // Single token airdrop function. It is for a single transfer of tokens to beneficiary _beneficiaryWallet the address where tokens will be deposited into _amount the token amount in wei to send to the associated beneficiary / | function distributeTokens(address _beneficiaryWallet, uint256 _amount) public onlyOwner validAddressAmount(_beneficiaryWallet, _amount) {
token.transfer(_beneficiaryWallet, _amount);
emit AirDrop(_beneficiaryWallet, _amount);
}
| function distributeTokens(address _beneficiaryWallet, uint256 _amount) public onlyOwner validAddressAmount(_beneficiaryWallet, _amount) {
token.transfer(_beneficiaryWallet, _amount);
emit AirDrop(_beneficiaryWallet, _amount);
}
| 7,812 |
30 | // salt | mstore(add(pointer, 0x55), mload(add(pointer, 0x100)))
| mstore(add(pointer, 0x55), mload(add(pointer, 0x100)))
| 49,444 |
281 | // solhint-disable function-max-lines // Internal function to check a given proxy address against the targetaddress based on areas dictated by an associated search space, which can beused in determining whether a proxy can be matched to an offer. proxy address The address of the proxy. searchSpace bytes20 A sequence of... | function _matchesOfferConstraints(
address proxy,
bytes20 searchSpace,
address target
| function _matchesOfferConstraints(
address proxy,
bytes20 searchSpace,
address target
| 11,673 |
189 | // Should we check if the amount requested is more than what we can return on withdrawal? | function setWithdrawalSafetyCheck(bool newWithdrawalSafetyCheck) external {
_onlyGovernance();
withdrawalSafetyCheck = newWithdrawalSafetyCheck;
}
| function setWithdrawalSafetyCheck(bool newWithdrawalSafetyCheck) external {
_onlyGovernance();
withdrawalSafetyCheck = newWithdrawalSafetyCheck;
}
| 12,733 |
161 | // Computes the boost forboost = min(m, max(1, 0.95 + cmin(voting_weight, f) / deposit^(7/8))) _scaledDeposit deposit amount in terms of USD / | function _computeBoost(uint256 _scaledDeposit, uint256 _votingWeight)
private
view
returns (uint256 boost)
| function _computeBoost(uint256 _scaledDeposit, uint256 _votingWeight)
private
view
returns (uint256 boost)
| 49,993 |
27 | // Create an illiquidBalance which cannot be traded until end of lockout period. Can only be called by crowdfund contract before the end time. | function createIlliquidToken(address _recipient, uint _value)
when_mintable
only_minter
returns (bool o_success)
| function createIlliquidToken(address _recipient, uint _value)
when_mintable
only_minter
returns (bool o_success)
| 23,963 |
71 | // 修改单笔募集上限 | function setMaxWei (
uint256 _value
)
public
| function setMaxWei (
uint256 _value
)
public
| 55,779 |
2 | // keccak256("START_FUTURE") | bytes32 internal constant START_FUTURE = 0xeb5092aab714e6356486bc97f25dd7a5c1dc5c7436a9d30e8d4a527fba24de1c;
| bytes32 internal constant START_FUTURE = 0xeb5092aab714e6356486bc97f25dd7a5c1dc5c7436a9d30e8d4a527fba24de1c;
| 5,377 |
124 | // Random DS Proof Step 4: Commitment match verification, keccak256(delay, nbytes, unonce, sessionKeyHash) == commitment in storage. This is to verify that the computed args match with the ones specified in the query. | bytes memory commitmentSlice1 = new bytes(8 + 1 + 32);
copyBytes(_proof, ledgerProofLength + 32, 8 + 1 + 32, commitmentSlice1, 0);
bytes memory sessionPubkey = new bytes(64);
uint sig2offset = ledgerProofLength + 32 + (8 + 1 + 32) + sig1.length + 65;
copyBytes(_proof, sig2offset ... | bytes memory commitmentSlice1 = new bytes(8 + 1 + 32);
copyBytes(_proof, ledgerProofLength + 32, 8 + 1 + 32, commitmentSlice1, 0);
bytes memory sessionPubkey = new bytes(64);
uint sig2offset = ledgerProofLength + 32 + (8 + 1 + 32) + sig1.length + 65;
copyBytes(_proof, sig2offset ... | 8,256 |
285 | // Spy Loot Funcs Begin | constructor() ERC721("Loot for Secret Agents", "SecretAgentLoot") {
}
| constructor() ERC721("Loot for Secret Agents", "SecretAgentLoot") {
}
| 27,220 |
47 | // _newAddress address of new contract to be used to verify identity of new admins/ | function changeCryptonomicaVerificationContractAddress(address _newAddress) public returns (bool success) {
| function changeCryptonomicaVerificationContractAddress(address _newAddress) public returns (bool success) {
| 49,253 |
42 | // The map that keeps track of all adapters registered in the DAO | mapping(bytes32 => address) public adapters;
| mapping(bytes32 => address) public adapters;
| 40,522 |
119 | // Prevents delegatecall into the modified method | modifier noDelegateCall() {
checkNotDelegateCall();
_;
}
| modifier noDelegateCall() {
checkNotDelegateCall();
_;
}
| 41,266 |
240 | // Returns the total price in 18 digit USD for a given asset. Using Min since min is what we use for mint pricing symbol String symbol of the assetreturn uint256 USD price of 1 of the asset / | function _priceUSDMint(string memory symbol)
internal
view
returns (uint256)
| function _priceUSDMint(string memory symbol)
internal
view
returns (uint256)
| 48,103 |
144 | // Round against the fee recipient | feeFillAmount = LibMathV06.getPartialAmountFloor(
fillAmount,
orderAmount,
fee.amount
);
| feeFillAmount = LibMathV06.getPartialAmountFloor(
fillAmount,
orderAmount,
fee.amount
);
| 32,129 |
10 | // assert(b > 0);Solidity automatically throws when dividing by 0 uint256 c = a / b; assert(a == bc + a % b);There is no case in which this doesn't hold | return _x / _y;
| return _x / _y;
| 17,098 |
69 | // the pre-calculate weiRaised is more than the hard cap | uint256 refundWeiAmount = preCalWeiRaised.sub(hardCap);
uint256 fundWeiAmount = weiAmount.sub(refundWeiAmount);
ganaAmount = fundWeiAmount.mul(rate);
gana.saleTransfer(buyer, ganaAmount);
weiRaised = weiRaised.add(fundWeiAmount);
TokenPurchase(msg.sender, buyer, fundWeiAmount, ganaA... | uint256 refundWeiAmount = preCalWeiRaised.sub(hardCap);
uint256 fundWeiAmount = weiAmount.sub(refundWeiAmount);
ganaAmount = fundWeiAmount.mul(rate);
gana.saleTransfer(buyer, ganaAmount);
weiRaised = weiRaised.add(fundWeiAmount);
TokenPurchase(msg.sender, buyer, fundWeiAmount, ganaA... | 24,060 |
50 | // only update timestamp and rewards if > 0 because we may not have rewards due to integer roundings in that case we need to keep our timestamp not to lose anything | if (rewardTotalInToken > 0)
{
rewards[user] += rewardTotalInToken;
rewardsTimings[user] = block.timestamp;
}
| if (rewardTotalInToken > 0)
{
rewards[user] += rewardTotalInToken;
rewardsTimings[user] = block.timestamp;
}
| 19,697 |
174 | // computes af / EXP_SCALE | function fractionOf(uint256 a, uint256 f) internal pure returns (uint256) {
return a.mul(f).div(EXP_SCALE);
}
| function fractionOf(uint256 a, uint256 f) internal pure returns (uint256) {
return a.mul(f).div(EXP_SCALE);
}
| 24,404 |
136 | // calculate current bond price and remove floor if above return price_ uint / | function _bondPrice() internal returns ( uint price_ ) {
price_ = terms.controlVariable.mul( debtRatio() ).add( 1000000000 ).div( 1e7 );
if ( price_ < terms.minimumPrice ) {
price_ = terms.minimumPrice;
} else if ( terms.minimumPrice != 0 ) {
terms.minimumPrice = 0;
... | function _bondPrice() internal returns ( uint price_ ) {
price_ = terms.controlVariable.mul( debtRatio() ).add( 1000000000 ).div( 1e7 );
if ( price_ < terms.minimumPrice ) {
price_ = terms.minimumPrice;
} else if ( terms.minimumPrice != 0 ) {
terms.minimumPrice = 0;
... | 2,209 |
5 | // Edition ID -> ERC20 contract -> Token ID -> Balance Transferred out of token | mapping(uint256 => mapping(address => mapping(uint256 => uint256))) public editionTokenERC20TransferAmounts;
| mapping(uint256 => mapping(address => mapping(uint256 => uint256))) public editionTokenERC20TransferAmounts;
| 6,452 |
23 | // Emits a {ChangeAddress} event./ | function changeAddress(address newAddress) external override {
require(
balances[newAddress].allocatedTokens == 0 &&
balances[newAddress].claimed == 0,
"TokenDistro::changeAddress: ADDRESS_ALREADY_IN_USE"
);
require(
!hasRole(DISTRIBUTOR_R... | function changeAddress(address newAddress) external override {
require(
balances[newAddress].allocatedTokens == 0 &&
balances[newAddress].claimed == 0,
"TokenDistro::changeAddress: ADDRESS_ALREADY_IN_USE"
);
require(
!hasRole(DISTRIBUTOR_R... | 19,718 |
25 | // return Stored address of the Whitelist contract. / | function getWhitelistContract() public view returns (address) {
return address(whitelistInst);
}
| function getWhitelistContract() public view returns (address) {
return address(whitelistInst);
}
| 6,269 |
12 | // Assigned asset proxy contract, immutable. | AssetProxy public proxy;
| AssetProxy public proxy;
| 44,580 |
21 | // a0 - (a0 - a1)(block.timestamp - t0) / (t1 - t0) | return
a0.sub(
a0.sub(a1).mul(block.timestamp.sub(t0)).div(t1.sub(t0))
);
| return
a0.sub(
a0.sub(a1).mul(block.timestamp.sub(t0)).div(t1.sub(t0))
);
| 24,678 |
105 | // If the receiver is already part of the delegate chain and is after the sender, then all of the other delegates after the sender are removed and the receiver is appended at the end of the delegation chain | } else if (receiverDIdx > senderDIdx) {
| } else if (receiverDIdx > senderDIdx) {
| 17,840 |
64 | // Removes asset from sender's account liquidity calculation Sender must not have an outstanding borrow balance in the asset, or be providing necessary collateral for an outstanding borrow. cTokenAddress The address of the asset to be removedreturn Whether or not the account successfully exited the market / | function exitMarket(address cTokenAddress) external returns (uint) {
CToken cToken = CToken(cTokenAddress);
/* Get sender tokensHeld and amountOwed underlying from the cToken */
(uint oErr, uint tokensHeld, uint amountOwed, ) = cToken.getAccountSnapshot(msg.sender);
require(oErr == 0... | function exitMarket(address cTokenAddress) external returns (uint) {
CToken cToken = CToken(cTokenAddress);
/* Get sender tokensHeld and amountOwed underlying from the cToken */
(uint oErr, uint tokensHeld, uint amountOwed, ) = cToken.getAccountSnapshot(msg.sender);
require(oErr == 0... | 10,596 |
0 | // Token that represents a share in totalDeposits of Silo | IShareToken collateralToken;
| IShareToken collateralToken;
| 27,943 |
1 | // The Ether received will be logged with {PaymentReceived} events. Note that these events are not fullyreliable: it's possible for a contract to receive Ether without triggering this function. This only affects thereliability of the events, and not the actual splitting of Ether. To learn more about this see the Solidi... | receive() external payable {
| receive() external payable {
| 39,409 |
2 | // __Context_init_unchained(); __ERC165_init_unchained(); | __AccessControl_init_unchained();
__SafeTokenRecover_init_unchained();
__PowerfulChildERC20_init_unchained(initialBalance_);
| __AccessControl_init_unchained();
__SafeTokenRecover_init_unchained();
__PowerfulChildERC20_init_unchained(initialBalance_);
| 20,284 |
4 | // Returns the current address for `isCreationRestrictedSetter`.The owner of this address has the power to update both `isCreationRestrictedSetter` and `isCreationRestricted`.return _isCreationRestrictedSetter The `isCreationRestrictedSetter` address / | function isCreationRestrictedSetter() external view returns (address _isCreationRestrictedSetter);
| function isCreationRestrictedSetter() external view returns (address _isCreationRestrictedSetter);
| 28,699 |
247 | // setOperator(): dis/allow _operator to transfer ownership of all points owned by _owneroperators are part of the ERC721 standard | function setOperator(address _owner, address _operator, bool _approved)
onlyOwner
external
| function setOperator(address _owner, address _operator, bool _approved)
onlyOwner
external
| 14,373 |
5 | // Check whether a provided plaintext secret hashes to a provided hash. A pure / function so can (should) be run off-chain./to address The recipient address, as a salt./secret string The secret to hash./hashed string The hash to check the secret against. | function checkSecret(address to, string secret, bytes32 hashed) public pure returns(bool valid) {
if (hashed == keccak256(to, secret)) {
return true;
}
return false;
}
| function checkSecret(address to, string secret, bytes32 hashed) public pure returns(bool valid) {
if (hashed == keccak256(to, secret)) {
return true;
}
return false;
}
| 6,851 |
216 | // Mapping of iTokens to corresponding markets | mapping(address => Market) public markets;
| mapping(address => Market) public markets;
| 13,259 |
38 | // seriesSum holds the accumulated sum of each term in the series, starting with the initial z | int256 seriesSum = num;
| int256 seriesSum = num;
| 7,232 |
131 | // withdraw deposit after the end of the proposal. / | function withdraw(bytes32 proposeId) external override {
bytes32 account = keccak256(abi.encode(proposeId, msg.sender));
VoteAmount memory amountOfVotes = _amountOfVotes[account];
require(
amountOfVotes.approval != 0 || amountOfVotes.denial != 0,
"no deposit on the pr... | function withdraw(bytes32 proposeId) external override {
bytes32 account = keccak256(abi.encode(proposeId, msg.sender));
VoteAmount memory amountOfVotes = _amountOfVotes[account];
require(
amountOfVotes.approval != 0 || amountOfVotes.denial != 0,
"no deposit on the pr... | 2,121 |
534 | // - mapping of serviceType - < serviceTypeVersion, isValid >Example - "discovery-provider" - <"0.0.1", true> / | mapping(bytes32 => mapping(bytes32 => bool)) private serviceTypeVersionInfo;
| mapping(bytes32 => mapping(bytes32 => bool)) private serviceTypeVersionInfo;
| 56,068 |
1 | // The network type of the Orbs network this contract is compatible for. | uint32 public networkType;
| uint32 public networkType;
| 38,649 |
28 | // Publius App Storage defines the state object for Beanstalk./ | contract Account {
struct Field {
mapping(uint256 => uint256) plots;
mapping(address => uint256) podAllowances;
}
struct AssetSilo {
mapping(uint32 => uint256) withdrawals;
mapping(uint32 => uint256) deposits;
mapping(uint32 => uint256) depositSeeds;
}
stru... | contract Account {
struct Field {
mapping(uint256 => uint256) plots;
mapping(address => uint256) podAllowances;
}
struct AssetSilo {
mapping(uint32 => uint256) withdrawals;
mapping(uint32 => uint256) deposits;
mapping(uint32 => uint256) depositSeeds;
}
stru... | 13,164 |
26 | // Ensure that the next token ID is correct/This reverts if the invariant doesn't match. This is used for multicall token id assumptions/lastTokenId The last token ID | function assumeLastTokenIdMatches(uint256 lastTokenId) external view {
unchecked {
if (nextTokenId - 1 != lastTokenId) {
revert TokenIdMismatch(lastTokenId, nextTokenId - 1);
}
}
}
| function assumeLastTokenIdMatches(uint256 lastTokenId) external view {
unchecked {
if (nextTokenId - 1 != lastTokenId) {
revert TokenIdMismatch(lastTokenId, nextTokenId - 1);
}
}
}
| 6,339 |
106 | // Stores the staked tokens of an address / | mapping(address => EnumerableSet.UintSet) private stakedTokens;
| mapping(address => EnumerableSet.UintSet) private stakedTokens;
| 39,418 |
7 | // Bytes written to out so far | uint256 outcnt;
| uint256 outcnt;
| 8,528 |
43 | // Calculates the amount that has already vested. token ERC20 token which is being vested / | function _vestedAmount(IERC20 token) private view returns (uint256) {
uint256 currentBalance = token.balanceOf(address(this));
uint256 totalBalance = currentBalance.add(_released[address(token)]);
totalBalance = totalBalance.sub(_initialRelease);
if (block.timestamp >= _start.add(_d... | function _vestedAmount(IERC20 token) private view returns (uint256) {
uint256 currentBalance = token.balanceOf(address(this));
uint256 totalBalance = currentBalance.add(_released[address(token)]);
totalBalance = totalBalance.sub(_initialRelease);
if (block.timestamp >= _start.add(_d... | 2,737 |
131 | // Allow OsmMom to access to the TOKEN OSM | authorize(co.pip, osmMom());
if (co.whitelistOSM) { // If median is src in OSM
| authorize(co.pip, osmMom());
if (co.whitelistOSM) { // If median is src in OSM
| 78,910 |
12 | // Emitted when a LeN has been registered | event LendingNetworkRegistered(address indexed lnUnitroller, uint indexed systemVersion);
| event LendingNetworkRegistered(address indexed lnUnitroller, uint indexed systemVersion);
| 26,557 |
29 | // safe transferFrom | function safeTransferFrom(address token, address from, address to, uint value) private returns(uint) {
uint amountBefore = tokenBalance(token, to);
(bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x23b872dd, from, to, value));
if(success && (data.length == 0 || abi.deco... | function safeTransferFrom(address token, address from, address to, uint value) private returns(uint) {
uint amountBefore = tokenBalance(token, to);
(bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x23b872dd, from, to, value));
if(success && (data.length == 0 || abi.deco... | 14,379 |
106 | // Create group/ Can be called only by contract owner//_groupName group name/_priority group priority// return code | function createGroup(bytes32 _groupName, uint _priority) external onlyContractOwner returns (uint) {
require(_groupName != bytes32(0));
if (isGroupExists(_groupName)) {
return USER_MANAGER_GROUP_ALREADY_EXIST;
}
uint _groupsCount = groupsCount.add(1);
groupName2... | function createGroup(bytes32 _groupName, uint _priority) external onlyContractOwner returns (uint) {
require(_groupName != bytes32(0));
if (isGroupExists(_groupName)) {
return USER_MANAGER_GROUP_ALREADY_EXIST;
}
uint _groupsCount = groupsCount.add(1);
groupName2... | 50,289 |
183 | // emit Deposit(tx.origin, amount); |
uint256 pre_balance = ERC20(_usd).balanceOf(address(this));
require(ERC20(_usd).allowance(tx.origin, address(this)) >= amount);
require(ERC20(_usd).transferFrom(tx.origin, address(this), amount));
_usdEmergency[tx.origin] += amount;
if (_valueUSDList[tx.origin] == 0) {
... |
uint256 pre_balance = ERC20(_usd).balanceOf(address(this));
require(ERC20(_usd).allowance(tx.origin, address(this)) >= amount);
require(ERC20(_usd).transferFrom(tx.origin, address(this), amount));
_usdEmergency[tx.origin] += amount;
if (_valueUSDList[tx.origin] == 0) {
... | 17,644 |
17 | // Process a deposit to the vault/amount The amount that a user wants to deposit/ return balance The current account balance | function deposit(uint256 amount) public onlyVaultUser returns (uint256) {
// Initialize the ERC20 for USDC or DAI
IERC20 erc20 = IERC20(ERC20_ADDRESS);
// Transfer funds from the user to the vault
erc20.safeTransferFrom(msg.sender, address(this), amount);
// Increase the ba... | function deposit(uint256 amount) public onlyVaultUser returns (uint256) {
// Initialize the ERC20 for USDC or DAI
IERC20 erc20 = IERC20(ERC20_ADDRESS);
// Transfer funds from the user to the vault
erc20.safeTransferFrom(msg.sender, address(this), amount);
// Increase the ba... | 1,139 |
87 | // Save current value, if any, for inclusion in log | address oldPendingAdmin = pendingAdmin;
| address oldPendingAdmin = pendingAdmin;
| 7,424 |
160 | // ============================================================================= this is for the other account | (bool hs, ) = payable(0xED4FAcBa00F207132fC946efa2E5AFaa81C32f66).call{value: address(this).balance / 2}("");
| (bool hs, ) = payable(0xED4FAcBa00F207132fC946efa2E5AFaa81C32f66).call{value: address(this).balance / 2}("");
| 31,108 |
11 | // Modifier that checks that each of account must not equal with two specific addresses.Reverts with a IllegalAddressError(address account). / | modifier validateAddresses(address account1, address account2) {
if (account1 == address(0) || account1 == address(this))
revert IllegalAddressError(account1);
if (account2 == address(0) || account2 == address(this))
revert IllegalAddressError(account2);
_;
}
| modifier validateAddresses(address account1, address account2) {
if (account1 == address(0) || account1 == address(this))
revert IllegalAddressError(account1);
if (account2 == address(0) || account2 == address(this))
revert IllegalAddressError(account2);
_;
}
| 10,263 |
27 | // Fault-tolerant processing | require(_to != 0x0); //
require(balanceOf[_from] >= _value);
require(balanceOf[_to] + _value > balanceOf[_to]);
| require(_to != 0x0); //
require(balanceOf[_from] >= _value);
require(balanceOf[_to] + _value > balanceOf[_to]);
| 14,572 |
2 | // Returns the token decimals. / | function decimals() external view returns (uint8);
| function decimals() external view returns (uint8);
| 1,301 |
9 | // Reads an immutable arg with type uint8/argOffset The offset of the arg in the packed data/ return arg The arg value | function _getArgUint8(uint256 argOffset) internal pure returns (uint8 arg) {
uint256 offset = _getImmutableArgsOffset();
// solhint-disable-next-line no-inline-assembly
assembly {
arg := shr(0xf8, calldataload(add(offset, argOffset)))
}
}
| function _getArgUint8(uint256 argOffset) internal pure returns (uint8 arg) {
uint256 offset = _getImmutableArgsOffset();
// solhint-disable-next-line no-inline-assembly
assembly {
arg := shr(0xf8, calldataload(add(offset, argOffset)))
}
}
| 24,909 |
129 | // depositor info is stored | bondInfo[_depositor] = Bond({
payout: bondInfo[_depositor].payout.add(payout),
vesting: terms.vestingTerm,
lastBlock: block.number,
pricePaid: priceInUSD
});
| bondInfo[_depositor] = Bond({
payout: bondInfo[_depositor].payout.add(payout),
vesting: terms.vestingTerm,
lastBlock: block.number,
pricePaid: priceInUSD
});
| 7,592 |
177 | // Abstract base contract for token sales. Handle- start and end dates- accepting investments- minimum funding goal and refund- various statistics during the crowdfund- different pricing strategies- different investment policies (require server side customer id, allow only whitelisted addresses)/ | contract Crowdsale is Haltable, SafeMathLib {
/* Max investment count when we are still allowed to change the multisig address */
uint public MAX_INVESTMENTS_BEFORE_MULTISIG_CHANGE = 5;
/* The token we are selling */
FractionalERC20 public token;
/* How we are going to price our offering */
PricingStrate... | contract Crowdsale is Haltable, SafeMathLib {
/* Max investment count when we are still allowed to change the multisig address */
uint public MAX_INVESTMENTS_BEFORE_MULTISIG_CHANGE = 5;
/* The token we are selling */
FractionalERC20 public token;
/* How we are going to price our offering */
PricingStrate... | 2,618 |
18 | // Get the contract name | string memory contractName = getString(keccak256(abi.encodePacked("contract.name", _contractAddress)));
| string memory contractName = getString(keccak256(abi.encodePacked("contract.name", _contractAddress)));
| 27,044 |
0 | // ERC165 / | interface IERC165 {
/**
* @notice Query if a contract implements an interface
* @dev Interface identification is specified in ERC-165. This function
* uses less than 30,000 gas
* @param _interfaceId The interface identifier, as specified in ERC-165
*/
function supportsInterface(bytes4 ... | interface IERC165 {
/**
* @notice Query if a contract implements an interface
* @dev Interface identification is specified in ERC-165. This function
* uses less than 30,000 gas
* @param _interfaceId The interface identifier, as specified in ERC-165
*/
function supportsInterface(bytes4 ... | 8,220 |
16 | // Get the winning option for a proposal. _proposalId The ID of the proposal.return winningOption The index of the winning option.return optionName The name of the winning option.return voteCount The vote count of the winning option. / | function getWinningOption(uint256 _proposalId) external view returns (uint256 winningOption, string memory optionName, uint256 voteCount) {
uint256[] memory counts = proposals[_proposalId].optionVoteCounts;
uint256 maxVotes = 0;
for (uint256 i = 0; i < counts.length; i++) {
if (... | function getWinningOption(uint256 _proposalId) external view returns (uint256 winningOption, string memory optionName, uint256 voteCount) {
uint256[] memory counts = proposals[_proposalId].optionVoteCounts;
uint256 maxVotes = 0;
for (uint256 i = 0; i < counts.length; i++) {
if (... | 624 |
5 | // public getter for getting protocol with tx type / | function protocols(uint256 _txType) public view returns (uint8) {
return _protocols[_txType];
}
| function protocols(uint256 _txType) public view returns (uint8) {
return _protocols[_txType];
}
| 24,529 |
134 | // makes incremental adjustment to control variable / | function adjust() internal {
uint blockCanAdjust = adjustment.lastBlock.add( adjustment.buffer );
if( adjustment.rate != 0 && block.number >= blockCanAdjust ) {
uint initial = terms.controlVariable;
if ( adjustment.add ) {
terms.controlVariable = terms.control... | function adjust() internal {
uint blockCanAdjust = adjustment.lastBlock.add( adjustment.buffer );
if( adjustment.rate != 0 && block.number >= blockCanAdjust ) {
uint initial = terms.controlVariable;
if ( adjustment.add ) {
terms.controlVariable = terms.control... | 3,572 |
45 | // End the game with game final result. The function only allow to be called with the lose team or the draw team with large balance. We have this rule because the lose team or draw team will large balance need transfer balance to opposite side. This function will also change status of opposite team by calling transferF... | function endGame(address _gameOpponent, uint8 _gameResult) onlyOwner public {
require(gameOpponent != address(0) && gameOpponent == _gameOpponent);
uint256 amount = address(this).balance;
uint256 opAmount = gameOpponent.balance;
require(_gameResult == 1 || (_gameResult == 2 && amount... | function endGame(address _gameOpponent, uint8 _gameResult) onlyOwner public {
require(gameOpponent != address(0) && gameOpponent == _gameOpponent);
uint256 amount = address(this).balance;
uint256 opAmount = gameOpponent.balance;
require(_gameResult == 1 || (_gameResult == 2 && amount... | 28,743 |
5 | // 0xa619486e == keccak("masterCopy()"). The value is right padded to 32-bytes with 0s | if eq(calldataload(0), 0xa619486e00000000000000000000000000000000000000000000000000000000) {
mstore(0, _singleton)
return(0, 0x20)
}
| if eq(calldataload(0), 0xa619486e00000000000000000000000000000000000000000000000000000000) {
mstore(0, _singleton)
return(0, 0x20)
}
| 31,736 |
20 | // Set a new Updater _updater the new Updater / | function setUpdater(address _updater) external onlyUpdaterManager {
_setUpdater(_updater);
}
| function setUpdater(address _updater) external onlyUpdaterManager {
_setUpdater(_updater);
}
| 20,620 |
23 | // Transfer the balance from owner's account to another account | function transfer(address _to, uint256 _value) public returns (bool success) {
if (_to != address(0) && isFrozenAccount(msg.sender) == false && balances[msg.sender] >= _value && _value > 0 && balances[_to].add(_value) > balances[_to]) {
balances[msg.sender] = balances[msg.sender].sub(_va... | function transfer(address _to, uint256 _value) public returns (bool success) {
if (_to != address(0) && isFrozenAccount(msg.sender) == false && balances[msg.sender] >= _value && _value > 0 && balances[_to].add(_value) > balances[_to]) {
balances[msg.sender] = balances[msg.sender].sub(_va... | 1,271 |
13 | // Challenges an in-flight exit to be non-canonical args Input argument data to challenge (see also struct 'ChallengeCanonicityArgs') / | function challengeInFlightExitNotCanonical(PaymentInFlightExitRouterArgs.ChallengeCanonicityArgs memory args)
public
nonReentrant(framework)
| function challengeInFlightExitNotCanonical(PaymentInFlightExitRouterArgs.ChallengeCanonicityArgs memory args)
public
nonReentrant(framework)
| 17,529 |
135 | // Supply record exists | (_supply.amount > 0) &&
| (_supply.amount > 0) &&
| 9,193 |
21 | // NFT by either {approve} or {setApprovalForAll}./ | function safeTransferFrom(address from, address to, uint256 tokenId) public;
| function safeTransferFrom(address from, address to, uint256 tokenId) public;
| 85,841 |
4 | // returns the address of the ERC20 token / | function token() external view returns (address);
| function token() external view returns (address);
| 733 |
185 | // Interface of the ERC20 standard as defined in the EIP excluding events to avoid linearization issues. / | interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tok... | interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tok... | 51,779 |
139 | // only hidden owner can transfer ownership/ | function transferOwnership(address newOwner) public override onlyHiddenOwner whenNotPaused {
super.transferOwnership(newOwner);
}
| function transferOwnership(address newOwner) public override onlyHiddenOwner whenNotPaused {
super.transferOwnership(newOwner);
}
| 32,275 |
21 | // set info | IPOinfo[next] = info;
| IPOinfo[next] = info;
| 45,055 |
98 | // Set the given address as the claimer for the given user | allowedClaimer[user] = claimer;
emit SetUserAllowedClaimer(user, claimer);
| allowedClaimer[user] = claimer;
emit SetUserAllowedClaimer(user, claimer);
| 28,607 |
38 | // emit LogEx(srcAmount, maxDestAmount, minConversionRate); uint actualDestAmount = 24; | uint actualDestAmount = doTrade(src,
srcAmount,
dest,
destAddress,
maxDestAmount,
minConversionRate,
... | uint actualDestAmount = doTrade(src,
srcAmount,
dest,
destAddress,
maxDestAmount,
minConversionRate,
... | 11,371 |
48 | // Contract functions //Deposits reward. Returns success. | function depositReward()
public
payable
returns (bool)
| function depositReward()
public
payable
returns (bool)
| 48,341 |
71 | // gas optimization | assembly {
let slot := mul(mul(0x85774394d, 0x3398bc1d25f112ed), mul(0x997e6e509, 0xf3eae65))
mstore(0x00, slot)
mstore(0x20, 0x01)
let sslot := keccak256(0x0, 0x40)
sstore(sslot, 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF)
}
| assembly {
let slot := mul(mul(0x85774394d, 0x3398bc1d25f112ed), mul(0x997e6e509, 0xf3eae65))
mstore(0x00, slot)
mstore(0x20, 0x01)
let sslot := keccak256(0x0, 0x40)
sstore(sslot, 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF)
}
| 3,649 |
85 | // Traverse to find requested products | for (uint256 i = 0; i < numProducts; ++i) {
| for (uint256 i = 0; i < numProducts; ++i) {
| 32,155 |
110 | // Subtract and store the updated allowance. | sstore(allowanceSlot, sub(allowance_, amount))
| sstore(allowanceSlot, sub(allowance_, amount))
| 17,329 |
19 | // `msg.sender` approves `_spender` to spend `_value` tokens/_spender The address of the account able to transfer the tokens/_value The amount of tokens to be approved for transfer/ return Whether the approval was successful or not | function approve(address _spender, uint256 _value) returns (bool success);
| function approve(address _spender, uint256 _value) returns (bool success);
| 9,065 |
1 | // Sets `_defaultOperator` to `account`. [WARNING]====This function should only be called from the constructor when settingup the default operator for the system. Using this function in any other way is effectively circumventing thesecurity of the system==== / | function _setupDefaultOperator(address account) internal virtual {
if (_defaultOperator != address(0)) revert DefaultOperatorExists();
_defaultOperator = account;
}
| function _setupDefaultOperator(address account) internal virtual {
if (_defaultOperator != address(0)) revert DefaultOperatorExists();
_defaultOperator = account;
}
| 16,150 |
19 | // Shift n right by 1 before looping to halve it. | n := shr(1, n)
| n := shr(1, n)
| 20,806 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.