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
97
// set matching enabled/disabledIf matchingEnabled true(default), then inserted offers are matched.Except the ones inserted by contracts, because those end upin the unsorted list of offers, that must be later sorted bykeepers using insert().If matchingEnabled is false then RubiconMarket is reverted to ExpiringMarket,an...
function setMatchingEnabled(bool matchingEnabled_) external auth returns (bool)
function setMatchingEnabled(bool matchingEnabled_) external auth returns (bool)
17,022
2
// Dictionary containing reviews
struct ReviewsMap { Evaluation[] evaluations; // list of evaluations mapping (uint => uint) indexes; // maps the agent to the corresponding evaluation in the list }
struct ReviewsMap { Evaluation[] evaluations; // list of evaluations mapping (uint => uint) indexes; // maps the agent to the corresponding evaluation in the list }
47,989
123
// Take a portion of the profits for the buy and burn and retirement yeld Convert half the USDC earned into ETH for the protocol algorithms
uint256 stakingProfits = usdcToETH(onePercent); uint256 tokensAlreadyBurned = yeldToken.balanceOf(address(0)); if (tokensAlreadyBurned < maximumTokensToBurn) {
uint256 stakingProfits = usdcToETH(onePercent); uint256 tokensAlreadyBurned = yeldToken.balanceOf(address(0)); if (tokensAlreadyBurned < maximumTokensToBurn) {
15,513
2
// Handles farm distribution, only callable from controller If recipient is booster contract, amount is temporarily stored and lockedin a second call.farm The reward farm that the call originates from recipient The recipient of the rewards amount The amount to distribute fee The fee in 6 decimal notation /
function distributeFromFarm(
function distributeFromFarm(
37,601
13
// uint256 strength = (randomNumber % 100); uint256 luck = (((randomNumber) % 10000) / 100); uint256 speed = ((randomNumber % 10)82);
uint256 dna = randomNumber; characters.push(Character(dna)); emit CharacterEvent(requestId, dna, newId); _safeMint(requestToSender[requestId], newId);
uint256 dna = randomNumber; characters.push(Character(dna)); emit CharacterEvent(requestId, dna, newId); _safeMint(requestToSender[requestId], newId);
27,865
52
// To increase the number of points for a user.Callable only by point admins /
function increaseUserPoints( address _userAddress, uint256 _numberPoints, uint256 _campaignId
function increaseUserPoints( address _userAddress, uint256 _numberPoints, uint256 _campaignId
22,273
81
// Can only fund loan if there are payments remaining (as defined by the initialization) and no payment is due yet (as set by a funding).
require((_nextPaymentDueDate == uint256(0)) && (paymentsRemaining != uint256(0)), "MLI:FL:LOAN_ACTIVE"); uint256 paymentInterval = _paymentInterval;
require((_nextPaymentDueDate == uint256(0)) && (paymentsRemaining != uint256(0)), "MLI:FL:LOAN_ACTIVE"); uint256 paymentInterval = _paymentInterval;
1,897
147
// asset function to get common information / return asset name / return notarized number
function getAssetCommonInfo() external view returns (string memory, string memory) { return ( assetCommonInfo.assetName, assetCommonInfo.notarizedNumber ); }
function getAssetCommonInfo() external view returns (string memory, string memory) { return ( assetCommonInfo.assetName, assetCommonInfo.notarizedNumber ); }
16,017
159
// address of the callee contract
address callee;
address callee;
46,181
162
// Use uniswap since this contract is registered as no fee address for swapping SDVD to ETH Swap path
address[] memory path = new address[](2); path[0] = sdvd; path[1] = weth;
address[] memory path = new address[](2); path[0] = sdvd; path[1] = weth;
42,573
2
// Constant `a` of EC equation
uint256 internal constant AA = 0;
uint256 internal constant AA = 0;
25,836
15
// transfer function signature
mstore(0x7c, ERC20_TRANSFER_ID)
mstore(0x7c, ERC20_TRANSFER_ID)
82,386
7
// require a valid candidate
require(_candidateId > 0 && _candidateId <= candidatesCount);
require(_candidateId > 0 && _candidateId <= candidatesCount);
2,294
143
// Gets the total amount of `token` in the ring
function getPoolBalance() public view returns (uint256) { return ERC20(token).balanceOf(address(this)); }
function getPoolBalance() public view returns (uint256) { return ERC20(token).balanceOf(address(this)); }
44,185
128
// toの口座にamountが振り込まれる
_storage.addCoinBalance(to, amount); if (fee > 0) {
_storage.addCoinBalance(to, amount); if (fee > 0) {
38,403
35
// Management address batchManagerMint names_ SNS name tos_ SNS owner /
function batchManagerMint(string[] memory names_, address[] memory tos_,uint256[] memory tokenIds_, bool isKeyMint_) external virtual userTokenManagerAllowed(_msgSender()) { for (uint256 i = 0; i < names_.length; i++) { _managerMint(names_[i], tos_[i], tokenIds_[i], isKeyMint_); } }
function batchManagerMint(string[] memory names_, address[] memory tos_,uint256[] memory tokenIds_, bool isKeyMint_) external virtual userTokenManagerAllowed(_msgSender()) { for (uint256 i = 0; i < names_.length; i++) { _managerMint(names_[i], tos_[i], tokenIds_[i], isKeyMint_); } }
41,501
197
// we don't need sender init as _sigsVerifier is immutable so already in the deployed code
initReceiver(_cBridge, _gateBridge);
initReceiver(_cBridge, _gateBridge);
48,386
19
// Set user state for last harvested
lastEpochIdHarvested[msg.sender] = epochId;
lastEpochIdHarvested[msg.sender] = epochId;
22,235
64
// PreSale bonus in percent
uint256 bonusPercent;
uint256 bonusPercent;
23,232
13
// Mapping from mint request UID => whether the mint request is processed.
mapping(bytes32 => bool) private minted; mapping(uint256 => string) private _tokenURI;
mapping(bytes32 => bool) private minted; mapping(uint256 => string) private _tokenURI;
19,282
3
// if needed remove underlying from basket
removeToken(_underlying);
removeToken(_underlying);
20,248
65
// With new amounts, calculate again how much liquidity we can get
(compoundLiquidity, used0, used1) = _getCompoundLiquidity(_nextLowerTick,_nextUpperTick,partialAmount0.add(newAmount0).sub(used0),partialAmount1.add(newAmount1).sub(used1));
(compoundLiquidity, used0, used1) = _getCompoundLiquidity(_nextLowerTick,_nextUpperTick,partialAmount0.add(newAmount0).sub(used0),partialAmount1.add(newAmount1).sub(used1));
27,153
85
// Registry data.
mapping(address => Darknode) private darknodeRegistry; LinkedList.List private darknodes;
mapping(address => Darknode) private darknodeRegistry; LinkedList.List private darknodes;
4,529
54
// /
function manualSwapBack() external { uint256 allLeft = balanceOf(address(this)); doSwapBack(allLeft); }*/
function manualSwapBack() external { uint256 allLeft = balanceOf(address(this)); doSwapBack(allLeft); }*/
48,792
68
// Maximum value that can be safely used as a dividend. divide(maxFixedDiv,newFixedFraction(1,fixed1())) = maxInt256().Test maxFixedDiv() equals maxInt256()/fixed1()Test divide(maxFixedDiv(),multiply(mulPrecision(),mulPrecision())) = maxFixedDiv()(10^digits())Test divide(maxFixedDiv()+1,multiply(mulPrecision(),mulPreci...
function maxFixedDiv() public pure returns(int256) { return 57896044618658097711785492504343953926634992332820282; }
function maxFixedDiv() public pure returns(int256) { return 57896044618658097711785492504343953926634992332820282; }
28,419
4
// The sender mints. apeTokenMint The market that user wants to mint mintAmount The mint amount /
function mint(ApeTokenInterface apeTokenMint, uint256 mintAmount) external { require( comptroller.isMarketListed(address(apeTokenMint)), "market not list" ); _mint(apeTokenMint, mintAmount); }
function mint(ApeTokenInterface apeTokenMint, uint256 mintAmount) external { require( comptroller.isMarketListed(address(apeTokenMint)), "market not list" ); _mint(apeTokenMint, mintAmount); }
6,380
15
// Soldity contract for proof of perception
contract Percept { mapping(bytes32 => Proof) public proofs; // Proof storage mappings (key => value data) struct Proof { // Proof data type // Pre-release data address creator; // Address of the proof maker bytes32 hash; // 1-way hash of the proof text ...
contract Percept { mapping(bytes32 => Proof) public proofs; // Proof storage mappings (key => value data) struct Proof { // Proof data type // Pre-release data address creator; // Address of the proof maker bytes32 hash; // 1-way hash of the proof text ...
51,626
27
// Returns the key-value pair stored at position `index` in the map. O(1). Note that there are no guarantees on the ordering of entries inside thearray, and it may change when more entries are added or removed. Requirements:
* - `index` must be strictly less than {length}. */ function _at(CardMap storage map, uint256 index) private view returns ( bytes32, uint256, uint256, uint256[] memory, uint256[] memory, string memory, ...
* - `index` must be strictly less than {length}. */ function _at(CardMap storage map, uint256 index) private view returns ( bytes32, uint256, uint256, uint256[] memory, uint256[] memory, string memory, ...
15,575
7
// Create a new token Id/recipient Receiving Address/numTokens Number of tokens to be minted
function create(address recipient, uint256 numTokens) public onlyMarket returns (uint256)
function create(address recipient, uint256 numTokens) public onlyMarket returns (uint256)
20,238
106
// indicates if fee should be deducted from transfer
bool takeFee = false;
bool takeFee = false;
9,569
16
// TEAM FEE DATA
mapping (uint256 => FFEIFDatasets.TeamFee) public fees_; // (team => fees) fee distribution by team mapping (uint256 => FFEIFDatasets.PotSplit) public potSplit_; // (team => fees) pot split distribution by team
mapping (uint256 => FFEIFDatasets.TeamFee) public fees_; // (team => fees) fee distribution by team mapping (uint256 => FFEIFDatasets.PotSplit) public potSplit_; // (team => fees) pot split distribution by team
32,207
0
// The onlyOwner modifier restricts who can call the store function
function store(uint256 newValue) public onlyOwner { value = newValue; console.log(value); emit ValueChanged(newValue); }
function store(uint256 newValue) public onlyOwner { value = newValue; console.log(value); emit ValueChanged(newValue); }
1,744
64
// If blockcap is not set yet, cap the round
if (round.blockCap == 0) { allocateToPot(round); allocateFromPot(round);
if (round.blockCap == 0) { allocateToPot(round); allocateFromPot(round);
44,682
56
// transfer fee to fee address, doesn't take off the top
rewardToken.safeTransfer(feeAddress, _fee);
rewardToken.safeTransfer(feeAddress, _fee);
23,726
11
// Accept ownership request, works only if called by new owner /
function acceptOwnership() { // Avoid multiple events triggering in case of several calls from owner if (msg.sender == newOwner && owner != newOwner) { OwnershipTransferred(owner, newOwner); owner = newOwner; } }
function acceptOwnership() { // Avoid multiple events triggering in case of several calls from owner if (msg.sender == newOwner && owner != newOwner) { OwnershipTransferred(owner, newOwner); owner = newOwner; } }
40,750
12
// TopUp the last product of a customer _phoneHash The address that identifies to the customer _paidTimestamp Timestamp of the acceptance TopUp the last product of a customer (identified with `_phoneHash`) at timestamp `_paidTimestamp` /
function topUp(address _phoneHash, uint256 _paidTimestamp) external onlyOwner
function topUp(address _phoneHash, uint256 _paidTimestamp) external onlyOwner
7,044
18
// Sets initialized == true on implementation contracts test Set to true to skip implementation initialization /
constructor(bool test) public InitializableV2(test) {} /** * @notice Updates the block delay for a ValidatorGroup's commission udpdate * @param delay Number of blocks to delay the update */ function setCommissionUpdateDelay(uint256 delay) public onlyOwner { require(delay != commissionUpdateDelay, "c...
constructor(bool test) public InitializableV2(test) {} /** * @notice Updates the block delay for a ValidatorGroup's commission udpdate * @param delay Number of blocks to delay the update */ function setCommissionUpdateDelay(uint256 delay) public onlyOwner { require(delay != commissionUpdateDelay, "c...
14,628
7
// Throws if the sender is not an authorised feature of the target wallet. /
modifier onlyWalletFeature(address _wallet) { require(versionManager.isFeatureAuthorised(_wallet, msg.sender), "BF: must be a wallet feature"); _; }
modifier onlyWalletFeature(address _wallet) { require(versionManager.isFeatureAuthorised(_wallet, msg.sender), "BF: must be a wallet feature"); _; }
24,734
40
// Send _value amount of metadollars from address _from to address _to/ The transferFrom method is used for a withdraw workflow, allowing contracts to send/ tokens on your behalf, for example to "deposit" to a contract address and/or to charge/ fees in sub-currencies; the command should fail unless the _from account ha...
function transferFrom(address _from, address _to, uint256 _value) returns (bool success) { assert(msg.sender != address(0)); assert(_from != address(0)); assert(_to != address(0)); require(!frozenAccount[msg.sender]); require(!frozenAccount[_from]); require(!frozenAccount[_to]); require(tokenBalanceOf[_f...
function transferFrom(address _from, address _to, uint256 _value) returns (bool success) { assert(msg.sender != address(0)); assert(_from != address(0)); assert(_to != address(0)); require(!frozenAccount[msg.sender]); require(!frozenAccount[_from]); require(!frozenAccount[_to]); require(tokenBalanceOf[_f...
40,420
90
// change the maximum height of the reward curve
function setPulseAmplitude(uint poolId, uint newAmplitude) external poolOwnerOnly(poolId) pausedAndSynced(poolId) { Pulse storage pulse = pulses[poolId]; pulse.pulseAmplitudeWei = newAmplitude; pulse.pulseConstant = pulse.pulseAmplitudeWei / pulse.pulseWavelengthBlocks.times(pulse.pulseWavel...
function setPulseAmplitude(uint poolId, uint newAmplitude) external poolOwnerOnly(poolId) pausedAndSynced(poolId) { Pulse storage pulse = pulses[poolId]; pulse.pulseAmplitudeWei = newAmplitude; pulse.pulseConstant = pulse.pulseAmplitudeWei / pulse.pulseWavelengthBlocks.times(pulse.pulseWavel...
17,184
60
// Get number of votes for an airline/
function getVoteCount(address airlineAddress) public view requireIsOperational requireAddressAuthorized(msg.sender) requireAirlineStored(airlineAddress) returns(uint256)
function getVoteCount(address airlineAddress) public view requireIsOperational requireAddressAuthorized(msg.sender) requireAirlineStored(airlineAddress) returns(uint256)
38,360
9
// 5- Locking the token solhint-disable-next-line not-rely-on-time
if (_lockEnd > now) { address[] memory locks = new address[](1); locks[0] = address(token); require(_core.defineTokenLocks(address(token), locks), "TF09"); require(_core.defineLock( address(token), ANY_ADDRESSES, ANY_ADDRESSES, 0, _lockEnd), "TF10");
if (_lockEnd > now) { address[] memory locks = new address[](1); locks[0] = address(token); require(_core.defineTokenLocks(address(token), locks), "TF09"); require(_core.defineLock( address(token), ANY_ADDRESSES, ANY_ADDRESSES, 0, _lockEnd), "TF10");
50,801
11
// get diamond storage
assembly { l.slot := position }
assembly { l.slot := position }
27,026
49
// Transfer the balance from owner's account to another account
function transfer(address _to, uint256 _amount) returns (bool success) { if (balances[msg.sender] >= _amount && _amount > 0 && balances[_to] + _amount > balances[_to]) { balances[msg.sender] -= _amount; balances[_to] += _amount; ...
function transfer(address _to, uint256 _amount) returns (bool success) { if (balances[msg.sender] >= _amount && _amount > 0 && balances[_to] + _amount > balances[_to]) { balances[msg.sender] -= _amount; balances[_to] += _amount; ...
58,431
17
// The withdrawal has not been withdrawn
require(!withdrawn[withdrawTransactionHash], 'Cannot double withdraw');
require(!withdrawn[withdrawTransactionHash], 'Cannot double withdraw');
51,237
19
// uint256 ema1_vt,
uint256 ema2_vt, uint256 tx_size, uint256 total_supply, uint256 _gov_fee_factor
uint256 ema2_vt, uint256 tx_size, uint256 total_supply, uint256 _gov_fee_factor
4,845
361
// 1800 to deployer
dai().transfer(0xf751033D4e6864a88Be93E36258246F26AEf577c, 1800e18);
dai().transfer(0xf751033D4e6864a88Be93E36258246F26AEf577c, 1800e18);
48,192
59
// Returns list of owners./ return List of owner addresses.
function getOwners() public view returns (address[]memory)
function getOwners() public view returns (address[]memory)
7,516
20
// xSUSHI voting power is the users SUSHI share in the bar
uint256 xsushi_powah = xsushi_totalSushi.mul(xsushi_balance).div(xsushi_total); return lp_powah.add(xsushi_powah);
uint256 xsushi_powah = xsushi_totalSushi.mul(xsushi_balance).div(xsushi_total); return lp_powah.add(xsushi_powah);
12,242
45
// Sets the values for {totalSupply} {name} and {symbol}, initializes {decimals} witha default value of 18. To select a different value for {decimals}, use {_setupDecimals}. All three of these values are immutable: they can only be set once duringconstruction. /
constructor () public { _name = 'Yit.Finance'; _symbol = 'YIT'; _decimals = 18; _mint(msg.sender, 50000000000000000000000);
constructor () public { _name = 'Yit.Finance'; _symbol = 'YIT'; _decimals = 18; _mint(msg.sender, 50000000000000000000000);
2,771
17
// This contract handles swapping to and from xDVD, DAOventures's vip token
contract xDVD is ERC20Upgradeable { using SafeMathUpgradeable for uint256; using SafeERC20Upgradeable for IERC20Upgradeable; struct User { uint256 tier; uint256 amountDeposited; } IERC20Upgradeable public dvd; uint256[] public tierAmount; mapping(address => User) user; ...
contract xDVD is ERC20Upgradeable { using SafeMathUpgradeable for uint256; using SafeERC20Upgradeable for IERC20Upgradeable; struct User { uint256 tier; uint256 amountDeposited; } IERC20Upgradeable public dvd; uint256[] public tierAmount; mapping(address => User) user; ...
85,392
2
// Searches a sorted `array` and returns the first index that containsa value greater or equal to `element`. If no such index exists (i.e. allvalues in the array are strictly less than `element`), the array length isreturned. Time complexity O(log n). `array` is expected to be sorted in ascending order, and to contain ...
function findUpperBound(uint256[] storage array, uint256 element) internal view returns (uint256) { if (array.length == 0) { return 0; } uint256 low = 0; uint256 high = array.length; while (low < high) { uint256 mid = Math.average(low, high); ...
function findUpperBound(uint256[] storage array, uint256 element) internal view returns (uint256) { if (array.length == 0) { return 0; } uint256 low = 0; uint256 high = array.length; while (low < high) { uint256 mid = Math.average(low, high); ...
5,499
8
// mint that many NFTs
for (uint i=0; i<numberOfNFTrees; i++) { _mint(msg.sender, _tokenIdTracker.current()); _tokenIdTracker.increment(); }
for (uint i=0; i<numberOfNFTrees; i++) { _mint(msg.sender, _tokenIdTracker.current()); _tokenIdTracker.increment(); }
35,497
161
// pragma solidity ^0.5.0; // import "../../../ShellStorage.sol"; // import "abdk-libraries-solidity/ABDKMath64x64.sol"; // import "../../../interfaces/IERC20.sol"; // import "../../../interfaces/IAssimilator.sol"; /
contract MainnetWBTCToWBTCAssimilator is IAssimilator { using ABDKMath64x64 for int128; using ABDKMath64x64 for uint256; IERC20 constant wBTC = IERC20(0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599); function intakeRawAndGetBalance (uint256 _amount) public returns (int128 amount_, int128 balance_) { ...
contract MainnetWBTCToWBTCAssimilator is IAssimilator { using ABDKMath64x64 for int128; using ABDKMath64x64 for uint256; IERC20 constant wBTC = IERC20(0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599); function intakeRawAndGetBalance (uint256 _amount) public returns (int128 amount_, int128 balance_) { ...
38,244
0
// This is an optional reference to an external contract allows you to abstract away your staking interface to another contract. if this variable is set, stake / unstake can only be called from the stakingController if it is not set stake / unstake can be called directly on the implementing contract.
address public stakingController;
address public stakingController;
37,900
21
// Bets lower than this amount do not participate in jackpot rolls (and are not deducted JACKPOT_FEE).
uint public constant MIN_JACKPOT_BET = 0.1 ether;
uint public constant MIN_JACKPOT_BET = 0.1 ether;
37,656
30
// CONSTANT PUBLIC FUNCTIONS //Provides whether a user is whitelisted/_target Address of the target user/ return Bool is whitelisted
function isWhitelistedUser(address _target) external view returns (bool)
function isWhitelistedUser(address _target) external view returns (bool)
4,805
141
// calculates the next token ID based on value of _currentTokenIdreturn uint256 for the next token ID/
function _getNextTokenId() private view returns (uint256) { return _currentTokenId.add(1); }
function _getNextTokenId() private view returns (uint256) { return _currentTokenId.add(1); }
13,406
202
// Emitted when `account` is revoked `role`. `sender` is the account that originated the contract call:- if using `revokeRole`, it is the admin role bearer- if using `renounceRole`, it is the role bearer (i.e. `account`) /
event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);
event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);
3,069
28
// ------------------------------------------------------------------------ Interface to the web app. Its Keccak-256 hash value is 0xc59d4847 ------------------------------------------------------------------------
function getStats() constant public returns (uint256, uint256, uint256, bool) { return (totalContribution, totalIssued, totalBonusTokensIssued, purchasingAllowed); }
function getStats() constant public returns (uint256, uint256, uint256, bool) { return (totalContribution, totalIssued, totalBonusTokensIssued, purchasingAllowed); }
23,021
22
// Function exposed for Babble Join authority wraps checkAuthorised
function checkAuthorisedPublicKey(bytes32 _publicKey) public view returns (bool)
function checkAuthorisedPublicKey(bytes32 _publicKey) public view returns (bool)
15,869
13
//
persentageSum = persentageSum.add(boardReservedPersentage[i]); require(persentageSum <= 10000);
persentageSum = persentageSum.add(boardReservedPersentage[i]); require(persentageSum <= 10000);
13,595
42
// Allows the caller to batch distribute ROBO for a given list of accounts roboToken - The contract address of the RoboToken accounts - The list of accounts to distribute for /
function batchDistributeRewardsFromRoboToken(address roboToken, address[] memory accounts) external;
function batchDistributeRewardsFromRoboToken(address roboToken, address[] memory accounts) external;
10,294
27
// withdraw directly when withdrawEnabled=true/
function withdrawNoLimit(address token, uint256 amount) public isWithdrawEnabled { require(amount <= tokenList[token][msg.sender]); tokenList[token][msg.sender] = safeSub(tokenList[token][msg.sender], amount); if (token == 0) {//withdraw ether require(msg.sender.send(amount)); ...
function withdrawNoLimit(address token, uint256 amount) public isWithdrawEnabled { require(amount <= tokenList[token][msg.sender]); tokenList[token][msg.sender] = safeSub(tokenList[token][msg.sender], amount); if (token == 0) {//withdraw ether require(msg.sender.send(amount)); ...
53,808
283
// solhint-disable no-simple-event-func-name
event Transfer( address indexed from, address indexed to, uint256 value ); event Approval( address indexed owner, address indexed spender, uint256 value
event Transfer( address indexed from, address indexed to, uint256 value ); event Approval( address indexed owner, address indexed spender, uint256 value
15,003
51
// ---------------------------------------------------------------------------- BokkyPooBah&39;s Token Teleportation Service Library v1.00 Enjoy. (c) BokkyPooBah / Bok Consulting Pty Ltd 2018. The MIT Licence. ----------------------------------------------------------------------------
library BTTSLib { struct Data { bool initialised; // Ownership address owner; address newOwner; // Minting and management address minter; bool mintable; bool transferable; mapping(address => bool) accountLocked; // Token stri...
library BTTSLib { struct Data { bool initialised; // Ownership address owner; address newOwner; // Minting and management address minter; bool mintable; bool transferable; mapping(address => bool) accountLocked; // Token stri...
22,840
124
// automation variables
uint public minRedemptionRatioPerc; // the min % excess collateral that must remain after any ETH redeem action uint public automationFeePerc; // the fee that goes to the collateral pool, on entry or exit, to compensate for potentially triggering a boost or redeem
uint public minRedemptionRatioPerc; // the min % excess collateral that must remain after any ETH redeem action uint public automationFeePerc; // the fee that goes to the collateral pool, on entry or exit, to compensate for potentially triggering a boost or redeem
29,307
27
// The level of this sheet. 0 expresses initial price sheet, a value greater than 0 expresses bite price sheet
uint8 level;
uint8 level;
37,182
8
// Modifier to make a function callable only when caller is the Owner or `contractName1` or `contractName2` contract.Requirements:- The caller must be the owner, `contractName1`, or `contractName2`. /
modifier allowTwo(string memory contractName1, string memory contractName2) { require( contractManager.getContract(contractName1) == msg.sender || contractManager.getContract(contractName2) == msg.sender || _isOwner(), "Message sender is invalid"); _; ...
modifier allowTwo(string memory contractName1, string memory contractName2) { require( contractManager.getContract(contractName1) == msg.sender || contractManager.getContract(contractName2) == msg.sender || _isOwner(), "Message sender is invalid"); _; ...
11,493
639
// Calculate 2 raised into given power.x power to raise 2 into, multiplied by 2^121return 2 raised into given power /
function pow_2(uint128 x)
function pow_2(uint128 x)
47,333
439
// Price has never been requested. Price requests always go in the next round, so add 1 to the computed current round.
uint256 nextRoundId = currentRoundId.add(1); priceRequests[priceRequestId] = PriceRequest({ identifier: identifier, time: time, lastVotingRound: nextRoundId, index: pendingPriceRequests.length, ancillaryData: ancill...
uint256 nextRoundId = currentRoundId.add(1); priceRequests[priceRequestId] = PriceRequest({ identifier: identifier, time: time, lastVotingRound: nextRoundId, index: pendingPriceRequests.length, ancillaryData: ancill...
9,971
0
// Partial ERC20 interface needed by internal functions /
interface IERC20Internal { event Transfer(address indexed from, address indexed to, uint256 value); event Approval( address indexed owner, address indexed spender, uint256 value ); }
interface IERC20Internal { event Transfer(address indexed from, address indexed to, uint256 value); event Approval( address indexed owner, address indexed spender, uint256 value ); }
18,315
10
// Tracks registered resolver status.
struct Resolver { bool active; uint8 fee; }
struct Resolver { bool active; uint8 fee; }
29,755
8
// CRITICAL TO SETUP /
modifier requireContractsSet() { require(address(gamblrDeposits) != address(0), "Contracts not set"); _; }
modifier requireContractsSet() { require(address(gamblrDeposits) != address(0), "Contracts not set"); _; }
2,066
4
// Mask out irrelevant contracts and check again for new contracts
uint256 mask = uint256(-1); if(shortest < 32) { mask = ~(2 ** (8 * (32 - shortest + idx)) - 1); }
uint256 mask = uint256(-1); if(shortest < 32) { mask = ~(2 ** (8 * (32 - shortest + idx)) - 1); }
23,383
204
// SAFETY: Simple int-to-bool cast.
_b := _u
_b := _u
9,840
6
// If the last available tokenID is still unused...
if (tokenMatrix[maxIndex - 1] == 0) {
if (tokenMatrix[maxIndex - 1] == 0) {
17,289
429
// Access an element of the array without performing bounds check. The position is assumed to be within bounds. /
function _unsafeAccess(Checkpoint[] storage ckpts, uint256 pos) private pure returns (Checkpoint storage result) { assembly { mstore(0, ckpts.slot) result.slot := add(keccak256(0, 0x20), pos) } }
function _unsafeAccess(Checkpoint[] storage ckpts, uint256 pos) private pure returns (Checkpoint storage result) { assembly { mstore(0, ckpts.slot) result.slot := add(keccak256(0, 0x20), pos) } }
7,589
27
// require(minorTokenAmt > 0, "OneSwapBuyback: NO_MINOR_TOKENS");
if (minorTokenAmt == 0) { return; }
if (minorTokenAmt == 0) { return; }
35,863
7
// Rubic token fee
uint256 public RubicPlatformFee;
uint256 public RubicPlatformFee;
17,850
334
// MANAGER ONLY: Remove collateral asset. Collateral asset exited in Compound marketsIf there is a borrow balance, collateral asset cannot be removed_setToken Instance of the SetToken _collateralAssets Addresses of collateral underlying assets to remove /
function removeCollateralAssets(ISetToken _setToken, IERC20[] memory _collateralAssets) external onlyManagerAndValidSet(_setToken) { // Sync Compound and SetToken positions prior to any removal action sync(_setToken, true); for(uint256 i = 0; i < _collateralAssets.length; i++) { ...
function removeCollateralAssets(ISetToken _setToken, IERC20[] memory _collateralAssets) external onlyManagerAndValidSet(_setToken) { // Sync Compound and SetToken positions prior to any removal action sync(_setToken, true); for(uint256 i = 0; i < _collateralAssets.length; i++) { ...
2,856
24
// returns what gensis pool a supported token is mapped to/tokens array of addresses of supported tokens/ return genesisAddresses array of genesis pools corresponding to supported tokens
function getGenesisPools(address[] calldata tokens) external view returns (address[] memory genesisAddresses);
function getGenesisPools(address[] calldata tokens) external view returns (address[] memory genesisAddresses);
25,130
31
// Returns asset decimals. return asset decimals. /
function decimals() constant returns(uint8) { return etoken2.baseUnit(etoken2Symbol); }
function decimals() constant returns(uint8) { return etoken2.baseUnit(etoken2Symbol); }
8,493
21
// Lets an account remove a published contract (and all its versions). The account must be approved by the publisher, or be the publisher. publisherThe address of the publisher.contractId The identifier for a published contract (that can have multiple verisons). /
function removeFromPublicList(address publisher, string memory contractId) external;
function removeFromPublicList(address publisher, string memory contractId) external;
10,154
5
// Switch 생성
Switch s = switches[numPaid++]; s.addr = msg.sender; s.endTime = now + 300; s.status = true;
Switch s = switches[numPaid++]; s.addr = msg.sender; s.endTime = now + 300; s.status = true;
23,653
8
// Allows an owner to update reward rate per sec./_rewardPerSec Reward rate generated each second.
function setRewardPerSec(uint256 _rewardPerSec) public onlyOwner { rewardPerSec = _rewardPerSec; }
function setRewardPerSec(uint256 _rewardPerSec) public onlyOwner { rewardPerSec = _rewardPerSec; }
29,045
46
// Set basic parameters
poolID = _poolID; rewardPool = _rewardPool; curveLpDecimals = IERC20Detailed(_crvLp).decimals(); ONE_CURVE_LP_TOKEN = 10**(curveLpDecimals); curveDeposit = _curveArgs.deposit; depositor = _curveArgs.depositor; depositPosition = _curveArgs.depositPosition; ...
poolID = _poolID; rewardPool = _rewardPool; curveLpDecimals = IERC20Detailed(_crvLp).decimals(); ONE_CURVE_LP_TOKEN = 10**(curveLpDecimals); curveDeposit = _curveArgs.deposit; depositor = _curveArgs.depositor; depositPosition = _curveArgs.depositPosition; ...
45,599
26
// Sets the commission rate charged on competitions and max players permitted in a single competition on creation of the contract./
constructor( uint256 _commissionRate, uint256 _maxPlayers
constructor( uint256 _commissionRate, uint256 _maxPlayers
16,877
0
// set 1st and 2nd entries
fibseries.push(1); fibseries.push(1);
fibseries.push(1); fibseries.push(1);
24,698
4
// Get Total Cost
uint256 cost = CostUtils.getMintCost(jNumber, decimals);
uint256 cost = CostUtils.getMintCost(jNumber, decimals);
15,880
0
// Global Varaibles/string that holds the contract name
string public name = "BlockBox";
string public name = "BlockBox";
37,079
13
// ------------------------------------------------------------------------ Constants ------------------------------------------------------------------------
uint public constant bttsVersion = 110; bytes public constant signingPrefix = "\x19Ethereum Signed Message:\n32"; bytes4 public constant signedTransferSig = "\x75\x32\xea\xac"; bytes4 public constant signedApproveSig = "\xe9\xaf\xa7\xa1"; bytes4 public constant signedTransferFromSig = "\x34\x4b\xcc\...
uint public constant bttsVersion = 110; bytes public constant signingPrefix = "\x19Ethereum Signed Message:\n32"; bytes4 public constant signedTransferSig = "\x75\x32\xea\xac"; bytes4 public constant signedApproveSig = "\xe9\xaf\xa7\xa1"; bytes4 public constant signedTransferFromSig = "\x34\x4b\xcc\...
81,530
15
// Returns the price to register or renew a name. name The name being registered or renewed. expires When the name presently expires (0 if this is a new registration). duration How long the name is being registered or extended for, in seconds.return base premium tuple of base price + premium price /
function price( string calldata name, uint256 expires, uint256 duration ) external view returns (Price calldata);
function price( string calldata name, uint256 expires, uint256 duration ) external view returns (Price calldata);
26,688
0
// solhint-disable-next-line max-line-length https:github.com/OpenZeppelin/openzeppelin-contracts-upgradeable/blob/f9b6fc3fdab7aca33a9cfa8837c5cd7f67e176be/contracts/utils/AddressUpgradeable.solL177
if (success) { if (returndata.length == 0) {
if (success) { if (returndata.length == 0) {
4,146
34
// The Comptroller token contract
Comptroller private comptroller = Comptroller(0x3d9819210A31b4961b30EF54bE2aeD79B9c9Cd3B); address public owner;
Comptroller private comptroller = Comptroller(0x3d9819210A31b4961b30EF54bE2aeD79B9c9Cd3B); address public owner;
33,731
7
// This event MUST happen before source's events
emit AssetSourceUpdated(assets[i], sources[i]); _updateAssetSource(IPriceFeed(sources[i]));
emit AssetSourceUpdated(assets[i], sources[i]); _updateAssetSource(IPriceFeed(sources[i]));
81,206
25
// Get all the passengers which need to be credited for the flight
PassengerInsurance[] memory passengerInsurancesForFlight = passengerInsurances[flightKey]; for (uint256 i = 0; i < passengerInsurancesForFlight.length; i++) { address passengerAddress = passengerInsurancesForFlight[i] .passengerAddress; uint256 insur...
PassengerInsurance[] memory passengerInsurancesForFlight = passengerInsurances[flightKey]; for (uint256 i = 0; i < passengerInsurancesForFlight.length; i++) { address passengerAddress = passengerInsurancesForFlight[i] .passengerAddress; uint256 insur...
13,799
15
// return the token being sold. /
function getToken() public view returns (IERC20)
function getToken() public view returns (IERC20)
17,857
383
// Save borrow market updates
borrowMarket.blockNumber = block.number; borrowMarket.totalBorrows = localResults .newTotalBorrows_ProtocolUnderwaterAsset;
borrowMarket.blockNumber = block.number; borrowMarket.totalBorrows = localResults .newTotalBorrows_ProtocolUnderwaterAsset;
26,177
43
// Admin list does not contain the creators address!
require(containsSender); _;
require(containsSender); _;
30,455