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 |
|---|---|---|---|---|
29 | // Collection of functions related to the address type/ | library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
... | library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
... | 41,573 |
51 | // EIP-712 Domain separatorreturn Separator / | function getDomainSeparator() public view returns (bytes32) {
return keccak256(
abi.encode(
DOMAIN_TYPEHASH,
keccak256(bytes(name)),
VERSION_HASH,
_getChainId(),
address(this)
)
);
}
| function getDomainSeparator() public view returns (bytes32) {
return keccak256(
abi.encode(
DOMAIN_TYPEHASH,
keccak256(bytes(name)),
VERSION_HASH,
_getChainId(),
address(this)
)
);
}
| 32,161 |
20 | // These are related to SOTOX team members | mapping (address => bool) public frozenAccount;
mapping (address => uint[3]) public frozenTokens;
| mapping (address => bool) public frozenAccount;
mapping (address => uint[3]) public frozenTokens;
| 10,792 |
75 | // Only compound if we're on a new block | uint32 _timeElapsed;
unchecked {
_timeElapsed = uint32(block.timestamp) - debtTokenData.interestAccumulatorUpdatedAt;
}
| uint32 _timeElapsed;
unchecked {
_timeElapsed = uint32(block.timestamp) - debtTokenData.interestAccumulatorUpdatedAt;
}
| 40,848 |
45 | // ERROR CODES / | struct LockedDeposits {
uint counter;
mapping(uint => uint) index2Date;
mapping(uint => uint) date2deposit;
}
| struct LockedDeposits {
uint counter;
mapping(uint => uint) index2Date;
mapping(uint => uint) date2deposit;
}
| 47,696 |
21 | // Used when any of the resolved stakedCeloGroupVoter.pendingWithdrawalvalues do not match the equivalent record in lockedGold.pendingWithdrawals. / | error InconsistentPendingWithdrawalValues(
| error InconsistentPendingWithdrawalValues(
| 24,966 |
992 | // If the start time is in the past, "fast forward" to start now This avoids discontinuities in the weight curve. Otherwise, if you set the start/end times with only 10% of the period in the future, the weights would immediately jump 90% | uint256 currentTime = block.timestamp;
startTime = Math.max(currentTime, startTime);
_require(startTime <= endTime, Errors.GRADUAL_UPDATE_TIME_TRAVEL);
_startGradualWeightChange(startTime, endTime, _getNormalizedWeights(), endWeights);
| uint256 currentTime = block.timestamp;
startTime = Math.max(currentTime, startTime);
_require(startTime <= endTime, Errors.GRADUAL_UPDATE_TIME_TRAVEL);
_startGradualWeightChange(startTime, endTime, _getNormalizedWeights(), endWeights);
| 30,718 |
36 | // An address for the transfer event where the burned tokens are transferred in a faux Transfer event | address public constant BURN_ADDRESS = 0;
| address public constant BURN_ADDRESS = 0;
| 41,873 |
23 | // User supplies assets into the market and receives cTokens in exchange Assumes interest has already been accrued up to the current block minter The address of the account which is supplying the assets mintAmount The amount of the underlying asset to supply isNative The amount is in native or notreturn (uint, uint) An... | function mintFresh(
address minter,
uint256 mintAmount,
bool isNative
| function mintFresh(
address minter,
uint256 mintAmount,
bool isNative
| 48,338 |
31 | // views the numeraire value of the current balance of the reserve, in this case token1 instead of calculating with chainlink's "rate" it'll be determined by the existing token ratio. This is in here to prevent LPs from losing out on future oracle price updates | function viewNumeraireBalanceLPRatio(
uint256 _baseWeight,
uint256 _quoteWeight,
address _addr
| function viewNumeraireBalanceLPRatio(
uint256 _baseWeight,
uint256 _quoteWeight,
address _addr
| 31,121 |
4 | // Inserts an item at the beginning of the queue. / | function pushFront(Bytes32Deque storage deque, bytes32 value) internal {
int128 frontIndex;
unchecked {
frontIndex = deque._begin - 1;
}
deque._data[frontIndex] = value;
deque._begin = frontIndex;
}
| function pushFront(Bytes32Deque storage deque, bytes32 value) internal {
int128 frontIndex;
unchecked {
frontIndex = deque._begin - 1;
}
deque._data[frontIndex] = value;
deque._begin = frontIndex;
}
| 25,308 |
7 | // Assets by ID | mapping(uint256 => Asset) assets;
| mapping(uint256 => Asset) assets;
| 15,195 |
51 | // Transfer balance controlled by magistrate./Magistrate has exclusive rights to withdraw until the end of term./Remaining balance after the next election is rolled over to the next magistrate. | function withdraw(address payable to) public {
require(_msgSender() == getMagistrate(), Errors.OnlyMagistrate);
// TODO: Someday, would it be fun if this required having a >2 LINK balance to
// withdraw? If we wanna be super cute, could automagically buy LINK from
// the proceeds before transferring t... | function withdraw(address payable to) public {
require(_msgSender() == getMagistrate(), Errors.OnlyMagistrate);
// TODO: Someday, would it be fun if this required having a >2 LINK balance to
// withdraw? If we wanna be super cute, could automagically buy LINK from
// the proceeds before transferring t... | 18,200 |
86 | // 3 | uint256 totalLocked;
for(uint idx = 0; idx < timelockList[holder].length ; idx++ ){
totalLocked = totalLocked.add(timelockList[holder][idx]._amount);
}
| uint256 totalLocked;
for(uint idx = 0; idx < timelockList[holder].length ; idx++ ){
totalLocked = totalLocked.add(timelockList[holder][idx]._amount);
}
| 16,108 |
51 | // max transaction is 4% of initialSupply | uint256 public maxTxAmount = initialSupply * 400 / 10000;
bool private _swapping;
| uint256 public maxTxAmount = initialSupply * 400 / 10000;
bool private _swapping;
| 21,167 |
2 | // write SYN address | syn = _syn;
| syn = _syn;
| 2,162 |
8 | // Sellers sell items and create orders | function Sell(string calldata _sellObject,uint256 _stackAmount,address _allowbuyer) public nonReentrant returns (bool) {
require(Address.isContract(_msgSender())==false,"not hunman");
//Administrators can block a certain address for transactions
require(!TransactionBan[_msgSender()],"Transa... | function Sell(string calldata _sellObject,uint256 _stackAmount,address _allowbuyer) public nonReentrant returns (bool) {
require(Address.isContract(_msgSender())==false,"not hunman");
//Administrators can block a certain address for transactions
require(!TransactionBan[_msgSender()],"Transa... | 2,086 |
0 | // Constructor that gives msg.sender all of existing tokens./ | constructor() public ERC20Detailed('USDTTestToken', 'UTT', 18) {
_mint(msg.sender, 10000 * (10 ** uint256(decimals())));
}
| constructor() public ERC20Detailed('USDTTestToken', 'UTT', 18) {
_mint(msg.sender, 10000 * (10 ** uint256(decimals())));
}
| 8,893 |
44 | // Realize $CARROT earnings and optionally unstake tokens. tokenIds the IDs of the tokens to claim earnings from unstake whether or not to unstake ALL of the tokens listed in tokenIds membership wheather user is membership or not seed account seed sig signature / | function claimRewardsAndUnstake(uint16[] calldata tokenIds, bool unstake, bool membership, uint48 expiration, uint256 seed, bytes memory sig) external whenNotPaused nonReentrant _eosOnly _updateEarnings {
require(isValidSignature(msg.sender, membership, expiration, seed, sig), "invalid signature");
uint128 r... | function claimRewardsAndUnstake(uint16[] calldata tokenIds, bool unstake, bool membership, uint48 expiration, uint256 seed, bytes memory sig) external whenNotPaused nonReentrant _eosOnly _updateEarnings {
require(isValidSignature(msg.sender, membership, expiration, seed, sig), "invalid signature");
uint128 r... | 40,133 |
92 | // Extension of `ERC20Mintable` that adds a cap to the supply of tokens. / | contract ERC20Capped is ERC20Mintable {
uint256 private _cap;
/**
* @dev Sets the value of the `cap`. This value is immutable, it can only be
* set once during construction.
*/
constructor (uint256 cap) public {
require(cap > 0, "ERC20Capped: cap is 0");
_cap = cap;
}
... | contract ERC20Capped is ERC20Mintable {
uint256 private _cap;
/**
* @dev Sets the value of the `cap`. This value is immutable, it can only be
* set once during construction.
*/
constructor (uint256 cap) public {
require(cap > 0, "ERC20Capped: cap is 0");
_cap = cap;
}
... | 38,072 |
20 | // Current cycle deposits counter. Incremented on deposit and decremented on withdrawal. | uint256 public currentCycleDepositsCount;
| uint256 public currentCycleDepositsCount;
| 34,239 |
37 | // Airline has been voted in | flightSuretyData.registerAirline(airline, false);
flightSuretyData.resetVoteCounter(airline);
emit RegisterAirline(airline);
| flightSuretyData.registerAirline(airline, false);
flightSuretyData.resetVoteCounter(airline);
emit RegisterAirline(airline);
| 7,789 |
69 | // distribute rewards to each recipient | for ( uint i = 0; i < info.length; i++ ) {
if ( info[ i ].rate > 0 ) {
ITreasury( treasury ).mintRewards( // mint and send from treasury
info[ i ].recipient,
nextRewardAt( info[ i ].rate )
);
... | for ( uint i = 0; i < info.length; i++ ) {
if ( info[ i ].rate > 0 ) {
ITreasury( treasury ).mintRewards( // mint and send from treasury
info[ i ].recipient,
nextRewardAt( info[ i ].rate )
);
... | 28,519 |
3 | // Claim a Dawn Key quantity The quantity to claim maxKeys The maximum number of keys allocated to this address in the snapshot signature A signature to authenticate the claim / | function claim(
uint8 quantity,
uint16 maxKeys,
bytes memory signature
| function claim(
uint8 quantity,
uint16 maxKeys,
bytes memory signature
| 77,492 |
2 | // The name of this component | string name;
| string name;
| 225 |
139 | // Get the deposit and borrow amount with interest of the user for the handler (internal)userAddr The address of userhandlerID The handler ID return The deposit and borrow amount with interest/ | function _getHandlerAmountWithAmount(address payable userAddr, uint256 handlerID) internal view returns (uint256, uint256)
| function _getHandlerAmountWithAmount(address payable userAddr, uint256 handlerID) internal view returns (uint256, uint256)
| 85,131 |
41 | // tokenId ERC721 tokenId of a depositreturn string with metadata JSON containing the NFT's name and description / | function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
require(_exists(tokenId), "ERC721: nonexistent token");
Deposit storage dep = deposits[tokenId];
return string(abi.encodePacked(
'{"name":"Hodl-bonus-pool deposit, tokenId: ',
tokenId.toString(... | function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
require(_exists(tokenId), "ERC721: nonexistent token");
Deposit storage dep = deposits[tokenId];
return string(abi.encodePacked(
'{"name":"Hodl-bonus-pool deposit, tokenId: ',
tokenId.toString(... | 24,330 |
9 | // Tcrit ≥ 0 - the time during which the utilization exceeds the critical value | int256 Tcrit;
| int256 Tcrit;
| 24,636 |
8 | // received pot swap deposit | event onPotSwapDeposit
(
uint256 roundID,
uint256 amountAddedToPot
);
| event onPotSwapDeposit
(
uint256 roundID,
uint256 amountAddedToPot
);
| 51,520 |
73 | // {See ICreatorCore-royaltyInfo}. / | function royaltyInfo(uint256 tokenId, uint256 value) external view virtual override returns (address, uint256) {
return _getRoyaltyInfo(tokenId, value);
}
| function royaltyInfo(uint256 tokenId, uint256 value) external view virtual override returns (address, uint256) {
return _getRoyaltyInfo(tokenId, value);
}
| 27,132 |
109 | // Returns the cost in XP for a user to rank up. user The user's address.return The cost in XP for the user to rank up. / | function getRankUpCostXP(address user) public view returns (uint256) {
IGuildID guildID = IGuildID(_contracts.guildID);
return _rankUpBasePriceXP * (guildID.getRank(guildID.getID(user)) + 1);
}
| function getRankUpCostXP(address user) public view returns (uint256) {
IGuildID guildID = IGuildID(_contracts.guildID);
return _rankUpBasePriceXP * (guildID.getRank(guildID.getID(user)) + 1);
}
| 33,866 |
47 | // ========== RESTRICTED FUNCTIONS (SIGNATURE REQUIRED) ========== //Claim the asset of a swap request on source chain after YPool worker `closeSwap` on target chain, by providing signatures of validators/ Claiming MUST be performed on source chain/Signatures from validators are first sent to SwapValidator contract on ... | function claim(uint256 _swapId, bytes[] memory signatures) external whenNotPaused {
require(_swapId < swapId, "ERR_INVALID_SWAPID");
require(swapRequests[_swapId].status != RequestStatus.Closed, "ERR_ALREADY_CLOSED");
swapRequests[_swapId].status = RequestStatus.Closed;
bytes32 sigI... | function claim(uint256 _swapId, bytes[] memory signatures) external whenNotPaused {
require(_swapId < swapId, "ERR_INVALID_SWAPID");
require(swapRequests[_swapId].status != RequestStatus.Closed, "ERR_ALREADY_CLOSED");
swapRequests[_swapId].status = RequestStatus.Closed;
bytes32 sigI... | 35,478 |
42 | // MODIFIERS / | 45,035 | ||
4 | // Solidity in-memory arrays can't be increased in size, but can be decreased in size by writing to the length. Since we can't know the number of RLP items without looping over the entire input, we'd have to loop twice to accurately size this array. It's easier to simply set a reasonable maximum list length and decreas... | RLPItem[] memory out = new RLPItem[](MAX_LIST_LENGTH);
uint256 itemCount = 0;
uint256 offset = listOffset;
while (offset < _in.length) {
require(
itemCount < MAX_LIST_LENGTH,
'Provided RLP list exceeds max list length.'
);
| RLPItem[] memory out = new RLPItem[](MAX_LIST_LENGTH);
uint256 itemCount = 0;
uint256 offset = listOffset;
while (offset < _in.length) {
require(
itemCount < MAX_LIST_LENGTH,
'Provided RLP list exceeds max list length.'
);
| 31,678 |
18 | // function to fetchMarketItmes - minting, buying and selling return the number of unsold items | function fetchMarketTokens() public view returns(MarketToken[] memory) {
uint itemCount = _tokenIds.current();
uint unsoldItemCount = _tokenIds.current() - _tokensSold.current();
uint currentIndex = 0;
// looping over the number of items created (if number has no... | function fetchMarketTokens() public view returns(MarketToken[] memory) {
uint itemCount = _tokenIds.current();
uint unsoldItemCount = _tokenIds.current() - _tokensSold.current();
uint currentIndex = 0;
// looping over the number of items created (if number has no... | 9,533 |
75 | // Set contract creator as initial owner / | constructor() public {
owner = msg.sender;
pendingOwner = address(0);
}
| constructor() public {
owner = msg.sender;
pendingOwner = address(0);
}
| 36,760 |
29 | // Block number at which the challenge period ends, in case it has been initiated. | uint32 settle_block_number;
| uint32 settle_block_number;
| 51,854 |
70 | // Group-buy contract for Token ICO/Joe Wasson/Allows for group purchase of the Token ICO. This is done/ in two phases:/ a) contributions initiate a purchase on demand./ b) tokens are collected when they are unfrozen | contract TokenBuy is Pausable, Claimable, TokenDestructible, DSMath {
using SafeERC20 for ERC20Basic;
/// @notice Token ICO contract
ACOTokenCrowdsale public crowdsaleContract;
/// @notice Token contract
ERC20Basic public tokenContract;
/// @notice Map of contributors and their token balances... | contract TokenBuy is Pausable, Claimable, TokenDestructible, DSMath {
using SafeERC20 for ERC20Basic;
/// @notice Token ICO contract
ACOTokenCrowdsale public crowdsaleContract;
/// @notice Token contract
ERC20Basic public tokenContract;
/// @notice Map of contributors and their token balances... | 26,767 |
61 | // save in returned value the amount of weth receive to use off-chain | _balances[i] = _res[_res.length - 1];
| _balances[i] = _res[_res.length - 1];
| 5,288 |
0 | // The mode that the App is currently in from POV of the blockchain | enum AppStatus {
ON,
DISPUTE,
OFF
}
| enum AppStatus {
ON,
DISPUTE,
OFF
}
| 33,302 |
94 | // `(_prevId, _nextId)` is a valid insert position if they are adjacent nodes and `_key` falls between the two nodes' keys | return self.nodes[_prevId].nextId == _nextId && self.nodes[_prevId].key >= _key && _key >= self.nodes[_nextId].key;
| return self.nodes[_prevId].nextId == _nextId && self.nodes[_prevId].key >= _key && _key >= self.nodes[_nextId].key;
| 45,732 |
79 | // Total DVD that have been burned./These DVD are still in circulation therefore they/ are still considered on the bonding curve formula./ return Total burned DVD in wei. | function dvdBurnedAmount() public view returns (uint256) {
return IERC20(dvd).balanceOf(BURN_ADDRESS);
}
| function dvdBurnedAmount() public view returns (uint256) {
return IERC20(dvd).balanceOf(BURN_ADDRESS);
}
| 10,224 |
184 | // Setter for refill price / | function setStnRefillPrice(uint _stnRefillPrice) external onlyOwner {
stnRefillPrice = _stnRefillPrice;
}
| function setStnRefillPrice(uint _stnRefillPrice) external onlyOwner {
stnRefillPrice = _stnRefillPrice;
}
| 73,447 |
94 | // Validate inputs | require(weiAmount != 0, "BeardGangLandNFTICO: ETH sent 0");
require(_beneficiary != address(0), "BeardGangLandNFTICO: beneficiary zero address");
| require(weiAmount != 0, "BeardGangLandNFTICO: ETH sent 0");
require(_beneficiary != address(0), "BeardGangLandNFTICO: beneficiary zero address");
| 40,897 |
320 | // function to dynamically change supply | function changeSupply(uint256 _supply) external onlyOwner {
maxSupply = _supply;
}
| function changeSupply(uint256 _supply) external onlyOwner {
maxSupply = _supply;
}
| 25,778 |
38 | // Timestamp of the moment the swap was created. Always set to `now` on creation This field is also used to check for struct existence by comparing it against 0 | uint startTimestamp;
| uint startTimestamp;
| 45,569 |
20 | // Mints liquidity tokens./The input tokens must've already been sent to the pool./data ABI-encoded params that the pool requires./ return liquidity The amount of liquidity tokens that were minted for the user. | function mint(bytes calldata data) external returns (uint256 liquidity);
| function mint(bytes calldata data) external returns (uint256 liquidity);
| 30,966 |
22 | // submit re-rollup batch indexbatchIndex need re-rollup batch index/ | function submitReRollUpInfo(
uint256 batchIndex
| function submitReRollUpInfo(
uint256 batchIndex
| 29,558 |
7 | // Emit when the token ticker expiry is changed | event ChangeExpiryLimit(uint256 _oldExpiry, uint256 _newExpiry);
| event ChangeExpiryLimit(uint256 _oldExpiry, uint256 _newExpiry);
| 50,559 |
102 | // Internal function to stake all outstanding LP tokens to the given position ID. | function _addShare(uint256 id) internal {
uint256 balance = lpToken.balanceOf(address(this));
if (balance > 0) {
uint256 share = balanceToShare(balance);
masterChef.deposit(pid, balance);
shares[id] = shares[id].add(share);
totalShare = totalShare.add... | function _addShare(uint256 id) internal {
uint256 balance = lpToken.balanceOf(address(this));
if (balance > 0) {
uint256 share = balanceToShare(balance);
masterChef.deposit(pid, balance);
shares[id] = shares[id].add(share);
totalShare = totalShare.add... | 20,049 |
93 | // Change partner address _nftAddress Token maket fee address _tokenCreaterAddress Partner addressOnly partner can change their share address / | function changeTokenCreaterAddress(
address _nftAddress,
| function changeTokenCreaterAddress(
address _nftAddress,
| 22,373 |
3 | // Certify document creation with hash and timestampIt registers in the blockchain the proof-of-existence of an external document_documentHash - Hash of the document (it should have 32 bytes) return id - returns certified document id/ | function certifyDocumentCreation(bytes32 _documentHash, string memory _timestamp)
| function certifyDocumentCreation(bytes32 _documentHash, string memory _timestamp)
| 43,987 |
8 | // save contributor address | t.contributions[_sender] = _amount;
t.index[_sender] = t.senders.length;
| t.contributions[_sender] = _amount;
t.index[_sender] = t.senders.length;
| 23,891 |
35 | // Backwards compatibility | function mintedBalance() public view returns (int256) {
return amo_minter.frax_mint_balances(address(this));
}
| function mintedBalance() public view returns (int256) {
return amo_minter.frax_mint_balances(address(this));
}
| 10,536 |
15 | // can only call functions that have no parameters | function upgradePolicyBooksAndCall(
address policyBookImpl,
uint256 offset,
uint256 limit,
string calldata functionSignature
| function upgradePolicyBooksAndCall(
address policyBookImpl,
uint256 offset,
uint256 limit,
string calldata functionSignature
| 27,182 |
85 | // Ensure the message validity. | require(validateOrderHash(hash, msg.sender, v, r, s));
| require(validateOrderHash(hash, msg.sender, v, r, s));
| 34,401 |
121 | // Should return whether the signature provided is valid for the provided data _data Arbitrary length data signed on the behalf of address(this) _signature Signature byte array associated with _data MUST return the bytes4 magic value 0x20c13b0b when function passes.MUST NOT modify state (using STATICCALL for solc < 0.5... | function isValidSignature(bytes memory _data, bytes memory _signature) public view virtual returns (bytes4);
| function isValidSignature(bytes memory _data, bytes memory _signature) public view virtual returns (bytes4);
| 8,037 |
57 | // Both - (1) offers to direct listings, and (2) bids to auctions - share the same structure. | Offer memory newOffer = Offer({
listingId: _listingId,
offeror: _msgSender(),
quantityWanted: _quantityWanted,
currency: _currency,
pricePerToken: _pricePerToken,
expirationTimestamp: _expirationTimestamp
});
| Offer memory newOffer = Offer({
listingId: _listingId,
offeror: _msgSender(),
quantityWanted: _quantityWanted,
currency: _currency,
pricePerToken: _pricePerToken,
expirationTimestamp: _expirationTimestamp
});
| 3,498 |
44 | // LAYA Token. / | contract LAYA is PausableToken {
string public name = "LAYA Token";
string public symbol = "LAYA";
uint public decimals = 8;
string public version = "1.0";
event Burn(address indexed from, uint256 value);
function LAYA() public {
totalSupply_ = 100000000000 * 10 ** 8;
balance... | contract LAYA is PausableToken {
string public name = "LAYA Token";
string public symbol = "LAYA";
uint public decimals = 8;
string public version = "1.0";
event Burn(address indexed from, uint256 value);
function LAYA() public {
totalSupply_ = 100000000000 * 10 ** 8;
balance... | 65,150 |
102 | // or 0-9 | (_temp[i] > 0x2f && _temp[i] < 0x3a),
"string contains invalid characters"
);
| (_temp[i] > 0x2f && _temp[i] < 0x3a),
"string contains invalid characters"
);
| 3,992 |
64 | // Storage for each lots price | struct LotPrice {
uint256 pricePerEdition; // The cost per token
uint256 maxBatchBuy; // The max amount of tokens per TX
uint256 tokenID;
uint256 startTime;
uint256 endTime;
bool biddable;
bool useMaxStock;
uint256 maxStock;
uint256 tokensMinte... | struct LotPrice {
uint256 pricePerEdition; // The cost per token
uint256 maxBatchBuy; // The max amount of tokens per TX
uint256 tokenID;
uint256 startTime;
uint256 endTime;
bool biddable;
bool useMaxStock;
uint256 maxStock;
uint256 tokensMinte... | 41,326 |
9 | // A mapping for executed requests | mapping(uint256 => bool) public executedRequests;
| mapping(uint256 => bool) public executedRequests;
| 2,312 |
69 | // Deploys and returns the address of a clone that mimics the behaviour of `master`. This function uses the create opcode, which should never revert. / | function clone(address master) internal returns (address instance) {
// solhint-disable-next-line no-inline-assembly
assembly {
let ptr := mload(0x40)
mstore(ptr, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000000000000000000000)
mstore(add(ptr, 0x14), shl(0x60, ... | function clone(address master) internal returns (address instance) {
// solhint-disable-next-line no-inline-assembly
assembly {
let ptr := mload(0x40)
mstore(ptr, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000000000000000000000)
mstore(add(ptr, 0x14), shl(0x60, ... | 4,948 |
13 | // Creates `_amount` PWDR token to `_to`.Can only be called by the LGE, Slopes, and Avalanche contractswhen epoch and max supply numbers allow | function mint(address _to, uint256 _amount)
external
override
Accumulation
MaxSupplyNotReached
OnlyAuthorized
| function mint(address _to, uint256 _amount)
external
override
Accumulation
MaxSupplyNotReached
OnlyAuthorized
| 20,860 |
63 | // 管理员取出BHC | function fetchBHC(address _to, uint256 _value) public onlyOwner returns (bool success2) {
// 不能是0地址
require(_to != address(0));
(bool success, ) = BHCAddress.call(
abi.encodeWithSelector(SELECTOR, _to, _value)
);
if(!success) {
revert("transfer fail");... | function fetchBHC(address _to, uint256 _value) public onlyOwner returns (bool success2) {
// 不能是0地址
require(_to != address(0));
(bool success, ) = BHCAddress.call(
abi.encodeWithSelector(SELECTOR, _to, _value)
);
if(!success) {
revert("transfer fail");... | 9,706 |
47 | // should run end round | if ( minigames[miniGameId].endTime < now ) {
endMiniGame();
}
| if ( minigames[miniGameId].endTime < now ) {
endMiniGame();
}
| 32,627 |
0 | // Deploy a Pool./ Make sure that the fyToken follows ERC20 standards with regards to name, symbol and decimals | constructor(IERC20 base_, IFYToken fyToken_, int128 ts_, int128 g1_, int128 g2_)
ERC20Permit(
string(abi.encodePacked(IERC20Metadata(address(fyToken_)).name(), " LP")),
string(abi.encodePacked(IERC20Metadata(address(fyToken_)).symbol(), "LP")),
IERC20Metadata(address(fyTo... | constructor(IERC20 base_, IFYToken fyToken_, int128 ts_, int128 g1_, int128 g2_)
ERC20Permit(
string(abi.encodePacked(IERC20Metadata(address(fyToken_)).name(), " LP")),
string(abi.encodePacked(IERC20Metadata(address(fyToken_)).symbol(), "LP")),
IERC20Metadata(address(fyTo... | 47,743 |
18 | // merge it into the first draw, and update the second draw index to this one | uint256 firstAmount = self.sortitionSumTrees.stakeOf(bytes32(firstDrawIndex), userId);
uint256 secondAmount = self.sortitionSumTrees.stakeOf(bytes32(secondDrawIndex), userId);
drawSet(self, firstDrawIndex, firstAmount.add(secondAmount), _addr);
drawSet(sel... | uint256 firstAmount = self.sortitionSumTrees.stakeOf(bytes32(firstDrawIndex), userId);
uint256 secondAmount = self.sortitionSumTrees.stakeOf(bytes32(secondDrawIndex), userId);
drawSet(self, firstDrawIndex, firstAmount.add(secondAmount), _addr);
drawSet(sel... | 17,210 |
3 | // Return the last day on which the Oracle is updated / | function getLastIndexedDay() external view returns (uint32);
| function getLastIndexedDay() external view returns (uint32);
| 9,920 |
115 | // Get Uint value from InstaMemory Contract. / | function getUint(uint getId, uint val) internal returns (uint returnVal) {
returnVal = getId == 0 ? val : instaMemory.getUint(getId);
| function getUint(uint getId, uint val) internal returns (uint returnVal) {
returnVal = getId == 0 ? val : instaMemory.getUint(getId);
| 11,180 |
136 | // Write the character to the pointer. 48 is the ASCII index of '0'. | mstore8(ptr, add(48, mod(temp, 10)))
temp := div(temp, 10)
| mstore8(ptr, add(48, mod(temp, 10)))
temp := div(temp, 10)
| 12,979 |
234 | // Helper: Returns boolean if we are before the freeze period. / | function isBeforeFreeze(ExecutionWindow storage self)
internal view returns (bool)
| function isBeforeFreeze(ExecutionWindow storage self)
internal view returns (bool)
| 53,361 |
300 | // Validates seize and reverts on rejection. May emit logs. cTokenCollateral Asset which was used as collateral and will be seized cTokenBorrowed Asset which was borrowed by the borrower liquidator The address repaying the borrow and seizing the collateral borrower The address of the borrower seizeTokens The number of ... | function seizeVerify(
address cTokenCollateral,
address cTokenBorrowed,
address liquidator,
address borrower,
| function seizeVerify(
address cTokenCollateral,
address cTokenBorrowed,
address liquidator,
address borrower,
| 7,503 |
4 | // Function to transfer tokens to the Treasury. Only BIG_TIMELOCK_ADMIN can call it. bucket The bucket from which to transfer pTokens amount The amount of pTokens to transfer / | function transferToTreasury(address bucket, uint256 amount) external;
| function transferToTreasury(address bucket, uint256 amount) external;
| 30,334 |
353 | // Whether or not the admin has admin rights / | bool public adminHasRights = true;
| bool public adminHasRights = true;
| 61,104 |
1 | // The maximum yoda token supply | uint256 public constant MAX_SUPPLY = 2022;
| uint256 public constant MAX_SUPPLY = 2022;
| 13,884 |
41 | // now resume the token sale | tokenSaleIsPaused = false;
emit SaleResumed("token sale has now resumed", now);
| tokenSaleIsPaused = false;
emit SaleResumed("token sale has now resumed", now);
| 41,960 |
32 | // quart coefficient is sqrt(sqrt(4.4)) | if(fullQuarts != 0)
{
price = price * 14483154**fullQuarts;
price = price / 10**(7 * fullQuarts);
}
| if(fullQuarts != 0)
{
price = price * 14483154**fullQuarts;
price = price / 10**(7 * fullQuarts);
}
| 36,714 |
25 | // this event shows the other signer and the operation hash that they signed specific batch transfer events are emitted in Batcher | event BatchTransacted(
address msgSender, // Address of the sender of the message initiating the transaction
address otherSigner, // Address of the signer (second signature) used to initiate the transaction
bytes32 operation // Operation hash (see Data Formats)
);
| event BatchTransacted(
address msgSender, // Address of the sender of the message initiating the transaction
address otherSigner, // Address of the signer (second signature) used to initiate the transaction
bytes32 operation // Operation hash (see Data Formats)
);
| 14,202 |
60 | // Validates borrow and reverts on rejection. May emit logs. slToken Asset whose underlying is being borrowed borrower The address borrowing the underlying borrowAmount The amount of the underlying asset requested to borrow / | function borrowVerify(address slToken, address borrower, uint borrowAmount) external {
// Shh - currently unused
slToken;
borrower;
borrowAmount;
// Shh - we don't ever want this hook to be marked pure
if (false) {
maxAssets = maxAssets;
}
}
| function borrowVerify(address slToken, address borrower, uint borrowAmount) external {
// Shh - currently unused
slToken;
borrower;
borrowAmount;
// Shh - we don't ever want this hook to be marked pure
if (false) {
maxAssets = maxAssets;
}
}
| 7,513 |
205 | // Hack to get things to work automatically on OpenSea.Use safeTransferFrom so the frontend doesn't have to worry about different method names. / | function safeTransferFrom(
address /* _from */,
address _to,
uint256 _optionId,
uint256 _amount,
bytes calldata _data
| function safeTransferFrom(
address /* _from */,
address _to,
uint256 _optionId,
uint256 _amount,
bytes calldata _data
| 12,434 |
59 | // Max wallet check excluding pair and router | if (!isSell && !_isFree[recipient]){
require((_balances[recipient] + amount) < _maxWallet, "Max wallet has been triggered");
}
| if (!isSell && !_isFree[recipient]){
require((_balances[recipient] + amount) < _maxWallet, "Max wallet has been triggered");
}
| 58,530 |
30 | // Replacement for Solidity's `transfer`: sends `amount` wei to`recipient`, forwarding all available gas and reverting on errors. of certain opcodes, possibly making contracts go over the 2300 gas limitimposed by `transfer`, making them unable to receive funds via | * `transfer`. {sendValue} removes this limitation.
*
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerati... | * `transfer`. {sendValue} removes this limitation.
*
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerati... | 25,606 |
16 | // Maintain a memory counter for the current write location in the temp bytes array by adding the 32 bytes for the array length to the starting location. | let mc := add(tempBytes, 0x20)
| let mc := add(tempBytes, 0x20)
| 24,211 |
18 | // Checks pair for sweep amount available | function sweepAmountAvailable(IUniswapV2Pair pair) public view returns (uint amountAvailable) {
require(pairRegistered[address(pair)], "!pairRegistered[pair]");
bool xethIsToken0 = false;
IERC20 token;
if(pair.token0() == address(_xeth)) {
xethIsToken0 = true;
... | function sweepAmountAvailable(IUniswapV2Pair pair) public view returns (uint amountAvailable) {
require(pairRegistered[address(pair)], "!pairRegistered[pair]");
bool xethIsToken0 = false;
IERC20 token;
if(pair.token0() == address(_xeth)) {
xethIsToken0 = true;
... | 26,367 |
8 | // bonus owner can transfer their bonus wei to any investor account before bonus period ended | function fillInvestorAccountWithBonus(address accountAddress) onlyBonusOwner {
if(investorsAccounts[accountAddress]==-1 || investorsAccounts[accountAddress]>0) {
var bonusValue = ownedBonus[msg.sender];
ownedBonus[msg.sender] = 0;
if(investorsAccounts[accountAddress]==-1)... | function fillInvestorAccountWithBonus(address accountAddress) onlyBonusOwner {
if(investorsAccounts[accountAddress]==-1 || investorsAccounts[accountAddress]>0) {
var bonusValue = ownedBonus[msg.sender];
ownedBonus[msg.sender] = 0;
if(investorsAccounts[accountAddress]==-1)... | 29,297 |
7 | // check if some coupons outdatedhelper function | function updateCoupon(uint ID, uint _date) public{
for(uint i = 0; i < Members[ID].CouponsCount; i++){
if(Members[ID].Coupons[i].endDate < _date){
delete Members[ID].Coupons[i];
for(uint j = i+1; j <Members[ID].CouponsCount; j++){
Members[ID].Coupons[j-1] = Members[ID].Coupons[j];
}
Members[I... | function updateCoupon(uint ID, uint _date) public{
for(uint i = 0; i < Members[ID].CouponsCount; i++){
if(Members[ID].Coupons[i].endDate < _date){
delete Members[ID].Coupons[i];
for(uint j = i+1; j <Members[ID].CouponsCount; j++){
Members[ID].Coupons[j-1] = Members[ID].Coupons[j];
}
Members[I... | 22,228 |
39 | // Get the minimum and maximum amount of stable token than can be involved in the exchange. This reverts if exchange limits for the stable token have not been set. | (uint256 minExchangeAmount, uint256 maxExchangeAmount) = getStableTokenExchangeLimits(
stableTokenRegistryId
);
| (uint256 minExchangeAmount, uint256 maxExchangeAmount) = getStableTokenExchangeLimits(
stableTokenRegistryId
);
| 37,849 |
139 | // The function allow Wallet to Mint Tokens payied by bank transfer and credit card / | function addAllowedWallet(address _wallet, bool isAllowed) public {
bool public mintingIsLive = true;
bool public inRewardsPaused = true;
bool public sendAndLiquifyEnabled = false;
address public deadWallet = address(0x000000000000000000000000000000000000dEaD);
mapping(address =... | function addAllowedWallet(address _wallet, bool isAllowed) public {
bool public mintingIsLive = true;
bool public inRewardsPaused = true;
bool public sendAndLiquifyEnabled = false;
address public deadWallet = address(0x000000000000000000000000000000000000dEaD);
mapping(address =... | 14,932 |
45 | // total supply should be 0 | assertEq(converter.totalSupply(), 0);
| assertEq(converter.totalSupply(), 0);
| 41,325 |
51 | // Ensures the target address is a prize strategy (has both canStartAward and canCompleteAward) | using SafeAwardable for address;
| using SafeAwardable for address;
| 80,976 |
225 | // load as string | returndatacopy(add(res, 32), 64, size)
jump(exit)
| returndatacopy(add(res, 32), 64, size)
jump(exit)
| 28,756 |
384 | // Create a new vote instanceThis function can only be called by the CRVoting owner_voteId ID of the new vote instance to be created_possibleOutcomes Number of possible outcomes for the new vote instance to be created/ | function createVote(uint256 _voteId, uint8 _possibleOutcomes) external;
| function createVote(uint256 _voteId, uint8 _possibleOutcomes) external;
| 19,599 |
97 | // aTokens are 1:1 | toTokenAmt = _fillQuote(
fromToken,
underlyingAsset,
toInvest,
_swapTarget,
swapData
);
IERC20(underlyingAsset).safeApprove(
lendingPoolAddressProvider.getLendingPoolCore(),
| toTokenAmt = _fillQuote(
fromToken,
underlyingAsset,
toInvest,
_swapTarget,
swapData
);
IERC20(underlyingAsset).safeApprove(
lendingPoolAddressProvider.getLendingPoolCore(),
| 40,434 |
900 | // Called whenever an action execution is failed./ | event ActionFailed (
uint256 proposalId
);
| event ActionFailed (
uint256 proposalId
);
| 2,283 |
6 | // Log the return data for debugging or informational purposes | emit TransferData(data);
| emit TransferData(data);
| 11,449 |
53 | // Returns the number of accounts that have `role`. Can be used | * together with {getRoleMember} to enumerate all bearers of a role.
*/
function getRoleMemberCount(bytes32 role) public view returns (uint256) {
return _roles[role].members.length();
}
| * together with {getRoleMember} to enumerate all bearers of a role.
*/
function getRoleMemberCount(bytes32 role) public view returns (uint256) {
return _roles[role].members.length();
}
| 6,427 |
6 | // weather = bytes32ToString(_data); | weather = _data;
| weather = _data;
| 7,323 |
48 | // mapping from Card ID to the current value stashed away for a future claimer | mapping (uint256 => uint256) public cardIdToStashedPayout;
| mapping (uint256 => uint256) public cardIdToStashedPayout;
| 5,251 |
115 | // GP: Add more data to events | event MisoInitFarmFactory(address sender);
event FarmCreated(address indexed owner, address indexed addr, address token, uint256 startBlock, address farmTemplate);
event FarmTemplateAdded(address newFarm, uint256 templateId);
event FarmTemplateRemoved(address farm, uint256 templateId);
| event MisoInitFarmFactory(address sender);
event FarmCreated(address indexed owner, address indexed addr, address token, uint256 startBlock, address farmTemplate);
event FarmTemplateAdded(address newFarm, uint256 templateId);
event FarmTemplateRemoved(address farm, uint256 templateId);
| 27,093 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.