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
1
// Scale factor of the fixed curve.
uint256 public immutable fixedCurveA;
uint256 public immutable fixedCurveA;
24,279
21
// Sets state variable that tells contract if it can send data to EventProxy/eventSendSet Bool to set state variable to
function setEventSend(bool eventSendSet) external;
function setEventSend(bool eventSendSet) external;
8,251
5
// Deposits tokens in proportion to the Unipilot's current holdings & mints them/ `Unipilot`s LP token./amount0Desired Max amount of token0 to deposit/amount1Desired Max amount of token1 to deposit/recipient Recipient of shares/ return lpShares Number of shares minted/ return amount0 Amount of token0 deposited in vault...
function deposit( uint256 amount0Desired, uint256 amount1Desired, address recipient ) external payable returns ( uint256 lpShares, uint256 amount0,
function deposit( uint256 amount0Desired, uint256 amount1Desired, address recipient ) external payable returns ( uint256 lpShares, uint256 amount0,
27,263
68
// Bad interface
require(upgradeAgent.isUpgradeAgent());
require(upgradeAgent.isUpgradeAgent());
22,747
663
// Check the exchange rate without any state changes/ @inheritdoc IOracle
function peek(bytes calldata data) public view override returns (bool, uint256) { uint256 rate = abi.decode(data, (uint256)); return (rate != 0, rate); }
function peek(bytes calldata data) public view override returns (bool, uint256) { uint256 rate = abi.decode(data, (uint256)); return (rate != 0, rate); }
6,390
93
// Rounds down to the nearest tick where tick % tickSpacing == 0/tick The tick to round/tickSpacing The tick spacing to round to/ return the floored tick/Ensure tick +/- tickSpacing does not overflow or underflow int24
function floor(int24 tick, int24 tickSpacing) internal pure returns (int24) { int24 mod = tick % tickSpacing; unchecked { if (mod >= 0) return tick - mod; return tick - mod - tickSpacing; } }
function floor(int24 tick, int24 tickSpacing) internal pure returns (int24) { int24 mod = tick % tickSpacing; unchecked { if (mod >= 0) return tick - mod; return tick - mod - tickSpacing; } }
17,273
1,102
// https:etherscan.io/address/0xe2f532c389deb5E42DCe53e78A9762949A885455;
Synth existingSynth = Synth(0xe2f532c389deb5E42DCe53e78A9762949A885455);
Synth existingSynth = Synth(0xe2f532c389deb5E42DCe53e78A9762949A885455);
49,053
707
// Private hash Delegate struct for EIP-712_delegate VotingDelegate struct return bytes32 hash of _delegate/
function _hash(VotingDelegate memory _delegate) internal pure returns (bytes32) { return keccak256( abi.encode( DELEGATE_TYPEHASH, _delegate.owner, _delegate.delegate, _delegate.nonce, _delegate.expirationTime ) ); ...
function _hash(VotingDelegate memory _delegate) internal pure returns (bytes32) { return keccak256( abi.encode( DELEGATE_TYPEHASH, _delegate.owner, _delegate.delegate, _delegate.nonce, _delegate.expirationTime ) ); ...
32,847
77
// Set current adjustment to inactive (e.g. if we are re-tuning early)
adjustments[id_].active = false;
adjustments[id_].active = false;
5,554
20
// The owner can withdraw ethers already during presale,/ only if the minimum funding level has been reached
function ownerWithdraw(uint256 value) external onlyOwner { // The owner cannot withdraw if the presale did not reach the minimum funding amount if (totalFunding < PRESALE_MINIMUM_FUNDING) throw; // Withdraw the amount requested if (!owner.send(value)) throw; }
function ownerWithdraw(uint256 value) external onlyOwner { // The owner cannot withdraw if the presale did not reach the minimum funding amount if (totalFunding < PRESALE_MINIMUM_FUNDING) throw; // Withdraw the amount requested if (!owner.send(value)) throw; }
34,447
6
// Get conversion rate from minimum receive token quantity. dstQty(1018)(10dstDecimals) / (10srcDecimals) / srcQty
kyberTradeInfo.conversionRate = _minDestinationQuantity .mul(PreciseUnitMath.preciseUnit()) .mul(10 ** kyberTradeInfo.sourceTokenDecimals) .div(10 ** kyberTradeInfo.destinationTokenDecimals) .div(_sourceQuantity);
kyberTradeInfo.conversionRate = _minDestinationQuantity .mul(PreciseUnitMath.preciseUnit()) .mul(10 ** kyberTradeInfo.sourceTokenDecimals) .div(10 ** kyberTradeInfo.destinationTokenDecimals) .div(_sourceQuantity);
40,380
28
// A contract for TopWolves/Rob Park/NFT Minting
contract TopWolves is ERC721, Ownable, ReentrancyGuard { using SafeMath for uint256; using SafeMath for uint16; using SafeMath for uint8; uint16 private _tokenId; // Team wallet address walletAddress = 0x9569c3ca25C5cb45Fa3eabe4A1f4b94f527a9Fd6; // Minting Limitation uint16 pub...
contract TopWolves is ERC721, Ownable, ReentrancyGuard { using SafeMath for uint256; using SafeMath for uint16; using SafeMath for uint8; uint16 private _tokenId; // Team wallet address walletAddress = 0x9569c3ca25C5cb45Fa3eabe4A1f4b94f527a9Fd6; // Minting Limitation uint16 pub...
21,463
14
// Convert a color from the HSL colorspace to RGB and return the Red, Green, and Blue components.Core function that was originally parsed in Javascript, translated to Solidity. /
function hueToRGB (uint256 hue, uint8 _lightness) public pure returns (uint8, uint8, uint8) { uint256 c; uint256 lightness = _lightness * HUNDREDTH; if (lightness < (ONE / 2)) { c = 2 * lightness; } else { c = 2 * (ONE - lightness); } uint256 ...
function hueToRGB (uint256 hue, uint8 _lightness) public pure returns (uint8, uint8, uint8) { uint256 c; uint256 lightness = _lightness * HUNDREDTH; if (lightness < (ONE / 2)) { c = 2 * lightness; } else { c = 2 * (ONE - lightness); } uint256 ...
46,790
17
// increment the skip count
pools[poolIndex].contributionSkipCount += 1;
pools[poolIndex].contributionSkipCount += 1;
10,102
12
// Emit an event when the PRIME price is set/tokenId is the token ID/price is the new PRIME price
event PriceSet(uint256 tokenId, uint256 price);
event PriceSet(uint256 tokenId, uint256 price);
36,507
18
// Withdraw the entire balance for an account /
function withdrawAll() external override
function withdrawAll() external override
60,049
5
// Define the inflationary model
inflationaryModelPerYear[1] = YearlyMintInfo( MAX_MINT_AMOUNT_YEAR_1, 0, MAX_MINT_AMOUNT_YEAR_1 ); inflationaryModelPerYear[2] = YearlyMintInfo( MAX_MINT_AMOUNT_YEAR_2, 0, MAX_MINT_AMOUNT_YEAR_2 );
inflationaryModelPerYear[1] = YearlyMintInfo( MAX_MINT_AMOUNT_YEAR_1, 0, MAX_MINT_AMOUNT_YEAR_1 ); inflationaryModelPerYear[2] = YearlyMintInfo( MAX_MINT_AMOUNT_YEAR_2, 0, MAX_MINT_AMOUNT_YEAR_2 );
16,277
67
// perform reclaim token by admin
function adminReclaimToken(address _address) public onlyOwner { uint256 amount = reclaimTokenMap.get(_address); require(amount > 0); require(token.balanceOf(address(this)) >= amount); token.transfer(_address, amount); // remove from map recl...
function adminReclaimToken(address _address) public onlyOwner { uint256 amount = reclaimTokenMap.get(_address); require(amount > 0); require(token.balanceOf(address(this)) >= amount); token.transfer(_address, amount); // remove from map recl...
9,557
209
// Reset to allow add/remove tokens, or manual weight updates
if (block.number >= gradualUpdate.endBlock) { gradualUpdate.startBlock = 0; }
if (block.number >= gradualUpdate.endBlock) { gradualUpdate.startBlock = 0; }
23,368
120
// Send transfers to dead address
if (burnAmt > 0) { _transferStandard(sender, deadWallet, burnAmt); }
if (burnAmt > 0) { _transferStandard(sender, deadWallet, burnAmt); }
25,286
52
// The number of memory words this memory view occupies, rounded up. memView The viewreturnuint256 - The number of memory words /
function words(bytes29 memView) internal pure returns (uint256) { return uint256(len(memView)).add(32) / 32; }
function words(bytes29 memView) internal pure returns (uint256) { return uint256(len(memView)).add(32) / 32; }
46,641
9
// returns sorted token addresses, used to handle return values from pairs sorted in this order
function sortTokens(address tokenA, address tokenB) internal pure returns (address token0, address token1) { require(tokenA != tokenB, "GemLibrary: IDENTICAL_ADDRESSES"); (token0, token1) = tokenA < tokenB ? (tokenA, tokenB) : (tokenB, tokenA); require(token0 != address(0), "GemLibrary: ZERO...
function sortTokens(address tokenA, address tokenB) internal pure returns (address token0, address token1) { require(tokenA != tokenB, "GemLibrary: IDENTICAL_ADDRESSES"); (token0, token1) = tokenA < tokenB ? (tokenA, tokenB) : (tokenB, tokenA); require(token0 != address(0), "GemLibrary: ZERO...
1,459
22
// Override isApprovedForAll to whitelist user's OpenSea proxy accounts to enable gas-less listings/owner Token owner/operator Operator to check/ return bool true if `_operator` is approved for all
function isApprovedForAll(address owner, address operator) public override(ERC721Upgradeable, IERC721Upgradeable) view returns (bool)
function isApprovedForAll(address owner, address operator) public override(ERC721Upgradeable, IERC721Upgradeable) view returns (bool)
27,169
46
// Past report is too old.
emit ReportTimestampOutOfRange(providerAddress);
emit ReportTimestampOutOfRange(providerAddress);
29,369
24
// We can unsafely cast to int256 because balances are actually stored as uint112
_unsafeCastToInt256(amountsInOrOut, positive), dueProtocolFeeAmounts );
_unsafeCastToInt256(amountsInOrOut, positive), dueProtocolFeeAmounts );
12,012
42
// Event logged when a new address is authorized.
event AuthorizedAddressAdded( address indexed target, address indexed caller );
event AuthorizedAddressAdded( address indexed target, address indexed caller );
33,355
16
// Update token price. tokenPrice_ The new token price /
function setTokenPrice(uint256 tokenPrice_) external onlyOwner { tokenPrice = tokenPrice_; }
function setTokenPrice(uint256 tokenPrice_) external onlyOwner { tokenPrice = tokenPrice_; }
74,606
104
// revert(); msg.value is the amount of Ether sent by the transaction.
if (msg.value > 0) { fund(lastGateway); } else {
if (msg.value > 0) { fund(lastGateway); } else {
46,389
52
// Whether `a` is less than `b`. a a FixedPoint.Signed. b an int256.return True if `a < b`, or False. /
function isLessThan(Signed memory a, int256 b) internal pure returns (bool) { return a.rawValue < fromUnscaledInt(b).rawValue; }
function isLessThan(Signed memory a, int256 b) internal pure returns (bool) { return a.rawValue < fromUnscaledInt(b).rawValue; }
1,151
39
// returns the balance in staked UNIC with Multiplier
function balanceOf(address owner) external view returns (uint256 unicWithMultiplierSum) { uint256 balanceOf = stakingNftContract.balanceOf(owner); unicWithMultiplierSum = 0; for (uint256 i = 0; i < balanceOf; i++) { unicWithMultiplierSum += stakingPoolContract.getStakeWithMult...
function balanceOf(address owner) external view returns (uint256 unicWithMultiplierSum) { uint256 balanceOf = stakingNftContract.balanceOf(owner); unicWithMultiplierSum = 0; for (uint256 i = 0; i < balanceOf; i++) { unicWithMultiplierSum += stakingPoolContract.getStakeWithMult...
42,759
23
// Send to UniSwap
IWETH(WETH).deposit{value : totalETHContributed}();
IWETH(WETH).deposit{value : totalETHContributed}();
7,001
78
// withdraw token bonus earned from locking up liquidity-------------------------------------------------------------- _user--> address of the user making withdrawal releasedAmount --> released token to be withdrawn------------------------------------------------------------------returns whether successfully withdrawn ...
function _withdrawUserTokenBonus(address _user, uint releasedAmount) internal returns(bool) { _users[_user].tokenWithdrawn = _users[_user].tokenWithdrawn.add(releasedAmount); _pendingBonusesToken = _pendingBonusesToken.sub(releasedAmount); (uint fee, uint feeInToken) = _cal...
function _withdrawUserTokenBonus(address _user, uint releasedAmount) internal returns(bool) { _users[_user].tokenWithdrawn = _users[_user].tokenWithdrawn.add(releasedAmount); _pendingBonusesToken = _pendingBonusesToken.sub(releasedAmount); (uint fee, uint feeInToken) = _cal...
30,022
1
// need memory keynote for every single string datatype within the function
function createCampaign( address _owner, string memory _title, string memory _description, uint256 _target, uint256 _deadline, string memory _image
function createCampaign( address _owner, string memory _title, string memory _description, uint256 _target, uint256 _deadline, string memory _image
14,678
61
// FinalAmount = PAPY/SecondsPerYearn Compounded interest = FinalAmount - P;
userReward = (user.amount * fixedAPY * multiplier) / SECONDS_YEAR / _RATE_NOMINATOR;
userReward = (user.amount * fixedAPY * multiplier) / SECONDS_YEAR / _RATE_NOMINATOR;
35,114
25
// private claim all accumulated outstanding tokens back to the callers wallet
function _claim() private { // Return with no action if the staking period has not commenced yet. if (rewardStartTime == 0) { return; } uint32 lastClaimTime = userStakes[msg.sender].lastClaimTime; // If the user staked before the start time was set, update the s...
function _claim() private { // Return with no action if the staking period has not commenced yet. if (rewardStartTime == 0) { return; } uint32 lastClaimTime = userStakes[msg.sender].lastClaimTime; // If the user staked before the start time was set, update the s...
6,353
24
// Step 5: create gauges for the single-recipient gauge types The LM committee gauge will be remain as a SingleRecipientGauge permanently, however the gauges for veBAL, Polygon and Arbitrum types are temporary pending an automated solution. These three gauges will in time be retired (killed) and replaced with new gauge...
{ authorizer.grantRole(authorizerAdaptor.getActionId(IGaugeController.add_gauge.selector), address(this));
{ authorizer.grantRole(authorizerAdaptor.getActionId(IGaugeController.add_gauge.selector), address(this));
22,801
47
// save some gas by making only one contract call
function burnFrom(address _from, uint256 _value) returns (bool)
function burnFrom(address _from, uint256 _value) returns (bool)
41,472
27
// Current resource supply
uint public resourceSupply;
uint public resourceSupply;
1,400
51
// every reward era, the reward amount halves.
return (50 * 10**uint(decimals) ).div( 2**rewardEra ) ;
return (50 * 10**uint(decimals) ).div( 2**rewardEra ) ;
48,186
70
// deposit all liquidity from msg.senderreturn success/failure /
function depositAll() external returns (bool) { return deposit(IERC20(reserve).balanceOf(msg.sender)); }
function depositAll() external returns (bool) { return deposit(IERC20(reserve).balanceOf(msg.sender)); }
44,744
38
// Calculates sqrt(1.0001^tick)2^96/Throws if |tick| > max tick/tick The input tick for the above formula/ return sqrtPriceX96 A Fixed point Q64.96 number representing the sqrt of the ratio of the two assets (token1/token0)/ at the given tick
function getSqrtRatioAtTick(int24 tick) internal pure returns (uint160 sqrtPriceX96) { uint256 absTick = tick < 0 ? uint256(-int256(tick)) : uint256(int256(tick)); require(absTick <= uint256(MAX_TICK), 'T'); uint256 ratio = absTick & 0x1 != 0 ? 0xfffcb933bd6fad37aa2d162d1a594001 : 0x1000000...
function getSqrtRatioAtTick(int24 tick) internal pure returns (uint160 sqrtPriceX96) { uint256 absTick = tick < 0 ? uint256(-int256(tick)) : uint256(int256(tick)); require(absTick <= uint256(MAX_TICK), 'T'); uint256 ratio = absTick & 0x1 != 0 ? 0xfffcb933bd6fad37aa2d162d1a594001 : 0x1000000...
2,807
229
// Makes Data Availability Service keyset valid keysetBytes bytes of the serialized keyset /
function setValidKeyset(bytes calldata keysetBytes) external;
function setValidKeyset(bytes calldata keysetBytes) external;
36,705
119
// thrown when caller is not the flywheel
error FlywheelError();
error FlywheelError();
21,794
52
// PRIVILEGED GOVERNANCE FUNCTION. Allows governance to remove a factory_factory Address of the factory contract to remove /
function removeFactory(address _factory) external onlyInitialized onlyOwner { require(isFactory[_factory], "Factory does not exist"); factories = factories.remove(_factory); isFactory[_factory] = false; emit FactoryRemoved(_factory); }
function removeFactory(address _factory) external onlyInitialized onlyOwner { require(isFactory[_factory], "Factory does not exist"); factories = factories.remove(_factory); isFactory[_factory] = false; emit FactoryRemoved(_factory); }
34,334
229
// 1. Take out collateral
doTakeCollateral(lp, amt.amtLPTake);
doTakeCollateral(lp, amt.amtLPTake);
32,828
86
// note this will always return 0 before update has been called successfully for the first time.
function consult(address token, uint amountIn) internal view returns (uint amountOut) { if (token == token0) { amountOut = price0Average.mul(amountIn).decode144(); } else { require(token == token1, 'OracleSimple: INVALID_TOKEN'); amountOut = price1Average.mul(amou...
function consult(address token, uint amountIn) internal view returns (uint amountOut) { if (token == token0) { amountOut = price0Average.mul(amountIn).decode144(); } else { require(token == token1, 'OracleSimple: INVALID_TOKEN'); amountOut = price1Average.mul(amou...
5,896
61
// Get the approved address for a single NFT. Throws if `_tokenId` is not a valid NFT. _tokenId ID of the NFT to query the approval of.return Address that _tokenId is approved for. /
function getApproved( uint256 _tokenId ) external override view validNFToken(_tokenId) returns (address)
function getApproved( uint256 _tokenId ) external override view validNFToken(_tokenId) returns (address)
1,860
14
// fetch local storage /
function getStorage() internal pure returns (Storage storage s) { bytes32 namespace = NAMESPACE; // solhint-disable-next-line no-inline-assembly assembly { s.slot := namespace } }
function getStorage() internal pure returns (Storage storage s) { bytes32 namespace = NAMESPACE; // solhint-disable-next-line no-inline-assembly assembly { s.slot := namespace } }
30,212
177
// Execution of INVEST proposal./proposal_ proposal.
function _executeInvest(Proposal storage proposal_) private { // Check that DAO has sufficient balance for investment. require(availableBalance() >= proposal_.amount); // Transfer funds. payable(proposal_.proposalAddress).call{value: proposal_.amount}(""); // If secondary address for invest to...
function _executeInvest(Proposal storage proposal_) private { // Check that DAO has sufficient balance for investment. require(availableBalance() >= proposal_.amount); // Transfer funds. payable(proposal_.proposalAddress).call{value: proposal_.amount}(""); // If secondary address for invest to...
12,723
48
// add the tokens to the user's balance
balances[msg.sender] = balances[msg.sender].add(_amount); Deposit(msg.sender, _amount, balances[msg.sender]);
balances[msg.sender] = balances[msg.sender].add(_amount); Deposit(msg.sender, _amount, balances[msg.sender]);
45,134
5
// allow deposit of funds
receive() external payable {} // convenience function function contractBalance() public view returns (uint256) { return address(this).balance; }
receive() external payable {} // convenience function function contractBalance() public view returns (uint256) { return address(this).balance; }
44,893
133
// 5. If it is below the minimum, don't allow this draw.
require(collateralRatio(loan) > minCratio, "Cannot draw this much");
require(collateralRatio(loan) > minCratio, "Cannot draw this much");
7,596
609
// reset re-entrancy guard
entered = 1;
entered = 1;
21,694
27
// require(msg.sender == address(eurekaTokenContract));
require(_value == submissionFee, 'transferred amount needs to equal the submission fee'); uint submissionId = submissionCounter++; ArticleSubmission storage submission = articleSubmissions[submissionId]; submission.submissionId = submissionId; submission.submissionOwner = _from...
require(_value == submissionFee, 'transferred amount needs to equal the submission fee'); uint submissionId = submissionCounter++; ArticleSubmission storage submission = articleSubmissions[submissionId]; submission.submissionId = submissionId; submission.submissionOwner = _from...
7,785
3
// ownership
address public _master;
address public _master;
3,320
45
// Returns whether transfering is stopped. /
function isTransferringStopped() external view override returns (bool) { return _stopped; }
function isTransferringStopped() external view override returns (bool) { return _stopped; }
47,262
123
// Returns all currently active adIds.
function getAdIds() external view returns (uint256[]) { return adIds; }
function getAdIds() external view returns (uint256[]) { return adIds; }
29,003
24
// May emit a {RoleGranted} event. /
function _grantRole(bytes32 role, address account) internal virtual { if (!hasRole(role, account)) { _roles[role].members[account] = true; emit RoleGranted(role, account, _msgSender()); }
function _grantRole(bytes32 role, address account) internal virtual { if (!hasRole(role, account)) { _roles[role].members[account] = true; emit RoleGranted(role, account, _msgSender()); }
22,313
30
// Withdraws all the ETH of `msg.sender`./It can only be called when the contract state is not `PostDeposit`./ Emits a {Withdrawal} event./minimumETHAmount The minimum amount of ETH that must be received for the transaction not to revert.
function withdrawAll(uint256 minimumETHAmount) external returns (uint256);
function withdrawAll(uint256 minimumETHAmount) external returns (uint256);
1,847
141
// use by default 500,000 gas to process auto-claiming dividends
uint256 public gasForProcessing = 500000;
uint256 public gasForProcessing = 500000;
9,232
23
// the cliff period has not ended, therefore, no tokens to draw down
if (_getNow() <= schedule.cliff) { return 0; }
if (_getNow() <= schedule.cliff) { return 0; }
14,996
39
// update shares per token
_sharesPerPolkamoon = _totalShares.div(_totalSupply);
_sharesPerPolkamoon = _totalShares.div(_totalSupply);
72,382
82
// Contract initializer. factory Address of the initial factory. data Data to send as msg.data to the implementation to initialize the proxied contract.It should include the signature and the parameters of the function to be called, as described inThis parameter is optional, if no data is given the initialization call ...
function initialize(address factory, bytes memory data) public payable { require(_factory() == address(0)); assert(FACTORY_SLOT == bytes32(uint256(keccak256('eip1967.proxy.factory')) - 1)); _setFactory(factory); if(data.length > 0) { (bool success,) = _implementation().delegatecall(data); ...
function initialize(address factory, bytes memory data) public payable { require(_factory() == address(0)); assert(FACTORY_SLOT == bytes32(uint256(keccak256('eip1967.proxy.factory')) - 1)); _setFactory(factory); if(data.length > 0) { (bool success,) = _implementation().delegatecall(data); ...
20,215
5
// Mapping from owner to number of owned token
mapping (address => uint256) internal ownedTokensCount;
mapping (address => uint256) internal ownedTokensCount;
5,046
42
// Called by a Suspender to suspend, triggers stopped state. /
function suspend() public onlySuspender whenNotSuspended { _suspended = true; emit Suspended(msg.sender); }
function suspend() public onlySuspender whenNotSuspended { _suspended = true; emit Suspended(msg.sender); }
12,603
12
// generate the arcadiumSwap pair path of token -> usdc.
address[] memory path = new address[](2); path[0] = token; path[1] = address(usdcRewardCurrency); uint256 usdcPriorBalance = usdcRewardCurrency.balanceOf(address(this)); require(IERC20(token).approve(address(arcadiumSwapRouter), totalTokenBalance), 'approval failed');
address[] memory path = new address[](2); path[0] = token; path[1] = address(usdcRewardCurrency); uint256 usdcPriorBalance = usdcRewardCurrency.balanceOf(address(this)); require(IERC20(token).approve(address(arcadiumSwapRouter), totalTokenBalance), 'approval failed');
17,521
0
// ░██████╗██╗░░██╗██╗██████╗░░█████╗░ ███╗░░██╗░█████╗░██████╗░██╗░░░██╗ ██╔════╝██║░░██║██║██╔══██╗██╔══██╗ ████╗░██║██╔══██╗██╔══██╗██║░░░██║ ╚█████╗░███████║██║██████╦╝███████║ ██╔██╗██║███████║██████╔╝██║░░░██║ ░╚═══██╗██╔══██║██║██╔══██╗██╔══██║ ██║╚████║██╔══██║██╔══██╗██║░░░██║ ██████╔╝██║░░██║██║██████╦╝██║░░█...
interface IERC20 { function totalSupply() external view returns (uint256); function balanceOf(address account) external view returns (uint256); function transfer(address recipient, uint256 amount) external returns (bool); function burn(uint256 amount) external; function allowance(address own...
interface IERC20 { function totalSupply() external view returns (uint256); function balanceOf(address account) external view returns (uint256); function transfer(address recipient, uint256 amount) external returns (bool); function burn(uint256 amount) external; function allowance(address own...
52,138
131
// iOVM_L1TokenGateway /
interface iOVM_L1TokenGateway { /********** * Events * **********/ event DepositInitiated( address indexed _from, address _to, uint256 _amount ); event WithdrawalFinalized( address indexed _to, uint256 _amount ); /******************** *...
interface iOVM_L1TokenGateway { /********** * Events * **********/ event DepositInitiated( address indexed _from, address _to, uint256 _amount ); event WithdrawalFinalized( address indexed _to, uint256 _amount ); /******************** *...
59,860
66
// A bid to an auction must be made in the auction's desired currency.
require(newOffer.currency == targetListing.currency, "must use approved currency to bid");
require(newOffer.currency == targetListing.currency, "must use approved currency to bid");
1,835
1
// SafeMath div funciotn function for safe devide /
function div(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a / b; return c; }
function div(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a / b; return c; }
39,928
1
// Deploys a new DegenData contract.
function deployDegenData( uint256 _id, string memory _name, uint256 _renameCost, address _worlds, address _degens, address _payments
function deployDegenData( uint256 _id, string memory _name, uint256 _renameCost, address _worlds, address _degens, address _payments
5,620
188
// Any calls to nonReentrant after this point will fail
_status = _ENTERED; _;
_status = _ENTERED; _;
430
255
// Transfer Liquidity Asset from burn to LiquidityLocker.
liquidityAsset.safeTransfer(liquidityLocker, liquidityAssetRecoveredFromBurn); principalOut = principalOut.sub(defaultSuffered); // Subtract rest of the Loan's principal from `principalOut`. emit DefaultSuffered( loan, // The Loan that suffered the defau...
liquidityAsset.safeTransfer(liquidityLocker, liquidityAssetRecoveredFromBurn); principalOut = principalOut.sub(defaultSuffered); // Subtract rest of the Loan's principal from `principalOut`. emit DefaultSuffered( loan, // The Loan that suffered the defau...
60,228
272
// If the account has never borrowed the token, return 0
uint256 lastBorrowBlock = tokenInfo.getLastBorrowBlock(); if (lastBorrowBlock == 0) return 0; else {
uint256 lastBorrowBlock = tokenInfo.getLastBorrowBlock(); if (lastBorrowBlock == 0) return 0; else {
42,308
37
// function to calculate the quantity of TOKEN based on the TOKEN price of bnbAmount
function calculateTokenAmount(uint256 bnbAmount) public view returns (uint256) { uint256 tokenAmount = tokenPrice.mul(bnbAmount).div(DEFAULT_DECIMALS); return tokenAmount; }
function calculateTokenAmount(uint256 bnbAmount) public view returns (uint256) { uint256 tokenAmount = tokenPrice.mul(bnbAmount).div(DEFAULT_DECIMALS); return tokenAmount; }
41,036
9
// try to recover collateral from position
if (loanPosition.positionTokenAmountFilled > 0) { uint256 collateralAmountNeeded = amountWithdrawn - loanPosition.collateralTokenAmountFilled; if (loanPosition.positionTokenAddressFilled != loanPosition.collateralTokenAddressFilled) { if (!BZxVault(vaultCo...
if (loanPosition.positionTokenAmountFilled > 0) { uint256 collateralAmountNeeded = amountWithdrawn - loanPosition.collateralTokenAmountFilled; if (loanPosition.positionTokenAddressFilled != loanPosition.collateralTokenAddressFilled) { if (!BZxVault(vaultCo...
12,303
0
// ===================================== proof of stake (defaults at too many tokens), No masternodes
uint public stakingRequirement = 10000000e18;
uint public stakingRequirement = 10000000e18;
70,713
7
// check that the vendor's token balance is enough to do swap
uint256 amountOfEthToTransfer = tokenAmountToSell / tokensPerEth; uint256 ownerEthBalance = address(this).balance; require(ownerEthBalance >= amountOfEthToTransfer, "Vendor has not enough funds to accept the sell request");
uint256 amountOfEthToTransfer = tokenAmountToSell / tokensPerEth; uint256 ownerEthBalance = address(this).balance; require(ownerEthBalance >= amountOfEthToTransfer, "Vendor has not enough funds to accept the sell request");
43,282
33
// This is used to allow some account to utilise transferFrom and sends tokens on your behalf, this method is disabled if emergencyLock is activated_spender Who can send tokens on your behalf_value The amount of tokens that are allowed to be sentreturn if successful returns true/
function approve(address _spender, uint256 _value) lockAffected public returns (bool success) { allowances[msg.sender][_spender] = _value; emit Approval(msg.sender, _spender, _value); return true; }
function approve(address _spender, uint256 _value) lockAffected public returns (bool success) { allowances[msg.sender][_spender] = _value; emit Approval(msg.sender, _spender, _value); return true; }
49,941
115
// Constructor, takes maximum amount of wei accepted in the crowdsale. _cap Max amount of wei to be contributed /
constructor(uint256 _cap) public { require(_cap > 0); cap = _cap; }
constructor(uint256 _cap) public { require(_cap > 0); cap = _cap; }
6,851
42
// Block number when bonus SUSHI period ends.
uint256 public bonusEndBlock;
uint256 public bonusEndBlock;
22,936
1
// ERRORS
error InvalidConfig(bytes32 config); error ConfigIsLocked(bytes32 config); error Unauthorized(); error NonExistentToken(uint256 tokenId);
error InvalidConfig(bytes32 config); error ConfigIsLocked(bytes32 config); error Unauthorized(); error NonExistentToken(uint256 tokenId);
29,420
5
// bytes 1 to 32 are 0 because message length is stored as little endian. mload always reads 32 bytes. so we can and have to start reading recipient at offset 20 instead of 32. if we were to read at 32 the address would contain part of value and be corrupted. when reading from offset 20 mload will read 12 zero bytes fo...
function parseMessage(bytes message) internal pure returns(address recipient, uint256 amount, bytes32 txHash)
function parseMessage(bytes message) internal pure returns(address recipient, uint256 amount, bytes32 txHash)
1,343
66
// Function used to set wallets and enable the sale. _etherWallet Address of ether wallet. _teamWallet Address of team wallet. _advisorWallet Address of advisors wallet. _bountyWallet Address of bounty wallet. _fundWallet Address of fund wallet. /
function setWallets(address _etherWallet, address _teamWallet, address _advisorWallet, address _bountyWallet, address _fundWallet) public onlyOwner inState(State.BEFORE_START) { require(_etherWallet != address(0)); require(_teamWallet != address(0)); require(_advisorWallet != address(0)); ...
function setWallets(address _etherWallet, address _teamWallet, address _advisorWallet, address _bountyWallet, address _fundWallet) public onlyOwner inState(State.BEFORE_START) { require(_etherWallet != address(0)); require(_teamWallet != address(0)); require(_advisorWallet != address(0)); ...
4,261
26
// Setup Header Area / Load free memory pointer
fillOrderCalldata := mload(0x40)
fillOrderCalldata := mload(0x40)
24,003
24
// we can accept 0 as minimum, this will be called only by trusted roles
uint256 minimum = 0; ICurveDeposit_4token(curveDeposit()).add_liquidity(depositArray, minimum);
uint256 minimum = 0; ICurveDeposit_4token(curveDeposit()).add_liquidity(depositArray, minimum);
46,040
74
// Returns the Name for a given token ID.Throws if the token ID does not exist. May return an empty string. tokenId uint256 ID of the token to query /
function tokenName(uint256 tokenId) external view returns (string memory) { require(_exists(tokenId), "ERC721Metadata: Name query for nonexistent token"); uint niftyType = _getNiftyTypeId(tokenId); return _niftyTypeName[niftyType]; }
function tokenName(uint256 tokenId) external view returns (string memory) { require(_exists(tokenId), "ERC721Metadata: Name query for nonexistent token"); uint niftyType = _getNiftyTypeId(tokenId); return _niftyTypeName[niftyType]; }
15,969
64
// Finally, update the _from user's swap balance
self.swap_balances[from_swaps[i]][from_swap_user_index].amount = self.swap_balances[from_swaps[i]][from_swap_user_index].amount.sub(_amount);
self.swap_balances[from_swaps[i]][from_swap_user_index].amount = self.swap_balances[from_swaps[i]][from_swap_user_index].amount.sub(_amount);
72,640
17
// Get the Agreement requiredSignatures map as an array of bools parallelto its signatories array. /
function _getRequiredSignaturesArray(Agreement storage agreement)
function _getRequiredSignaturesArray(Agreement storage agreement)
33,235
75
// Should https:github.com/OpenZeppelin/zeppelin-solidity/issues/707 be accepted, this function needs to emit an event with the updated approval.
allowedBurn[_from][msg.sender] = allowedBurn[_from][msg.sender].sub(_value); _burn(_from, _value);
allowedBurn[_from][msg.sender] = allowedBurn[_from][msg.sender].sub(_value); _burn(_from, _value);
39,175
1,013
// Emits a {BountyWasPaid} event. /
function _distributeBounty(uint amount, uint validatorId) private { TimeHelpers timeHelpers = TimeHelpers(contractManager.getContract("TimeHelpers")); ValidatorService validatorService = ValidatorService(contractManager.getContract("ValidatorService"));
function _distributeBounty(uint amount, uint validatorId) private { TimeHelpers timeHelpers = TimeHelpers(contractManager.getContract("TimeHelpers")); ValidatorService validatorService = ValidatorService(contractManager.getContract("ValidatorService"));
2,839
211
// Refund leftovers
IERC20(Constants.USDC).transfer( _sender, IERC20(Constants.USDC).balanceOf(address(this)) );
IERC20(Constants.USDC).transfer( _sender, IERC20(Constants.USDC).balanceOf(address(this)) );
494
8
// 0x95d89b41 = bytes4(keccak256("symbol()"))
string memory symbol = callAndParseStringReturn(token, 0x95d89b41); if (bytes(symbol).length == 0) {
string memory symbol = callAndParseStringReturn(token, 0x95d89b41); if (bytes(symbol).length == 0) {
36,958
16
// multiplies two ray, rounding half up to the nearest raya rayb ray return the result of ab, in ray/
function rayMul(uint256 a, uint256 b) internal pure returns (uint256) { return halfRAY.add(a.mul(b)).div(RAY); }
function rayMul(uint256 a, uint256 b) internal pure returns (uint256) { return halfRAY.add(a.mul(b)).div(RAY); }
16,059
65
// sign(requestId ||lastSystemRandomness || userSeed || selected sender in group)
emit LogRequestUserRandom( requestId, lastRandomness, userSeed, grp.groupId, getGroupPubKey(idx) ); return requestId;
emit LogRequestUserRandom( requestId, lastRandomness, userSeed, grp.groupId, getGroupPubKey(idx) ); return requestId;
33,882
19
// Returns an Ethereum Signed Message, created from a `hash`. Thisproduces hash corresponding to the one signed with theJSON-RPC method as part of EIP-191.
* See {recover}. */ function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32 message) { // 32 is the length in bytes of hash, // enforced by the type signature above /// @solidity memory-safe-assembly assembly { mstore(0x00, "\x19Ethereum Sig...
* See {recover}. */ function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32 message) { // 32 is the length in bytes of hash, // enforced by the type signature above /// @solidity memory-safe-assembly assembly { mstore(0x00, "\x19Ethereum Sig...
24,797
24
// returns balance of our UniV3 LP, assuming 1 FRAX = 1 want, factoring curve swap fee
function balanceOfNFToptimistic() public view returns (uint256) { (uint256 fraxBalance, uint256 usdcBalance) = principal(); uint256 fraxRebase = fraxBalance.div(1e12).mul(9996).div(DENOMINATOR); // div by 1e12 to convert frax to usdc, assume 1:1 swap on curve with fees return fraxRebase.add(...
function balanceOfNFToptimistic() public view returns (uint256) { (uint256 fraxBalance, uint256 usdcBalance) = principal(); uint256 fraxRebase = fraxBalance.div(1e12).mul(9996).div(DENOMINATOR); // div by 1e12 to convert frax to usdc, assume 1:1 swap on curve with fees return fraxRebase.add(...
18,295
52
// USDB ERC20 Token backed by fiat reserves /
contract USDB is Ownable, ERC20, Pausable, Blacklistable { using SafeMath for uint256; string public name; string public symbol; uint8 public decimals; string public currency; address public masterMinter; bool internal initialized; mapping(address => uint256) internal balances; map...
contract USDB is Ownable, ERC20, Pausable, Blacklistable { using SafeMath for uint256; string public name; string public symbol; uint8 public decimals; string public currency; address public masterMinter; bool internal initialized; mapping(address => uint256) internal balances; map...
61,101
56
// Returns the current balance of the given asset. /
function checkBalance(address _asset)
function checkBalance(address _asset)
26,180
596
// List of addresses with privileged access /
mapping(address => uint) public privilegedAddresses;
mapping(address => uint) public privilegedAddresses;
32,754