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 |
|---|---|---|---|---|
101 | // need to add up since the range could be in the middle somewheretraverse inversely to make more current queries more gas efficient | uint256 locksLength = locks.length;
for (uint256 i = locksLength; i > 0; i--) {
uint256 lockEpoch = uint256(locks[i - 1].unlockTime).sub(lockDuration);
| uint256 locksLength = locks.length;
for (uint256 i = locksLength; i > 0; i--) {
uint256 lockEpoch = uint256(locks[i - 1].unlockTime).sub(lockDuration);
| 33,185 |
78 | // Find ready nodes to pin to | for (uint j = 0; j < readyNodes.length && workersCount < app.clusterSize; j++) {
Node storage node = nodes[readyNodes[j]];
| for (uint j = 0; j < readyNodes.length && workersCount < app.clusterSize; j++) {
Node storage node = nodes[readyNodes[j]];
| 33,686 |
19 | // View function to see pending ns on frontend. | function pendingToken(uint256 _pid, address _user)
external
view
returns (uint256)
| function pendingToken(uint256 _pid, address _user)
external
view
returns (uint256)
| 33,612 |
126 | // Function to mint tokens to The address that will receive the minted tokens. tokenId The token id to mint.return A boolean that indicates if the operation was successful. / | function mint(
address to,
uint256 tokenId
)
public
onlyMinter
onlyBeforeMintingFinished
returns (bool)
| function mint(
address to,
uint256 tokenId
)
public
onlyMinter
onlyBeforeMintingFinished
returns (bool)
| 33,426 |
161 | // Gets the amount of yield that a CDP has earned since the last time it was updated.//_self the CDP to query./_ctxthe CDP context.// return the amount of earned yield. | function getEarnedYield(Data storage _self, Context storage _ctx) internal view returns (uint256) {
FixedPointMath.FixedDecimal memory _currentAccumulatedYieldWeight = _ctx.accumulatedYieldWeight;
FixedPointMath.FixedDecimal memory _lastAccumulatedYieldWeight = _self.lastAccumulatedYieldWeight;
if (_curr... | function getEarnedYield(Data storage _self, Context storage _ctx) internal view returns (uint256) {
FixedPointMath.FixedDecimal memory _currentAccumulatedYieldWeight = _ctx.accumulatedYieldWeight;
FixedPointMath.FixedDecimal memory _lastAccumulatedYieldWeight = _self.lastAccumulatedYieldWeight;
if (_curr... | 30,822 |
316 | // View the amount of rewards that an address has withdrawn. _account The address of a token holder.return The amount of rewards that `account` has withdrawn. / | function withdrawnRewardsOf(address _account) public view override returns (uint256) {
return withdrawnRewards[_account];
}
| function withdrawnRewardsOf(address _account) public view override returns (uint256) {
return withdrawnRewards[_account];
}
| 2,135 |
523 | // Return the bin number and index within that bin where ID is_idToken id return bin index (Bin number, ID"s index within that bin)/ | function getIDBinIndex(uint256 _id)
public pure returns (uint256 bin, uint256 index)
| function getIDBinIndex(uint256 _id)
public pure returns (uint256 bin, uint256 index)
| 35,180 |
26 | // ================================ | interface T1WinAdmin {
function getAdmin() external view returns(address);
}
| interface T1WinAdmin {
function getAdmin() external view returns(address);
}
| 20,911 |
275 | // See {IMintableERC721-mint}. / | function mint(address user, uint256 tokenId) external override only(PREDICATE_ROLE) {
_mint(user, tokenId);
}
| function mint(address user, uint256 tokenId) external override only(PREDICATE_ROLE) {
_mint(user, tokenId);
}
| 84,250 |
37 | // populate equivalent ERC20 | erc20Addrs[i] = Nft20Registry.nftToErc20(nftDetails[i].nftAddr);
| erc20Addrs[i] = Nft20Registry.nftToErc20(nftDetails[i].nftAddr);
| 25,956 |
16 | // function to set hash | function setUserTranscriptHash(uint uid, string memory _transcriptHash) public{
if(!isAuthed(uid)) return;
for (uint8 i = 0; i < users.length; i++) {
if(users[i].id == uid){
users[i].data.transcriptHash = _transcriptHash;
}
}
}
| function setUserTranscriptHash(uint uid, string memory _transcriptHash) public{
if(!isAuthed(uid)) return;
for (uint8 i = 0; i < users.length; i++) {
if(users[i].id == uid){
users[i].data.transcriptHash = _transcriptHash;
}
}
}
| 3,394 |
9 | // Base coin, rewards will convert to this token | address public baseToken = WETH;
| address public baseToken = WETH;
| 36,495 |
40 | // Lets a module admin update the fees on primary sales. | function setPlatformFeeInfo(address _platformFeeRecipient, uint256 _platformFeeBps)
external
onlyRole(DEFAULT_ADMIN_ROLE)
| function setPlatformFeeInfo(address _platformFeeRecipient, uint256 _platformFeeBps)
external
onlyRole(DEFAULT_ADMIN_ROLE)
| 8,766 |
167 | // Max Dougs per wallet in pre-sale | uint256 public constant dougsMintPerWalletPresale = 3;
| uint256 public constant dougsMintPerWalletPresale = 3;
| 10,006 |
108 | // Transfer ownership of an NFT -- THE CALLER IS RESPONSIBLE/TO CONFIRM THAT `_to` IS CAPABLE OF RECEIVING NFTS OR ELSE/THEY MAY BE PERMANENTLY LOST/Throws unless `msg.sender` is the current owner, an authorized/operator, or the approved address for this NFT. Throws if `_from` is/not the current owner. Throws if `_to` ... | function transferFrom(
address _from,
address _to,
uint256 _tokenId
) external;
| function transferFrom(
address _from,
address _to,
uint256 _tokenId
) external;
| 10,069 |
127 | // Get the total balance of want realized in the strategy, whether idle or active in Strategy positions. | function balanceOf() public virtual view returns (uint256) {
return balanceOfWant().add(balanceOfPool());
}
| function balanceOf() public virtual view returns (uint256) {
return balanceOfWant().add(balanceOfPool());
}
| 25,083 |
8 | // This is a virtual function that should be overridden so it returns the address to which the fallback function | * and {_fallback} should delegate.
*/
function _implementation() internal view virtual returns (address);
/**
* @dev Delegates the current call to the address returned by `_implementation()`.
*
* This function does not return to its internal call site, it will return directly to the ex... | * and {_fallback} should delegate.
*/
function _implementation() internal view virtual returns (address);
/**
* @dev Delegates the current call to the address returned by `_implementation()`.
*
* This function does not return to its internal call site, it will return directly to the ex... | 29,816 |
29 | // updates stake data | function updateStakeData(uint hearts, uint dayLength, address payable ref, uint index)
internal
| function updateStakeData(uint hearts, uint dayLength, address payable ref, uint index)
internal
| 32,418 |
125 | // Fetch the latest medianPrice (for maxWindow) or revert if is is null / | function read() external view returns (uint256 value) {
value = getTwapPrice();
require(
both(value > 0, isValid()),
"UniswapV3Medianizer/invalid-price-feed"
);
}
| function read() external view returns (uint256 value) {
value = getTwapPrice();
require(
both(value > 0, isValid()),
"UniswapV3Medianizer/invalid-price-feed"
);
}
| 24,159 |
30 | // Fees 1 Payment | uint256 fees1Pay = tokensRaised == 0 ? 0 : tokensRaised.mul(FEES1_PER).div(100);
if (fees1Pay >= FEES1_MAX_AMOUNT) {
fees1Pay = FEES1_MAX_AMOUNT;
}
| uint256 fees1Pay = tokensRaised == 0 ? 0 : tokensRaised.mul(FEES1_PER).div(100);
if (fees1Pay >= FEES1_MAX_AMOUNT) {
fees1Pay = FEES1_MAX_AMOUNT;
}
| 11,256 |
73 | // Set max transaction percent | function setMaxTxPercent(uint256 _maxTxPercent) external onlyOwner {
maxTxPercent = _maxTxPercent;
}
| function setMaxTxPercent(uint256 _maxTxPercent) external onlyOwner {
maxTxPercent = _maxTxPercent;
}
| 17,829 |
18 | // Return the ruling of an arbitration price update request._requestID ID of the request. return ruling The ruling which would or has been given. / | function currentRequestRuling(uint _requestID) public view returns(uint ruling) {
ArbitrationPriceRequest storage request = requests[_requestID];
VoteCounter storage voteCounter = request.voteCounter;
return voteCounter.winningChoice;
}
| function currentRequestRuling(uint _requestID) public view returns(uint ruling) {
ArbitrationPriceRequest storage request = requests[_requestID];
VoteCounter storage voteCounter = request.voteCounter;
return voteCounter.winningChoice;
}
| 9,498 |
13 | // from plot Id to owner's address | mapping (uint => address) idPlotToOwner;
| mapping (uint => address) idPlotToOwner;
| 5,699 |
202 | // The fallback function on the wstETH contract automatically stakes and wraps any ETH sent to it. We can then send the ETH safely, and only have to ensure that the call doesn't revert. This would be dangerous if `_wstETH` were set to the zero address. However, in this scenario, this function would have already reverte... | payable(address(_wstETH)).sendValue(amount);
if (recipient != address(this)) {
_wstETH.transfer(recipient, result);
}
| payable(address(_wstETH)).sendValue(amount);
if (recipient != address(this)) {
_wstETH.transfer(recipient, result);
}
| 52,868 |
30 | // mint token | _safeMint(msg.sender, currentAssembleCounter);
| _safeMint(msg.sender, currentAssembleCounter);
| 43,369 |
139 | // _aprSplit apr split for AA, considering FULL_ALLOC = 100% | function setMinAprSplitAYS(uint256 _aprSplit) external {
_checkOnlyOwner();
require((minAprSplitAYS = _aprSplit) <= FULL_ALLOC, '7');
minAprSplitAYS = _aprSplit;
}
| function setMinAprSplitAYS(uint256 _aprSplit) external {
_checkOnlyOwner();
require((minAprSplitAYS = _aprSplit) <= FULL_ALLOC, '7');
minAprSplitAYS = _aprSplit;
}
| 33,397 |
8 | // The list of all markets. / | function allMarkets() public view returns (address[] memory) {
return _markets.getPage(0, _markets.elements.length);
}
| function allMarkets() public view returns (address[] memory) {
return _markets.getPage(0, _markets.elements.length);
}
| 9,489 |
17 | // Delete the slot where the moved value was stored | set._values.pop();
| set._values.pop();
| 40,216 |
121 | // Update operator status | operators[msg.sender][_operator] = _approved;
emit ApprovalForAll(msg.sender, _operator, _approved);
| operators[msg.sender][_operator] = _approved;
emit ApprovalForAll(msg.sender, _operator, _approved);
| 11,321 |
190 | // Investor address | address public investorAddr;
| address public investorAddr;
| 5,353 |
1 | // The 'signature minting' mechanism used in web3sdkio Token smart contracts is a way for a contract admin to authorize an external party's request to mint tokens on the admin's contract.At a high level, this means you can authorize some external party to mint tokens on your contract, and specify what exactly will be m... | interface ISignatureMintERC721 {
/**
* @notice The body of a request to mint tokens.
*
* @param to The receiver of the tokens to mint.
* @param royaltyRecipient The recipient of the minted token's secondary sales royalties. (Not applicable for ERC20 tokens)
* @param royaltyBps The perce... | interface ISignatureMintERC721 {
/**
* @notice The body of a request to mint tokens.
*
* @param to The receiver of the tokens to mint.
* @param royaltyRecipient The recipient of the minted token's secondary sales royalties. (Not applicable for ERC20 tokens)
* @param royaltyBps The perce... | 24,639 |
16 | // _vrfCoordinator address of VRFCoordinator contract _link address of LINK token contract/ | constructor(address _vrfCoordinator, address _link) {
vrfCoordinator = _vrfCoordinator;
LINK = LinkTokenInterface(_link);
}
| constructor(address _vrfCoordinator, address _link) {
vrfCoordinator = _vrfCoordinator;
LINK = LinkTokenInterface(_link);
}
| 21,078 |
115 | // sum all issued options and sold options | uint supply = options[i].totalSupply();
uint sold = supply.sub(options[i].balanceOf(address(this)));
sigmaTotalOptions = sigmaTotalOptions.add(supply);
sigmaSoldOptions = sigmaSoldOptions.add(sold);
| uint supply = options[i].totalSupply();
uint sold = supply.sub(options[i].balanceOf(address(this)));
sigmaTotalOptions = sigmaTotalOptions.add(supply);
sigmaSoldOptions = sigmaSoldOptions.add(sold);
| 41,821 |
14 | // require function that lets only up to 50 NFTs minted | require(newItemId <= TOTAL_SUPPLY, "Only 50 NFTs are allowed!");
| require(newItemId <= TOTAL_SUPPLY, "Only 50 NFTs are allowed!");
| 8,887 |
23 | // The `quantity` minted with ERC2309 exceeds the safety limit. / | error MintERC2309QuantityExceedsLimit();
| error MintERC2309QuantityExceedsLimit();
| 1,067 |
4 | // Store the table into the scratch space. Offsetted by -1 byte so that the `mload` will load the character. We will rewrite the free memory pointer at `0x40` later with the allocated size. The magic constant 0x0670 will turn "-_" into "+/". | mstore(0x1f, "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdef")
mstore(0x3f, xor("ghijklmnopqrstuvwxyz0123456789-_", mul(iszero(fileSafe), 0x0670)))
| mstore(0x1f, "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdef")
mstore(0x3f, xor("ghijklmnopqrstuvwxyz0123456789-_", mul(iszero(fileSafe), 0x0670)))
| 23,941 |
8 | // Retrieves human-redable named version of current implementation. | function version() virtual public view returns (bytes32);
| function version() virtual public view returns (bytes32);
| 29,501 |
337 | // Note: also ensures the given synths are allowed to be atomically exchanged | (
amountReceived, // output amount with fee taken out (denominated in dest currency)
fee, // fee amount (denominated in dest currency)
exchangeFeeRate, // applied fee rate
systemConvertedAmount, // current system value without fees (denominated in dest currency)
... | (
amountReceived, // output amount with fee taken out (denominated in dest currency)
fee, // fee amount (denominated in dest currency)
exchangeFeeRate, // applied fee rate
systemConvertedAmount, // current system value without fees (denominated in dest currency)
... | 20,727 |
29 | // long string | let lengthSize := sub(kind, 0xB7)
| let lengthSize := sub(kind, 0xB7)
| 27,601 |
25 | // This function refunds the publisher, i.e./ pays back the locked funds of the publisher. | function refund() external onlyPublisher inState(State.Created) {
emit SellerRefunded();
// It is important to change the state first because
// otherwise, the contracts called using `send` below
// can call in again here.
state = State.Inactive;
publisher.transfer(va... | function refund() external onlyPublisher inState(State.Created) {
emit SellerRefunded();
// It is important to change the state first because
// otherwise, the contracts called using `send` below
// can call in again here.
state = State.Inactive;
publisher.transfer(va... | 17,719 |
206 | // Compare record.rightsholder with supplied bytes32 rightsholderreturn 170 if matches, 0 if not / | function _verifyRightsHolder(bytes32 _idxHash, bytes32 _rgtHash)
| function _verifyRightsHolder(bytes32 _idxHash, bytes32 _rgtHash)
| 62,764 |
100 | // 2. Calculate hash of array of EIP712 hashes and write theresult to the corresponding OfferItem struct:`keccak256(abi.encodePacked(offerItemHashes))` / | mstore(BasicOrder_order_offerHashes_ptr, keccak256(0, OneWord))
| mstore(BasicOrder_order_offerHashes_ptr, keccak256(0, OneWord))
| 23,083 |
67 | // Accessor method to calculate a transformed collateral requirement using the finanical product library price input price used as an input to transform the collateral requirement.return transformedCollateralRequirement collateral requirement with transformation applied to it. This method should never revert. / | function transformCollateralRequirement(FixedPoint.Unsigned memory price)
public
view
nonReentrantView
returns (FixedPoint.Unsigned memory)
| function transformCollateralRequirement(FixedPoint.Unsigned memory price)
public
view
nonReentrantView
returns (FixedPoint.Unsigned memory)
| 30,116 |
7 | // Just do some expensive work for the sake of the proof of concept | current_state = keccak256(abi.encodePacked(current_state, user));
for (uint256 i; i < 1000; ++i) {
current_state = keccak256(abi.encodePacked(current_state, some_arg));
}
| current_state = keccak256(abi.encodePacked(current_state, user));
for (uint256 i; i < 1000; ++i) {
current_state = keccak256(abi.encodePacked(current_state, some_arg));
}
| 19,733 |
47 | // not/allow contract to receive funds | function() public payable {
if (!IsPayble) revert();
}
| function() public payable {
if (!IsPayble) revert();
}
| 13,341 |
146 | // convert squeeth amount from uniswap position token as equivalent amount of collateral | uint256 wSqueethIndexValueInEth = nftWsqueethAmount.mul(_normalizationFactor).mul(_ethQuoteCurrencyPrice).div(
ONE_ONE
);
| uint256 wSqueethIndexValueInEth = nftWsqueethAmount.mul(_normalizationFactor).mul(_ethQuoteCurrencyPrice).div(
ONE_ONE
);
| 21,631 |
685 | // Call these after the main state has been set up | S.registerToken(address(0));
S.registerToken(loopring.lrcAddress());
| S.registerToken(address(0));
S.registerToken(loopring.lrcAddress());
| 32,449 |
74 | // exlcude pair address from tax rewards | _isExcluded[address(uniswapV2Pair)] = true;
_excluded.push(address(uniswapV2Pair));
| _isExcluded[address(uniswapV2Pair)] = true;
_excluded.push(address(uniswapV2Pair));
| 7,320 |
722 | // Approve SDVD ETH pool to spend LP token | IERC20(pairAddress).approve(sdvdEthPool, liquidity);
| IERC20(pairAddress).approve(sdvdEthPool, liquidity);
| 80,993 |
197 | // Returns the starting token ID.To change the starting token ID, please override this function. / | function _startTokenId() internal view virtual returns (uint256) {
return 1;
}
| function _startTokenId() internal view virtual returns (uint256) {
return 1;
}
| 503 |
8 | // See {ERC20Pausable} and {Pausable-_unpause}. Requirements: - the caller must have the `PAUSER_ROLE`. / | function unpause() public virtual {
require(hasRole(PAUSER_ROLE, _msgSender()), "ERC20PresetMinterPauser: must have pauser role to unpause");
_unpause();
}
| function unpause() public virtual {
require(hasRole(PAUSER_ROLE, _msgSender()), "ERC20PresetMinterPauser: must have pauser role to unpause");
_unpause();
}
| 11,284 |
0 | // Emits when a sunset has been initiated/tokenId The token id | event SunsetInitiated(uint256 indexed tokenId);
| event SunsetInitiated(uint256 indexed tokenId);
| 48,806 |
26 | // Take the tokens out of the last step and forward them to the recipient. The last amount parameter is only used for the dummies so is set to zero. | handleSwap(lastStep, recipient, 0);
| handleSwap(lastStep, recipient, 0);
| 24,118 |
14 | // File: contracts/uniswapv2/interfaces/IUniswapV2Router01.sol | interface IUniswapV2Router01 {
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidity(
address tokenA,
address tokenB,
uint256 amountADesired,
uint256 amountBDesired,
uint256 amountAMin,
uin... | interface IUniswapV2Router01 {
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidity(
address tokenA,
address tokenB,
uint256 amountADesired,
uint256 amountBDesired,
uint256 amountAMin,
uin... | 31,202 |
119 | // Keeps track of number of pregnant puppies. | uint256 public pregnantpuppies;
uint256 public minChildCount = 2;
uint256 public maxChildCount = 14;
uint randNonce = 0;
| uint256 public pregnantpuppies;
uint256 public minChildCount = 2;
uint256 public maxChildCount = 14;
uint randNonce = 0;
| 66,414 |
15 | // Access Controllers //Restricted to members of the admin role. | modifier onlyAdmin() {
require(_isAdmin(msg.sender), "Restricted to admin.");
_;
}
| modifier onlyAdmin() {
require(_isAdmin(msg.sender), "Restricted to admin.");
_;
}
| 3,068 |
224 | // Get the total amount of token for the account | uint amount = globalConfig.accounts().getDepositBalanceCurrent(_token, msg.sender);
uint256 actualAmount = globalConfig.bank().withdraw(msg.sender, _token, amount);
if(actualAmount != 0) {
SavingLib.send(globalConfig, actualAmount, _token);
}
| uint amount = globalConfig.accounts().getDepositBalanceCurrent(_token, msg.sender);
uint256 actualAmount = globalConfig.bank().withdraw(msg.sender, _token, amount);
if(actualAmount != 0) {
SavingLib.send(globalConfig, actualAmount, _token);
}
| 54,486 |
43 | // Throws when the paymaster address provided is address(0) / | error PaymasterIdCannotBeZero();
| error PaymasterIdCannotBeZero();
| 3,728 |
27 | // Referendums_Registers[register_address].Parameters_Versions[new_version].Assembly_Associated_Delegation = Assembly_Associated_Delegation; | Referendums_Registers[register_address].Parameters_Versions[new_version].Ivote_address; Ivote_address;
Referendums_Registers[register_address].Last_Version = new_version;
emit Referendum_Parameters_Updated( register_address, new_version);
| Referendums_Registers[register_address].Parameters_Versions[new_version].Ivote_address; Ivote_address;
Referendums_Registers[register_address].Last_Version = new_version;
emit Referendum_Parameters_Updated( register_address, new_version);
| 33,681 |
1 | // Query if a contract implements an interface interfaceId The interface identifier, as specified in ERC-165 Interface identification is specified in ERC-165. This functionuses less than 30,000 gas./ |
function supportsInterface(bytes4 interfaceId) external view returns (bool);
|
function supportsInterface(bytes4 interfaceId) external view returns (bool);
| 43,561 |
197 | // remove a unit from sale | function _removeSale(uint256 tokenId) internal {
Sale storage s = tokenIdToSale[tokenId];
address seller = s.seller;
_removeSaleTokenFromSellerEnumeration(seller, tokenId);
_removeSaleTokenFromAllTokensEnumeration(tokenId);
delete tokenIdToSale[tokenId];
}
| function _removeSale(uint256 tokenId) internal {
Sale storage s = tokenIdToSale[tokenId];
address seller = s.seller;
_removeSaleTokenFromSellerEnumeration(seller, tokenId);
_removeSaleTokenFromAllTokensEnumeration(tokenId);
delete tokenIdToSale[tokenId];
}
| 64,026 |
18 | // The constructor is executed only when the contract is created in the blockchain. | function DadaCollectible () {
// assigns the address of the account creating the contract as the
// "owner" of the contract. Since the contract doesn't have
// a "set" function for the owner attribute this value will be immutable.
owner = msg.sender;
// Update total supply
totalSupply... | function DadaCollectible () {
// assigns the address of the account creating the contract as the
// "owner" of the contract. Since the contract doesn't have
// a "set" function for the owner attribute this value will be immutable.
owner = msg.sender;
// Update total supply
totalSupply... | 26,680 |
168 | // Destoys `amount` tokens from `account`.`amount` is then deductedfrom the caller's allowance. See `_burn` and `_approve`. / | function _burnFrom(address account, uint256 amount) internal {
_burn(account, amount);
_approve(account, msg.sender, _allowances[account][msg.sender].sub(amount));
}
| function _burnFrom(address account, uint256 amount) internal {
_burn(account, amount);
_approve(account, msg.sender, _allowances[account][msg.sender].sub(amount));
}
| 1,730 |
0 | // Increases supply by factor of (1 + frac/1e18) and mints it for _to | function mintRelative(address to, uint256 frac) external onlyOwner returns (uint256) {
uint256 supply = totalSupply();
uint256 dSupply = (supply * frac) / 10 ** 18;
if (dSupply > 0) {
_mint(to, dSupply);
}
| function mintRelative(address to, uint256 frac) external onlyOwner returns (uint256) {
uint256 supply = totalSupply();
uint256 dSupply = (supply * frac) / 10 ** 18;
if (dSupply > 0) {
_mint(to, dSupply);
}
| 12,829 |
44 | // burn `amount` of a and b, get `amount` baseToken | function burn(uint256 amount) external {
require(canBuy, "cannot buy");
a[msg.sender] = a[msg.sender].sub(amount);
b[msg.sender] = b[msg.sender].sub(amount);
doTransferOut(baseToken, msg.sender, amount);
}
| function burn(uint256 amount) external {
require(canBuy, "cannot buy");
a[msg.sender] = a[msg.sender].sub(amount);
b[msg.sender] = b[msg.sender].sub(amount);
doTransferOut(baseToken, msg.sender, amount);
}
| 13,988 |
213 | // File Meta Data | IceGlobal.GlobalRecord rec; // store the association in global record
| IceGlobal.GlobalRecord rec; // store the association in global record
| 24,597 |
117 | // Revert if called by any account other than the rescuer. / | modifier onlyRescuer() {
require(msg.sender == _rescuer, "Rescuable: caller is not the rescuer");
_;
}
| modifier onlyRescuer() {
require(msg.sender == _rescuer, "Rescuable: caller is not the rescuer");
_;
}
| 42,683 |
11 | // list of aliases for Walker's Alias algorithm 0 - 9 are associated with Sheep, 10 - 18 are associated with Wolves | uint8[][18] public aliases;
| uint8[][18] public aliases;
| 9,088 |
31 | // current upline to be sent money | uint256 uplineLevel = users[uplineAddress].currentLevel;
| uint256 uplineLevel = users[uplineAddress].currentLevel;
| 24,677 |
6 | // IMasterChef(chef).withdraw(poolId, _amount.sub(wantBal)); | wantBal = IERC20(want).balanceOf(address(this));
| wantBal = IERC20(want).balanceOf(address(this));
| 19,959 |
3 | // Checks | require(amount <= type(uint120).max, "Distributor: amount > type(uint120).max");
require(amount > 0, "Distributor: amount == 0");
require(!records[beneficiary].initialized, "Distributor: already initialized");
| require(amount <= type(uint120).max, "Distributor: amount > type(uint120).max");
require(amount > 0, "Distributor: amount == 0");
require(!records[beneficiary].initialized, "Distributor: already initialized");
| 28,008 |
33 | // Called from BalanceVerifier.proveProve can be called directly to withdraw less than the whole share,or just "cement" the earnings so far into root chain even without withdrawing / | function onVerifySuccess(uint blockNumber, address account, uint newEarnings) internal {
uint blockFreezeStart = blockTimestamp[blockNumber];
require(now > blockFreezeStart + blockFreezeSeconds, "error_frozen");
require(earnings[account] < newEarnings, "error_oldEarnings");
totalProv... | function onVerifySuccess(uint blockNumber, address account, uint newEarnings) internal {
uint blockFreezeStart = blockTimestamp[blockNumber];
require(now > blockFreezeStart + blockFreezeSeconds, "error_frozen");
require(earnings[account] < newEarnings, "error_oldEarnings");
totalProv... | 15,202 |
35 | // Check tier info | require(_discount < 100, "Tier discount error");
| require(_discount < 100, "Tier discount error");
| 11,071 |
19 | // Sync address node node name hash / | function syncAddr(
bytes32 node
)
external
| function syncAddr(
bytes32 node
)
external
| 34,879 |
142 | // Avoid duplicated adapter | require(address(_element.adapter) != address(_self.elements[i].adapter), '!Repeat adapter');
| require(address(_element.adapter) != address(_self.elements[i].adapter), '!Repeat adapter');
| 42,695 |
54 | // ownerEscrowsCounter[msg.sender] = getEscrowCountByAssetIdArray(msg.sender) + 1; |
allEscrowIds.push(escrowId);
emit EscrowCreated(
escrowId,
msg.sender,
buyer,
escrowPrice,
|
allEscrowIds.push(escrowId);
emit EscrowCreated(
escrowId,
msg.sender,
buyer,
escrowPrice,
| 53,190 |
5 | // Array of games | Game[] public games;
| Game[] public games;
| 9,511 |
41 | // Modifier to restrict access to the set manager / | modifier restricted() {
require(msg.sender == manager);
_;
}
| modifier restricted() {
require(msg.sender == manager);
_;
}
| 17,562 |
7 | // GnosisSafeProxy - Generic proxy contract allows to execute all transactions applying the code of a master contract./Stefan George - <stefan@gnosis.io>/Richard Meissner - <richard@gnosis.io> | contract GnosisSafeProxy {
// singleton always needs to be first declared variable, to ensure that it is at the same location in the contracts to which calls are delegated.
// To reduce deployment costs this variable is internal and needs to be retrieved via `getStorageAt`
address internal singleton;
/... | contract GnosisSafeProxy {
// singleton always needs to be first declared variable, to ensure that it is at the same location in the contracts to which calls are delegated.
// To reduce deployment costs this variable is internal and needs to be retrieved via `getStorageAt`
address internal singleton;
/... | 25,930 |
30 | // Replace first entry with this one. Before: HEAD <-> X <-> Y After: HEAD <-> THIS <-> X <-> Y do: THIS.NEXT = [0].next; [0].next.prev = THIS; [0].next = THIS; THIS.prev = 0; | Entry storage HEAD = entries[0x0];
entry.next = HEAD.next;
entries[HEAD.next].prev = _address;
HEAD.next = _address;
return true;
| Entry storage HEAD = entries[0x0];
entry.next = HEAD.next;
entries[HEAD.next].prev = _address;
HEAD.next = _address;
return true;
| 21,635 |
81 | // ensures that burns don't accidentally happen by sending to the zeroaddress / | modifier validateRecipient(
address to
| modifier validateRecipient(
address to
| 46,867 |
2 | // Sets the text data associated with an ENS node and key. May only be called by the owner of that node in the ENS registry.node The node to update.key The key to set.value The text data value to set./ | function setText(bytes32 node, string calldata key, string calldata value) virtual external authorised(node) {
texts[node][key] = value;
emit TextChanged(node, key, key);
}
| function setText(bytes32 node, string calldata key, string calldata value) virtual external authorised(node) {
texts[node][key] = value;
emit TextChanged(node, key, key);
}
| 16,938 |
2 | // Make sure the sender is registered as a validator | bool isRegisteredAsEthentityVerifier = false;
Member member = verificationContract.ethentity().getMemberFromAddress(msg.sender);
if (address(member) != address(0)) {
| bool isRegisteredAsEthentityVerifier = false;
Member member = verificationContract.ethentity().getMemberFromAddress(msg.sender);
if (address(member) != address(0)) {
| 16,821 |
241 | // Use the prepaidProposerReward as the proposer reward. | if (prepaidProposerReward > 0) collateralToken.safeApprove(address(optimisticOracle), prepaidProposerReward);
optimisticOracle.requestPrice(
priceIdentifier,
expirationTimestamp,
customAncillaryData,
collateralToken,
prepaidProposerReward
... | if (prepaidProposerReward > 0) collateralToken.safeApprove(address(optimisticOracle), prepaidProposerReward);
optimisticOracle.requestPrice(
priceIdentifier,
expirationTimestamp,
customAncillaryData,
collateralToken,
prepaidProposerReward
... | 19,968 |
31 | // Calculate sum of total tokens | uint tTokens = iTokens + bTokens + eTokens;
| uint tTokens = iTokens + bTokens + eTokens;
| 22,051 |
2 | // Modifier which prevents the function from being called by unauthorized parties.The caller must either be the sender or the function must becalled via the frontend, otherwise the call is reverted. caller The address of the passed-in caller. Used to preserve the original caller. / | modifier guarded(address caller) {
require(
msg.sender == caller || msg.sender == frontend,
"either caller must be sender or calling via frontend"
);
_;
}
| modifier guarded(address caller) {
require(
msg.sender == caller || msg.sender == frontend,
"either caller must be sender or calling via frontend"
);
_;
}
| 19,303 |
16 | // Gets the total amount of tokens stored by the contract return uint256 representing the total amount of tokens/ | function totalSupply() public view returns (uint256) {
return totalTokens;
}
| function totalSupply() public view returns (uint256) {
return totalTokens;
}
| 12,276 |
156 | // Pancake has to add hidden dummy pools inorder to alter the emission, here we make it simple and transparent to all. | function updateEmissionRate(uint256 _eggPerBlock) public onlyOwner {
massUpdatePools();
eggPerBlock = _eggPerBlock;
emit UpdateEmissionRate(msg.sender, _eggPerBlock);
}
| function updateEmissionRate(uint256 _eggPerBlock) public onlyOwner {
massUpdatePools();
eggPerBlock = _eggPerBlock;
emit UpdateEmissionRate(msg.sender, _eggPerBlock);
}
| 1,933 |
650 | // 327 | entry "half-price" : ENG_ADVERB
| entry "half-price" : ENG_ADVERB
| 21,163 |
27 | // if we give bad submission bits (e.g. all 0s) then refuse to deploy ballot | bool okaySubmissionBits = 1 == (isEthNoEnc(sb) ? 1 : 0) + (isEthWithEnc(sb) ? 1 : 0);
require(okaySubmissionBits, "!valid-sb");
| bool okaySubmissionBits = 1 == (isEthNoEnc(sb) ? 1 : 0) + (isEthWithEnc(sb) ? 1 : 0);
require(okaySubmissionBits, "!valid-sb");
| 37,378 |
18 | // 增加下一回合信息 | function getEvents(int x1, int y1, int x2, int y2, uint t) public view returns (uint[] memory) {
require(x2 >= x1 && y2 >= y1, "Invalid index");
uint[] memory selectEvents = new uint[](uint((x2-x1+1)*(y2-y1+1)));
uint i = 0;
for (int x=x1; x<=x2; x++) {
for (int y=y1; y<=y2... | function getEvents(int x1, int y1, int x2, int y2, uint t) public view returns (uint[] memory) {
require(x2 >= x1 && y2 >= y1, "Invalid index");
uint[] memory selectEvents = new uint[](uint((x2-x1+1)*(y2-y1+1)));
uint i = 0;
for (int x=x1; x<=x2; x++) {
for (int y=y1; y<=y2... | 915 |
39 | // Adds a new rebalancer. Only governance can add new rebalancers. / | function addRebalancer(address _rebalancer) external onlyGovernance {
require(_rebalancer != address(0x0), "rebalancer not set");
require(!rebalancers[_rebalancer], "rebalancer exist");
rebalancers[_rebalancer] = true;
emit RebalancerUpdated(_rebalancer, true);
}
| function addRebalancer(address _rebalancer) external onlyGovernance {
require(_rebalancer != address(0x0), "rebalancer not set");
require(!rebalancers[_rebalancer], "rebalancer exist");
rebalancers[_rebalancer] = true;
emit RebalancerUpdated(_rebalancer, true);
}
| 24,928 |
73 | // Loop through the mapping to populate the return array | for (uint i = 0; i < _epochInfo[_id][_epoch].totDepositors; i++) {
users[i] = _depositors[_id][_epoch][i];
}
| for (uint i = 0; i < _epochInfo[_id][_epoch].totDepositors; i++) {
users[i] = _depositors[_id][_epoch][i];
}
| 20,561 |
8 | // skip directory holds contract addresses for dependencies numCurrencies initializes the number of currencies listed on the escrow contract maxAssets max assets that a portfolio can hold / | function initialize(address directory, address owner, uint16 numCurrencies, uint256 maxAssets) external initializer {
Governed.initialize(directory, owner);
// We must initialize this here because it cannot be a constant.
NULL_ASSET = Common.Asset(0, 0, 0, 0, 0, 0);
G_NUM_CURRENCIE... | function initialize(address directory, address owner, uint16 numCurrencies, uint256 maxAssets) external initializer {
Governed.initialize(directory, owner);
// We must initialize this here because it cannot be a constant.
NULL_ASSET = Common.Asset(0, 0, 0, 0, 0, 0);
G_NUM_CURRENCIE... | 32,704 |
192 | // INTERACTIONS: 1. Burn the synthetic asset directly from their wallet 2.Transfer the stable coins back to the user | TypesV1.Position memory position = state.getPosition(positionId);
Decimal.D256 memory currentPrice = state.getCurrentPrice();
| TypesV1.Position memory position = state.getPosition(positionId);
Decimal.D256 memory currentPrice = state.getCurrentPrice();
| 44,107 |
0 | // Usings // Events // Structs / | struct StakeRequest {
address staker;
uint256 stake;
uint256 nonce;
}
| struct StakeRequest {
address staker;
uint256 stake;
uint256 nonce;
}
| 18,392 |
24 | // 四个不同的部落要求 | CryptoZooNFT.Tribe tribe = zoonerNFT.getZooner(_tokenIds[i]).tribe;
require(tribes[uint(tribe)] == 0,"Must chose four different tribes");
tribes[uint(tribe)] = uint(tribe)+1;
uint256 level = zoonerNFT.getRare(_tokenIds[i]);
totalLevel = total... | CryptoZooNFT.Tribe tribe = zoonerNFT.getZooner(_tokenIds[i]).tribe;
require(tribes[uint(tribe)] == 0,"Must chose four different tribes");
tribes[uint(tribe)] = uint(tribe)+1;
uint256 level = zoonerNFT.getRare(_tokenIds[i]);
totalLevel = total... | 5,639 |
339 | // Internal function that updates the Reward struct if a newer balance proof/ is provided in the monitor() function/token_network_address Address of the TokenNetwork being monitored/closing_participant The address of the participant who closed the channel/non_closing_participant Address of the other channel participant... | function updateReward(
address token_network_address,
address closing_participant,
address non_closing_participant,
uint256 reward_amount,
uint256 nonce,
address monitoring_service_address,
bytes memory non_closing_signature,
bytes memory reward_proof_... | function updateReward(
address token_network_address,
address closing_participant,
address non_closing_participant,
uint256 reward_amount,
uint256 nonce,
address monitoring_service_address,
bytes memory non_closing_signature,
bytes memory reward_proof_... | 57,423 |
18 | // validate all tokens being claimed and aggregate a total cost due |
for (uint i=0; i< mpIndexs.length; i++) {
require(isValidClaim(numPasses[i],amounts[i],mpIndexs[i],merkleProofs[i]), "One or more claims are invalid");
}
|
for (uint i=0; i< mpIndexs.length; i++) {
require(isValidClaim(numPasses[i],amounts[i],mpIndexs[i],merkleProofs[i]), "One or more claims are invalid");
}
| 5,334 |
79 | // Invert denominator mod 2256 Now that denominator is an odd number, it has an inverse modulo 2256 such that denominatorinv = 1 mod 2256. Compute the inverse by starting with a seed that is correct correct for four bits. That is, denominatorinv = 1 mod 24 | uint256 inv = (3 * denominator) ^ 2;
| uint256 inv = (3 * denominator) ^ 2;
| 36,386 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.