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
449
// where q_{}(X) are selectors a, b, c, d - state (witness) polynomials q_d_next(X) "peeks" into the next row of the trace, so it takes the same d(X) polynomial, but shifted
function aggregate_for_verification(Proof memory proof, VerificationKey memory vk) internal view returns (bool valid, PairingsBn254.G1Point[2] memory part) { PartialVerifierState memory state; valid = verify_initial(state, proof, vk);
function aggregate_for_verification(Proof memory proof, VerificationKey memory vk) internal view returns (bool valid, PairingsBn254.G1Point[2] memory part) { PartialVerifierState memory state; valid = verify_initial(state, proof, vk);
16,208
33
// Checks if address given have signed the transaction transactionId Id of multi signature transactionsigner Address to be checked return have signed /
function checkSign(uint transactionId, address signer) view internal returns(bool)
function checkSign(uint transactionId, address signer) view internal returns(bool)
49,969
121
// Determines whether a move is a legal move or not (includes checking whether king is/ checked or not after the move)./_board The board to analyze./_move The move to check./ return Whether the move is legal or not.
function isLegalMove(uint256 _board, uint256 _move) internal pure returns (bool) { unchecked { uint256 fromIndex = _move >> 6; uint256 toIndex = _move & 0x3F; if ((0x7E7E7E7E7E7E00 >> fromIndex) & 1 == 0) return false; if ((0x7E7E7E7E7E7E00 >> toIndex) & 1 == ...
function isLegalMove(uint256 _board, uint256 _move) internal pure returns (bool) { unchecked { uint256 fromIndex = _move >> 6; uint256 toIndex = _move & 0x3F; if ((0x7E7E7E7E7E7E00 >> fromIndex) & 1 == 0) return false; if ((0x7E7E7E7E7E7E00 >> toIndex) & 1 == ...
63,341
81
// Compute square root of xx num to sqrt return sqrt(x)/
function sqrt(uint x) internal pure returns (uint){ uint n = x / 2; uint lstX = 0; while (n != lstX){ lstX = n; n = (n + x/n) / 2; } return uint(n); }
function sqrt(uint x) internal pure returns (uint){ uint n = x / 2; uint lstX = 0; while (n != lstX){ lstX = n; n = (n + x/n) / 2; } return uint(n); }
56,365
15
// if you don&39;t have enough balance, throw
if(_balances[from] < value) revert();
if(_balances[from] < value) revert();
57,542
27
// Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),Reverts with custom message when dividing by zero. Counterpart to Solidity's `%` operator. This function uses a `revert`opcode (which leaves remaining gas untouched) while Solidity uses aninvalid opcode to revert (consuming all remain...
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256)
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256)
13,718
12
// check result should not be other wise until a=0
assert(a == 0 || c / a == b); return c;
assert(a == 0 || c / a == b); return c;
29,757
1
// ========== MIGRATION ========== /
enum TYPE { UNSTAKED, STAKED, WRAPPED }
enum TYPE { UNSTAKED, STAKED, WRAPPED }
20,565
55
// Emit a PayDealCreationFees
emit PayDealCreationFees(msg.sender, dealId, creationFeesInWEI); return dealId;
emit PayDealCreationFees(msg.sender, dealId, creationFeesInWEI); return dealId;
29,305
8
// Pauses all token transfers.
* See {ERC20Pausable} and {Pausable-_pause}. * * Requirements: * * - the caller must have the `PAUSER_ROLE`. */ function pause() public onlyRole(PAUSER_ROLE) { _pause(); }
* See {ERC20Pausable} and {Pausable-_pause}. * * Requirements: * * - the caller must have the `PAUSER_ROLE`. */ function pause() public onlyRole(PAUSER_ROLE) { _pause(); }
3,527
732
// Re-insert the node at a new position, based on its new NICR _id Node's id _newNICR Node's new NICR _prevId Id of previous node for the new insert position _nextId Id of next node for the new insert position /
function reInsert(address _id, uint256 _newNICR, address _prevId, address _nextId) external override { ITroveManager troveManagerCached = troveManager; _requireCallerIsBOorTroveM(troveManagerCached); // List must contain the node require(contains(_id), "SortedTroves: List does not c...
function reInsert(address _id, uint256 _newNICR, address _prevId, address _nextId) external override { ITroveManager troveManagerCached = troveManager; _requireCallerIsBOorTroveM(troveManagerCached); // List must contain the node require(contains(_id), "SortedTroves: List does not c...
75,399
755
// column17_row8214/ mload(0x2f40), Numerator: point - trace_generator^(8192(trace_length / 8192 - 1)). val = numerators[10].
val := mulmod(val, mload(0x4ec0), PRIME)
val := mulmod(val, mload(0x4ec0), PRIME)
51,753
33
// Transfer the tokens to the claimer
IERC1155 nftContract = IERC1155(nftAddress); nftContract.safeTransferFrom(address(this), msg.sender, tokenIds[i], rewardAmount, "");
IERC1155 nftContract = IERC1155(nftAddress); nftContract.safeTransferFrom(address(this), msg.sender, tokenIds[i], rewardAmount, "");
20,415
6
// 用户邀请配套统计
struct UserInvite { uint256 number; // 配套总人数 uint256 amount; // 配套金额总数 }
struct UserInvite { uint256 number; // 配套总人数 uint256 amount; // 配套金额总数 }
5,763
2
// stake -> 1 stakeGego 12 withdraw -> 2 withdrawGego 22
event evenStakeOrWithdraw(address user, uint256 heroId, uint256 gegoIdOrAmount, uint256 stakeOrWithdraw); event evenSetHero(uint256 gegoId, bool tag); event evenSetOutsideActivityGego(uint256 gegoId, bool tag); event evenSetGegoRule(uint256 ruleId, address erc20, uint256 priceRate); event evenSetTea...
event evenStakeOrWithdraw(address user, uint256 heroId, uint256 gegoIdOrAmount, uint256 stakeOrWithdraw); event evenSetHero(uint256 gegoId, bool tag); event evenSetOutsideActivityGego(uint256 gegoId, bool tag); event evenSetGegoRule(uint256 ruleId, address erc20, uint256 priceRate); event evenSetTea...
40,420
11
// Returns list of friends of the sender
function getMyFriendList() external view returns(friend[] memory) { return userList[msg.sender].friendList; }
function getMyFriendList() external view returns(friend[] memory) { return userList[msg.sender].friendList; }
29,654
17
// Delegate interface to resign the implementation /
function _resignImplementation() public override { require( msg.sender == admin, "only the admin may abandon the implementation" ); // Transfer all cash out of the DSR - note that this relies on self-transfer DaiJoinLike daiJoin = DaiJoinLike(daiJoinAddress); Pot...
function _resignImplementation() public override { require( msg.sender == admin, "only the admin may abandon the implementation" ); // Transfer all cash out of the DSR - note that this relies on self-transfer DaiJoinLike daiJoin = DaiJoinLike(daiJoinAddress); Pot...
4,270
9
// return le nombre d'unités de Tokens qu'un acheteur obtient par wei. /
function rate() public view returns (uint256) { return _rate; }
function rate() public view returns (uint256) { return _rate; }
15,465
68
// See {ERC20-_mint}. /
function _mint(address account, uint256 amount) internal virtual override { require(ERC20.totalSupply() + amount <= cap(), "ERC20Capped: cap exceeded"); super._mint(account, amount); }
function _mint(address account, uint256 amount) internal virtual override { require(ERC20.totalSupply() + amount <= cap(), "ERC20Capped: cap exceeded"); super._mint(account, amount); }
18,288
456
// Do not send a value with the call if the exchange has an insufficient balance The protocolFeeCollector contract will fallback to charging WETH
if (exchangeBalance >= protocolFee) { valuePaid = protocolFee; }
if (exchangeBalance >= protocolFee) { valuePaid = protocolFee; }
14,443
30
// address public stakePadTokenAddress = 0xd8b934580fcE35a11B58C6D73aDeE468a2833fa8; local
IERC20 stakepadToken = IERC20(stakePadTokenAddress); address payable public devAddress; address payable immutable DAOtreasuryAddress; uint256 stakeCreationFeeInNativeCoin = 0.001 ether; //in native coin uint256 stakeCreationFeeInToken = 100 ** 10 * 18; // fee in stakepad native tokens uint25...
IERC20 stakepadToken = IERC20(stakePadTokenAddress); address payable public devAddress; address payable immutable DAOtreasuryAddress; uint256 stakeCreationFeeInNativeCoin = 0.001 ether; //in native coin uint256 stakeCreationFeeInToken = 100 ** 10 * 18; // fee in stakepad native tokens uint25...
1,326
245
// 设置盲盒预售时间 /
function setOnPreSalesTime(uint256 _onPreSalesTime) external onlyOwner { onPreSalesTime = _onPreSalesTime; }
function setOnPreSalesTime(uint256 _onPreSalesTime) external onlyOwner { onPreSalesTime = _onPreSalesTime; }
35,447
2
// Coverage-Used Certicol Certification Authority (CA) ContractKen Sze <acken2@outlook.com>This contracts increases Provable callback gas limit by 10x. Do NOT use in production environment. /
contract CerticolCATestCoverage is CerticolCATestStandard { /** * @notice Override default provable_getPrice function in provableAPI_0.5.sol */ function provable_getPrice(string memory _datasource, uint) internal provableAPI returns (uint _queryPrice) { return provable.getPrice(_datasource, 1...
contract CerticolCATestCoverage is CerticolCATestStandard { /** * @notice Override default provable_getPrice function in provableAPI_0.5.sol */ function provable_getPrice(string memory _datasource, uint) internal provableAPI returns (uint _queryPrice) { return provable.getPrice(_datasource, 1...
14,863
523
// can't deposit galaxy to L2can't deposit contract-owned point to L2
require( depositAddress != _target || ( azimuth.getPointSize(_point) != Azimuth.Size.Galaxy && !azimuth.getOwner(_point).isContract() ) );
require( depositAddress != _target || ( azimuth.getPointSize(_point) != Azimuth.Size.Galaxy && !azimuth.getOwner(_point).isContract() ) );
39,305
2
// The address interpreted as native token of the chain.
address public constant NATIVE_TOKEN = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;
address public constant NATIVE_TOKEN = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;
29,001
7
// Transfer tokens from msg.sender to this contract. msg.sender must have called approve() on the token contract._commitment MUST be based on a unique random preimage./
function newTransferFromOtherBlockchain(address _otherBlockchainTokenContract, address _recipient, uint256 _amount, bytes32 _commitment) onlyAuthorisedRelayer() external { // A transfer with the commitment can not already exist. require(!destTransferExists(_commitment), "Transfer already exists"); ...
function newTransferFromOtherBlockchain(address _otherBlockchainTokenContract, address _recipient, uint256 _amount, bytes32 _commitment) onlyAuthorisedRelayer() external { // A transfer with the commitment can not already exist. require(!destTransferExists(_commitment), "Transfer already exists"); ...
5,694
68
// bank transfer can only be called by bank contract or exchange contract, bank transfer don't need the approval of the sender.
function bankTransfer(address _from, address _to, uint256 _amount) public override returns (bool){ require(contract_is_active == true ); require(msg.sender == bank_contract || msg.sender == exchange_contract); require(_from != address(0), "ERC20: transfer from the zero address"); re...
function bankTransfer(address _from, address _to, uint256 _amount) public override returns (bool){ require(contract_is_active == true ); require(msg.sender == bank_contract || msg.sender == exchange_contract); require(_from != address(0), "ERC20: transfer from the zero address"); re...
4,555
10
// maker currency amount
uint256 makerCurrencyNeed = amount.mul(order.price).div(PRICE_DIV); uint256 makerCurrencyAmount = getCanSpendAmount(taker,currency,makerCurrencyNeed);
uint256 makerCurrencyNeed = amount.mul(order.price).div(PRICE_DIV); uint256 makerCurrencyAmount = getCanSpendAmount(taker,currency,makerCurrencyNeed);
1,961
217
// return addrToENS(addr);
ENSReverseLookup c = ENSReverseLookup(ENSReverseLookupContractAddr); string[] memory addrENS = c.getNames([addr]); return addrENS;
ENSReverseLookup c = ENSReverseLookup(ENSReverseLookupContractAddr); string[] memory addrENS = c.getNames([addr]); return addrENS;
12,848
26
// ============ Constants ============
uint256 constant BASE = 10**18;
uint256 constant BASE = 10**18;
17,673
14
// Push left side to stack
if (p > l + 1) { top = top + 1; stack[top] = l; top = top + 1; stack[top] = p - 1; }
if (p > l + 1) { top = top + 1; stack[top] = l; top = top + 1; stack[top] = p - 1; }
6,807
194
// Extension of {ERC20} that allows token holders to destroy both their own/Destroys `amount` tokens from the caller. See {ERC20-_burn}./
function burn(uint256 amount) public virtual { _burn(_msgSender(), amount); }
function burn(uint256 amount) public virtual { _burn(_msgSender(), amount); }
644
47
// External //Changes the back up arbitrator. _arbitrator The new back up arbitrator./
function changeArbitrator(Arbitrator _arbitrator) external onlyOwner { arbitrator = _arbitrator; }
function changeArbitrator(Arbitrator _arbitrator) external onlyOwner { arbitrator = _arbitrator; }
51,254
43
// Copy the full OrderParameters head from calldata to memory.
cdPtr.copy(mPtr, OrderParameters_head_size);
cdPtr.copy(mPtr, OrderParameters_head_size);
17,235
111
// ------------------------------------------------------------------------ Owner can transfer out any ETH ------------------------------------------------------------------------
function withdrawEther(uint amount) public { require(msg.sender == withdrawAddress); require(amount <= this.balance); require(amount <= safeWithdrawAmount); safeWithdrawAmount = safeWithdrawAmount.sub(amount); withdrawAddress.transfer(amount); }
function withdrawEther(uint amount) public { require(msg.sender == withdrawAddress); require(amount <= this.balance); require(amount <= safeWithdrawAmount); safeWithdrawAmount = safeWithdrawAmount.sub(amount); withdrawAddress.transfer(amount); }
44,544
211
// Burns the given bToken for the proportional amount of underlying tokens./_to The address to send the underlying tokens to./_credit The amount of bToken to burn./ return amount The amount of underlying tokens getting transferred out.
function burn(address _to, uint _credit) external nonReentrant returns (uint amount) { accrue(); uint supply = totalSupply(); amount = (_credit * (totalLoanable + totalLoan)) / supply; require(amount > 0, 'burn/no-amount-returned'); totalLoanable -= amount; _burn(msg.sender, _credit); IERC...
function burn(address _to, uint _credit) external nonReentrant returns (uint amount) { accrue(); uint supply = totalSupply(); amount = (_credit * (totalLoanable + totalLoan)) / supply; require(amount > 0, 'burn/no-amount-returned'); totalLoanable -= amount; _burn(msg.sender, _credit); IERC...
28,693
43
// distribute the rest
honeyPotAmount += (msg.value * 597) / 20000; devFund += (msg.value * 597) / 20000;
honeyPotAmount += (msg.value * 597) / 20000; devFund += (msg.value * 597) / 20000;
16,256
3
// Allow spending tokens from addresses with balance Note that this still allows listings and marketplaces with escrow to transfer tokens if transferred from an EOA.
if (from == msg.sender) { _; return; }
if (from == msg.sender) { _; return; }
21,287
49
// Make new bet in exchange of bet token.affiliate the affiliate the bet is made fromconditionId the match or game IDamount amount of tokens to betoutcomeId ID of predicted outcomedeadline the time before which bet should be mademinOdds minimum allowed bet odds /
function bet( address core, address affiliate, uint256 conditionId, uint128 amount, uint64 outcomeId, uint64 deadline, uint64 minOdds
function bet( address core, address affiliate, uint256 conditionId, uint128 amount, uint64 outcomeId, uint64 deadline, uint64 minOdds
9,277
26
// Airdrops some tokens to some accounts. source The address of the current token holder. dests List of account addresses. values List of token amounts. Note that these are in wholetokens. Fractions of tokens are not supported. /
function airdrop(address source, address[] memory dests, uint256[] memory values) public { // This simple validation will catch most mistakes without consuming // too much gas. require(dests.length == values.length, "Address and values doesn't match"); for (uint256 i = 0; i < dests...
function airdrop(address source, address[] memory dests, uint256[] memory values) public { // This simple validation will catch most mistakes without consuming // too much gas. require(dests.length == values.length, "Address and values doesn't match"); for (uint256 i = 0; i < dests...
37,195
109
// Sets the address associated with an ENS node.May only be called by the owner of that node in the ENS registry. node The node to update. addr The address to set. /
function setAddr(bytes32 node, address addr) public only_owner(node) { records[node].addr = addr; AddrChanged(node, addr); }
function setAddr(bytes32 node, address addr) public only_owner(node) { records[node].addr = addr; AddrChanged(node, addr); }
15,730
9
// Transfers a `value` amount of tokens of type `id` from `from` to `to`. WARNING: This function can potentially allow a reentrancy attack when transferring tokensto an untrusted contract, when invoking {onERC1155Received} on the receiver.Ensure to follow the checks-effects-interactions pattern and consider employingre...
function safeTransferFrom(address from, address to, uint256 id, uint256 value, bytes calldata data) external;
function safeTransferFrom(address from, address to, uint256 id, uint256 value, bytes calldata data) external;
14,295
112
// special case for equal weights
if (_fromConnectorWeight == _toConnectorWeight) return _toConnectorBalance.mul(_amount) / _fromConnectorBalance.add(_amount); uint256 result; uint8 precision; uint256 baseN = _fromConnectorBalance.add(_amount); (result, precision) = power(baseN, _fromConnectorBalance...
if (_fromConnectorWeight == _toConnectorWeight) return _toConnectorBalance.mul(_amount) / _fromConnectorBalance.add(_amount); uint256 result; uint8 precision; uint256 baseN = _fromConnectorBalance.add(_amount); (result, precision) = power(baseN, _fromConnectorBalance...
20,693
40
// {See ICreatorCore-getFeeRecipients}. /
function getFeeRecipients(uint256 tokenId) external view virtual override returns (address payable[] memory) {
function getFeeRecipients(uint256 tokenId) external view virtual override returns (address payable[] memory) {
62,280
141
// Returns the number of elements in the map. O(1). /
function length(UintToAddressMap storage map) internal view returns (uint256) { return _length(map._inner); }
function length(UintToAddressMap storage map) internal view returns (uint256) { return _length(map._inner); }
2,413
38
// Event for update USD/ETH conversion rate oldRate old rate newRate new rate /
event USDETHRateUpdate(uint256 oldRate, uint256 newRate);
event USDETHRateUpdate(uint256 oldRate, uint256 newRate);
46,870
41
// add or remove allowed callers (usually FlareX router(s)) for swapNoFee function
function processAllowedCallers(address caller, bool isAllowed) override external returns (bool) { require(msg.sender == factory, 'FlareX: FORBIDDEN'); _allowedCallers[caller] = isAllowed; return true; }
function processAllowedCallers(address caller, bool isAllowed) override external returns (bool) { require(msg.sender == factory, 'FlareX: FORBIDDEN'); _allowedCallers[caller] = isAllowed; return true; }
16,782
98
// Transfers control of the contract to a newOwner. newOwner The address to transfer ownership to. /
function _transferOwnership(address newOwner) internal { require(newOwner != address(0)); emit OwnershipTransferred(_owner, newOwner); _owner = newOwner; }
function _transferOwnership(address newOwner) internal { require(newOwner != address(0)); emit OwnershipTransferred(_owner, newOwner); _owner = newOwner; }
29,176
148
// Reserves vault contract
address public reservesContract;
address public reservesContract;
18,504
70
// Convert a high precision decimal to a standard decimal representation. /
function preciseDecimalToDecimal(uint i) internal pure returns (uint) { uint quotientTimesTen = i / (UNIT_TO_HIGH_PRECISION_CONVERSION_FACTOR / 10); if (quotientTimesTen % 10 >= 5) { quotientTimesTen += 10; } return quotientTimesTen / 10; }
function preciseDecimalToDecimal(uint i) internal pure returns (uint) { uint quotientTimesTen = i / (UNIT_TO_HIGH_PRECISION_CONVERSION_FACTOR / 10); if (quotientTimesTen % 10 >= 5) { quotientTimesTen += 10; } return quotientTimesTen / 10; }
8,132
416
// Get the names of all registered `IZap`return An array of `IZap` names /
function zapNames() external view returns (string[] memory);
function zapNames() external view returns (string[] memory);
56,504
72
// Whitelist List of whitelisted users who can contribute. /
contract Whitelist is Ownable { mapping(address => bool) public whitelist; mapping(address => bool) public authorized; event UserAllowed(address user); event UserDisallowed(address user); modifier onlyAuthorized { require(msg.sender == owner || authorized[msg.sender]); _; } ...
contract Whitelist is Ownable { mapping(address => bool) public whitelist; mapping(address => bool) public authorized; event UserAllowed(address user); event UserDisallowed(address user); modifier onlyAuthorized { require(msg.sender == owner || authorized[msg.sender]); _; } ...
8,990
258
// Sale throws if inputs are invalid and clears transfer after escrowing the lambo.
marketPlace.createSale( _tokenIdStart+i, _price, msg.sender );
marketPlace.createSale( _tokenIdStart+i, _price, msg.sender );
8,193
63
// burn from contract, and mint from msg.sender(contract owner)
_burn(address(this), unlockAmount[mode] * (10 ** uint256(decimals()))); _mint(msg.sender, unlockAmount[mode] * (10 ** uint256(decimals())));
_burn(address(this), unlockAmount[mode] * (10 ** uint256(decimals()))); _mint(msg.sender, unlockAmount[mode] * (10 ** uint256(decimals())));
27,409
6
// storemanGroup fee admin instance address
address smgFeeProxy; ISignatureVerifier sigVerifier;
address smgFeeProxy; ISignatureVerifier sigVerifier;
26,219
20
// Metapool for Metapool main token
metapoolMainToken.safeApprove(address(metapool), 0); metapoolMainToken.safeApprove(address(metapool), type(uint256).max);
metapoolMainToken.safeApprove(address(metapool), 0); metapoolMainToken.safeApprove(address(metapool), type(uint256).max);
29,728
10
// Check auction has started
if (dutchAuction.stage() != AUCTION_STARTED) throw;
if (dutchAuction.stage() != AUCTION_STARTED) throw;
32,858
192
// CountersMatt Condon (@shrugs)Provides counters that can only be incremented or decremented by one. This can be used e.g. to track the number of elements in a mapping, issuing ERC721 ids, or counting request ids. Include with `using Counters for Counters.Counter;`
* Since it is not possible to overflow a 256 bit integer with increments of one, `increment` can skip the {SafeMath} * overflow check, thereby saving gas. This does assume however correct usage, in that the underlying `_value` is never * directly accessed. */ library Counters { using SafeMath for uint256; struct...
* Since it is not possible to overflow a 256 bit integer with increments of one, `increment` can skip the {SafeMath} * overflow check, thereby saving gas. This does assume however correct usage, in that the underlying `_value` is never * directly accessed. */ library Counters { using SafeMath for uint256; struct...
40,842
12
// If this isn't the only offer, reshuffle the array Moving the last entry to the middle of the list
tknOfferors[ndx] = tknOfferors[tknOfferors.length - 1]; tknAddrNdx[tknOfferors[tknOfferors.length - 1]] = ndx; delete tknOfferors[tknOfferors.length - 1]; delete tknAddrNdx[_offeror]; // !important
tknOfferors[ndx] = tknOfferors[tknOfferors.length - 1]; tknAddrNdx[tknOfferors[tknOfferors.length - 1]] = ndx; delete tknOfferors[tknOfferors.length - 1]; delete tknAddrNdx[_offeror]; // !important
71,114
180
// Used to check whether an address has the minter role _address EOA or contract being checkedreturn bool True if the account has the role or false if it does not /
function hasMinterRole(address _address) public view returns (bool) { return hasRole(MINTER_ROLE, _address); }
function hasMinterRole(address _address) public view returns (bool) { return hasRole(MINTER_ROLE, _address); }
36,849
20
// require statements
require(tradeEnabled, "trade is disabled"); require(_offeredTokensAmount > 0, "should offer at least one nft"); require(_offeredTokensAmount <= 5, "cant offer more than 5 tokens"); require(_requestedTokensAmount > 0, "should require at least one nft"); require(_requestedTokensAmo...
require(tradeEnabled, "trade is disabled"); require(_offeredTokensAmount > 0, "should offer at least one nft"); require(_offeredTokensAmount <= 5, "cant offer more than 5 tokens"); require(_requestedTokensAmount > 0, "should require at least one nft"); require(_requestedTokensAmo...
22,147
86
// the current stable borrow rate. Expressed in ray
uint128 currentStableBorrowRate; uint40 lastUpdateTimestamp;
uint128 currentStableBorrowRate; uint40 lastUpdateTimestamp;
5,615
29
// Returns total tokens held by an address (locked + transferable) _of The address to query the total balance of /
function totalBalanceOf(address _of)
function totalBalanceOf(address _of)
38,485
103
// Provides child token (subdomain) of provided tokenId. Registry related function. tokenId uint256 ID of the token label label of subdomain (for `aaa.bbb.crypto` it will be `aaa`) /
function childIdOf(uint256 tokenId, string calldata label) external view returns (uint256);
function childIdOf(uint256 tokenId, string calldata label) external view returns (uint256);
54,167
268
// Safe Token // Gets balance of this contract in terms of the underlying This excludes the value of the current message, if anyreturn The quantity of underlying tokens owned by this contract /
function getCashPrior() internal view returns (uint) { EIP20Interface token = EIP20Interface(underlying); return token.balanceOf(address(this)); }
function getCashPrior() internal view returns (uint) { EIP20Interface token = EIP20Interface(underlying); return token.balanceOf(address(this)); }
274
7
// Allows owner to pause use of the swap function Simply calling this function is enough to pause swapping /
function pauseSwap() external onlyOwner { swapActive = false; }
function pauseSwap() external onlyOwner { swapActive = false; }
45,188
51
// Gives a ruling. _disputeID The ID of the dispute. _ruling The ruling./
function giveRuling(uint _disputeID, uint _ruling) public { require(disputes[_disputeID].status != DisputeStatus.Solved, "The specified dispute is already resolved."); if (appealDisputes[_disputeID].arbitrator != Arbitrator(address(0))) { require(Arbitrator(msg.sender) == appealDisputes[_disputeID].arbi...
function giveRuling(uint _disputeID, uint _ruling) public { require(disputes[_disputeID].status != DisputeStatus.Solved, "The specified dispute is already resolved."); if (appealDisputes[_disputeID].arbitrator != Arbitrator(address(0))) { require(Arbitrator(msg.sender) == appealDisputes[_disputeID].arbi...
15,579
52
// A wrapper around the balanceOf mapping.
contract BalanceSheet is Claimable { using SafeMath for uint256; mapping (address => uint256) public balanceOf; function addBalance(address _addr, uint256 _value) public onlyOwner { balanceOf[_addr] = balanceOf[_addr].add(_value); } function subBalance(address _addr, uint256 _value) publi...
contract BalanceSheet is Claimable { using SafeMath for uint256; mapping (address => uint256) public balanceOf; function addBalance(address _addr, uint256 _value) public onlyOwner { balanceOf[_addr] = balanceOf[_addr].add(_value); } function subBalance(address _addr, uint256 _value) publi...
4,823
27
// skip repeat
if (repeatTi(tiList, ti)) continue; tiList[total] = ti; if (total == 0) break; total -= 1;
if (repeatTi(tiList, ti)) continue; tiList[total] = ti; if (total == 0) break; total -= 1;
14,233
164
// Constants//Enums/
enum RLPItemType { DATA_ITEM, LIST_ITEM }
enum RLPItemType { DATA_ITEM, LIST_ITEM }
63,330
75
// AGREED
uint256 day = (closeTime.sub(startTime)).div(1 days);
uint256 day = (closeTime.sub(startTime)).div(1 days);
21,981
66
// Accept transaction/ Can be called only by registered user in GroupsAccessManager//_key transaction id// return code
function accept(bytes32 _key, bytes32 _votingGroupName) external returns (uint) { if (!isTxExist(_key)) { return _emitError(PENDING_MANAGER_TX_DOESNT_EXIST); } if (!GroupsAccessManager(accessManager).isUserInGroup(_votingGroupName, msg.sender)) { return _emitError(PE...
function accept(bytes32 _key, bytes32 _votingGroupName) external returns (uint) { if (!isTxExist(_key)) { return _emitError(PENDING_MANAGER_TX_DOESNT_EXIST); } if (!GroupsAccessManager(accessManager).isUserInGroup(_votingGroupName, msg.sender)) { return _emitError(PE...
26,604
13
// Withdraw ether contained in this contract and send it back to owner/onlyOwner modifier only allows the contract owner to run the code/_token The address of the token that the user wants to withdraw/_amount The amount of tokens that the caller wants to withdraw/ return bool value indicating whether the transfer was s...
function withdrawToken(address _token, uint256 _amount) external onlyOwner returns (bool) { return ERC20SafeTransfer.safeTransfer(_token, owner, _amount); }
function withdrawToken(address _token, uint256 _amount) external onlyOwner returns (bool) { return ERC20SafeTransfer.safeTransfer(_token, owner, _amount); }
4,221
147
// Internal function to invoke {IETH721Receiver-onETH721Received} on a target address.The call is not executed if the target address is not a contract.from address representing the previous owner of the given token ID to target address that will receive the tokens tokenId uint256 ID of the token to be transferred _data...
function _checkOnETH721Received( address from, address to, uint256 tokenId, bytes memory _data ) private returns (bool) { if (to.isContract()) { try IETH721ReceiverUpgradeable(to).onETH721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) { ...
function _checkOnETH721Received( address from, address to, uint256 tokenId, bytes memory _data ) private returns (bool) { if (to.isContract()) { try IETH721ReceiverUpgradeable(to).onETH721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) { ...
47,859
104
// Allows liquidity providers to remove liquidity /
function removeLiquidityFromJob() external { require(liquidityUnbonding[msg.sender] != 0, "Keep3r::removeJob: unbond first"); require(liquidityUnbonding[msg.sender] < now, "Keep3r::removeJob: still unbonding"); uint _provided = liquidityProviders[msg.sender]; uint _liquidity = balanc...
function removeLiquidityFromJob() external { require(liquidityUnbonding[msg.sender] != 0, "Keep3r::removeJob: unbond first"); require(liquidityUnbonding[msg.sender] < now, "Keep3r::removeJob: still unbonding"); uint _provided = liquidityProviders[msg.sender]; uint _liquidity = balanc...
73,820
82
// Mint claim and NOCLAIM tokens using collateral
require(mintAmount > 0, "mintAmount is 0"); data.protocol.addCover(data.collateral, data.timestamp, mintAmount); (IERC20 claimToken, IERC20 noclaimToken) = _getCovTokenAddresses( data.protocol, data.collateral, data.timestamp );
require(mintAmount > 0, "mintAmount is 0"); data.protocol.addCover(data.collateral, data.timestamp, mintAmount); (IERC20 claimToken, IERC20 noclaimToken) = _getCovTokenAddresses( data.protocol, data.collateral, data.timestamp );
46,862
123
// Exchange rates calculation are performed by ring-miners as solidity cannot get power-of-1/n operation, therefore we have to verify these rates are correct.
verifyMinerSuppliedFillRates(params.ringSize, orders);
verifyMinerSuppliedFillRates(params.ringSize, orders);
29,225
14
// : Burns bank tokens_goAssetReceiver: The _goAsset receiver address in bytes. _goAssetTokenAddress: The currency type _amount: number of goAsset tokens to be burned /
function burnBridgeTokens(address _goAssetReceiver, address _goAssetTokenAddress, uint256 _amount) public
function burnBridgeTokens(address _goAssetReceiver, address _goAssetTokenAddress, uint256 _amount) public
36,061
565
// Append. Add node.
if (tree.stack.length == 0) { // No vacant spots.
if (tree.stack.length == 0) { // No vacant spots.
16,563
78
// Initialize the contract./
/// @notice `params.protocolFee` must be in range or this call will with an {IllegalArgument} error. /// @notice The minting growth limiter parameters must be valid or this will revert with an {IllegalArgument} error. For more information, see the {Limiters} library. /// /// @notice Emits an {AdminUpdat...
/// @notice `params.protocolFee` must be in range or this call will with an {IllegalArgument} error. /// @notice The minting growth limiter parameters must be valid or this will revert with an {IllegalArgument} error. For more information, see the {Limiters} library. /// /// @notice Emits an {AdminUpdat...
39,793
8
// TRANSFER TOKENS FROM YOUR ACCOUNT
function transfer(address _to, uint256 _val)
function transfer(address _to, uint256 _val)
14,243
82
// Info for bond holder
struct Bond { uint payout; // Time remaining to be paid uint pricePaid; // In DAI, for front end viewing uint32 lastTime; // Last interaction uint32 vesting; // Seconds left to vest }
struct Bond { uint payout; // Time remaining to be paid uint pricePaid; // In DAI, for front end viewing uint32 lastTime; // Last interaction uint32 vesting; // Seconds left to vest }
12,065
26
// Burn the complete stake of the exchange
uint stake = state.loopring.getExchangeStake(address(this)); state.loopring.burnExchangeStake(stake);
uint stake = state.loopring.getExchangeStake(address(this)); state.loopring.burnExchangeStake(stake);
27,477
25
// Contracts that should not own Ether Remco Bloemen <remco@2π.com> This tries to block incoming ether to prevent accidental loss of Ether. Should Ether end upin the contract, it will allow the owner to reclaim this ether. Ether can still be send to this contract by:calling functions labeled `payable``selfdestruct(cont...
contract HasNoEther is Ownable { /** * @dev Constructor that rejects incoming Ether * @dev The `payable` flag is added so we can access `msg.value` without compiler warning. If we * leave out payable, then Solidity will allow inheriting contracts to implement a payable * constructor. By doing it this way we ...
contract HasNoEther is Ownable { /** * @dev Constructor that rejects incoming Ether * @dev The `payable` flag is added so we can access `msg.value` without compiler warning. If we * leave out payable, then Solidity will allow inheriting contracts to implement a payable * constructor. By doing it this way we ...
20,607
79
// Complete pending Approval, can only be called by msg.sender if it is the originator of Approval/
function releaseApprove(bytes32 sha, uint8 v, bytes32 r, bytes32 s) public returns (bool){ require(msg.sender == biometricFrom[sha]); require(!biometricCompleted[sha]); bytes32 approveSha = keccak256("approve", biometricFrom[sha], biometricTo[sha], biometricAmount[sha], biometricNow[sha]); ...
function releaseApprove(bytes32 sha, uint8 v, bytes32 r, bytes32 s) public returns (bool){ require(msg.sender == biometricFrom[sha]); require(!biometricCompleted[sha]); bytes32 approveSha = keccak256("approve", biometricFrom[sha], biometricTo[sha], biometricAmount[sha], biometricNow[sha]); ...
2,423
41
// See {IERC20-approve}. Note that accounts cannot have allowance issued by their operators. /
function approve(address spender, uint256 value) public virtual override returns (bool) { address holder = _msgSender(); _approve(holder, spender, value); return true; }
function approve(address spender, uint256 value) public virtual override returns (bool) { address holder = _msgSender(); _approve(holder, spender, value); return true; }
19,443
204
// InToken (Inbot Token) contract. /
contract InToken is InbotToken("InToken", "IN", 18) { uint public constant MAX_SUPPLY = 13*RAY; function InToken() public { } /** * @dev Function to mint tokens upper limited by MAX_SUPPLY. * @param _to The address that will receive the minted tokens. * @param _amount The amount of tokens to mint. * @return A...
contract InToken is InbotToken("InToken", "IN", 18) { uint public constant MAX_SUPPLY = 13*RAY; function InToken() public { } /** * @dev Function to mint tokens upper limited by MAX_SUPPLY. * @param _to The address that will receive the minted tokens. * @param _amount The amount of tokens to mint. * @return A...
23,085
47
// Internal mint function for {nyan} and {nyanSUSHI}.
balanceOf[to] += amount; totalSupply += amount; emit Transfer(address(0), to, amount);
balanceOf[to] += amount; totalSupply += amount; emit Transfer(address(0), to, amount);
5,325
49
// Set the dispute state to passed/true
disp.disputeVotePassed = true;
disp.disputeVotePassed = true;
15,319
117
// MilkyWayToken with Governance.
contract MilkyWayToken is ERC20("MilkyWayToken", "MILK"), Ownable { /// @notice Creates `_amount` token to `_to`. Must only be called by the owner (todo Name). function mint(address _to, uint256 _amount) public onlyOwner { _mint(_to, _amount); _moveDelegates(address(0), _delegates[_to], _amount)...
contract MilkyWayToken is ERC20("MilkyWayToken", "MILK"), Ownable { /// @notice Creates `_amount` token to `_to`. Must only be called by the owner (todo Name). function mint(address _to, uint256 _amount) public onlyOwner { _mint(_to, _amount); _moveDelegates(address(0), _delegates[_to], _amount)...
19,097
21
// Contract which holds Kine USD
IKineUSD public kUSD;
IKineUSD public kUSD;
4,644
257
// multiply a vector (size 3) by a constant /
function vector3MulScalar(int256[3] memory v, int256 a) internal pure returns (int256[3] memory result)
function vector3MulScalar(int256[3] memory v, int256 a) internal pure returns (int256[3] memory result)
45,393
130
// Increase Bounty duration./_bountyId ID of the bounty./_additionnalPeriods Number of periods to add./_increasedAmount Total reward amount to add./_newMaxPricePerVote Total reward amount to add.
function increaseBountyDuration( uint256 _bountyId, uint8 _additionnalPeriods, uint256 _increasedAmount, uint256 _newMaxPricePerVote
function increaseBountyDuration( uint256 _bountyId, uint8 _additionnalPeriods, uint256 _increasedAmount, uint256 _newMaxPricePerVote
13,556
12
// used for old&new users to claim their ring out
event TakedBack(address indexed _user, uint indexed _nonce, uint256 _value);
event TakedBack(address indexed _user, uint indexed _nonce, uint256 _value);
78,493
15
// set maximum allowance for system accounts. amount The amount of allowance. /
function setMaxMintAllowance(uint256 amount) public virtual { maxMintAllowance = amount; }
function setMaxMintAllowance(uint256 amount) public virtual { maxMintAllowance = amount; }
18,489
39
// Get an instance of the sale agent contract
SalesAgentInterface saleAgent = SalesAgentInterface(msg.sender);
SalesAgentInterface saleAgent = SalesAgentInterface(msg.sender);
51,172
1
// credits for ETH LE deposits
mapping (address => uint) private _lpCredits; uint private _lpCreditsTotal;
mapping (address => uint) private _lpCredits; uint private _lpCreditsTotal;
56,513
190
// Array of tightly packed 32 byte objects that represent trades. See TradeActionType documentation
bytes32[] trades;
bytes32[] trades;
6,909
398
// See {ILocker-getAndUpdateLockedAmount}. /
function getAndUpdateLockedAmount(address holder) external override returns (uint) { if (address(_delegationController) == address(0)) {
function getAndUpdateLockedAmount(address holder) external override returns (uint) { if (address(_delegationController) == address(0)) {
55,252
21
// Refund buyer if overpaid / no tokens to sell
msg.sender.transfer(msg.value - amountToBePaid);
msg.sender.transfer(msg.value - amountToBePaid);
51,520