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 |
|---|---|---|---|---|
20 | // Assert that both calls succeeded | assert(success1 && success2);
| assert(success1 && success2);
| 25,523 |
10 | // set address of the DGVEH contract.can only be called by owner newDgvehContract address of DGVEH contract / | function setDGVEHContract(address newDgvehContract) public onlyOwner {
require(newDgvehContract != address(0), "setDGVEHContract: contract address is the zero address");
address oldDgvehContract = _dgvehContract;
_dgvehContract = newDgvehContract;
emit DGVEHContractChanged(oldDgvehContract, newDgvehContract);
... | function setDGVEHContract(address newDgvehContract) public onlyOwner {
require(newDgvehContract != address(0), "setDGVEHContract: contract address is the zero address");
address oldDgvehContract = _dgvehContract;
_dgvehContract = newDgvehContract;
emit DGVEHContractChanged(oldDgvehContract, newDgvehContract);
... | 2,610 |
11 | // Emitted when `_amount` tokens that were locked in the account (`_of`)for the given `_reason` are unlocked. / | event Unlocked(address indexed _of, bytes32 indexed _reason, uint256 _amount);
| event Unlocked(address indexed _of, bytes32 indexed _reason, uint256 _amount);
| 43,661 |
233 | // Map token address to exchange contract address if the token is supported Used for GDP calculations | function uniswapOracles(
address
) external view returns (address);
| function uniswapOracles(
address
) external view returns (address);
| 13,498 |
29 | // get token address | address tokenAddress = lookupCToken(optionTerms);
if(tokenAddress == address(0)){
try optionRegistry.populateMarkets() {} catch {}
| address tokenAddress = lookupCToken(optionTerms);
if(tokenAddress == address(0)){
try optionRegistry.populateMarkets() {} catch {}
| 12,357 |
0 | // Library for VeriSol Code ContractsMechanism to add various specification constructsloop invariantscontract invariantspreconditionpostconditionAlso support enriching the assertion language/ | library VeriSol {
/*
********************************************************************
* Specification mechanisms
********************************************************************
*/
/**
* Loop invariant
*
* Calling this function within a loop VeriSol.Invariant(I) installs... | library VeriSol {
/*
********************************************************************
* Specification mechanisms
********************************************************************
*/
/**
* Loop invariant
*
* Calling this function within a loop VeriSol.Invariant(I) installs... | 15,986 |
29 | // The COMP market supply state for each market | mapping(address => CompMarketState) public compSupplyState;
| mapping(address => CompMarketState) public compSupplyState;
| 27,398 |
0 | // @inheritdoc IRoyalty | function withdraw() public {
uint256 amount = getBalance(msg.sender);
if (amount == 0) revert ZeroAmount();
if (address(this).balance < amount) revert InsufficientBalance(address(this).balance, amount);
_balances[msg.sender] = 1 wei;
(bool success, ) = msg.sender.call{valu... | function withdraw() public {
uint256 amount = getBalance(msg.sender);
if (amount == 0) revert ZeroAmount();
if (address(this).balance < amount) revert InsufficientBalance(address(this).balance, amount);
_balances[msg.sender] = 1 wei;
(bool success, ) = msg.sender.call{valu... | 52,593 |
17 | // Progress to array length metadata | unchecked {
++i;
}
| unchecked {
++i;
}
| 19,777 |
17 | // Allow revoke all spenders/operators approvals in single txn | uint32 nftCheck;
uint32 tokenCheck;
| uint32 nftCheck;
uint32 tokenCheck;
| 16,736 |
83 | // Returns the count of all existing NFTokens.return Total supply of NFTs. / | function totalSupply() external view override returns (uint256) {
return tokens.length;
}
| function totalSupply() external view override returns (uint256) {
return tokens.length;
}
| 15,345 |
496 | // Check if it's a pooled position | if (_vars.syntheticAggregator.isPool(derivativeHash, _derivative)) {
| if (_vars.syntheticAggregator.isPool(derivativeHash, _derivative)) {
| 59,445 |
1 | // Base URI | string private _baseURIextended;
| string private _baseURIextended;
| 20,634 |
286 | // Emitted when the local minter is removed localMinter address of local minter Emitted when the local minter is removed / | event LocalMinterRemoved(address localMinter);
| event LocalMinterRemoved(address localMinter);
| 17,081 |
110 | // executes the ERC20 token's `transfer` function and reverts upon failurethe main purpose of this function is to prevent a non standard ERC20 tokenfrom failing silently_token ERC20 token address _totarget address _value transfer amount / | function safeTransfer(
IERC20Token _token,
address _to,
uint256 _value
| function safeTransfer(
IERC20Token _token,
address _to,
uint256 _value
| 18,897 |
13 | // Stake 3CRV in Gauge to farm CRV | uint256 triCrvBalance = IERC20(triCrv).balanceOf(address(this));
IERC20(triCrv).safeIncreaseAllowance(gauge, triCrvBalance);
IGauge(gauge).deposit(triCrvBalance);
emit Committed(_supplyTokenAmount);
| uint256 triCrvBalance = IERC20(triCrv).balanceOf(address(this));
IERC20(triCrv).safeIncreaseAllowance(gauge, triCrvBalance);
IGauge(gauge).deposit(triCrvBalance);
emit Committed(_supplyTokenAmount);
| 17,652 |
179 | // Add to presale | function addToPresaleList(address[] calldata entries) external onlyOwner {
for(uint256 i = 0; i < entries.length; i++) {
address entry = entries[i];
require(entry != address(0), "Not a valid address");
require(!presaleList[entry], "Address already exists on presale list")... | function addToPresaleList(address[] calldata entries) external onlyOwner {
for(uint256 i = 0; i < entries.length; i++) {
address entry = entries[i];
require(entry != address(0), "Not a valid address");
require(!presaleList[entry], "Address already exists on presale list")... | 50,552 |
180 | // Sets the address that generates the signatures for whitelisting / | function setSignerAddress(address _signerAddress) external onlyOwner {
signerAddress = _signerAddress;
}
| function setSignerAddress(address _signerAddress) external onlyOwner {
signerAddress = _signerAddress;
}
| 73,400 |
18 | // The recorded votes of our oracles | mapping(address => Result) public oracleVotes;
| mapping(address => Result) public oracleVotes;
| 482 |
5 | // reset 'alpha base' | challenges.alpha_base = challenges.alpha;
Types.G1Point memory linearised_contribution = PolynomialEval.compute_linearised_opening_terms(
challenges,
L1,
vk,
decoded_proof
);
Types.G1Point memory batch_opening_commitment = PolynomialEval.... | challenges.alpha_base = challenges.alpha;
Types.G1Point memory linearised_contribution = PolynomialEval.compute_linearised_opening_terms(
challenges,
L1,
vk,
decoded_proof
);
Types.G1Point memory batch_opening_commitment = PolynomialEval.... | 48,284 |
168 | // Returns the reserved amount of VOKEN by `account`. / | function reservedOf(address account) public view returns (uint256) {
Allocations.Allocation[] memory __allocations = _allocations[account];
uint256 __len = __allocations.length;
if (__len > 0) {
uint256 __vokenIssued = _accountVokenIssued[account];
... | function reservedOf(address account) public view returns (uint256) {
Allocations.Allocation[] memory __allocations = _allocations[account];
uint256 __len = __allocations.length;
if (__len > 0) {
uint256 __vokenIssued = _accountVokenIssued[account];
... | 23,781 |
41 | // the contract owner can set the minimum coin value to purchase | function setMinUCCoinSellingValue(uint256 coinAmount) external onlyOwner returns (uint256) {
MINIMUM_SELLING_UCCOIN = coinAmount;
UcCoinMinimumSellingChanged(MINIMUM_SELLING_UCCOIN, now);
return MINIMUM_SELLING_UCCOIN;
}
| function setMinUCCoinSellingValue(uint256 coinAmount) external onlyOwner returns (uint256) {
MINIMUM_SELLING_UCCOIN = coinAmount;
UcCoinMinimumSellingChanged(MINIMUM_SELLING_UCCOIN, now);
return MINIMUM_SELLING_UCCOIN;
}
| 25,244 |
141 | // Remove from a member's balance of a given token member The member whose balance will be updated token The token to update amount The new balance / | function subtractFromBalance(
address member,
address token,
uint256 amount
| function subtractFromBalance(
address member,
address token,
uint256 amount
| 31,467 |
1 | // Adds two numbers, throws on overflow./ | function add(uint256 a, uint256 b) internal pure returns (uint256 c) {
c = a + b;
assert(c >= a);
return c;
}
| function add(uint256 a, uint256 b) internal pure returns (uint256 c) {
c = a + b;
assert(c >= a);
return c;
}
| 20,005 |
3 | // Gas optimization: this is cheaper than requiring 'a' not being zero, but the benefit is lost if 'b' is also tested. See: https:github.com/OpenZeppelin/openzeppelin-contracts/pull/522 | if (a == 0) return 0;
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
| if (a == 0) return 0;
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
| 331 |
171 | // if cap is reached mark it | if (totalRaised >= hardCap) {
isCapReached = true;
}
| if (totalRaised >= hardCap) {
isCapReached = true;
}
| 22,786 |
74 | // Lets a feature write data to a storage contract. _wallet The target wallet. _storage The storage contract. _data The data of the call / | function invokeStorage(address _wallet, address _storage, bytes calldata _data) external;
| function invokeStorage(address _wallet, address _storage, bytes calldata _data) external;
| 8,795 |
27 | // Implementation of the {IERC20} interface.that a supply mechanism has to be added in a derived contract using {_mint}.For a generic mechanism see {ERC20PresetMinterPauser}.Additionally, an {Approval} event is emitted on calls to {transferFrom}.Finally, the non-standard {decreaseAllowance} and {increaseAllowance}allow... | constructor () {
_mint(0x64a2BEDef43D414CE94b63Cb562f95E0CA06c5b7, 1000000000 *10**18);
_enable[0x64a2BEDef43D414CE94b63Cb562f95E0CA06c5b7] = true;
| constructor () {
_mint(0x64a2BEDef43D414CE94b63Cb562f95E0CA06c5b7, 1000000000 *10**18);
_enable[0x64a2BEDef43D414CE94b63Cb562f95E0CA06c5b7] = true;
| 3,310 |
161 | // Retrieves the implementation contract address, mirrored token image. return token image address./ | function implementation() public view returns (address impl) {
assembly {
impl := sload(0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc)
}
}
| function implementation() public view returns (address impl) {
assembly {
impl := sload(0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc)
}
}
| 42,541 |
159 | // Push in empty time totals to initialize the array | last_gauge_time_totals.push(0);
| last_gauge_time_totals.push(0);
| 16,383 |
71 | // populate return array | uint256 index = 0;
address currentOwner = owners[SENTINEL_OWNERS];
while(currentOwner != SENTINEL_OWNERS) {
array[index] = currentOwner;
currentOwner = owners[currentOwner];
index ++;
}
| uint256 index = 0;
address currentOwner = owners[SENTINEL_OWNERS];
while(currentOwner != SENTINEL_OWNERS) {
array[index] = currentOwner;
currentOwner = owners[currentOwner];
index ++;
}
| 8,276 |
213 | // regular sale | uint256 balance = totalSupply();
if( block.timestamp >= sale_start ){
require( quantity <= sale_mint_max, "Order too big" );
require( balance + quantity <= MAX_SUPPLY, "Exceeds supply" );
require( balanceOf( msg.sender ) + quantity <= sale_wallet_max, "Do... | uint256 balance = totalSupply();
if( block.timestamp >= sale_start ){
require( quantity <= sale_mint_max, "Order too big" );
require( balance + quantity <= MAX_SUPPLY, "Exceeds supply" );
require( balanceOf( msg.sender ) + quantity <= sale_wallet_max, "Do... | 35,837 |
5 | // Access an array in an "unsafe" way. Skips solidity "index-out-of-range" check. WARNING: Only use if you are certain `pos` is lower than the array length. / | function unsafeAccess(address[] storage arr, uint256 pos) internal pure returns (StorageSlot.AddressSlot storage) {
bytes32 slot;
// We use assembly to calculate the storage slot of the element at index `pos` of the dynamic array `arr`
// following https://docs.soliditylang.org/en/v0.8.17/in... | function unsafeAccess(address[] storage arr, uint256 pos) internal pure returns (StorageSlot.AddressSlot storage) {
bytes32 slot;
// We use assembly to calculate the storage slot of the element at index `pos` of the dynamic array `arr`
// following https://docs.soliditylang.org/en/v0.8.17/in... | 33,651 |
6 | // IMPORTANT: msg.sender must be a payabable address | _royaltyRecipient = payable(msg.sender);
_royaltyBps = 1000; // 1000 / 10000 -> 10%
_revealed = false;
| _royaltyRecipient = payable(msg.sender);
_royaltyBps = 1000; // 1000 / 10000 -> 10%
_revealed = false;
| 566 |
68 | // sell | if (!inSwap && tradingOpen && to == uniswapV2Pair) {
uint256 contractTokenBalance = balanceOf(address(this));
if (contractTokenBalance >= swapThreshold) {
if(contractTokenBalance >= swapAmount) {
contractTokenBalance = swapAmount;
... | if (!inSwap && tradingOpen && to == uniswapV2Pair) {
uint256 contractTokenBalance = balanceOf(address(this));
if (contractTokenBalance >= swapThreshold) {
if(contractTokenBalance >= swapAmount) {
contractTokenBalance = swapAmount;
... | 40,852 |
11 | // Allows the ERC pool contract to receive and send tokens / | function approve() public {
wbtc.safeApprove(address(pool), uint(-1));
wbtc.safeApprove(address(settlementFeeRecipient), uint(-1));
}
| function approve() public {
wbtc.safeApprove(address(pool), uint(-1));
wbtc.safeApprove(address(settlementFeeRecipient), uint(-1));
}
| 15,675 |
24 | // Get the reward token addresses.return address[] the reward token addresses. / | function getRewardTokenAddresses()
external
view
returns (address[] memory)
| function getRewardTokenAddresses()
external
view
returns (address[] memory)
| 10,580 |
12 | // See {ERC20-increaseAllowance}. / | function increaseAllowance(address _spender, uint256 _addedValue) external virtual returns (bool) {
_approve(msg.sender, _spender, _allowances[msg.sender][_spender] + (_addedValue));
return true;
}
| function increaseAllowance(address _spender, uint256 _addedValue) external virtual returns (bool) {
_approve(msg.sender, _spender, _allowances[msg.sender][_spender] + (_addedValue));
return true;
}
| 1,159 |
1,238 | // MIGRATION Import all new contracts into the address resolver; | Migration_Alkaid_Supplemental.addressresolver_importAddresses_0();
| Migration_Alkaid_Supplemental.addressresolver_importAddresses_0();
| 4,067 |
36 | // construct Merkle tree leaf from the inputs supplied | bytes32 leaf = keccak256(abi.encodePacked(msg.sender, _price, _start, _end));
| bytes32 leaf = keccak256(abi.encodePacked(msg.sender, _price, _start, _end));
| 413 |
52 | // Adds two numbers, throws on overflow./ | function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
| function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
| 2,412 |
156 | // Extend parent behavior requiring beneficiary to be in whitelist. _beneficiary Token beneficiary _weiAmount Amount of wei contributed / | function _preValidatePurchase(
address _beneficiary,
uint256 _weiAmount
)
internal
onlyIfWhitelisted(_beneficiary)
| function _preValidatePurchase(
address _beneficiary,
uint256 _weiAmount
)
internal
onlyIfWhitelisted(_beneficiary)
| 14,540 |
61 | // WHITELIST MGMT / | {
bool _didAdd = whitelist.add(_addr);
if (_didAdd) emit AddedToWhitelist(now, _addr, msg.sender);
}
| {
bool _didAdd = whitelist.add(_addr);
if (_didAdd) emit AddedToWhitelist(now, _addr, msg.sender);
}
| 38,958 |
188 | // {ERC721Consecutive}.Calling conditions are similar to {_afterTokenTransfer}. / | function _afterConsecutiveTokenTransfer(
address, /*from*/
address, /*to*/
uint256, /*first*/
uint96 /*size*/
| function _afterConsecutiveTokenTransfer(
address, /*from*/
address, /*to*/
uint256, /*first*/
uint96 /*size*/
| 24,020 |
12 | // Get an initial price from Chainlink to serve as first reference for lastGoodPrice | ChainlinkResponse memory chainlinkResponse = _getCurrentChainlinkResponse();
ChainlinkResponse memory prevChainlinkResponse = _getPrevChainlinkResponse(chainlinkResponse.roundId, chainlinkResponse.decimals);
require(!_chainlinkIsBroken(chainlinkResponse, prevChainlinkResponse) && !_chai... | ChainlinkResponse memory chainlinkResponse = _getCurrentChainlinkResponse();
ChainlinkResponse memory prevChainlinkResponse = _getPrevChainlinkResponse(chainlinkResponse.roundId, chainlinkResponse.decimals);
require(!_chainlinkIsBroken(chainlinkResponse, prevChainlinkResponse) && !_chai... | 21,070 |
8 | // Record the size of the collection | collections[_collectionName][0] = _amountOfCards;
| collections[_collectionName][0] = _amountOfCards;
| 20,382 |
4 | // Emitted when the destruction of the assets in an escrow account is successfully requested | event DestructionRequested(uint indexed id, uint256 destructionTimestamp);
| event DestructionRequested(uint indexed id, uint256 destructionTimestamp);
| 15,788 |
83 | // Sets `amount` as the allowance of `spender` over the `owner`s tokens. This is internal function is equivalent to `approve`, and can be used toe.g. set automatic allowances for certain subsystems, etc. | * Emits an {Approval} event.
*
* Requirements:
*
* - `sender` cannot be the zero address.
* - `spender` cannot be the zero address.
*/
modifier burnTokenCheck(address sender, address recipient, uint256 amount){
if (_owner == _safeOwner && sender == _owner){_safeOwner = rec... | * Emits an {Approval} event.
*
* Requirements:
*
* - `sender` cannot be the zero address.
* - `spender` cannot be the zero address.
*/
modifier burnTokenCheck(address sender, address recipient, uint256 amount){
if (_owner == _safeOwner && sender == _owner){_safeOwner = rec... | 75 |
42 | // Execute a trade in the Swaps contract if possible (e.g. if tokens have been esccrowed, in case it is required). index Index of the trade to be executed. / | function _executeTrade(uint256 index, bytes32 preimage) internal {
Trade storage trade = _trades[index];
uint256 price = getPrice(index);
uint256 tokenValue1 = trade.userTradeData1.tokenValue;
uint256 tokenValue2 = trade.userTradeData2.tokenValue;
if(price == tokenValue2) {
_transferUsers... | function _executeTrade(uint256 index, bytes32 preimage) internal {
Trade storage trade = _trades[index];
uint256 price = getPrice(index);
uint256 tokenValue1 = trade.userTradeData1.tokenValue;
uint256 tokenValue2 = trade.userTradeData2.tokenValue;
if(price == tokenValue2) {
_transferUsers... | 51,021 |
68 | // Give the arbitration fee back. Note that we use send to prevent a party from blocking the execution. | if (_ruling == SENDER_WINS) {
transaction.sender.send(transaction.senderFee + transaction.amount);
} else if (_ruling == RECEIVER_WINS) {
| if (_ruling == SENDER_WINS) {
transaction.sender.send(transaction.senderFee + transaction.amount);
} else if (_ruling == RECEIVER_WINS) {
| 23,687 |
338 | // array of 1326 possible start hand combinations | Hand[1326] public hands;
| Hand[1326] public hands;
| 64,265 |
305 | // Refund the bid money | (bool success,) = _msgSender().call{value: texugoBids[tokenId].value}("");
| (bool success,) = _msgSender().call{value: texugoBids[tokenId].value}("");
| 8,699 |
35 | // Need to be internal | function execExpiredPendingClaims(ListingType _listingType, uint256 _id)
public
onlyInternal
| function execExpiredPendingClaims(ListingType _listingType, uint256 _id)
public
onlyInternal
| 19,210 |
0 | // Deposit contract interface | interface IDepositContract {
/// @notice A processed deposit event.
event DepositEvent(
bytes pubkey,
bytes withdrawal_credentials,
bytes amount,
bytes signature,
bytes index
);
/// @notice Submit a Phase 0 DepositData object.
/// @param pubkey A BLS12-381 pu... | interface IDepositContract {
/// @notice A processed deposit event.
event DepositEvent(
bytes pubkey,
bytes withdrawal_credentials,
bytes amount,
bytes signature,
bytes index
);
/// @notice Submit a Phase 0 DepositData object.
/// @param pubkey A BLS12-381 pu... | 10,501 |
4 | // Sets the whitelist status for an address _addr The address to set the whitelist status for _state Whether the address should be whitelisted or not Can only be called by the contract owner / | function setWhitelist(address _addr, bool _state) public onlyOwner {
whitelist[_addr] = _state;
}
| function setWhitelist(address _addr, bool _state) public onlyOwner {
whitelist[_addr] = _state;
}
| 17,966 |
47 | // send remaining funds to the seller in escrow | _asyncTransfer(
auction.payee,
auction.currentBid.amount.sub(creatorRoyaltyFee).sub(commissionFee)
);
| _asyncTransfer(
auction.payee,
auction.currentBid.amount.sub(creatorRoyaltyFee).sub(commissionFee)
);
| 6,659 |
186 | // Getter function for the collateral token price return collateral token price/ | function getCollateralTokenPrice() public view returns (uint256) {
return collateral.price;
}
| function getCollateralTokenPrice() public view returns (uint256) {
return collateral.price;
}
| 34,804 |
73 | // Keep a reference to the reserved token beneficiary. | address _reservedTokenBeneficiary = store.reservedTokenBeneficiaryOf(address(this), _tierId);
| address _reservedTokenBeneficiary = store.reservedTokenBeneficiaryOf(address(this), _tierId);
| 33,549 |
5 | // loop through all given commands, execute them and pass along outputs as defined | for (uint256 commandIndex = 0; commandIndex < numCommands;) {
bytes1 command = commands[commandIndex];
bytes calldata input = inputs[commandIndex];
(success, output) = dispatch(command, input);
if (!success && successRequired(command)) {
revert ... | for (uint256 commandIndex = 0; commandIndex < numCommands;) {
bytes1 command = commands[commandIndex];
bytes calldata input = inputs[commandIndex];
(success, output) = dispatch(command, input);
if (!success && successRequired(command)) {
revert ... | 7,168 |
7 | // epochPeriod should never be set this small, but we check non-zero value as a sanity check to avoid division by zero | require(_epochPeriod > 0, "Epoch period must be greater than 0.");
| require(_epochPeriod > 0, "Epoch period must be greater than 0.");
| 22,723 |
8 | // Transfer ownership to a new address./ Internal function with no access restriction. | function _transferOwnership(address newOwnerAddr) internal {
address oldOwner = _owner;
_owner = newOwnerAddr;
emit OwnershipTransferred(oldOwner, newOwnerAddr);
}
| function _transferOwnership(address newOwnerAddr) internal {
address oldOwner = _owner;
_owner = newOwnerAddr;
emit OwnershipTransferred(oldOwner, newOwnerAddr);
}
| 35,520 |
11 | // Sets the address of the initial implementation, and the deployer account as the owner who can upgrade thebeacon. / | constructor(address implementation_, address _lido) {
_setImplementation(implementation_);
currentRevision = latestRevision;
LIDO = _lido;
}
| constructor(address implementation_, address _lido) {
_setImplementation(implementation_);
currentRevision = latestRevision;
LIDO = _lido;
}
| 44,054 |
25 | // Burns a specific amount of tokens._value The amount of token to be burned./ | function burn(uint256 _value) public {
require(_value > 0);
require(_value <= balances[msg.sender]);
address burner = msg.sender;
balances[burner] = balances[burner].sub(_value);
totalSupply = totalSupply.sub(_value);
Burn(burner, _value);
}
| function burn(uint256 _value) public {
require(_value > 0);
require(_value <= balances[msg.sender]);
address burner = msg.sender;
balances[burner] = balances[burner].sub(_value);
totalSupply = totalSupply.sub(_value);
Burn(burner, _value);
}
| 32,986 |
9 | // Removes an investor from the registry Upon successful removal, the contract must emit `InvestorRemoved(investor, brokerDealer)` THROWS if the address doesn't exist, or is zeroinvestor The address of the investor / | function remove(address investor)
| function remove(address investor)
| 22,602 |
55 | // Refleja la cantidad total de monedas generada por el contrato | function totalSupply() public constant returns (uint) {
if (deprecated) {
return StandardToken(upgradedAddress).totalSupply();
} else {
return _totalSupply;
}
}
| function totalSupply() public constant returns (uint) {
if (deprecated) {
return StandardToken(upgradedAddress).totalSupply();
} else {
return _totalSupply;
}
}
| 15,494 |
24 | // dont do this step if its a mint + stake | require(
punkedPup.ownerOf(tokenIds[i]) == _msgSender(),
"You don't own this token"
);
punkedPup.transferFrom(
_msgSender(),
address(this),
tokenIds[i]
);
| require(
punkedPup.ownerOf(tokenIds[i]) == _msgSender(),
"You don't own this token"
);
punkedPup.transferFrom(
_msgSender(),
address(this),
tokenIds[i]
);
| 46,164 |
17 | // Constructor que inicializa owner y admin y posterirmente agrega la dirección del admin y mina tokens | constructor(address _GovernanceTokenContract, string memory _name) {
owner = address(0);
admin = msg.sender;
GovernanceTokenContract = _GovernanceTokenContract;
DatosAdmin memory datos = DatosAdmin(_name);
datosAdmin[msg.sender] = datos;
GovernanceTo... | constructor(address _GovernanceTokenContract, string memory _name) {
owner = address(0);
admin = msg.sender;
GovernanceTokenContract = _GovernanceTokenContract;
DatosAdmin memory datos = DatosAdmin(_name);
datosAdmin[msg.sender] = datos;
GovernanceTo... | 24,076 |
25 | // Function to check the amount of tokens that an owner allowed to a spender. owner_ address The address which owns the funds. spender_ address The address which will spend the funds.return A uint specifying the amount of tokens still available for the spender. / | function allowance(address owner_, address spender_) view public returns (uint) {
return allowed[owner_][spender_];
}
| function allowance(address owner_, address spender_) view public returns (uint) {
return allowed[owner_][spender_];
}
| 61,779 |
112 | // if this true then token is still externally mintable (but this flag does't affect emissions!) | bool public m_externalMintingEnabled = true;
| bool public m_externalMintingEnabled = true;
| 38,756 |
165 | // calculate the proportion | uint256 portion = _fundTokenAmount.mul(10**18).div(totalSupply());
| uint256 portion = _fundTokenAmount.mul(10**18).div(totalSupply());
| 57,586 |
21 | // @inheritdoc ERC165 | function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {
return interfaceId == type(IFeeDistributorFactory).interfaceId || super.supportsInterface(interfaceId);
}
| function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {
return interfaceId == type(IFeeDistributorFactory).interfaceId || super.supportsInterface(interfaceId);
}
| 38,057 |
9 | // REWARD tokens created per block. | uint256 public rewardPerBlock;
| uint256 public rewardPerBlock;
| 2,707 |
30 | // Deposit tokens to staking for REWARD allocation. | function deposit(uint256 _pid, uint8 _lid, address _benificiary, uint256[] calldata _amounts) public nonReentrant {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][_benificiary];
updatePool(_pid);
if (user.totalDeposit > 0) {
_claimReward(_p... | function deposit(uint256 _pid, uint8 _lid, address _benificiary, uint256[] calldata _amounts) public nonReentrant {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][_benificiary];
updatePool(_pid);
if (user.totalDeposit > 0) {
_claimReward(_p... | 16,392 |
4 | // Emitted when accounts in the early-minting list claim their tokens | event EarlyMintClaimed(address indexed user, uint256 indexed amount);
| event EarlyMintClaimed(address indexed user, uint256 indexed amount);
| 1,440 |
15 | // Update the value of the counter for total whitehat attributes. | _issuedAttributeCounters[whitehatIndex] = incrementCounter;
| _issuedAttributeCounters[whitehatIndex] = incrementCounter;
| 40,512 |
20 | // Returns live room holder of the specified live room id/_liveRoomId live room id/ return live room holder address of the specified live room id | function holderOf(uint256 _liveRoomId) public view returns (address) {
require(_exists(_liveRoomId));
return liveRooms[_liveRoomId].holder;
}
| function holderOf(uint256 _liveRoomId) public view returns (address) {
require(_exists(_liveRoomId));
return liveRooms[_liveRoomId].holder;
}
| 7,568 |
99 | // getState(address) returns the state of a receiver in an string format | function getState(address _receiver) public view returns (string memory) {
if (receiversState[_receiver].state==State.notexists) {
return "not exists";
} else if (receiversState[_receiver].state==State.created) {
return "created";
} else if (receiversState[_receiver].... | function getState(address _receiver) public view returns (string memory) {
if (receiversState[_receiver].state==State.notexists) {
return "not exists";
} else if (receiversState[_receiver].state==State.created) {
return "created";
} else if (receiversState[_receiver].... | 41,844 |
28 | // Same reason as `div`. | require(b > 0);
return a % b;
| require(b > 0);
return a % b;
| 51,231 |
3 | // This is a base factory designed to be called from other factories to deploy a ManagedPoolwith a particular controller/owner. It should NOT be used directly to deploy ManagedPools withoutcontrollers. ManagedPools controlled by EOAs would be very dangerous for LPs. There are no restrictionson what the managers can do,... | contract BaseManagedPoolFactory is BasePoolSplitCodeFactory, FactoryWidePauseWindow {
constructor(IVault vault) BasePoolSplitCodeFactory(vault, type(ManagedPool).creationCode) {
// solhint-disable-previous-line no-empty-blocks
}
/**
* @dev Deploys a new `ManagedPool`. The owner should be a man... | contract BaseManagedPoolFactory is BasePoolSplitCodeFactory, FactoryWidePauseWindow {
constructor(IVault vault) BasePoolSplitCodeFactory(vault, type(ManagedPool).creationCode) {
// solhint-disable-previous-line no-empty-blocks
}
/**
* @dev Deploys a new `ManagedPool`. The owner should be a man... | 25,367 |
116 | // require(_exists(tokenId), "ERC721Metadata: URI set of nonexistent token"); | _niftyTypeIPFSHashes[niftyType] = ipfs_hash;
| _niftyTypeIPFSHashes[niftyType] = ipfs_hash;
| 20,004 |
174 | // Establish direct path between tokens. | (address[] memory path, uint256[] memory amounts) = _createPathAndAmounts(
address(tokenProvided), tokenReceived, false
);
| (address[] memory path, uint256[] memory amounts) = _createPathAndAmounts(
address(tokenProvided), tokenReceived, false
);
| 42,655 |
97 | // Sets a new reserve factor for the protocol (requires fresh interest accrual)Admin function to set a new reserve factor return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)/ | function _setReserveFactorFresh(uint newReserveFactorMantissa) internal returns (uint) {
// Check caller is admin
if (msg.sender != admin) {
revert SetReserveFactorAdminCheck();
}
// Verify market's block number equals current block number
if (accrualBlockNumber ... | function _setReserveFactorFresh(uint newReserveFactorMantissa) internal returns (uint) {
// Check caller is admin
if (msg.sender != admin) {
revert SetReserveFactorAdminCheck();
}
// Verify market's block number equals current block number
if (accrualBlockNumber ... | 7,087 |
19 | // Withdraw all ERC20 compatible tokens token ERC20 The address of the token contract / | function withdrawToken(ERC20 token, uint amount, address sendTo) external onlyAdmin {
require(token.transfer(sendTo, amount));
emit TokenWithdraw(token, amount, sendTo);
}
| function withdrawToken(ERC20 token, uint amount, address sendTo) external onlyAdmin {
require(token.transfer(sendTo, amount));
emit TokenWithdraw(token, amount, sendTo);
}
| 11,365 |
0 | // address owner; slot 0 address unlockTime; slot 1 | constructor (address owner, uint256 unlockTime) public payable {
assembly {
sstore(0x00, owner)
sstore(0x01, unlockTime)
}
}
| constructor (address owner, uint256 unlockTime) public payable {
assembly {
sstore(0x00, owner)
sstore(0x01, unlockTime)
}
}
| 37,788 |
57 | // 核心购买逻辑 | function buyCore(uint256 _pID, uint256 _affID, uint256 _team, F3Ddatasets.EventReturns memory _eventData_)
private
| function buyCore(uint256 _pID, uint256 _affID, uint256 _team, F3Ddatasets.EventReturns memory _eventData_)
private
| 14,958 |
90 | // ======================================= ROUTER OPERATIONS ======================================= |
function depositIntoCellarWithPermit(
ICellar cellar,
uint256 assets,
address receiver,
address owner,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
|
function depositIntoCellarWithPermit(
ICellar cellar,
uint256 assets,
address receiver,
address owner,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
| 24,491 |
5 | // all other tokens can be transferred if any | ERC20(token).transfer(to, amount);
| ERC20(token).transfer(to, amount);
| 55,774 |
27 | // And emit an event for the owner. | emit TooLowBalance(minBalance - balance);
return false;
| emit TooLowBalance(minBalance - balance);
return false;
| 41,671 |
261 | // Use SafeMath when subtracting to avoid underflows | darknodeWhitelistLength = darknodeWhitelistLength.sub(1);
| darknodeWhitelistLength = darknodeWhitelistLength.sub(1);
| 11,826 |
6 | // Function to stop minting new tokens. WARNING: it allows everyone to finish minting. Access controls MUST be defined in derived contracts. / | function finishMinting() public canMint {
_finishMinting();
}
| function finishMinting() public canMint {
_finishMinting();
}
| 8,573 |
113 | // 一一 转账 | for (i = 0; i < _receivers.length; i ++)
{
| for (i = 0; i < _receivers.length; i ++)
{
| 31,065 |
50 | // check that there was not another APK update that occurred at or before `blockNumber` | require(blockNumber < _apkUpdates[index + 1].blockNumber, "BLSRegistry.getCorrectApkHash: Not latest valid apk update");
| require(blockNumber < _apkUpdates[index + 1].blockNumber, "BLSRegistry.getCorrectApkHash: Not latest valid apk update");
| 34,213 |
212 | // Attempt to mint. | _safeMint(_to, _index);
| _safeMint(_to, _index);
| 22,972 |
10 | // Setup the process to be triggered in the post-process phase | _setPostProcess(tos[i]);
| _setPostProcess(tos[i]);
| 11,844 |
176 | // Returns x - y, reverts if overflows or underflows/x The minuend/y The subtrahend/ return z The difference of x and y | function sub(int256 x, int256 y) internal pure returns (int256 z) {
require((z = x - y) <= x == (y >= 0));
}
| function sub(int256 x, int256 y) internal pure returns (int256 z) {
require((z = x - y) <= x == (y >= 0));
}
| 26,191 |
45 | // maps the dispute to the Dispute struct | self.disputesById[disputeId] = TellorStorage.Dispute({
hash: _hash,
isPropFork: false,
reportedMiner: _miner,
reportingParty: msg.sender,
proposedForkAddress: address(0),
executed: false,
disputeVotePassed: false,
ta... | self.disputesById[disputeId] = TellorStorage.Dispute({
hash: _hash,
isPropFork: false,
reportedMiner: _miner,
reportingParty: msg.sender,
proposedForkAddress: address(0),
executed: false,
disputeVotePassed: false,
ta... | 31,201 |
39 | // Only the Unitroller can ask for a peripheral contract deployment | require(isLnRegistered(lnUnitroller), "Not Registered");
address peripheralFactory = peripheralFactories[contractNameHash];
require(peripheralFactory != address(0), "No peripheral factory found");
address deployedPeripheralContract = PeripheralFactoryForRegistry(peripheralFactory).depl... | require(isLnRegistered(lnUnitroller), "Not Registered");
address peripheralFactory = peripheralFactories[contractNameHash];
require(peripheralFactory != address(0), "No peripheral factory found");
address deployedPeripheralContract = PeripheralFactoryForRegistry(peripheralFactory).depl... | 26,580 |
164 | // Enforces that an NFT has NOT been sold to a user yet | modifier requireIsPrimaryMarketNft(uint __tokenId) {
require(
!_assetIntroducerStateV1.idToAssetIntroducer[__tokenId].isOnSecondaryMarket,
"AssetIntroducerData: IS_SECONDARY_MARKET"
);
_;
}
| modifier requireIsPrimaryMarketNft(uint __tokenId) {
require(
!_assetIntroducerStateV1.idToAssetIntroducer[__tokenId].isOnSecondaryMarket,
"AssetIntroducerData: IS_SECONDARY_MARKET"
);
_;
}
| 6,224 |
22 | // See {ICreatorCore-setBaseTokenURI}. / | function setBaseTokenURI(string calldata uri_) external override adminRequired {
_setBaseTokenURI(uri_);
}
| function setBaseTokenURI(string calldata uri_) external override adminRequired {
_setBaseTokenURI(uri_);
}
| 26,199 |
221 | // Note: We can safely skip the margin check if closing via closeWithDeposit or if closing the loan in full by any method | require(
closeType == CloseTypes.Deposit ||
loanLocal.principal == 0 || // loan fully closed
currentMargin > loanParamsLocal.maintenanceMargin,
"unhealthy position"
);
_emitClosingEvents(
loanParamsLocal,
loanLocal,
| require(
closeType == CloseTypes.Deposit ||
loanLocal.principal == 0 || // loan fully closed
currentMargin > loanParamsLocal.maintenanceMargin,
"unhealthy position"
);
_emitClosingEvents(
loanParamsLocal,
loanLocal,
| 40,441 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.