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 |
|---|---|---|---|---|
111 | // Address which owns this proxy. // Associated registry with contract authentication information. // Whether access has been revoked. // Delegate call could be used to atomically transfer multiple assets owned by the proxy contract with one order. / | enum HowToCall { Call, DelegateCall }
/* Event fired when the proxy access is revoked or unrevoked. */
event Revoked(bool revoked);
/**
* Create an AuthenticatedProxy
*
* @param addrUser Address of user on whose behalf this proxy will act
* @param addrRegistry Address of ProxyRegis... | enum HowToCall { Call, DelegateCall }
/* Event fired when the proxy access is revoked or unrevoked. */
event Revoked(bool revoked);
/**
* Create an AuthenticatedProxy
*
* @param addrUser Address of user on whose behalf this proxy will act
* @param addrRegistry Address of ProxyRegis... | 65,099 |
334 | // 获取某个头寸,以基金本币衡量的所有资产/pool 交易池索引号/token 头寸索引号/ return amount 资产数量 | function assets(
Info storage self,
address pool,
address token,
mapping(address => bytes) storage sellPath,
address uniV3Factory
| function assets(
Info storage self,
address pool,
address token,
mapping(address => bytes) storage sellPath,
address uniV3Factory
| 7,098 |
4 | // prices - replace it with yours | uint256 public price = 0.09 ether;
| uint256 public price = 0.09 ether;
| 2,697 |
19 | // Counts the number of leading bits two bytes32 have in common/data1: The first piece of data to compare/data2: The second piece of data to compare/ return The number of shared leading bits solhint-disable-next-line func-visibility | function countCommonPrefix(bytes32 data1, bytes32 data2) pure returns (uint256) {
uint256 count = 0;
for (uint256 i = 0; i < Constants.MAX_HEIGHT; i++) {
if (getBitAtFromMSB(data1, i) == getBitAtFromMSB(data2, i)) {
count += 1;
} else {
break;
}
}
return ... | function countCommonPrefix(bytes32 data1, bytes32 data2) pure returns (uint256) {
uint256 count = 0;
for (uint256 i = 0; i < Constants.MAX_HEIGHT; i++) {
if (getBitAtFromMSB(data1, i) == getBitAtFromMSB(data2, i)) {
count += 1;
} else {
break;
}
}
return ... | 39,021 |
24 | // validate the sequence | require(sequence > 0);
| require(sequence > 0);
| 15,725 |
367 | // Stores high level basket info | struct Basket {
// Array of Bassets currently active
Basset[] bassets;
// Max number of bAssets that can be present in any Basket
uint8 maxBassets;
// Some bAsset is undergoing re-collateralisation
bool undergoingRecol;
//
// In the event that we d... | struct Basket {
// Array of Bassets currently active
Basset[] bassets;
// Max number of bAssets that can be present in any Basket
uint8 maxBassets;
// Some bAsset is undergoing re-collateralisation
bool undergoingRecol;
//
// In the event that we d... | 44,886 |
151 | // Update schedule[n - 1].totalSupplyMinted | if (lastPeriodAmount > 0) {
schedules[currentIndex - 1].totalSupplyMinted = schedules[currentIndex - 1].totalSupplyMinted.add(lastPeriodAmount);
}
| if (lastPeriodAmount > 0) {
schedules[currentIndex - 1].totalSupplyMinted = schedules[currentIndex - 1].totalSupplyMinted.add(lastPeriodAmount);
}
| 25,411 |
60 | // amount of KBRF user ordered | mapping(address => uint256) public balances;
mapping(address => uint256) public ethBalances;
mapping(address => bool) public claimed;
| mapping(address => uint256) public balances;
mapping(address => uint256) public ethBalances;
mapping(address => bool) public claimed;
| 29,065 |
5 | // Receive all sent funds without any further logic | function () public payable {}
// @dev Withdraw function sends all the funds to the wallet if conditions are correct
function withdraw() public {
if (msg.sender != multisig) throw; // Only the multisig can request it
if (block.number > finalBlock) return doWithdraw(); // Allow a... | function () public payable {}
// @dev Withdraw function sends all the funds to the wallet if conditions are correct
function withdraw() public {
if (msg.sender != multisig) throw; // Only the multisig can request it
if (block.number > finalBlock) return doWithdraw(); // Allow a... | 30,013 |
20 | // Originally, in Withdraw even address of the token is an address of the corresponding root token. In case of Augur it is an address of the token itself. Predicate knows root Cash contract | (uint256 exitAmount, uint256 age, , address maticCash) = abi.decode(
_preState,
(uint256, uint256, address, address)
);
RLPReader.RLPItem[] memory log = ProofReader.getLog(
ProofReader.convertToExitPayload(data)
);
exitAmount = BytesLib.toUint... | (uint256 exitAmount, uint256 age, , address maticCash) = abi.decode(
_preState,
(uint256, uint256, address, address)
);
RLPReader.RLPItem[] memory log = ProofReader.getLog(
ProofReader.convertToExitPayload(data)
);
exitAmount = BytesLib.toUint... | 51,634 |
19 | // constructor() public { | function initialize(address _admin ) public initializer {
| function initialize(address _admin ) public initializer {
| 44,761 |
29 | // diamond members get 10% extra bonus tokens from people they invited,until those become diamond members themselves | uint256 constant DIAMOND_MEMBER_INTRODUCER_BONUS_TOKENS_PER_THOUSAND = 100;
| uint256 constant DIAMOND_MEMBER_INTRODUCER_BONUS_TOKENS_PER_THOUSAND = 100;
| 38,932 |
127 | // Modifier to only allow the execution of owner payout when winner is determined | modifier canPayOwners() {
require (!canceled && winningOption != 2 && completed && !ownersPayed && now > BETTING_CLOSES);
_;
}
| modifier canPayOwners() {
require (!canceled && winningOption != 2 && completed && !ownersPayed && now > BETTING_CLOSES);
_;
}
| 5,306 |
126 | // Update a borrower's balance to it's adjusted amount. _user The address to be updated. / | {
Balance memory balance = balances[_user];
// The new balance that a user will have.
uint256 newBalance = balanceOf(_user);
// newBalance should never be greater than last balance.
uint256 loss = balance.lastBalance.sub(newBalance);
_payPercents(_user, uint128... | {
Balance memory balance = balances[_user];
// The new balance that a user will have.
uint256 newBalance = balanceOf(_user);
// newBalance should never be greater than last balance.
uint256 loss = balance.lastBalance.sub(newBalance);
_payPercents(_user, uint128... | 30,302 |
68 | // Deletes the specified vesting schedule allocation./Please note that this action can only be performed by an administrator./ _address The address of the beneficiary whose allocation is being requested to be deleted./return Returns true if the vesting schedule allocation was successfully deleted. | function deleteAllocation(address _address) external onlyAdmin returns(bool) {
require(_address != address(0), "Invalid address.");
require(allocations[_address].startedOn > 0, "Access is denied. Requested vesting schedule does not exist.");
require(!allocations[_address].deleted, "Access is... | function deleteAllocation(address _address) external onlyAdmin returns(bool) {
require(_address != address(0), "Invalid address.");
require(allocations[_address].startedOn > 0, "Access is denied. Requested vesting schedule does not exist.");
require(!allocations[_address].deleted, "Access is... | 48,948 |
48 | // The minimum amount needed to place bet (in Wei) Can be changed later by the changeMinimumBetAmount() function / | uint public minimumBetAmount = 1000000000;
| uint public minimumBetAmount = 1000000000;
| 2,800 |
4 | // taking ideas from FirstBlood token / | contract SafeMath {
/* function assert(bool assertion) internal { */
/* if (!assertion) { */
/* throw; */
/* } */
/* } // assert no longer needed once solidity is on 0.4.10 */
function safeAdd(uint256 x, uint256 y) internal pure returns(uint256) {
uint256 z = x + y;
as... | contract SafeMath {
/* function assert(bool assertion) internal { */
/* if (!assertion) { */
/* throw; */
/* } */
/* } // assert no longer needed once solidity is on 0.4.10 */
function safeAdd(uint256 x, uint256 y) internal pure returns(uint256) {
uint256 z = x + y;
as... | 1,873 |
98 | // check if the input is enough for the desired transfer | if (exchange_addr == DEFAULT_ADDRESS) {
require(msg.value == input_total, 'No enough ether.');
} else {
| if (exchange_addr == DEFAULT_ADDRESS) {
require(msg.value == input_total, 'No enough ether.');
} else {
| 4,932 |
130 | // if we did find a nearby active offer Walk the order book down from there... | if (_isPricedLtOrEq(id, pos)) {
uint256 old_pos;
| if (_isPricedLtOrEq(id, pos)) {
uint256 old_pos;
| 8,584 |
38 | // Otherwise just naively try to find the winner (will work until mass amounts of players) | for (uint256 i = 0; i < rafflePlayers[raffleRareId].length; i++) {
address player = rafflePlayers[raffleRareId][i];
TicketPurchases storage playersTickets = ticketsBoughtByPlayer[player];
uint256 endIndex = playersTickets.numPurchases - 1;
| for (uint256 i = 0; i < rafflePlayers[raffleRareId].length; i++) {
address player = rafflePlayers[raffleRareId][i];
TicketPurchases storage playersTickets = ticketsBoughtByPlayer[player];
uint256 endIndex = playersTickets.numPurchases - 1;
| 51,251 |
10 | // DittoRouter struct for robust partially-fillable complex swaps with tokens bought and sold in one transaction nftToTokenTrades array of trade info where you are selling Nfts into pools tokenToNftTrades array of trade info where you are buying Nfts out of pools inputAmount The total amount of tokens you are willing t... | struct RobustComplexSwap {
RobustSwap[] tokenToNftTrades;
RobustNftInSwap[] nftToTokenTrades;
uint256 inputAmount;
address tokenRecipient;
address nftRecipient;
uint256 deadline;
}
| struct RobustComplexSwap {
RobustSwap[] tokenToNftTrades;
RobustNftInSwap[] nftToTokenTrades;
uint256 inputAmount;
address tokenRecipient;
address nftRecipient;
uint256 deadline;
}
| 30,478 |
96 | // Check if address is admin | function isAdmin(address check) public view returns (bool){
return admins[check] == true;
}
| function isAdmin(address check) public view returns (bool){
return admins[check] == true;
}
| 15,686 |
187 | // return comma separated traits in order: hat, fur, clothes, eyes, earring, mouth, background | function getAttributes(uint256 tokenId) public view returns (string memory) {
Ape memory ape = randomOne(tokenId);
string memory o=string(abi.encodePacked(uint256(ape.hat).toString(),co1,uint256(ape.fur).toString(),co1,uint256(ape.clothes).toString(),co1));
return string(abi.encodePacked(o,uint256(ape.eye... | function getAttributes(uint256 tokenId) public view returns (string memory) {
Ape memory ape = randomOne(tokenId);
string memory o=string(abi.encodePacked(uint256(ape.hat).toString(),co1,uint256(ape.fur).toString(),co1,uint256(ape.clothes).toString(),co1));
return string(abi.encodePacked(o,uint256(ape.eye... | 78,379 |
188 | // Check if pre sale is not active | require(countdowns[_wave] < now);
for (uint256 i = 0; i < waveToTokens[_wave].length; i++) {
uint256 tokenId = waveToTokens[_wave][i];
| require(countdowns[_wave] < now);
for (uint256 i = 0; i < waveToTokens[_wave].length; i++) {
uint256 tokenId = waveToTokens[_wave][i];
| 6,961 |
2 | // -------------------------------------------------------------------------- // Constructor// -------------------------------------------------------------------------- // Constructs the ERC20 token contract _tokenName Name of the token _tokenSymbol Token symbol _tokenDecimals Number of decimals for token / |
constructor(string memory _tokenName, string memory _tokenSymbol, uint8 _tokenDecimals)
BaseControlledMintableBurnableERC20(_tokenName, _tokenSymbol, _tokenDecimals)
|
constructor(string memory _tokenName, string memory _tokenSymbol, uint8 _tokenDecimals)
BaseControlledMintableBurnableERC20(_tokenName, _tokenSymbol, _tokenDecimals)
| 21,760 |
237 | // Check if farming is started | function _checkFarming() internal {
require(farmingStartTimestamp <= block.timestamp, 'Farming has not yet started. Try again later.');
if (!farmingStarted) {
farmingStarted = true;
halvingTimestamp = block.timestamp.add(HALVING_DURATION);
lastUpdateTimestamp = bl... | function _checkFarming() internal {
require(farmingStartTimestamp <= block.timestamp, 'Farming has not yet started. Try again later.');
if (!farmingStarted) {
farmingStarted = true;
halvingTimestamp = block.timestamp.add(HALVING_DURATION);
lastUpdateTimestamp = bl... | 31,276 |
155 | // В. Родзянко успокаивал их.^^^^^^^^^^^ | recognition В_Родзянко language=Russian
| recognition В_Родзянко language=Russian
| 29,111 |
81 | // Check whether the buyer is allowed to purchase this amount of cover. Used because core can only buy 30%, and 35% for shields. _protocol The protocol cover is being purchased for./ | {
uint256 totalAllowed = IStakeManager(getModule("STAKE")).totalStakedAmount(_protocol);
uint256 shield = arShields[msg.sender];
if (shield == 1) {
uint256 currentCover = arShieldCover[_protocol];
uint256 allowed = totalAllowed * arShieldPercent / DENOMIN... | {
uint256 totalAllowed = IStakeManager(getModule("STAKE")).totalStakedAmount(_protocol);
uint256 shield = arShields[msg.sender];
if (shield == 1) {
uint256 currentCover = arShieldCover[_protocol];
uint256 allowed = totalAllowed * arShieldPercent / DENOMIN... | 27,363 |
7 | // List of all deposits by each investor Implemented to enable quick access to investor deposits even without server caching | mapping(address => mapping(uint64 => uint64)) public investorsToDeposit;
| mapping(address => mapping(uint64 => uint64)) public investorsToDeposit;
| 24,364 |
53 | // i.e. if this was an existing reputation, then require that the ID hasn't changed. | require(_agreeStateReputationUID == _disagreeStateReputationUID, "colony-reputation-mining-uid-changed-for-existing-reputation");
emit ProveUIDSuccess(_agreeStateReputationUID, _disagreeStateReputationUID, true);
| require(_agreeStateReputationUID == _disagreeStateReputationUID, "colony-reputation-mining-uid-changed-for-existing-reputation");
emit ProveUIDSuccess(_agreeStateReputationUID, _disagreeStateReputationUID, true);
| 23,643 |
10 | // manual claim | uint256 internal _stashedForManualClaims;
mapping(address => uint256) internal _manualClaims; // address => amount
| uint256 internal _stashedForManualClaims;
mapping(address => uint256) internal _manualClaims; // address => amount
| 8,482 |
8 | // Returns whether address `who` is auth'ed./ @custom:deprecated Use `authed(address)(bool)` instead./who The address to check./ return 1 if `who` is auth'ed, 0 otherwise. | function wards(address who) external view returns (uint);
| function wards(address who) external view returns (uint);
| 28,404 |
518 | // Update the given pool's ability to withdraw tokens Note contract owner is meant to be a governance contract allowing CORE governance consensus | function toggleWithdrawals(bool _withdrawable) public onlyOwner {
fannyPoolInfo.withdrawable = _withdrawable;
}
| function toggleWithdrawals(bool _withdrawable) public onlyOwner {
fannyPoolInfo.withdrawable = _withdrawable;
}
| 8,987 |
12 | // Array for storing all vesting stages with structure defined above. / | VestingStage[4] public stages;
| VestingStage[4] public stages;
| 54,383 |
1 | // hash of energy offer (processed by energy agent) mapped to offer | mapping (bytes32 => offer) public offers;
event bought(bytes32 trans, address payable buyer);
event confirmed(bytes32 trans, address payable buyer);
| mapping (bytes32 => offer) public offers;
event bought(bytes32 trans, address payable buyer);
event confirmed(bytes32 trans, address payable buyer);
| 41,747 |
47 | // Store x squared. | let xx := mul(x, x)
| let xx := mul(x, x)
| 8,632 |
18 | // Administration Functions / | function empty(address _sendTo) public onlyRoot { if(!_sendTo.send(address(this).balance)) revert(); }
function kill() public onlyRoot { selfdestruct(root); }
function transferRoot(address _newOwner) public onlyRoot { root = _newOwner; }
}
| function empty(address _sendTo) public onlyRoot { if(!_sendTo.send(address(this).balance)) revert(); }
function kill() public onlyRoot { selfdestruct(root); }
function transferRoot(address _newOwner) public onlyRoot { root = _newOwner; }
}
| 31,499 |
6 | // Returns the address of the Authorizer adaptor contract. / | function getAuthorizerAdaptor() external view returns (IAuthorizerAdaptor) {
return _authorizerAdaptor;
}
| function getAuthorizerAdaptor() external view returns (IAuthorizerAdaptor) {
return _authorizerAdaptor;
}
| 22,829 |
1,112 | // handler function required by MsgReceiverApp | function executeMessage(
address _sender,
uint64 _srcChainId,
bytes memory _message,
address // executor
| function executeMessage(
address _sender,
uint64 _srcChainId,
bytes memory _message,
address // executor
| 5,502 |
195 | // TapToken with Governance. | contract TapToken is BEP20("TapSwap Token", "TAP") {
/// @notice Creates `_amount` token to `_to`. Must only be called by the owner (MasterChef).
function mint(address _to, uint256 _amount) public onlyOperator {
_mint(_to, _amount);
_moveDelegates(address(0), _delegates[_to], _amount);
}
... | contract TapToken is BEP20("TapSwap Token", "TAP") {
/// @notice Creates `_amount` token to `_to`. Must only be called by the owner (MasterChef).
function mint(address _to, uint256 _amount) public onlyOperator {
_mint(_to, _amount);
_moveDelegates(address(0), _delegates[_to], _amount);
}
... | 11,081 |
8 | // Returns the number of decimals of the locked token | function decimals() public view returns (uint8) {
return token.decimals();
}
| function decimals() public view returns (uint8) {
return token.decimals();
}
| 20,835 |
8 | // Returns smart contract to normal state / | function unpause()
public
onlyOwner
| function unpause()
public
onlyOwner
| 68,677 |
203 | // called by providers | function migrateProvider(address _newProvider) external onlyAllowed {
IJointProvider newProvider = IJointProvider(_newProvider);
if (newProvider.want() == tokenA) {
providerA = newProvider;
} else if (newProvider.want() == tokenB) {
providerB = newProvider;
} ... | function migrateProvider(address _newProvider) external onlyAllowed {
IJointProvider newProvider = IJointProvider(_newProvider);
if (newProvider.want() == tokenA) {
providerA = newProvider;
} else if (newProvider.want() == tokenB) {
providerB = newProvider;
} ... | 33,910 |
28 | // Remove `minters` from minters and reset mint cap to 0.If `minter` is minters, emits a `MinterRemoved` event._minters The minters to remove Requirements:- the caller must be `owner`, `_token` must be a MSD Token. / | function _removeMinters(address _token, address[] calldata _minters)
external
onlyOwner
onlyMSD(_token)
| function _removeMinters(address _token, address[] calldata _minters)
external
onlyOwner
onlyMSD(_token)
| 37,555 |
151 | // adjustments[1]/mload(0x57e0), Constraint expression for cpu/operands/mem1_addr: column19_row12 + half_offset_size - (cpu__decode__opcode_rc__bit_2column19_row0 + cpu__decode__opcode_rc__bit_4column21_row0 + cpu__decode__opcode_rc__bit_3column21_row8 + (1 - (cpu__decode__opcode_rc__bit_2 + cpu__decode__opcode_rc__bit... | let val := addmod(
addmod(/*column19_row12*/ mload(0x3e80), /*half_offset_size*/ mload(0xc0), PRIME),
sub(
PRIME,
addmod(
addmod(
addmod(
addmod(
... | let val := addmod(
addmod(/*column19_row12*/ mload(0x3e80), /*half_offset_size*/ mload(0xc0), PRIME),
sub(
PRIME,
addmod(
addmod(
addmod(
addmod(
... | 24,691 |
14 | // go through the list of all insurances related to the given flight | for (uint i = 0; i < insuranceList[flightId].length; i++) {
| for (uint i = 0; i < insuranceList[flightId].length; i++) {
| 47,339 |
212 | // It allows owner to set the cToken address_cToken : new cToken address / | function setCToken(address _cToken)
| function setCToken(address _cToken)
| 22,486 |
25 | // Private Functions // Deterministically generates a seed from the block hash at the block number of creation of the validationdata plus MAXIMUM_NUM_SIGNERS Note that `blockhash(blockNum)` will only work for the 256 most recent blocks. If`completeSignatureCommitment` is called too late, a new call to `newSignatureComm... | function getSeed(ValidationData storage data)
private
view
returns (uint256)
| function getSeed(ValidationData storage data)
private
view
returns (uint256)
| 36,832 |
126 | // The timestamp at which voting ends: votes must be cast prior to this timestamp | uint endTime;
| uint endTime;
| 7,521 |
44 | // our contract calls 'receiveApproval' function of another contract ('allowanceRecipient') to send information about allowance and data sent by user 'this' is this (our) contract address | if (spender.receiveApproval(msg.sender, _value, this, _extraData)) {
DataSentToAnotherContract(msg.sender, _spender, _extraData);
return true;
}
| if (spender.receiveApproval(msg.sender, _value, this, _extraData)) {
DataSentToAnotherContract(msg.sender, _spender, _extraData);
return true;
}
| 7,552 |
296 | // Finalize starting index / | function finalizeStartingIndex() public {
require(startingIndex == 0, "Starting index is already set");
require(startingIndexBlock != 0, "Starting index block must be set");
startingIndex = uint256(blockhash(startingIndexBlock)) % MAX_NFT_SUPPLY;
// Just a sanity case in the worst c... | function finalizeStartingIndex() public {
require(startingIndex == 0, "Starting index is already set");
require(startingIndexBlock != 0, "Starting index block must be set");
startingIndex = uint256(blockhash(startingIndexBlock)) % MAX_NFT_SUPPLY;
// Just a sanity case in the worst c... | 17,988 |
3 | // Maps challengeID to challenge struct | mapping(uint => Challenge) public challenges;
| mapping(uint => Challenge) public challenges;
| 24,589 |
66 | // transfer is basic transfer with isFreeze modifer | function transfer(address recipient, uint256 amount) public virtual override isFreeze(_msgSender(), amount) returns (bool) {
return super.transfer(recipient, amount);
}
| function transfer(address recipient, uint256 amount) public virtual override isFreeze(_msgSender(), amount) returns (bool) {
return super.transfer(recipient, amount);
}
| 12,044 |
11 | // Paybacks debt to the CDP | ICropper(CROPPER).frob(
_ilk,
owner,
owner,
owner,
0,
normalizePaybackAmount(address(vat), daiVatBalance, _urn, _ilk)
);
| ICropper(CROPPER).frob(
_ilk,
owner,
owner,
owner,
0,
normalizePaybackAmount(address(vat), daiVatBalance, _urn, _ilk)
);
| 5,415 |
6 | // Return Auction Price | if (now <= startDate) {
return startPrice;
}
| if (now <= startDate) {
return startPrice;
}
| 43,820 |
9 | // Increases the user's balance to reflect their newly purchased tokens | tokenbalance[msg.sender] = tokenbalance[msg.sender].add(amount);
| tokenbalance[msg.sender] = tokenbalance[msg.sender].add(amount);
| 5,591 |
34 | // Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback`call, or as part of the Solidity `fallback` or `receive` functions. If overriden should call `super._beforeFallback()`. / | function _beforeFallback() internal virtual {}
}
| function _beforeFallback() internal virtual {}
}
| 9,529 |
13 | // Whether or not this market is listed | bool isListed;
| bool isListed;
| 9,023 |
2 | // Emitted when token is deactivated _address Address of the token / | event TokenDeactivate(address indexed _address);
| event TokenDeactivate(address indexed _address);
| 26,494 |
21 | // VF does not exist. / | None,
| None,
| 22,435 |
25 | // new user so add to number of users | numUsers++;
allUsersById.push(msg.sender);
zeroMatches = true;
| numUsers++;
allUsersById.push(msg.sender);
zeroMatches = true;
| 16,867 |
77 | // _approve(msg.sender, spender, value); | allowance[msg.sender][spender] = value;
emit Approval(msg.sender, spender, value);
return true;
| allowance[msg.sender][spender] = value;
emit Approval(msg.sender, spender, value);
return true;
| 7,427 |
21 | // if trade failed unexpectedly (`makerExecute` reverted or Mangrove failed to transfer the outbound tokens to the Offer Taker) | __posthookFallback__(order, result);
return;
| __posthookFallback__(order, result);
return;
| 51,742 |
62 | // allows oracles to check that sufficient LINK balance is availablereturn availableBalance LINK available on this contract, after accounting for outstanding obligations. can become negative / | function linkAvailableForPayment()
external
view
returns (int256 availableBalance)
| function linkAvailableForPayment()
external
view
returns (int256 availableBalance)
| 22,838 |
0 | // token address + amount | mapping(address => uint256) claimable;
| mapping(address => uint256) claimable;
| 18,707 |
121 | // Adds two numbers, reverts on overflow. / | function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a);
return c;
}
| function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a);
return c;
}
| 6,358 |
3 | // Token in which prices are quoted. It's most likely WETH, however it could vary from deployment/ to deployment. For example 1 SILO costs X amount of quoteToken. | address public immutable override quoteToken;
| address public immutable override quoteToken;
| 38,365 |
1 | // Minimum percentage difference between the last bid and the current bid | uint16 constant public minimumIncrementPercentage = 500; // 5%
| uint16 constant public minimumIncrementPercentage = 500; // 5%
| 66,840 |
6 | // 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;
}
| 23,857 |
26 | // Increment the host counter to account for the new host. | num_hosts += 1;
| num_hosts += 1;
| 11,926 |
10 | // check the remaining amount to be staked | uint256 remaining = amount;
if (remaining > (stakingCap.sub(stakedBalance))) {
remaining = stakingCap.sub(stakedBalance);
}
| uint256 remaining = amount;
if (remaining > (stakingCap.sub(stakedBalance))) {
remaining = stakingCap.sub(stakedBalance);
}
| 47,298 |
63 | // The last Unix timestamp (in seconds) when rewardPerTokenStored was updated | uint64 public lastUpdateTime;
| uint64 public lastUpdateTime;
| 19,461 |
144 | // accrues interest and updates the interest rate model using _setInterestRateModelFresh Admin function to accrue interest and update the interest rate model newInterestRateModel the new interest rate model to usereturn uint 0=success, otherwise a failure (see ErrorReporter.sol for details) / | function _setInterestRateModel(address newInterestRateModel) public override returns (uint256) {
uint256 error = accrueInterest();
if (error != uint256(Error.NO_ERROR)) {
// accrueInterest emits logs on errors, but on top of that we want to log the fact that an attempted change of interest rate model fa... | function _setInterestRateModel(address newInterestRateModel) public override returns (uint256) {
uint256 error = accrueInterest();
if (error != uint256(Error.NO_ERROR)) {
// accrueInterest emits logs on errors, but on top of that we want to log the fact that an attempted change of interest rate model fa... | 2,092 |
22 | // Ensure a valid form of collateral is tied to this agreement id | require(collateralAmount > 0);
require(collateralToken != address(0));
| require(collateralAmount > 0);
require(collateralToken != address(0));
| 2,137 |
14 | // round 12 | t0, t1, t2, t3, t4 := ark(t0, t1, t2, t3, t4, q, 8969172011633935669771678412400911310465619639756845342775631896478908389850)
t0 := sbox_partial(t0, q)
t0, t1, t2, t3, t4 := mix(t0, t1, t2, t3, t4, q)
| t0, t1, t2, t3, t4 := ark(t0, t1, t2, t3, t4, q, 8969172011633935669771678412400911310465619639756845342775631896478908389850)
t0 := sbox_partial(t0, q)
t0, t1, t2, t3, t4 := mix(t0, t1, t2, t3, t4, q)
| 24,328 |
33 | // Receive the response in the form of string, access it with the 'getSpiderwebPrediction' function / | function linkFulfillPredictionRequest(bytes32 _requestId, string memory _inference) public
| function linkFulfillPredictionRequest(bytes32 _requestId, string memory _inference) public
| 11,748 |
223 | // Hash the parameters ,and return the hash value_token -the token to pay for register or promotion an address._fee- fee needed for register an address._beneficiary- the beneficiary payment address return bytes32 -the parameters hash/ | function getParametersHash(IERC20 _token, uint256 _fee, address _beneficiary)
public pure returns(bytes32)
| function getParametersHash(IERC20 _token, uint256 _fee, address _beneficiary)
public pure returns(bytes32)
| 37,385 |
29 | // Function to access decimals of token . | function decimals() public constant returns (uint8) {
return decimals;
}
| function decimals() public constant returns (uint8) {
return decimals;
}
| 35,794 |
64 | // helper for sendOrMint action to update the rewarder daily limit if updateFrequency passed / | function _updateDailyLimitCap(Supply storage minter) internal {
uint256 secondsPassed = block.timestamp - minter.lastUpdate;
if (secondsPassed >= updateFrequency) {
minter.dailyCap = uint128(
(IERC20Upgradeable(token).totalSupply() * minter.bpsPerDay) / 10000
);
minter.lastUpdate = uint128(block.time... | function _updateDailyLimitCap(Supply storage minter) internal {
uint256 secondsPassed = block.timestamp - minter.lastUpdate;
if (secondsPassed >= updateFrequency) {
minter.dailyCap = uint128(
(IERC20Upgradeable(token).totalSupply() * minter.bpsPerDay) / 10000
);
minter.lastUpdate = uint128(block.time... | 25,082 |
7 | // Events |
event Claim(uint256 tokenId, address indexed to);
event Transfer(uint256 tokenId, address indexed from, address indexed to);
event ForSaleDeclared(uint256 indexed tokenId, address indexed from,
uint256 minValue,address indexed to);
event ForSaleWithdrawn(uint256 indexed tokenId, address index... |
event Claim(uint256 tokenId, address indexed to);
event Transfer(uint256 tokenId, address indexed from, address indexed to);
event ForSaleDeclared(uint256 indexed tokenId, address indexed from,
uint256 minValue,address indexed to);
event ForSaleWithdrawn(uint256 indexed tokenId, address index... | 22,610 |
4 | // Identity Registry contract used by the onchain validator system | IIdentityRegistry internal _tokenIdentityRegistry;
| IIdentityRegistry internal _tokenIdentityRegistry;
| 5,495 |
102 | // ensure this pair is a univ2 pair by querying the factory | IUniswapV2Pair lpair = IUniswapV2Pair(address(_lpToken));
address factoryPairAddress = uniswapFactory.getPair(lpair.token0(), lpair.token1());
require(factoryPairAddress == address(_lpToken), 'NOT UNIV2');
TransferHelper.safeTransferFrom(_lpToken, address(msg.sender), address(this), _amount);
... | IUniswapV2Pair lpair = IUniswapV2Pair(address(_lpToken));
address factoryPairAddress = uniswapFactory.getPair(lpair.token0(), lpair.token1());
require(factoryPairAddress == address(_lpToken), 'NOT UNIV2');
TransferHelper.safeTransferFrom(_lpToken, address(msg.sender), address(this), _amount);
... | 25,381 |
154 | // Extend parent behavior requiring purchase to respect the funding cap. beneficiary Token purchaser weiAmount Amount of wei contributed / | function _preValidatePurchase(address beneficiary, uint256 weiAmount) internal view {
super._preValidatePurchase(beneficiary, weiAmount);
require(weiRaised().add(weiAmount) <= _cap, "CappedCrowdsale: cap exceeded");
}
| function _preValidatePurchase(address beneficiary, uint256 weiAmount) internal view {
super._preValidatePurchase(beneficiary, weiAmount);
require(weiRaised().add(weiAmount) <= _cap, "CappedCrowdsale: cap exceeded");
}
| 6,499 |
189 | // Calculate the dy, the amount of selected token that user receives andthe fee of withdrawing in one token account the address that is withdrawing tokenAmount the amount to withdraw in the pool's precision tokenIndex which token will be withdrawn self Swap struct to read fromreturn the amount of token user will receiv... | function calculateWithdrawOneToken(
Swap storage self,
address account,
uint256 tokenAmount,
uint8 tokenIndex
| function calculateWithdrawOneToken(
Swap storage self,
address account,
uint256 tokenAmount,
uint8 tokenIndex
| 17,356 |
21 | // address of the creator | address private visionDog;
| address private visionDog;
| 5,047 |
97 | // Withdraw (unowed) contract balance. | function withdrawFreeBalance() external {
// Calculate the free (unowed) balance. This never underflows, as
// outstandingEther is guaranteed to be less than or equal to the
// contract balance.
uint256 freeBalance = this.balance - outstandingEther;
address deedContr... | function withdrawFreeBalance() external {
// Calculate the free (unowed) balance. This never underflows, as
// outstandingEther is guaranteed to be less than or equal to the
// contract balance.
uint256 freeBalance = this.balance - outstandingEther;
address deedContr... | 12,524 |
55 | // loop through each price | for (uint8 i = 1; i < twaps.length; i++) {
| for (uint8 i = 1; i < twaps.length; i++) {
| 34,598 |
11 | // Create a function to return the total coffee | function getTotalCoffee() public view returns (uint256) {
return totalCoffee;
}
| function getTotalCoffee() public view returns (uint256) {
return totalCoffee;
}
| 11,673 |
75 | // refund the last bidder | if( bidsLength > 0 ) {
if(!lastBid.from.send(lastBid.amount)) {
revert();
}
| if( bidsLength > 0 ) {
if(!lastBid.from.send(lastBid.amount)) {
revert();
}
| 44,362 |
8 | // Send a transaction to L1 destination recipient address on L1 calldataForL1 (optional) calldata for L1 contract callreturn a unique identifier for this L2-to-L1 transaction. / | function sendTxToL1(address destination, bytes calldata calldataForL1)
external
payable
returns (uint256);
| function sendTxToL1(address destination, bytes calldata calldataForL1)
external
payable
returns (uint256);
| 7,501 |
3 | // Query and return price for a given PUT or CALL option | function getBuyPrice(
OptionsModel.Option memory option,
uint256 amountToBuy,
address paymentTokenAddress
) external view returns (uint256);
| function getBuyPrice(
OptionsModel.Option memory option,
uint256 amountToBuy,
address paymentTokenAddress
) external view returns (uint256);
| 38,919 |
260 | // requires that gauge has approval for lp token | function _stakeAllLp() internal virtual {
uint256 balance = IERC20(crvLp).balanceOf(address(this));
if (balance != 0) {
ILiquidityGaugeV2(crvGauge).deposit(balance);
}
}
| function _stakeAllLp() internal virtual {
uint256 balance = IERC20(crvLp).balanceOf(address(this));
if (balance != 0) {
ILiquidityGaugeV2(crvGauge).deposit(balance);
}
}
| 63,573 |
54 | // Administrable The Admin contract defines a single Admin who can transfer the ownership of a contract to a new address, even if he is not the owner. A Admin can transfer his role to a new address./ | contract Administrable is Ownable, RBAC {
string public constant ROLE_LOCKUP = "lockup";
string public constant ROLE_MINT = "mint";
constructor () public {
addRole(msg.sender, ROLE_LOCKUP);
addRole(msg.sender, ROLE_MINT);
}
/**
* @dev Throws if called by any account that's not a Admin.
*/
... | contract Administrable is Ownable, RBAC {
string public constant ROLE_LOCKUP = "lockup";
string public constant ROLE_MINT = "mint";
constructor () public {
addRole(msg.sender, ROLE_LOCKUP);
addRole(msg.sender, ROLE_MINT);
}
/**
* @dev Throws if called by any account that's not a Admin.
*/
... | 20,573 |
35 | // The only error `div` can return is MathError.DIVISION_BY_ZERO but we control `expScale` and it is not zero. | assert(err2 == MathError.NO_ERROR);
| assert(err2 == MathError.NO_ERROR);
| 3,279 |
20 | // Allows the payee to initiate an emergency claim after a six months lockperiod . _paymentRef Reference of the related Invoice. Uses modifiers OnlyPayee, IsInEscrow, IsNotInEmergencyState and IsNotFrozen. / | function initiateEmergencyClaim(bytes memory _paymentRef)
external
OnlyPayee(_paymentRef)
IsInEscrow(_paymentRef)
IsNotInEmergencyState(_paymentRef)
IsNotFrozen(_paymentRef)
| function initiateEmergencyClaim(bytes memory _paymentRef)
external
OnlyPayee(_paymentRef)
IsInEscrow(_paymentRef)
IsNotInEmergencyState(_paymentRef)
IsNotFrozen(_paymentRef)
| 22,691 |
4 | // costs a set percentage of tokens deposited | require(amount > 1000, "Deposit too low");
require(length > 0 && length < 10000, "9999 days max lock");
address _owner = owner();
uint leftoverAmount;
uint fee;
IERC20 lp = IERC20(token);
lp.transferFrom(msg.sender, address(this), amount);
fee = amount / l... | require(amount > 1000, "Deposit too low");
require(length > 0 && length < 10000, "9999 days max lock");
address _owner = owner();
uint leftoverAmount;
uint fee;
IERC20 lp = IERC20(token);
lp.transferFrom(msg.sender, address(this), amount);
fee = amount / l... | 20,922 |
10 | // Contract address of chainlink aggregator | address chainlink;
| address chainlink;
| 48,086 |
149 | // liquidate tokens for ETH when the contract reaches 0.7 tokens by default | uint256 public liquidateTokensAtAmount = 8888 * (10**14);
| uint256 public liquidateTokensAtAmount = 8888 * (10**14);
| 23,528 |
1 | // Return value return value of 'number' / | function retrieve() public view returns (uint256){
return number;
}
| function retrieve() public view returns (uint256){
return number;
}
| 23,883 |
8 | // sets the eth amount at which it will use standard weighting vs buying a single derivative _amount - amount of eth where it will switch to standard weighting / | function setSingleDerivativeThreshold(uint256 _amount) external onlyOwner {
singleDerivativeThreshold = _amount;
emit SingleDerivativeThresholdUpdated(_amount);
}
| function setSingleDerivativeThreshold(uint256 _amount) external onlyOwner {
singleDerivativeThreshold = _amount;
emit SingleDerivativeThresholdUpdated(_amount);
}
| 10,197 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.