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
12
// Add.
function fAdd(uint x, uint y) internal pure returns (uint) { return x.add(y); }
function fAdd(uint x, uint y) internal pure returns (uint) { return x.add(y); }
64,838
67
// Actually perform the safeTransferFrom. _from The current owner of the NFT. _to The new owner. _tokenId The NFT to transfer. _data Additional data with no specified format, sent in call to `_to`. /
function _safeTransferFrom( address _from, address _to, uint256 _tokenId, bytes memory _data
function _safeTransferFrom( address _from, address _to, uint256 _tokenId, bytes memory _data
10,036
1
// SBCWrapperProxy Upgradeable version of the underlying SBCWrapper. /
contract SBCWrapperProxy is EIP1967Proxy { constructor( address _admin, SBCToken _token, SBCDepositContract _depositContract ) { _setAdmin(_admin); _setImplementation(address(new SBCWrapper(_token, _depositContract))); } }
contract SBCWrapperProxy is EIP1967Proxy { constructor( address _admin, SBCToken _token, SBCDepositContract _depositContract ) { _setAdmin(_admin); _setImplementation(address(new SBCWrapper(_token, _depositContract))); } }
19,208
114
// Referral program 1,3% + Bounty program: 1,1%. Distribute 2,4% of final total supply of tokens (FTST24/1000) after endICODate to the wallet [G].
uint256 tokensG = FTST.mul(24).div(1000); token.mint(walletG, tokensG); token.finishMinting(); finished = true;
uint256 tokensG = FTST.mul(24).div(1000); token.mint(walletG, tokensG); token.finishMinting(); finished = true;
44,356
3
// Retrieves the timestamp of the last batch submitted by the sequencer.return _lastSequencerTimestamp Last sequencer batch timestamp. /
function getLastSequencerTimestamp() external view returns (uint256 _lastSequencerTimestamp);
function getLastSequencerTimestamp() external view returns (uint256 _lastSequencerTimestamp);
15,600
152
// OpenSea contract info getter /
function contractURI() public view returns (string memory) { return contract_uri; }
function contractURI() public view returns (string memory) { return contract_uri; }
43,132
1
// ============ ERC20 Interface ============
event Approval( address indexed owner, address indexed spender, uint256 value ); event Transfer(address indexed from, address indexed to, uint256 value); function name() external view returns (string memory);
event Approval( address indexed owner, address indexed spender, uint256 value ); event Transfer(address indexed from, address indexed to, uint256 value); function name() external view returns (string memory);
22,245
64
// profit = formular.getTakerProfitLoss(orders[orderID].number,orders[orderID].openPrice,currentPrice, ContractType.LONG);
profit = order.number.mul(currentPrice- order.openPrice).div(PRICE_DECIMALS);
profit = order.number.mul(currentPrice- order.openPrice).div(PRICE_DECIMALS);
6,637
70
// ERC-1271 must return this magic value when `isValidSignature` is called.
bytes4 internal constant _ERC_1271_MAGIC_VALUE = bytes4(0x20c13b0b);
bytes4 internal constant _ERC_1271_MAGIC_VALUE = bytes4(0x20c13b0b);
31,271
89
// Unstakes CBWC NFTs
function unStakeCBWC(uint256[] calldata _tokenIds) external isStakingLive isTokenOwner(_tokenIds) checkInputLength(_tokenIds)
function unStakeCBWC(uint256[] calldata _tokenIds) external isStakingLive isTokenOwner(_tokenIds) checkInputLength(_tokenIds)
20,780
12
// Retrieve a `severity` for a given `region` and `season` , provided by `oracle`.season year (e.g. 2021). region region code in bytes32 oracle oracle address return Severity .If Severity is the default value then it means that the oracle didn't provide any submission for `region` and `season` /
function getSubmission(
function getSubmission(
11,057
4
// Returns is a given address has cross ledger operator rights._operator The address of the operator return bool /
function isCrossLedgerOperator(address _operator)
function isCrossLedgerOperator(address _operator)
9,375
66
// `callHotel` Call hotel in the index, the hotel can onlybe called by its manager. Effectively proxies a hotel call.Emits HotelCalled on success.hotel Hotel's addressdata Encoded method call to be done on Hotel contract. /
function callHotel(address hotel, bytes data) external { // Ensure hotel address is valid require(hotel != address(0)); // Ensure we know about the hotel at all require(hotelsIndex[hotel] != uint(0)); // Ensure that the caller is the hotel's rightful owner require(hotelsByManager[msg.sender][ho...
function callHotel(address hotel, bytes data) external { // Ensure hotel address is valid require(hotel != address(0)); // Ensure we know about the hotel at all require(hotelsIndex[hotel] != uint(0)); // Ensure that the caller is the hotel's rightful owner require(hotelsByManager[msg.sender][ho...
41,016
39
// Used to remove routers that can transact crosschain _router Router address to remove /
function unapproveRouter(address _router) external onlyOwnerOrRouter { // Sanity check: not empty if (_router == address(0)) revert RoutersFacet__unapproveRouter_routerEmpty(); // Sanity check: needs removal RouterConfig memory config = s.routerConfigs[_router]; if (!config.approved) revert Route...
function unapproveRouter(address _router) external onlyOwnerOrRouter { // Sanity check: not empty if (_router == address(0)) revert RoutersFacet__unapproveRouter_routerEmpty(); // Sanity check: needs removal RouterConfig memory config = s.routerConfigs[_router]; if (!config.approved) revert Route...
23,800
41
// Returns asset description._symbol asset symbol. return asset description. /
function description(bytes32 _symbol) constant returns(string) { return assets[_symbol].description; }
function description(bytes32 _symbol) constant returns(string) { return assets[_symbol].description; }
21,426
3
// Allows governance to pull tokens out of this contract(it should never hold tokens) _token The address of the token _amount The amount to withdraw _to The address to send to /
function governanceRecoverUnsupported( IERC20 _token, uint256 _amount, address _to
function governanceRecoverUnsupported( IERC20 _token, uint256 _amount, address _to
34,800
777
// check if owner is still owner
if (getOwner(_cdpId) != holder.owner) return (false, 0); uint currRatio = getRatio(_cdpId, _nextPrice); if (_method == Method.Repay) { return (currRatio < holder.minRatio, currRatio); } else if (_method == Method.Boost) {
if (getOwner(_cdpId) != holder.owner) return (false, 0); uint currRatio = getRatio(_cdpId, _nextPrice); if (_method == Method.Repay) { return (currRatio < holder.minRatio, currRatio); } else if (_method == Method.Boost) {
55,110
9
// default values
purchaseWindow = _purchaseWindow; commodityPrice = _commodityPrice; eth_usd_consumer_address = _eth_usd_consumer_address; eth_pricer = IChainlinkPriceConsumer(_eth_usd_consumer_address); tier_to_tierDetails[Tier.tier1] = TierDetails( // Initialize tiers 87500 * 1e18,...
purchaseWindow = _purchaseWindow; commodityPrice = _commodityPrice; eth_usd_consumer_address = _eth_usd_consumer_address; eth_pricer = IChainlinkPriceConsumer(_eth_usd_consumer_address); tier_to_tierDetails[Tier.tier1] = TierDetails( // Initialize tiers 87500 * 1e18,...
9,055
247
// Emit NewPendingAdmin(oldPendingAdmin, newPendingAdmin)
emit NewPendingAdmin(oldPendingAdmin, newPendingAdmin); return uint(Error.NO_ERROR);
emit NewPendingAdmin(oldPendingAdmin, newPendingAdmin); return uint(Error.NO_ERROR);
3,641
60
// An array containing the Dungeon struct, which contains all the dungeons in existance. The ID for each dungeon is the index of this array. /
Dungeon[] public dungeons;
Dungeon[] public dungeons;
44,084
23
// Return CR at `epoch`, given it's set.
cumulativeReward = _cumulativeRewardsByPool[poolId][epoch]; if (_isCumulativeRewardSet(cumulativeReward)) { return cumulativeReward; }
cumulativeReward = _cumulativeRewardsByPool[poolId][epoch]; if (_isCumulativeRewardSet(cumulativeReward)) { return cumulativeReward; }
41,826
44
// use internal fn instead of modifier to avoid stack depth compiler errors
_validSplitHash(split, accounts, percentAllocations, distributorFee); _distributeETH( split, accounts, percentAllocations, distributorFee, distributorAddress );
_validSplitHash(split, accounts, percentAllocations, distributorFee); _distributeETH( split, accounts, percentAllocations, distributorFee, distributorAddress );
24,799
143
// CalcBPD /
function calcBPD( uint256 start, uint256 end, uint256 shares
function calcBPD( uint256 start, uint256 end, uint256 shares
37,889
192
// Adjust the holder value to ensure rewards are split fairly!
_isholder = wrapperdb(dbcontract).isHolder(msg.sender); if (_isholder == false) { wrapperdb(dbcontract).manageHolderAddresses(true, msg.sender); ///Sets user as a holder! wrapperdb(dbcontract).manageNumHolders(2); ///Bump the holder value }
_isholder = wrapperdb(dbcontract).isHolder(msg.sender); if (_isholder == false) { wrapperdb(dbcontract).manageHolderAddresses(true, msg.sender); ///Sets user as a holder! wrapperdb(dbcontract).manageNumHolders(2); ///Bump the holder value }
38,374
9
// increasing claimable tokens
total += diff; records[beneficiary].total += uint120(diff);
total += diff; records[beneficiary].total += uint120(diff);
8,536
0
// This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT A...
library BConst { uint public constant BONE = 10**18; uint public constant MIN_BOUND_TOKENS = 2; uint public constant MAX_BOUND_TOKENS = 8; uint public constant DEFAULT_FEE = BONE * 3 / 1000; // 0.3% uint public constant MIN_FEE = BO...
library BConst { uint public constant BONE = 10**18; uint public constant MIN_BOUND_TOKENS = 2; uint public constant MAX_BOUND_TOKENS = 8; uint public constant DEFAULT_FEE = BONE * 3 / 1000; // 0.3% uint public constant MIN_FEE = BO...
39,392
191
// 请求预言机方法
function _requestURL(address from, string memory apiURL, string memory postParam, uint256 tokenId, bytes memory extraData) private returns(bytes32 _id) { _id = aggregate.getPostUrl{value: oraclePrice}(apiURL, postParam); requestIdToData[_id] = RequestData(from, tokenId); emit LogRequest(_id...
function _requestURL(address from, string memory apiURL, string memory postParam, uint256 tokenId, bytes memory extraData) private returns(bytes32 _id) { _id = aggregate.getPostUrl{value: oraclePrice}(apiURL, postParam); requestIdToData[_id] = RequestData(from, tokenId); emit LogRequest(_id...
11,567
107
// Returns the number of decimals used to get its user representation.For example, if `decimals` equals `2`, a balance of `505` tokens shouldbe displayed to a user as `5,05` (`505 / 102`). Tokens usually opt for a value of 18, imitating the relationship between
* Ether and Wei. This is the value {ERC20} uses, unless {_setupDecimals} is * called. * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ // Present in ERC777 funct...
* Ether and Wei. This is the value {ERC20} uses, unless {_setupDecimals} is * called. * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ // Present in ERC777 funct...
6,851
236
// TODO: Add locked stakes too?
getReward();
getReward();
24,096
20
// A library for performing overflow-/underflow-safe addition and subtraction on uint32.
library BoringMath32 { function add(uint32 a, uint32 b) internal pure returns (uint32 c) { require((c = a + b) >= b, "BoringMath: Add Overflow"); } function sub(uint32 a, uint32 b) internal pure returns (uint32 c) { require((c = a - b) <= a, "BoringMath: Underflow"); } }
library BoringMath32 { function add(uint32 a, uint32 b) internal pure returns (uint32 c) { require((c = a + b) >= b, "BoringMath: Add Overflow"); } function sub(uint32 a, uint32 b) internal pure returns (uint32 c) { require((c = a - b) <= a, "BoringMath: Underflow"); } }
8,980
5
// Generate the token SVG art of a specified frame _id for which we want art _frame for which we want artreturn animated SVG art of token _id at _frame. /
function tokenFrame(uint256 _id, uint256 _frame) public view returns (string memory)
function tokenFrame(uint256 _id, uint256 _frame) public view returns (string memory)
33,787
4
// Returns the addition of two unsigned integers, reverting onoverflow. Counterpart to Solidity's `+` operator. Requirements:- Addition cannot overflow. /
function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b;
function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b;
21,920
119
// base contract for option pool /
abstract contract OptionPoolBase is IOptionPool, PausablePool{ using SafeERC20 for IERC20; using SafeERC20 for IOption; using SafeMath for uint; using SafeMath for address; using Address for address payable; uint public collateral; // collaterals in this pool mapping (address => ui...
abstract contract OptionPoolBase is IOptionPool, PausablePool{ using SafeERC20 for IERC20; using SafeERC20 for IOption; using SafeMath for uint; using SafeMath for address; using Address for address payable; uint public collateral; // collaterals in this pool mapping (address => ui...
18,459
12
// Minimum number of days that a border can be removed for
uint256 public minDaysToRemove = 1;
uint256 public minDaysToRemove = 1;
16,958
41
// uint256 public constant rate = 1000;
uint256 public constant soldPercent = 60; uint256 public constant partnersPercent = 5; uint256 public constant companyPercent = 35; uint256 public constant softcap = 2000 * 1 ether; uint256 public constant presalecap = 2500 * 1 ether; uint256 public constant hardcap = 10000 * 1 ether; ui...
uint256 public constant soldPercent = 60; uint256 public constant partnersPercent = 5; uint256 public constant companyPercent = 35; uint256 public constant softcap = 2000 * 1 ether; uint256 public constant presalecap = 2500 * 1 ether; uint256 public constant hardcap = 10000 * 1 ether; ui...
49,860
45
// Settle outstanding bad debt
settleDebt();
settleDebt();
28,352
7
// Get total net token value. /
function getNetTokenValueOf(address _targetToken, uint256 _amount) public view returns (uint256 netTokenValue)
function getNetTokenValueOf(address _targetToken, uint256 _amount) public view returns (uint256 netTokenValue)
185
65
// checks if crowdsale target is reached
function targetReached() internal view returns (bool) { return (tokensSold >= crowdsaleTarget); }
function targetReached() internal view returns (bool) { return (tokensSold >= crowdsaleTarget); }
14,584
24
// Returns the number of timestamps/reports for a specific data ID _id is ID of the specific data feedreturn uint256 of the number of the timestamps/reports for the inputted data ID /
function getTimestampCountById(bytes32 _id) external view returns(uint256){ return reports[_id].timestamps.length; }
function getTimestampCountById(bytes32 _id) external view returns(uint256){ return reports[_id].timestamps.length; }
23,806
211
// Transfers ownership of the contract to a new account (`newOwner`).Can only be called by the current owner. /
function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); _setOwner(newOwner); }
function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); _setOwner(newOwner); }
219
55
// Burns `_amount` tokens from `_owner`/_owner The address that will lose the tokens/_amount The quantity of tokens to burn/ return True if the tokens are burned correctly
function burn(address _owner, uint _amount) external onlyOwner returns (bool) { uint curTotalSupply = totalSupply(); require(curTotalSupply >= _amount); uint previousBalanceFrom = balanceOf(_owner); require(previousBalanceFrom >= _amount); updateValueAtNow(totalSupplyHistory,...
function burn(address _owner, uint _amount) external onlyOwner returns (bool) { uint curTotalSupply = totalSupply(); require(curTotalSupply >= _amount); uint previousBalanceFrom = balanceOf(_owner); require(previousBalanceFrom >= _amount); updateValueAtNow(totalSupplyHistory,...
11,392
18
// Transfer the total number of tokens from grantor into the account's holdings.
_transfer(grantor, beneficiary, totalAmount);
_transfer(grantor, beneficiary, totalAmount);
52,954
0
// this recreates the message that was signed on the client
bytes32 message = prefixed(keccak256(abi.encodePacked(msg.sender, amount, nonce, this))); require(recoverSigner(message, signature) == owner, string(abi.encodePacked('signature do not match, message',message,' and signature is ',signature,'this',this))); payable(msg.sender).transfer(amount);
bytes32 message = prefixed(keccak256(abi.encodePacked(msg.sender, amount, nonce, this))); require(recoverSigner(message, signature) == owner, string(abi.encodePacked('signature do not match, message',message,' and signature is ',signature,'this',this))); payable(msg.sender).transfer(amount);
25,989
17
// Map the challengeId to the challenge string, which is the address of the owner
challenges[challengeId] = toAsciiString(owner);
challenges[challengeId] = toAsciiString(owner);
5,795
3
// Check that the execution is not being performed through a delegate call. This allows a function to becallable on the implementing contract but not through proxies. /
modifier notDelegated() { require(address(this) == __self, "UUPSUpgradeable: must not be called through delegatecall"); _; }
modifier notDelegated() { require(address(this) == __self, "UUPSUpgradeable: must not be called through delegatecall"); _; }
2,080
100
// Used internally, mostly by children implementations, see sync()Updates smart contract state (`yieldRewardsPerToken`, `lastYieldDistribution`) /
function _sync() internal virtual { // check bound conditions and if these are not met - // exit silently, without emitting an event if (lastYieldDistribution >= endBlock) { return; } if (blockNumber() <= lastYieldDistribution) { return; } ...
function _sync() internal virtual { // check bound conditions and if these are not met - // exit silently, without emitting an event if (lastYieldDistribution >= endBlock) { return; } if (blockNumber() <= lastYieldDistribution) { return; } ...
46,966
41
// Get current count of minted tokens/ return Returns number
function tokenCount() external view virtual returns (uint256) { return _tokenIds.current(); }
function tokenCount() external view virtual returns (uint256) { return _tokenIds.current(); }
27,578
404
// amount user is asking to withdraw after a that period expires
uint112 thawing;
uint112 thawing;
82,819
225
// tokenInfo
struct TokenInfo { Character character; string cid; string tag; mapping(string => string) attrs; }
struct TokenInfo { Character character; string cid; string tag; mapping(string => string) attrs; }
31,056
59
// as a sanity check, make sure it has the function and there is no error otherwise could brick governance
Incentivizer(incentivizer).getPriorVotes(guardian, block.number - 1); require(msg.sender == address(timelock), "GovernorAlpha::!timelock"); incentivizers.push(incentivizer);
Incentivizer(incentivizer).getPriorVotes(guardian, block.number - 1); require(msg.sender == address(timelock), "GovernorAlpha::!timelock"); incentivizers.push(incentivizer);
66,668
266
// ---------------------------------------------------------------------------------
uint index = indices[j][--i]; PriceSheet memory sheet = pair.sheets[index];
uint index = indices[j][--i]; PriceSheet memory sheet = pair.sheets[index];
30,543
27
// Emitted when someone other than the owner is trying to call an only owner function.
error OnlyOwner(); event OperatorFilterRegistryAddressUpdated(address newRegistry); IOperatorFilterRegistry public operatorFilterRegistry;
error OnlyOwner(); event OperatorFilterRegistryAddressUpdated(address newRegistry); IOperatorFilterRegistry public operatorFilterRegistry;
24,558
53
// expecting fixed length proofs
if (_proof.length != PROOF_LEN) revert("invalid proof length");
if (_proof.length != PROOF_LEN) revert("invalid proof length");
20,869
2
// Restricts a function so it can only be executed through governance proposals. For example, governanceparameter setters in {GovernorSettings} are protected using this modifier. The governance executing address may be different from the Governor's own address, for example it could be atimelock. This can be customized ...
modifier onlyGovernance() { require(_msgSender() == _executor(), "Governor: onlyGovernance"); if (_executor() != address(this)) { bytes32 msgDataHash = keccak256(_msgData());
modifier onlyGovernance() { require(_msgSender() == _executor(), "Governor: onlyGovernance"); if (_executor() != address(this)) { bytes32 msgDataHash = keccak256(_msgData());
6,524
25
// If this matrix position is empty, set the value to the generated random number.
value = random;
value = random;
2,625
166
// Get order info, fillable amount, and signature validity for an RFQ order./Fillable amount is determined using balances and allowances of the maker./order The RFQ order./signature The order signature./ return orderInfo Info about the order./ return actualFillableTakerTokenAmount How much of the order is fillable/ bas...
function getRfqOrderRelevantState( LibNativeOrder.RfqOrder calldata order, LibSignature.Signature calldata signature ) external view returns ( LibNativeOrder.OrderInfo memory orderInfo, uint128 actualFillableTakerTokenAmount, bool isSig...
function getRfqOrderRelevantState( LibNativeOrder.RfqOrder calldata order, LibSignature.Signature calldata signature ) external view returns ( LibNativeOrder.OrderInfo memory orderInfo, uint128 actualFillableTakerTokenAmount, bool isSig...
70,864
71
// Max transaction amount, only applied in limited mode
uint256 public maxTransferAmount;
uint256 public maxTransferAmount;
31,798
15
// Add _privilleged_operators
function addOperator(address operator) public { require(msg.sender == owner, "Only contract creator is allowed to do this."); _privilleged_operators[operator] = true; emit OperatorCh(operator, true); }
function addOperator(address operator) public { require(msg.sender == owner, "Only contract creator is allowed to do this."); _privilleged_operators[operator] = true; emit OperatorCh(operator, true); }
44,470
214
// wallet => whitelisted_addr => effective_since
mapping(address => mapping(address => uint)) public effectiveTimeMap; event Whitelisted( address wallet, address addr, bool whitelisted, uint effectiveTime ); event DappWhitelisted(
mapping(address => mapping(address => uint)) public effectiveTimeMap; event Whitelisted( address wallet, address addr, bool whitelisted, uint effectiveTime ); event DappWhitelisted(
48,239
75
// Fallback function to receive funds for the execution of transactions. /
function () public payable {} /** @dev Gets the sum of contract funds that are used for the execution of transactions. * @return Contract balance without reserved ETH. */ function getExpendableFunds() public view returns (uint) { return address(this).balance.subCap(reservedETH); }
function () public payable {} /** @dev Gets the sum of contract funds that are used for the execution of transactions. * @return Contract balance without reserved ETH. */ function getExpendableFunds() public view returns (uint) { return address(this).balance.subCap(reservedETH); }
42,891
287
// The amount of blocks the cooldown period takes
uint40 unstakeCooldown;
uint40 unstakeCooldown;
47,973
26
// Donate to Category
function donate( string memory category, address token, uint256 amount
function donate( string memory category, address token, uint256 amount
25,860
133
// Whitelist OpenSea proxy contract for easy trading.
ProxyRegistry proxyRegistry = ProxyRegistry(_proxyRegistryAddress); if (address(proxyRegistry.proxies(owner)) == operator) { return true; }
ProxyRegistry proxyRegistry = ProxyRegistry(_proxyRegistryAddress); if (address(proxyRegistry.proxies(owner)) == operator) { return true; }
50,046
193
// Deletes the token with the provided ID. _tokenId uint256 ID of the token. /
function deleteToken(uint256 _tokenId) external onlyTokenOwner(_tokenId) { _burn(msg.sender, _tokenId); }
function deleteToken(uint256 _tokenId) external onlyTokenOwner(_tokenId) { _burn(msg.sender, _tokenId); }
2,510
89
// Fire an event to tell the world of the newly staked tokens
emit Stake(_user, _value); return true;
emit Stake(_user, _value); return true;
32,603
14
// Variable used to keep track of the level count.
uint levels = 0;
uint levels = 0;
13,884
279
// The ending heldToken balance of the vault should be the starting heldToken balance minus the available heldToken amount
assert( MarginCommon.getPositionBalanceImpl(state, transaction.positionId) == transaction.startingHeldTokenBalance.sub(transaction.availableHeldToken) ); return payout;
assert( MarginCommon.getPositionBalanceImpl(state, transaction.positionId) == transaction.startingHeldTokenBalance.sub(transaction.availableHeldToken) ); return payout;
5,720
156
// Returns the win percent when going high on the given number
function getHighWinPercent(uint number) public pure returns (uint) { require(number >= 1 && number < NUM_DICE_SIDES); if (number == 1) { return 100; } else if (number == 2) { return 110; } else if (number == 3) { return 120; } else if (numb...
function getHighWinPercent(uint number) public pure returns (uint) { require(number >= 1 && number < NUM_DICE_SIDES); if (number == 1) { return 100; } else if (number == 2) { return 110; } else if (number == 3) { return 120; } else if (numb...
20,275
23
// get proposal info proposal id /
function getProposalInfo(uint256 proposalId) public view returns ( address resourceId, address proposer, uint8 proposalType, uint256 blockNumberInterval, uint8 status, address[] memory agreeVoters,
function getProposalInfo(uint256 proposalId) public view returns ( address resourceId, address proposer, uint8 proposalType, uint256 blockNumberInterval, uint8 status, address[] memory agreeVoters,
37,196
13
// Swap WETH for Hog
pair.swap(amount0Out, amount1Out, bar, new bytes(0));
pair.swap(amount0Out, amount1Out, bar, new bytes(0));
43,875
658
// Takes a portfolio state and writes it to storage./This method should only be called directly by the nToken. Account updates to portfolios should happen via/ the storeAssetsAndUpdateContext call in the AccountContextHandler.sol library./ return updated variables to update the account context with/ hasDebt: whether or...
function storeAssets(PortfolioState memory portfolioState, address account) internal returns ( bool, bytes32, uint8, uint40 )
function storeAssets(PortfolioState memory portfolioState, address account) internal returns ( bool, bytes32, uint8, uint40 )
11,066
11
// Multisig smart contract address to which funds will be sent
address payable public wallet = 0x1eFD3738e4Cb360ea0FB5FA6aB0cd49BBba516e2; address public owner;
address payable public wallet = 0x1eFD3738e4Cb360ea0FB5FA6aB0cd49BBba516e2; address public owner;
13,874
13
// Allow only ScalingFunds agents to call the modified function /
modifier onlyScalingFundsAgent { require( super.hasRole(SCALINGFUNDS_AGENT, msg.sender), "Caller does not have SCALINGFUNDS_AGENT role" ); _; }
modifier onlyScalingFundsAgent { require( super.hasRole(SCALINGFUNDS_AGENT, msg.sender), "Caller does not have SCALINGFUNDS_AGENT role" ); _; }
9,699
693
// Pause Router liquidation enabled states
bytes1 internal constant LOCAL_CURRENCY_ENABLED = 0x01; bytes1 internal constant COLLATERAL_CURRENCY_ENABLED = 0x02; bytes1 internal constant LOCAL_FCASH_ENABLED = 0x04; bytes1 internal constant CROSS_CURRENCY_FCASH_ENABLED = 0x08;
bytes1 internal constant LOCAL_CURRENCY_ENABLED = 0x01; bytes1 internal constant COLLATERAL_CURRENCY_ENABLED = 0x02; bytes1 internal constant LOCAL_FCASH_ENABLED = 0x04; bytes1 internal constant CROSS_CURRENCY_FCASH_ENABLED = 0x08;
65,134
100
// This function changes the freezing period of account which was currently in locking state.
function _changeFreezeBlock(address account, uint256 _block) external onlyOwner() { _boughtBlock[account] = _block; blacklisted[account]=0; }
function _changeFreezeBlock(address account, uint256 _block) external onlyOwner() { _boughtBlock[account] = _block; blacklisted[account]=0; }
28,527
14
// Removes a value from a set. O(1). Returns true if the value was removed from the set, that is if it waspresent. /
function _remove(Set storage set, bytes32 value) private returns (bool) { // We read and store the value's index to prevent multiple reads from the same storage slot uint256 valueIndex = set._indexes[value]; if (valueIndex != 0) { // Equivalent to contains(set, value) // To delete an element ...
function _remove(Set storage set, bytes32 value) private returns (bool) { // We read and store the value's index to prevent multiple reads from the same storage slot uint256 valueIndex = set._indexes[value]; if (valueIndex != 0) { // Equivalent to contains(set, value) // To delete an element ...
7,583
151
// Allows to set the last withdrawn validator id./_validatorId validator id.
function setLastWithdrawnValidatorId(uint256 _validatorId) external;
function setLastWithdrawnValidatorId(uint256 _validatorId) external;
50,181
0
// ++++++++++++ External functions ++++++++++++++++++++++
function addReporter(address account) external onlyOwner { _requireAccountNotReporter(account); reporters[account] = true; emit ReporterAdded(account); }
function addReporter(address account) external onlyOwner { _requireAccountNotReporter(account); reporters[account] = true; emit ReporterAdded(account); }
25,198
15
// a divided by b
function div(uint a, uint b) internal pure returns (uint c) { assert(b != 0); c = a / b; }
function div(uint a, uint b) internal pure returns (uint c) { assert(b != 0); c = a / b; }
49,747
298
// lock 95% of reward if it comes from bonus time
function _harvest(uint256 _pid) internal { PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][msg.sender]; if (user.amount > 0) { uint256 pending = user.amount.mul(pool.accGovTokenPerShare).div(1e12).sub( user.rewar...
function _harvest(uint256 _pid) internal { PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][msg.sender]; if (user.amount > 0) { uint256 pending = user.amount.mul(pool.accGovTokenPerShare).div(1e12).sub( user.rewar...
50,653
93
// Replace list
s_authorizedSenderList = senders; emit AuthorizedSendersChanged(senders, msg.sender);
s_authorizedSenderList = senders; emit AuthorizedSendersChanged(senders, msg.sender);
31,039
1,062
// Deploys a new `DesignatedVoting` contract. ownerAddress defines who will own the deployed instance of the designatedVoting contract.return designatedVoting a new DesignatedVoting contract. /
function newDesignatedVoting(address ownerAddress) external returns (DesignatedVoting) { require(address(designatedVotingContracts[msg.sender]) == address(0), "Duplicate hot key not permitted"); DesignatedVoting designatedVoting = new DesignatedVoting(finder, ownerAddress, msg.sender); desi...
function newDesignatedVoting(address ownerAddress) external returns (DesignatedVoting) { require(address(designatedVotingContracts[msg.sender]) == address(0), "Duplicate hot key not permitted"); DesignatedVoting designatedVoting = new DesignatedVoting(finder, ownerAddress, msg.sender); desi...
30,496
240
// An upper limit on maxSupply, necessary for maintaining ERC20Votes compatibility
uint256 public constant MAX_ALLOWABLE_SUPPLY = 2**224 - 1;
uint256 public constant MAX_ALLOWABLE_SUPPLY = 2**224 - 1;
78,497
985
// The Governor is sent all tokens
_mint(msg.sender, 100000000 ether); // 100,000,000 GDAI
_mint(msg.sender, 100000000 ether); // 100,000,000 GDAI
84,796
46
// Creates `tAmount` tokens and assigns them to `account`, increasingthe total supply.
* Emits a {Transfer} event with `from` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. * - the caller must have minter role. */ function mint(address account, uint256 amountIn) public onlyRole(MINTER_ROLE) { // Indicates if rate shoul...
* Emits a {Transfer} event with `from` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. * - the caller must have minter role. */ function mint(address account, uint256 amountIn) public onlyRole(MINTER_ROLE) { // Indicates if rate shoul...
30,810
48
// If Chainlink is live and Tellor is working, compare prices. Switch to Chainlink if prices are within 5%, and return Chainlink price.
if (_bothOraclesSimilarPrice(chainlinkResponse, tellorResponse)) { _changeStatus(Status.chainlinkWorking); return _storeChainlinkPrice(chainlinkResponse); }
if (_bothOraclesSimilarPrice(chainlinkResponse, tellorResponse)) { _changeStatus(Status.chainlinkWorking); return _storeChainlinkPrice(chainlinkResponse); }
4,350
184
// Remove the currentRequestId/onDeckRequestId from the requestQ array containing the rest of the 50 requests
self.requestQ[self.requestDetails[_topId].apiUintVars[keccak256("requestQPosition")]] = 0;
self.requestQ[self.requestDetails[_topId].apiUintVars[keccak256("requestQPosition")]] = 0;
15,417
17
// Encodes rebalance stable borrow rate parameters from standard input to compact representation of 1 bytes32 asset The address of the underlying asset borrowed user The address of the user to be rebalancedreturn compact representation of rebalance stable borrow rate parameters /
function encodeRebalanceStableBorrowRate( address asset, address user
function encodeRebalanceStableBorrowRate( address asset, address user
18,638
92
// Removes `memberToRemove` from the shared role, `roleId`. Reverts if `roleId` does not represent an initialized, SharedRole or if the caller is not a member of themanaging role for `roleId`. roleId the SharedRole membership to modify. memberToRemove the current SharedRole member to remove. /
function removeMember(uint256 roleId, address memberToRemove) public onlyShared(roleId) onlyRoleManager(roleId) { roles[roleId].sharedRoleMembership.removeMember(memberToRemove); emit RemovedSharedMember(roleId, memberToRemove, msg.sender); }
function removeMember(uint256 roleId, address memberToRemove) public onlyShared(roleId) onlyRoleManager(roleId) { roles[roleId].sharedRoleMembership.removeMember(memberToRemove); emit RemovedSharedMember(roleId, memberToRemove, msg.sender); }
6,611
104
// ExecutionLib Contains the logic for executing a scheduled transaction. /
library ExecutionLib { struct ExecutionData { address toAddress; /// The destination of the transaction. bytes callData; /// The bytecode that will be sent with the transaction. uint callValue; /// The wei value that will be sent with...
library ExecutionLib { struct ExecutionData { address toAddress; /// The destination of the transaction. bytes callData; /// The bytecode that will be sent with the transaction. uint callValue; /// The wei value that will be sent with...
15,981
73
// Push '0' to the end of the 4 bytes just pushed - this will be the length of the STORES action
mstore(add(0x24, add(ptr, mload(ptr))), 0)
mstore(add(0x24, add(ptr, mload(ptr))), 0)
60,705
29
// Emit an event inidicating a new validator has been registered, allowing for offchain listeners to track the validator registry
emit NewValidator(data.operator, data.pubkey, data.withdrawal_credentials, data.signature, data.deposit_data_root); unchecked { ++i; }
emit NewValidator(data.operator, data.pubkey, data.withdrawal_credentials, data.signature, data.deposit_data_root); unchecked { ++i; }
44,864
7
// Define an internal function '_addConsumer' to add this role, called by 'addConsumer'
function _addCustomer(address account) internal { grantRole(CUSTOMER_ROLE, account); }
function _addCustomer(address account) internal { grantRole(CUSTOMER_ROLE, account); }
5,198
13
// Finally update ticket total
raffleTicketsBought += amount;
raffleTicketsBought += amount;
31,240
104
// Update the promoter pledged balance [SmAC contracts calls only].
function updatePledged(address promoter, uint256 amount) external returns(bool);
function updatePledged(address promoter, uint256 amount) external returns(bool);
27,983
46
// allows the owner to send vested tokens to participants/self Stored vesting from vesting contract/token the token contract that is being withdrawn/_beneficiary registered address to send the tokens to
function sendTokens(VestingStorage storage self,CrowdsaleToken token, address _beneficiary) public returns (bool) { require(now > self.startTime); require(msg.sender == self.owner); require(self.isToken); bool ok; bool err; uint256 _withdrawAmount; if((now < self.endTime) && (self.holding...
function sendTokens(VestingStorage storage self,CrowdsaleToken token, address _beneficiary) public returns (bool) { require(now > self.startTime); require(msg.sender == self.owner); require(self.isToken); bool ok; bool err; uint256 _withdrawAmount; if((now < self.endTime) && (self.holding...
12,809
4
// Limit Admires per NFT
require( s.info[invokerId].admired != getMatrix() + s.info[invokerId].expand_level && block.timestamp < s.info[invokerId].can_admire_after, "Max Admires Reached" ); require(msg.sender == _ownerOf(invokerId), "No Ownership"); require...
require( s.info[invokerId].admired != getMatrix() + s.info[invokerId].expand_level && block.timestamp < s.info[invokerId].can_admire_after, "Max Admires Reached" ); require(msg.sender == _ownerOf(invokerId), "No Ownership"); require...
27,656
468
// Skin view
string public constant MOUSE = "iVBORw0KGgoAAAANSUhEUgAAAEAAAABABAMAAABYR2ztAAAAHlBMVEUAAACbnZmoqqf3ocW1t7TCxMH6uNXP0c7/0ODy9PBk4k/iAAAAAXRSTlMAQObYZgAAAlFJREFUSMftlEGumzAQhnMFp0ZZg+AAT9l0a/SPvDaakdULoGwjYaGuK6EcoG/BbTsOpM0T5PUCbxYJyJ//sWeY/3DQ4JTIHCtzeBXCIlVlypcAJUlG47XCmOQ/AH8OsBB/Chgb8nr1EjgX4Wyqah8gYXMGzm8gJh...
string public constant MOUSE = "iVBORw0KGgoAAAANSUhEUgAAAEAAAABABAMAAABYR2ztAAAAHlBMVEUAAACbnZmoqqf3ocW1t7TCxMH6uNXP0c7/0ODy9PBk4k/iAAAAAXRSTlMAQObYZgAAAlFJREFUSMftlEGumzAQhnMFp0ZZg+AAT9l0a/SPvDaakdULoGwjYaGuK6EcoG/BbTsOpM0T5PUCbxYJyJ//sWeY/3DQ4JTIHCtzeBXCIlVlypcAJUlG47XCmOQ/AH8OsBB/Chgb8nr1EjgX4Wyqah8gYXMGzm8gJh...
4,014
6
// define a function to renounce ownership
function renounceOwnership() public onlyOwner { emit TransferOwnership(origOwner, address(0)); origOwner = payable(address(0)); }
function renounceOwnership() public onlyOwner { emit TransferOwnership(origOwner, address(0)); origOwner = payable(address(0)); }
2,182
103
// ============ External ============ //Change base asset oracle in case current one fails or is deprecated. Only contractowner is allowed to change. _newBaseOracleAddress Address of new oracle to pull data from /
function changeBaseOracle( IOracle _newBaseOracleAddress ) external timeLockUpgrade
function changeBaseOracle( IOracle _newBaseOracleAddress ) external timeLockUpgrade
24,139