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
51
// else if the requestid is part of the requestQ[51] then update the tip for it
else if (_tip > 0){ zap.requestQ[_request.apiUintVars[keccak256("requestQPosition")]] += _tip; }
else if (_tip > 0){ zap.requestQ[_request.apiUintVars[keccak256("requestQPosition")]] += _tip; }
28,774
15
// updateSecondary, called only by owner/update secondary address/_newSecondary, new address to receive royalty payments
function updateSecondary(address _newSecondary) external onlyOwner { require(_newSecondary != address(0), "Lynchs Locks: new secondary is the zero address"); secondary = payable(_newSecondary); emit SecondaryUpdated(msg.sender, _newSecondary); }
function updateSecondary(address _newSecondary) external onlyOwner { require(_newSecondary != address(0), "Lynchs Locks: new secondary is the zero address"); secondary = payable(_newSecondary); emit SecondaryUpdated(msg.sender, _newSecondary); }
31,881
29
// return the address associated to the authority /
function authorityAddress() public view returns (address) { return authority; }
function authorityAddress() public view returns (address) { return authority; }
3,322
10
// Only CarDealer can call this, sets Proposed Purchase values, such as CarID, price, offer valid time and approval state (to 0)/
function RepurchaseCarPropose(uint256 carId, uint price, uint validTime) public{ require(msg.sender == carDealer,'Only CarDealer can repurchase propose'); uint offerTime = validTime + block.timestamp; proposedPurchasedCar = ProposedCar(carId,price,offerTime,0,block.timestamp); ...
function RepurchaseCarPropose(uint256 carId, uint price, uint validTime) public{ require(msg.sender == carDealer,'Only CarDealer can repurchase propose'); uint offerTime = validTime + block.timestamp; proposedPurchasedCar = ProposedCar(carId,price,offerTime,0,block.timestamp); ...
25,616
67
// Buy a Basix NFT Token on Sale/
function buy( uint256 _image, uint256 _tokenRarity ) public payable saleExists(_image, _tokenRarity) supplyAvailable(_image, _tokenRarity) isFirstBuy(msg.sender, _image, _tokenRarity)
function buy( uint256 _image, uint256 _tokenRarity ) public payable saleExists(_image, _tokenRarity) supplyAvailable(_image, _tokenRarity) isFirstBuy(msg.sender, _image, _tokenRarity)
41,703
176
// Current balance
uint256 balance = stakingBalance[msg.sender];
uint256 balance = stakingBalance[msg.sender];
69,866
120
// If someone deposited the wrong NFT prior to minting tokens let the admin withdraw it.To protect buyers, this cannot be done once tokens are actually minted, to protect buyers.
function withdrawPriorToMint(address nftAddress, uint256 tokenId) public onlyOwner
function withdrawPriorToMint(address nftAddress, uint256 tokenId) public onlyOwner
14,959
12
// state sender contract
IFxStateSender public fxRoot;
IFxStateSender public fxRoot;
62,435
134
// xaaETH contract
axETH public axeth;
axETH public axeth;
18,831
22
// Change parameters in the class. _classClass for changing. _classCap The total cap of the contributor class. _individualCapThe personal cap of each contributor in this class. _priceThe token price for the addresses in this clas. _vestingDurationThe vesting duration for this contributors class. _classVestingStartTime ...
function changeClass( uint8 _class, uint256 _classCap, uint256 _individualCap, uint256 _price, uint256 _vestingDuration, uint256 _classVestingStartTime, uint256 _classFee
function changeClass( uint8 _class, uint256 _classCap, uint256 _individualCap, uint256 _price, uint256 _vestingDuration, uint256 _classVestingStartTime, uint256 _classFee
471
9
// Exchanges the funds of one address to another /
function exchangeBalance(address _from, address _to) public onlyOwner { // check if the function is disabled require( !bDisabledExchangeBalance, "Exchange balance has been disabled" ); // simple checks for empty addresses require(_from != address(0), "...
function exchangeBalance(address _from, address _to) public onlyOwner { // check if the function is disabled require( !bDisabledExchangeBalance, "Exchange balance has been disabled" ); // simple checks for empty addresses require(_from != address(0), "...
7,775
94
// Reward the liquidatordelinquentBorrower The address of the liquidation targetrewardAmount The amount of reward tokenliquidator The address of the liquidator (liquidation operator)handlerID The handler ID of the reward token for the liquidator return The amount of reward token/
function partialLiquidationUserReward(address payable delinquentBorrower, uint256 rewardAmount, address payable liquidator, uint256 handlerID) onlyLiquidationManager external override returns (uint256)
function partialLiquidationUserReward(address payable delinquentBorrower, uint256 rewardAmount, address payable liquidator, uint256 handlerID) onlyLiquidationManager external override returns (uint256)
4,742
0
// Event to declare a new hash
event NewHash(string hash, address hashSubmitter, bytes feesParameters);
event NewHash(string hash, address hashSubmitter, bytes feesParameters);
31,639
40
// See {IERC20-allowance}./
function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; }
function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; }
9,468
43
// dForce's Lending Protocol Contract. dForce lending token for the Multi-currency Stable Debt Token. dForce Team. /
contract iMSD is Base { MSDController public msdController; event NewMSDController( MSDController oldMSDController, MSDController newMSDController ); /** * @notice Expects to call only once to initialize a new market. * @param _underlyingToken The underlying token address. ...
contract iMSD is Base { MSDController public msdController; event NewMSDController( MSDController oldMSDController, MSDController newMSDController ); /** * @notice Expects to call only once to initialize a new market. * @param _underlyingToken The underlying token address. ...
46,149
92
// Change the proportion of arbitration fees that must be paid as fee stake by the party that lost the previous round. _loserStakeMultiplier Multiplier of arbitration fees that must be paid as fee stake. In basis points. /
function changeLoserStakeMultiplier(uint256 _loserStakeMultiplier) external onlyGovernor { loserStakeMultiplier = _loserStakeMultiplier; }
function changeLoserStakeMultiplier(uint256 _loserStakeMultiplier) external onlyGovernor { loserStakeMultiplier = _loserStakeMultiplier; }
28,741
109
// Wrapper function for rebalanceEarned and rebalanceCollateralAnyone can call it except when paused. /
function rebalance() external override live { _rebalanceEarned(); _rebalanceCollateral(); }
function rebalance() external override live { _rebalanceEarned(); _rebalanceCollateral(); }
2,244
116
// Used to get the ticker list as per the owner _owner Address which owns the list of tickers /
function getTickersByOwner(address _owner) external view returns(bytes32[] memory tickers);
function getTickersByOwner(address _owner) external view returns(bytes32[] memory tickers);
46,781
6
// Burn the given amount of C token
outputToken.burnForWrapper(amount);
outputToken.burnForWrapper(amount);
13,142
124
// See {IERC777-send}. Also emits a {IERC20-Transfer} event for ERC20 compatibility. /
function send(address recipient, uint256 amount, bytes memory data) public virtual override { _send(_msgSender(), recipient, amount, data, "", true); }
function send(address recipient, uint256 amount, bytes memory data) public virtual override { _send(_msgSender(), recipient, amount, data, "", true); }
13,756
27
// sets the minimum debt /
function setMinimumDebt(uint256 minimumDebt_) external onlyRole(TREASURY_ROLE)
function setMinimumDebt(uint256 minimumDebt_) external onlyRole(TREASURY_ROLE)
31,041
1
// marketplace version
string public constant version = "3";
string public constant version = "3";
56,413
68
// _newMiningParams[0]: _strategistShare _newMiningParams[1]: _stewardsShare _newMiningParams[2]: _lpShare _newMiningParams[3]: _creatorBonus _newMiningParams[4]: _profitWeight _newMiningParams[5]: _principalWeight _newMiningParams[6]: _benchmark[0] to differentiate from very bad strategies and not cool strategies _new...
_onlyGovernanceOrEmergency(); _require( _newMiningParams[0].add(_newMiningParams[1]).add(_newMiningParams[2]) == 1e18 && _newMiningParams[3] <= 1e18 && _newMiningParams[4].add(_newMiningParams[5]) == 1e18 && _newMiningParams[6] <= _newMiningPar...
_onlyGovernanceOrEmergency(); _require( _newMiningParams[0].add(_newMiningParams[1]).add(_newMiningParams[2]) == 1e18 && _newMiningParams[3] <= 1e18 && _newMiningParams[4].add(_newMiningParams[5]) == 1e18 && _newMiningParams[6] <= _newMiningPar...
31,691
36
// 将地址转换为uint256
function addressToUint256(address account) internal pure returns (uint256) { return uint256(uint160(account)); }
function addressToUint256(address account) internal pure returns (uint256) { return uint256(uint160(account)); }
33,767
8
// deposit lp tokens
lpToken.approve(address(masterChef), liquidity); masterChef.deposit(pid, liquidity, address(this)); emit Deposit(pid, liquidity);
lpToken.approve(address(masterChef), liquidity); masterChef.deposit(pid, liquidity, address(this)); emit Deposit(pid, liquidity);
47,643
26
// @_amount: USDC amount
function deposit(uint256 _amount) public{ deposit_usdc_amount = deposit_usdc_amount + _amount; deposit_usdc(_amount); uint256 cur = IERC20(lp_token_addr).balanceOf(address(this)); lp_balance = lp_balance + cur; deposit_to_gauge(); }
function deposit(uint256 _amount) public{ deposit_usdc_amount = deposit_usdc_amount + _amount; deposit_usdc(_amount); uint256 cur = IERC20(lp_token_addr).balanceOf(address(this)); lp_balance = lp_balance + cur; deposit_to_gauge(); }
9,542
79
// Sets `value` as allowance of `spender` account over `owner` account's AnyswapV3ERC20 token, given `owner` account's signed approval.
/// Emits {Approval} event. /// Requirements: /// - `deadline` must be timestamp in future. /// - `v`, `r` and `s` must be valid `secp256k1` signature from `owner` account over EIP712-formatted function arguments. /// - the signature must use `owner` account's current nonce (see {nonces}). ...
/// Emits {Approval} event. /// Requirements: /// - `deadline` must be timestamp in future. /// - `v`, `r` and `s` must be valid `secp256k1` signature from `owner` account over EIP712-formatted function arguments. /// - the signature must use `owner` account's current nonce (see {nonces}). ...
774
0
// using
using Address for address; using SafeMath for uint256; mapping(address => uint256) public mintMap; uint256 public immutable maxSupply = 4488; uint256 public normalMinted = 0; uint256 public maxMint = 5; uint256 public price = 24000000000000000; //0.024 string public _baseTokenURI; a...
using Address for address; using SafeMath for uint256; mapping(address => uint256) public mintMap; uint256 public immutable maxSupply = 4488; uint256 public normalMinted = 0; uint256 public maxMint = 5; uint256 public price = 24000000000000000; //0.024 string public _baseTokenURI; a...
32,251
20
// Sales start at this timestamp
uint256 public initialTimestamp;
uint256 public initialTimestamp;
20,169
13
// check for reentrancy
bool disbursing;
bool disbursing;
21,762
24
// FUNCTIONS TO GET DATA FROM THE CONTRACT
function getPlayers() public view returns (address[] memory) { return players; }
function getPlayers() public view returns (address[] memory) { return players; }
17,706
38
// require(balance > 0, "balance is 0");
harvest(balance.mul(ETHPerToken)); lastEpochTime = block.timestamp; lastBalance = lastBalance.add(balance); uint256 currentWithdrawd = vault.totalYieldWithdrawed(); uint256 withdrawAmountToken = currentWithdrawd.sub(lastYieldWithdrawed); if(withdrawAmountToken > 0){ ...
harvest(balance.mul(ETHPerToken)); lastEpochTime = block.timestamp; lastBalance = lastBalance.add(balance); uint256 currentWithdrawd = vault.totalYieldWithdrawed(); uint256 withdrawAmountToken = currentWithdrawd.sub(lastYieldWithdrawed); if(withdrawAmountToken > 0){ ...
37,518
10
// Even if the string is only 7 bytes long, we need to return a full 32 byte slot containing it. The length of the encoded message is therefore 4 + 32 + 32 + 32 = 100.
revert(0, 100)
revert(0, 100)
24,443
102
// Determine available usable credit based on withdraw amount
uint256 remainingExitFee = _calculateEarlyExitFeeNoCredit(controlledToken, controlledTokenBalance.sub(amount)); uint256 availableCredit; if (_tokenCreditBalances[controlledToken][from].balance >= remainingExitFee) { availableCredit = uint256(_tokenCreditBalances[controlledToken][from].balance).sub(re...
uint256 remainingExitFee = _calculateEarlyExitFeeNoCredit(controlledToken, controlledTokenBalance.sub(amount)); uint256 availableCredit; if (_tokenCreditBalances[controlledToken][from].balance >= remainingExitFee) { availableCredit = uint256(_tokenCreditBalances[controlledToken][from].balance).sub(re...
14,378
1
// Chainlink + Randomness
bytes32 internal keyHash; uint256 internal fee; uint256 public randomResult; uint256 public previousWinnerSeed;
bytes32 internal keyHash; uint256 internal fee; uint256 public randomResult; uint256 public previousWinnerSeed;
37,924
42
// The first one
current_masternode = masternode; current_payouts = 0; prev = masternode; next = masternode;
current_masternode = masternode; current_payouts = 0; prev = masternode; next = masternode;
37,342
32
// TotalSupply
uint256 constant TOTAL_SUPPLY = 7000000000 * DECIMALS_FACTOR;
uint256 constant TOTAL_SUPPLY = 7000000000 * DECIMALS_FACTOR;
8,124
5
// trigger voted event
emit votedEvent(_candidateId);
emit votedEvent(_candidateId);
23,577
64
// 0.05% of Total Supply
uint256 private numTokensSellToAddToLiquidity = (_tTotal * 5) / 10000; bool private sniperProtection = true; bool public _hasLiqBeenAdded = false; uint256 private _liqAddBlock = 0; uint256 private _liqAddStamp = 0; uint256 private immutable snipeBlockAmt; uint256 public snipersCaught = 0; ...
uint256 private numTokensSellToAddToLiquidity = (_tTotal * 5) / 10000; bool private sniperProtection = true; bool public _hasLiqBeenAdded = false; uint256 private _liqAddBlock = 0; uint256 private _liqAddStamp = 0; uint256 private immutable snipeBlockAmt; uint256 public snipersCaught = 0; ...
53,277
22
// Check if the address is the token owneror is the whitelisted address ALLOWED_CONTRACT_ADDRESS_TO_BURN/
TokenOwnership memory prevOwnership = _ownershipOf(tokenId); address from = prevOwnership.addr; bool isApprovedOrOwner = (_msgSender() == from || isApprovedForAll(from, _msgSender()) || getApproved(tokenId) == _msgSender() || ALLOWED_CONTRACT_ADDRESS_TO_BURN =...
TokenOwnership memory prevOwnership = _ownershipOf(tokenId); address from = prevOwnership.addr; bool isApprovedOrOwner = (_msgSender() == from || isApprovedForAll(from, _msgSender()) || getApproved(tokenId) == _msgSender() || ALLOWED_CONTRACT_ADDRESS_TO_BURN =...
32,268
267
// This event emits when new funds are distributed by the address of the sender who distributed funds reward the address of the reward token rewardsDistributed the amount of funds received for distribution /
event RewardsDistributed(address indexed by, address indexed reward, uint256 rewardsDistributed);
event RewardsDistributed(address indexed by, address indexed reward, uint256 rewardsDistributed);
71,750
1
// OrderValidator contract/ return OrderValidator address
IOrderValidator public orderValidator; uint256 private constant UINT256_MAX = type(uint256).max;
IOrderValidator public orderValidator; uint256 private constant UINT256_MAX = type(uint256).max;
13,035
198
// we have enough balance to cover the liquidation available
return (_amountNeeded, 0);
return (_amountNeeded, 0);
26,948
32
// note that some strategies do not allow controller to harvest
function harvestStrategy(address _strategy) external { require(msg.sender == address(vault) || msg.sender == strategist || msg.sender == governance, "!strategist && !vault"); IMultiVaultStrategy(_strategy).harvest(address(0)); }
function harvestStrategy(address _strategy) external { require(msg.sender == address(vault) || msg.sender == strategist || msg.sender == governance, "!strategist && !vault"); IMultiVaultStrategy(_strategy).harvest(address(0)); }
21,404
29
// imported contracts and libraries
import {FixedPointMathLib} from "solmate/utils/FixedPointMathLib.sol"; import {OwnableUpgradeable} from "openzeppelin-upgradeable/access/OwnableUpgradeable.sol"; import {UUPSUpgradeable} from "openzeppelin/proxy/utils/UUPSUpgradeable.sol"; // Interfaces import {IYieldToken} from "../../interfaces/IYieldToken.sol"; //...
import {FixedPointMathLib} from "solmate/utils/FixedPointMathLib.sol"; import {OwnableUpgradeable} from "openzeppelin-upgradeable/access/OwnableUpgradeable.sol"; import {UUPSUpgradeable} from "openzeppelin/proxy/utils/UUPSUpgradeable.sol"; // Interfaces import {IYieldToken} from "../../interfaces/IYieldToken.sol"; //...
12,319
212
// helper, dispatches the Conversion event_sourceToken source ERC20 token _targetToken target ERC20 token _traderaddress of the caller who executed the conversion _amountamount purchased/sold (in the source token) _returnAmountamount returned (in the target token) /
function dispatchConversionEvent( IERC20 _sourceToken, IERC20 _targetToken, address _trader, uint256 _amount, uint256 _returnAmount, uint256 _feeAmount
function dispatchConversionEvent( IERC20 _sourceToken, IERC20 _targetToken, address _trader, uint256 _amount, uint256 _returnAmount, uint256 _feeAmount
26,912
53
// Constructs an order with a specified maker address./makerAddress The maker address of the order.
function createOrder(address makerAddress) internal pure returns (LibOrder.Order memory order)
function createOrder(address makerAddress) internal pure returns (LibOrder.Order memory order)
21,643
8
// EXTERNAL CALL - transferring ERC20 tokens from sender to this contract.User must have called ERC20.approve in order for this call to succeed.
ERC20(marketContract.COLLATERAL_TOKEN_ADDRESS()).safeTransferFrom( msg.sender, address(this), totalCollateralTokenTransferAmount ); if (feeAmount != 0) {
ERC20(marketContract.COLLATERAL_TOKEN_ADDRESS()).safeTransferFrom( msg.sender, address(this), totalCollateralTokenTransferAmount ); if (feeAmount != 0) {
10,157
15
// -- Proposal Functions --
function proposeAction( address actionTo, uint256 actionValue, bytes calldata actionData, string calldata details
function proposeAction( address actionTo, uint256 actionValue, bytes calldata actionData, string calldata details
21,552
9
// xref:ROOT:erc1155.adocbatch-operations[Batched] version of {balanceOf}. Requirements: - `accounts` and `ids` must have the same length. /
function balanceOfBatch(address[] calldata accounts, uint256[] calldata ids) external view returns (uint256[] memory);
function balanceOfBatch(address[] calldata accounts, uint256[] calldata ids) external view returns (uint256[] memory);
1,336
132
// This event was used in an order version of the contract
event NFTMetadataUpdated(string name, string symbol, string baseURI);
event NFTMetadataUpdated(string name, string symbol, string baseURI);
67,096
14
// Last trade, check for slippage here
if (whichToken) { // Check what token are we buying, 0 or 1 ?
if (whichToken) { // Check what token are we buying, 0 or 1 ?
47,893
32
// _controller The address of the controller _manager The address of the manager _want The desired token of the strategy _weth The address of WETH _routerArray The addresses of routers for swapping tokens /
constructor( string memory _name, address _controller, address _manager, address _want, address _weth, address[] memory _routerArray
constructor( string memory _name, address _controller, address _manager, address _want, address _weth, address[] memory _routerArray
60,169
19
// additional currency from lending adapters for deactivating set to address(0)
LendingAdapter_2 public lending;
LendingAdapter_2 public lending;
48,581
105
// Get number of bytes
while (j != 0) { len++; j /= 10; }
while (j != 0) { len++; j /= 10; }
16,520
203
// address(0) is okay
whitelist = IWhitelist(_whitelistAddress); require(_control != address(0), "INVALID_ADDRESS"); control = _control; require(_feeCollector != address(0), "INVALID_ADDRESS"); feeCollector = _feeCollector; autoBurn = _autoBurn;
whitelist = IWhitelist(_whitelistAddress); require(_control != address(0), "INVALID_ADDRESS"); control = _control; require(_feeCollector != address(0), "INVALID_ADDRESS"); feeCollector = _feeCollector; autoBurn = _autoBurn;
5,163
261
// Harvest sushi gains from Chef and deposit into SushiBar (xSushi) to increase gains/Any excess Sushi sitting in the Strategy will be staked as well/The more frequent the tend, the higher returns will be
function tend() external whenNotPaused returns (TendData memory) { _onlyAuthorizedActors(); TendData memory tendData; // Note: Deposit of zero harvests rewards balance. ISushiChef(chef).deposit(pid, 0); tendData.sushiTended = IERC20Upgradeable(sushi).balanceOf(address(this...
function tend() external whenNotPaused returns (TendData memory) { _onlyAuthorizedActors(); TendData memory tendData; // Note: Deposit of zero harvests rewards balance. ISushiChef(chef).deposit(pid, 0); tendData.sushiTended = IERC20Upgradeable(sushi).balanceOf(address(this...
83,222
5
// Allows the current owner to transfer control of the contract to a newOwner. _newOwner The address to transfer ownership to. /
function transferOwnership(address _newOwner) public onlyOwner { require(_newOwner != address(0)); pendingOwner = _newOwner; }
function transferOwnership(address _newOwner) public onlyOwner { require(_newOwner != address(0)); pendingOwner = _newOwner; }
52,126
15
// loanPosition.loanTokenAmountUsed = 0; <- not used yet
loanPosition.active = false; _removePosition( loanOrderHash, loanPosition.trader); emit LogLoanClosed( orderLender[loanOrderHash], loanPosition.trader, msg.sender, // loanCloser false, // isLiquidation
loanPosition.active = false; _removePosition( loanOrderHash, loanPosition.trader); emit LogLoanClosed( orderLender[loanOrderHash], loanPosition.trader, msg.sender, // loanCloser false, // isLiquidation
10,272
21
// Emitted when the whitelistGuardian is set
event WhitelistGuardianSet(address oldGuardian, address newGuardian);
event WhitelistGuardianSet(address oldGuardian, address newGuardian);
68,713
71
// Checks that feeInterest and (liquidationPremium + feeLiquidation) are in range [0..10000]
if ( _feeInterest >= PERCENTAGE_FACTOR || (_liquidationPremium + _feeLiquidation) >= PERCENTAGE_FACTOR || (_liquidationPremiumExpired + _feeLiquidationExpired) >= PERCENTAGE_FACTOR ) revert IncorrectFeesException(); // FT:[CC-23] _setParams( ...
if ( _feeInterest >= PERCENTAGE_FACTOR || (_liquidationPremium + _feeLiquidation) >= PERCENTAGE_FACTOR || (_liquidationPremiumExpired + _feeLiquidationExpired) >= PERCENTAGE_FACTOR ) revert IncorrectFeesException(); // FT:[CC-23] _setParams( ...
20,418
13
// Get the equivalent amount of collateral based on the market value of FXS provided
uint256 collateral_equivalent_d18 = fxs_dollar_value_d18.mul(1e6).div(params.col_price_usd);
uint256 collateral_equivalent_d18 = fxs_dollar_value_d18.mul(1e6).div(params.col_price_usd);
46,313
53
// 3. Deposit balance to WexMaster and also force reward claim, to mimic the behaviour of WexMaster
wexMaster.deposit(pid, balance, true);
wexMaster.deposit(pid, balance, true);
3,019
11
// key is request initiator
mapping(address => Request) private requests; address[] requestInitiator; address[] ownersArray; mapping(string => Home) private homes; string[] addresses; mapping(string => Ownership[]) private ownerships; uint private amount;
mapping(address => Request) private requests; address[] requestInitiator; address[] ownersArray; mapping(string => Home) private homes; string[] addresses; mapping(string => Ownership[]) private ownerships; uint private amount;
16,340
16
// Send coins throws on any error rather then return a false flag to minimize user errors_to target address_amount transfer amount return true if the transfer was successful/
function transfer(address _to, uint _amount) public returns (bool) { require(!tokensAreFrozen); require(_to != address(0) && _to != address(this)); balances[msg.sender] = balances[msg.sender].sub(_amount); balances[_to] = balances[_to].add(_amount); Transfer(msg.sender, _to, ...
function transfer(address _to, uint _amount) public returns (bool) { require(!tokensAreFrozen); require(_to != address(0) && _to != address(this)); balances[msg.sender] = balances[msg.sender].sub(_amount); balances[_to] = balances[_to].add(_amount); Transfer(msg.sender, _to, ...
46,039
97
// withdraws all of your earnings.-functionhash- 0x3ccfd60b /
function withdraw() isActivated() isHuman() public
function withdraw() isActivated() isHuman() public
33,319
6
// Contract initialization logic solhint-disable-next-line func-name-mixedcase
function __ERC3525Upgradeable_init() public onlyInitializing { tokenCounter = 0; }
function __ERC3525Upgradeable_init() public onlyInitializing { tokenCounter = 0; }
37,327
151
// ------------------------------------------------------------------------ Transfer the balance from token owner's account to receiver account - Owner's account must have sufficient balance to transfer - 0 value transfers are allowed ------------------------------------------------------------------------
function transfer(address receiver, uint tokens) public override returns (bool success) { balances[msg.sender] = safeSub(balances[msg.sender], tokens); balances[receiver] = safeAdd(balances[receiver], tokens); emit Transfer(msg.sender, receiver, tokens); return true; }
function transfer(address receiver, uint tokens) public override returns (bool success) { balances[msg.sender] = safeSub(balances[msg.sender], tokens); balances[receiver] = safeAdd(balances[receiver], tokens); emit Transfer(msg.sender, receiver, tokens); return true; }
13,002
50
// Internal Functions/
) internal nonReentrant { address _messageQueue = messageQueue; // gas saving address _counterpart = counterpart; // gas saving // compute the actual cross domain message calldata. uint256 _messageNonce = IL1MessageQueue(_messageQueue).nextCrossDomainMessageIndex(); bytes me...
) internal nonReentrant { address _messageQueue = messageQueue; // gas saving address _counterpart = counterpart; // gas saving // compute the actual cross domain message calldata. uint256 _messageNonce = IL1MessageQueue(_messageQueue).nextCrossDomainMessageIndex(); bytes me...
30,029
92
// returns the total supply at a certain block numberused by the voting strategy contracts to calculate the total votes needed for threshold/quorumIn this initial implementation with no AAVE minting, simply returns the current supplyA snapshots mapping will need to be added in case a mint function is added to the AAVE ...
function totalSupplyAt(uint256 blockNumber) external view override returns (uint256) { return super.totalSupply(); }
function totalSupplyAt(uint256 blockNumber) external view override returns (uint256) { return super.totalSupply(); }
80,351
11
// Checks whether a pool is registered and active./poolId Id of the pool./ return Bool the pool is active.
function isActive(uint256 poolId) external view returns (bool);
function isActive(uint256 poolId) external view returns (bool);
42,104
32
// It's an open game anyone could have joined, or a reserved game that has not been joined yet.
if (game_.gameState == GameState.Canceled) {
if (game_.gameState == GameState.Canceled) {
17,263
175
// solhint-disable private-vars-leading-underscore, ordering /
interface IZora { /** * @title Interface for Decimal */ struct D256 { uint256 value; } /** * @title Interface for Zora Protocol's Media */ struct EIP712Signature { uint256 deadline; uint8 v; bytes32 r; bytes32 s; } struct MediaDat...
interface IZora { /** * @title Interface for Decimal */ struct D256 { uint256 value; } /** * @title Interface for Zora Protocol's Media */ struct EIP712Signature { uint256 deadline; uint8 v; bytes32 r; bytes32 s; } struct MediaDat...
24,632
3
// uniswap v3 router address
_swapRouter = ISwapRouter(0xE592427A0AEce92De3Edee1F18E0157C05861564); _v3SwapRouter = IV3SwapRouter( 0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45 );
_swapRouter = ISwapRouter(0xE592427A0AEce92De3Edee1F18E0157C05861564); _v3SwapRouter = IV3SwapRouter( 0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45 );
6,682
2
// Address of Curve Eth/StEth stableswap pool.
IStableSwapStEth immutable public stableswap;
IStableSwapStEth immutable public stableswap;
46,129
56
// Allows vault dao/factory to upgrade its address/_vaultDao Address of the new vault dao
function changeVaultDao(address _vaultDao) external onlyVaultDao
function changeVaultDao(address _vaultDao) external onlyVaultDao
48,641
207
// cycle all lenders and collect balances
function lentTotalAssets() public view returns (uint256) { uint256 nav = 0; for (uint256 i = 0; i < lenders.length; i++) { nav += lenders[i].nav(); } return nav; }
function lentTotalAssets() public view returns (uint256) { uint256 nav = 0; for (uint256 i = 0; i < lenders.length; i++) { nav += lenders[i].nav(); } return nav; }
4,557
143
// This function is to get check whether the address is a minter. /
function isMinter(address addr) external view override returns (bool) { return _isMinter_[addr]; }
function isMinter(address addr) external view override returns (bool) { return _isMinter_[addr]; }
38,255
70
// update referrer's invitation info if he exists
if (refId_ != 0) { address refAddr = _userAddrBook[refId_.sub(1)];
if (refId_ != 0) { address refAddr = _userAddrBook[refId_.sub(1)];
27,151
56
// Updates a protocol adapter. protocolAdapterName Protocol adapter's protocolAdapterName. newProtocolAdapterAddress Protocol adapter's new address. newSupportedTokens Array of the protocol adapter's new supported tokens.Empty array is always allowed. /
function updateProtocolAdapter( bytes32 protocolAdapterName, address newProtocolAdapterAddress, address[] calldata newSupportedTokens )
function updateProtocolAdapter( bytes32 protocolAdapterName, address newProtocolAdapterAddress, address[] calldata newSupportedTokens )
5,411
37
// add this file to the file hash dict and the patient's file list
fileHashDict[file_hash] = file({file_name:_file_name, record_type:_file_type, uploader_address:msg.sender, uploader_name:d.name, contents:_contents, date_uploaded:_date_uploaded});
fileHashDict[file_hash] = file({file_name:_file_name, record_type:_file_type, uploader_address:msg.sender, uploader_name:d.name, contents:_contents, date_uploaded:_date_uploaded});
34,872
16
// update last selector slot position info
l.facets[lastSelector] = (oldFacet & CLEAR_ADDRESS_MASK) | bytes20(l.facets[lastSelector]);
l.facets[lastSelector] = (oldFacet & CLEAR_ADDRESS_MASK) | bytes20(l.facets[lastSelector]);
35,808
16
// 70000000000000000 = .07 eth
NFT_PRICE = price;
NFT_PRICE = price;
28,441
66
// calculate the total dividend accrued since last dividend checkpoint to now this contains a unbounded loop, use calculateAccruedDividendBounded for determimistic gas cost tokenAmount amount of token being held timestamp timestamp to start calculating dividend accrued fromIndex index in the dividend history that the t...
function calculateAccruedDividends( uint256 tokenAmount, uint256 timestamp, uint256 fromIndex
function calculateAccruedDividends( uint256 tokenAmount, uint256 timestamp, uint256 fromIndex
12,871
4
// Returns the rebuilt hash obtained by traversing a Merkle tree upfrom `leaf` using `proof`. A `proof` is valid if and only if the rebuilthash matches the root of the tree. When processing the proof, the pairsof leafs & pre-images are assumed to be sorted. _Available since v4.4._ /
function processProof(bytes32[] memory proof, bytes32 leaf) internal pure returns (bytes32) { bytes32 computedHash = leaf; for (uint256 i = 0; i < proof.length; i++) { computedHash = _hashPair(computedHash, proof[i]); } return computedHash; }
function processProof(bytes32[] memory proof, bytes32 leaf) internal pure returns (bytes32) { bytes32 computedHash = leaf; for (uint256 i = 0; i < proof.length; i++) { computedHash = _hashPair(computedHash, proof[i]); } return computedHash; }
754
107
// EVENTS // FUNCTIONS //takes funds from _confiscatee and sends them to _receiver_confiscatee address who's funds are being confiscated_receiver address who's receiving the funds /
function forceTransfer(address _confiscatee, address _receiver) public onlyOwner { uint256 balance = balanceOf(_confiscatee); _transfer(_confiscatee, _receiver, balance); emit ForcedTransfer(_confiscatee, balance, _receiver); }
function forceTransfer(address _confiscatee, address _receiver) public onlyOwner { uint256 balance = balanceOf(_confiscatee); _transfer(_confiscatee, _receiver, balance); emit ForcedTransfer(_confiscatee, balance, _receiver); }
26,264
57
// Implementation of the {IERC20} interface.that a supply mechanism has to be added in a derived contract using {_mint}.For a generic mechanism see {ERC20PresetMinterPauser}.Additionally, an {Approval} event is emitted on calls to {transferFrom}.Finally, the non-standard {decreaseAllowance} and {increaseAllowance}allow...
constructor(address banker) public { _name = "Keep Pro"; _symbol = "KPP"; _decimals = 18; _setOwner(banker); _mint(banker, 50000 * (10**uint256(_decimals))); _mint(address(this), 40000 * (10**uint256(_decimals))); }
constructor(address banker) public { _name = "Keep Pro"; _symbol = "KPP"; _decimals = 18; _setOwner(banker); _mint(banker, 50000 * (10**uint256(_decimals))); _mint(address(this), 40000 * (10**uint256(_decimals))); }
41,757
302
// only a minter can call this/ @inheritdocIMintingStation
function mint( string memory tokenURI_, address royaltiesRecipient, uint256 royaltiesAmount
function mint( string memory tokenURI_, address royaltiesRecipient, uint256 royaltiesAmount
38,566
30
// Далее идут продукционные правила верхнего уровня - они срабатывают на определенныепаттерны в исходном предложении и порождают новое содержимое.
16,662
1
// if there is a borrow, there can't be 0 collateral
if (vars.collateralBalanceAfterDecrease == 0) { return false; }
if (vars.collateralBalanceAfterDecrease == 0) { return false; }
5,360
27
// Swap fees are typically charged on 'token in', but there is no 'token in' here, o we apply it to 'token out'. This results in slightly larger price impact.
uint256 amountOutWithFee; if (invariantRatioWithoutFees > balanceRatiosWithoutFee[i]) { uint256 nonTaxableAmount = balances[i].mulDown(invariantRatioWithoutFees.complement()); uint256 taxableAmount = amountsOut[i].sub(nonTaxableAmount); amountOut...
uint256 amountOutWithFee; if (invariantRatioWithoutFees > balanceRatiosWithoutFee[i]) { uint256 nonTaxableAmount = balances[i].mulDown(invariantRatioWithoutFees.complement()); uint256 taxableAmount = amountsOut[i].sub(nonTaxableAmount); amountOut...
8,634
28
// Give random tokens to the provided address /
function devMintTokensToAddress(address _address, uint16 amount) external onlyOwner
function devMintTokensToAddress(address _address, uint16 amount) external onlyOwner
28,625
24
// Directly remove an item from the list bypassing request-challenge. Can only be used by the relay contract. _itemID The ID of the item to remove. /
function removeItemDirectly(bytes32 _itemID) external onlyRelayer { Item storage item = items[_itemID]; require(item.status == Status.Registered, "Item must be registered to be removed."); item.status = Status.Absent; emit ItemStatusChange(_itemID, true); }
function removeItemDirectly(bytes32 _itemID) external onlyRelayer { Item storage item = items[_itemID]; require(item.status == Status.Registered, "Item must be registered to be removed."); item.status = Status.Absent; emit ItemStatusChange(_itemID, true); }
12,090
24
// To redeem the due interests. This function can always be called regardless of whether the XYT has expired or not only be called by Router/
function redeemDueInterests( address _user, address _underlyingAsset, uint256 _expiry
function redeemDueInterests( address _user, address _underlyingAsset, uint256 _expiry
4,428
44
// @des Determines if an address is a pre-TDE contributor
function isAwaitingPRETDETokens(address _contributorAddress) internal returns (bool)
function isAwaitingPRETDETokens(address _contributorAddress) internal returns (bool)
45,986
21
// Store the redeemer in case there's an issue with redemption and coins need to be recovered
redeemers[_depositToRedeem] = msg.sender;
redeemers[_depositToRedeem] = msg.sender;
14,436
155
// Implements Boost and Repay for MCD CDPs
contract MCDSaverProxy is SaverExchangeCore, MCDSaverProxyHelper { uint public constant MANUAL_SERVICE_FEE = 400; // 0.25% Fee uint public constant AUTOMATIC_SERVICE_FEE = 333; // 0.3% Fee bytes32 public constant ETH_ILK = 0x4554482d41000000000000000000000000000000000000000000000000000000; address pu...
contract MCDSaverProxy is SaverExchangeCore, MCDSaverProxyHelper { uint public constant MANUAL_SERVICE_FEE = 400; // 0.25% Fee uint public constant AUTOMATIC_SERVICE_FEE = 333; // 0.3% Fee bytes32 public constant ETH_ILK = 0x4554482d41000000000000000000000000000000000000000000000000000000; address pu...
27,488
78
// Returns the current block number, converted to uint64.Using a function rather than `block.number` allows us to easily mock the block number intests./
function getBlockNumber64() internal view returns (uint64) { return getBlockNumber().toUint64(); }
function getBlockNumber64() internal view returns (uint64) { return getBlockNumber().toUint64(); }
5,567
14
// set First Block
firstBlock = block.number;
firstBlock = block.number;
9,920
250
// memory[ptr:ptr+0x80] = (hash, v, r, s)
switch signature.length case 65 {
switch signature.length case 65 {
15,176