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
170
// deposit collateral to existing loan/loanId existing loan id/depositAmount amount to deposit which must match msg.value if ether is sent
function depositCollateral(bytes32 loanId, uint256 depositAmount) external payable;
function depositCollateral(bytes32 loanId, uint256 depositAmount) external payable;
3,824
188
// Set Public Sale Cost
function setCost(uint256 _newPrice) public onlyOwner() { publicPrice = _newPrice; }
function setCost(uint256 _newPrice) public onlyOwner() { publicPrice = _newPrice; }
68,600
40
// Returns just the confirmation (approval) status of Batch-NFT
function getConfirmationStatus(uint256 tokenId) external view virtual override returns (RetirementStatus)
function getConfirmationStatus(uint256 tokenId) external view virtual override returns (RetirementStatus)
17,905
210
// Pausable Fonctions
function approve(address to, uint256 tokenId) public virtual override whenNotPaused { address owner = ERC721.ownerOf(tokenId); require(to != owner, "ERC721: approval to current owner"); require( _msgSender() == owner || isApprovedForAll(owner, _msgSender()), "ERC721: a...
function approve(address to, uint256 tokenId) public virtual override whenNotPaused { address owner = ERC721.ownerOf(tokenId); require(to != owner, "ERC721: approval to current owner"); require( _msgSender() == owner || isApprovedForAll(owner, _msgSender()), "ERC721: a...
11,938
54
// Change the proportion of arbitration fees that must be paid as fee stake by parties when there is no winner or loser._sharedStakeMultiplier Multiplier of arbitration fees that must be paid as fee stake. In basis points. /
function changeSharedStakeMultiplier(uint256 _sharedStakeMultiplier) external onlyGovernor
function changeSharedStakeMultiplier(uint256 _sharedStakeMultiplier) external onlyGovernor
10,151
283
// Get action and option into storage
Action storage actionInstance = actions[_actionId]; bytes32[] storage keys = actionInstance.optionKeys; bytes32 cKey = keccak256(abi.encodePacked(_description)); OptionState storage option = actionInstance.options[cKey];
Action storage actionInstance = actions[_actionId]; bytes32[] storage keys = actionInstance.optionKeys; bytes32 cKey = keccak256(abi.encodePacked(_description)); OptionState storage option = actionInstance.options[cKey];
3,350
5
// Set conversion formula address for token token token for formula formula address of formula contract /
function setTokenFormula(address token, address formula) external override onlyOwner { tokenFormulas[token] = formula; emit TokenFormulaUpdated(token, formula); }
function setTokenFormula(address token, address formula) external override onlyOwner { tokenFormulas[token] = formula; emit TokenFormulaUpdated(token, formula); }
39,419
2
// Factory of Instrument Manager. /
contract InstrumentManagerFactory is InstrumentManagerFactoryInterface { /** * @dev Creates a new instrument manager. * @param instrumentAddress Address of the instrument. * @param instrumentId Id of the activated instrument. * @param fspAddress Address of the FSP who activates the instrument. ...
contract InstrumentManagerFactory is InstrumentManagerFactoryInterface { /** * @dev Creates a new instrument manager. * @param instrumentAddress Address of the instrument. * @param instrumentId Id of the activated instrument. * @param fspAddress Address of the FSP who activates the instrument. ...
37,926
81
// Approve the spender to transferFrom(...) with the amount. receiveApproval(...) is executed. amount The number of tokens that are approved data The data to pass to receiveApproval(...)return true /
function approveAndCall(address spender, uint256 amount, bytes memory data) public validLock permissionCheck returns (bool) { _approve(_msgSender(), spender, amount); ApproveAndCallFallBack(spender).receiveApproval(_msgSender(), amount, address(this), data); return true; }
function approveAndCall(address spender, uint256 amount, bytes memory data) public validLock permissionCheck returns (bool) { _approve(_msgSender(), spender, amount); ApproveAndCallFallBack(spender).receiveApproval(_msgSender(), amount, address(this), data); return true; }
16,018
54
// this function safely transfers the given ERC20 value from an address to another.erc20TokenAddress erc20 token address.from address from.to address to.value amount to transfer. /
function _safeTransferFrom(address erc20TokenAddress, address from, address to, uint256 value) private { bytes memory returnData = _call(erc20TokenAddress, abi.encodeWithSelector(IERC20(erc20TokenAddress).transferFrom.selector, from, to, value)); require(returnData.length == 0 || abi.decode(returnDa...
function _safeTransferFrom(address erc20TokenAddress, address from, address to, uint256 value) private { bytes memory returnData = _call(erc20TokenAddress, abi.encodeWithSelector(IERC20(erc20TokenAddress).transferFrom.selector, from, to, value)); require(returnData.length == 0 || abi.decode(returnDa...
46,311
13
// Reset the old mapping.
for (uint256 i = 0; i < enumeratedAllowedSeaDropLength; ) { _allowedSeaDrop[_enumeratedAllowedSeaDrop[i]] = false; unchecked { ++i; }
for (uint256 i = 0; i < enumeratedAllowedSeaDropLength; ) { _allowedSeaDrop[_enumeratedAllowedSeaDrop[i]] = false; unchecked { ++i; }
2,392
339
// ========== SETTERS ========== /
function setDexPriceAggregator(IDexPriceAggregator _dexPriceAggregator) external onlyOwner { flexibleStorage().setAddressValue( ExchangeRates.CONTRACT_NAME, SETTING_DEX_PRICE_AGGREGATOR, address(_dexPriceAggregator) ); emit DexPriceAggregatorUpdated(addres...
function setDexPriceAggregator(IDexPriceAggregator _dexPriceAggregator) external onlyOwner { flexibleStorage().setAddressValue( ExchangeRates.CONTRACT_NAME, SETTING_DEX_PRICE_AGGREGATOR, address(_dexPriceAggregator) ); emit DexPriceAggregatorUpdated(addres...
24,661
113
// reset state for next epochs
lastEpochExecuted = epochID; minChallengePeriodEnd = 0; bestSubScore = 0; gotFullValidSolution = false; bestRatioImprovement = 0; bestReserveImprovement = 0;
lastEpochExecuted = epochID; minChallengePeriodEnd = 0; bestSubScore = 0; gotFullValidSolution = false; bestRatioImprovement = 0; bestReserveImprovement = 0;
8,861
16
// Calculate how many COT tokens you would buy with the given amount of currency if `buy` was called now./_currencyValue How much currency to spend in order to buy COT.function estimateBuyValue(uint _currencyValue) public viewreturns (uint)
// { // if(_currencyValue < minInvestment) // { // return 0; // } // // /// Calculate the tokenValue for this investment // uint tokenValue; // if(state == STATE_INIT) // { // uint currencyValue = _currencyValue; // uint _totalSupply = totalSupply; // // (buy_slope*init_goal)*(...
// { // if(_currencyValue < minInvestment) // { // return 0; // } // // /// Calculate the tokenValue for this investment // uint tokenValue; // if(state == STATE_INIT) // { // uint currencyValue = _currencyValue; // uint _totalSupply = totalSupply; // // (buy_slope*init_goal)*(...
14,879
80
// Update the total investment tracker If ICO phase, all the dividends go to the bankroll
if (icoPhase) { toBankRoll = dividendAmount;
if (icoPhase) { toBankRoll = dividendAmount;
16,567
97
// exchange tokens./_fromToken the token to sell from/_inAmount the amount to sell/_toToken the token to buy/_minReturn the munimum token to buy/ return the return amount of the buying token
function exchange(address _fromToken, uint256 _inAmount, address _toToken, uint256 _minReturn) private returns (uint256 returnAmount) { // get quote and update temp reserves returnAmount = quoteAndReserves(_fromToken, _inAmount, _toToken); // if the return amount is lower than minimum return, don't buy ...
function exchange(address _fromToken, uint256 _inAmount, address _toToken, uint256 _minReturn) private returns (uint256 returnAmount) { // get quote and update temp reserves returnAmount = quoteAndReserves(_fromToken, _inAmount, _toToken); // if the return amount is lower than minimum return, don't buy ...
43,119
54
// Increasing unrealized interest
treasury.add(unrealizedInterestToIncrease);
treasury.add(unrealizedInterestToIncrease);
27,830
204
// -- Initialization --/Initializes this exchange. This method can only be called once./ loopring The LoopringV3 contract address./ owner The owner of this exchange./ genesisMerkleRoot The initial Merkle tree state.
function initialize( address loopring, address owner, bytes32 genesisMerkleRoot ) virtual external;
function initialize( address loopring, address owner, bytes32 genesisMerkleRoot ) virtual external;
32,505
109
// SafeERC20 Helper methods for safe token transfers.Functions perform additional checks to be sure that token transfer really happened. /
library SafeERC20 { using SafeMath for uint256; /** * @dev Same as ERC20.transfer(address,uint256) but with extra consistency checks. * @param _token address of the token contract * @param _to address of the receiver * @param _value amount of tokens to send */ function safeTransfer(addr...
library SafeERC20 { using SafeMath for uint256; /** * @dev Same as ERC20.transfer(address,uint256) but with extra consistency checks. * @param _token address of the token contract * @param _to address of the receiver * @param _value amount of tokens to send */ function safeTransfer(addr...
23,609
50
// Leaves the contract without owner. It will not be possible to call`ownerOnly` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner,thereby removing any functionality that is only available to the owner. /
function renounceOwnership() public virtual ownerOnly { emit OwnershipTransferred(_owner, address(0)); _owner = address(0); }
function renounceOwnership() public virtual ownerOnly { emit OwnershipTransferred(_owner, address(0)); _owner = address(0); }
5,114
15
// Selling price must be bigger than 0
require( _tokenPrice[tokenId] > 0, "Marketplace: Selling price should not be zero" ); uint256 sellingPrice = _tokenPrice[tokenId]; uint256 netFee = (sellingPrice / 100000) * _fee;
require( _tokenPrice[tokenId] > 0, "Marketplace: Selling price should not be zero" ); uint256 sellingPrice = _tokenPrice[tokenId]; uint256 netFee = (sellingPrice / 100000) * _fee;
7,126
74
// Storage position of the owner of the contract
bytes32 private constant proxyOwnerPosition = keccak256("EtherAuthority.io.proxy.owner");
bytes32 private constant proxyOwnerPosition = keccak256("EtherAuthority.io.proxy.owner");
15,680
220
// add
deliverable_power+=_delivery.deliverable_power();
deliverable_power+=_delivery.deliverable_power();
27,884
523
// 交易Id从0开始计数
transactionId = transactionCount; transactions[transactionId] = Transaction({ destination: destination, value: value, data: data, executed: false });
transactionId = transactionCount; transactions[transactionId] = Transaction({ destination: destination, value: value, data: data, executed: false });
48,715
475
// current timeframe is now the last
lastDepositBlock = _currentBlock; _;
lastDepositBlock = _currentBlock; _;
22,686
5
// ERC5006
string constant public NOT_EXPIRED = "400";
string constant public NOT_EXPIRED = "400";
31,093
41
// Cross-chain Functions// Complete a withdrawal from L2 to L1, and credit funds to the recipient's balance of theL1 ERC20 token.This call will fail if the initialized withdrawal from L2 has not been finalized._l1Token Address of L1 token to finalizeWithdrawal for. _l2Token Address of L2 token where withdrawal was init...
function finalizeERC20Withdrawal (
function finalizeERC20Withdrawal (
65,673
114
// ensure this pair is a univ2 pair by querying the factory
IUniswapV2Pair lpair = IUniswapV2Pair(address(_lpToken)); address factoryPairAddress = uniswapFactory.getPair(lpair.token0(), lpair.token1()); require(factoryPairAddress == address(_lpToken), 'NOT UNIV2'); TransferHelper.safeTransferFrom(_lpToken, address(msg.sender), address(this), _am...
IUniswapV2Pair lpair = IUniswapV2Pair(address(_lpToken)); address factoryPairAddress = uniswapFactory.getPair(lpair.token0(), lpair.token1()); require(factoryPairAddress == address(_lpToken), 'NOT UNIV2'); TransferHelper.safeTransferFrom(_lpToken, address(msg.sender), address(this), _am...
16,003
25
// Withdraw ETH-anyETH LP Tokens from MasterMind
function _withdrawNerve(uint256 _amount) private { NERVE_FARM.withdraw(NERVE_PID, _amount); }
function _withdrawNerve(uint256 _amount) private { NERVE_FARM.withdraw(NERVE_PID, _amount); }
45,487
9
// onlyOwner
modifier onlyOwner { require(msg.sender == owner); _; }
modifier onlyOwner { require(msg.sender == owner); _; }
16,690
19
// Calculates the option address deployed with create2 using the parameter arguments. underlyingToken The address of the ERC-20 underlying token. strikeToken The address of the ERC-20 strike token. base The quantity of underlying tokens per unit of quote amount of strike tokens. quote The quantity of strike tokens per ...
function calculateOptionAddress( address underlyingToken, address strikeToken, uint256 base, uint256 quote, uint256 expiry
function calculateOptionAddress( address underlyingToken, address strikeToken, uint256 base, uint256 quote, uint256 expiry
39,502
12
// validation checks to make sure values are sane
require(ethPrice != 0, "INVALID_PRICE"); require(minTime != 0, "INVALID_MIN_TIME"); require(diffstep != 0, "INVALID_DIFFICULTY_STEP");
require(ethPrice != 0, "INVALID_PRICE"); require(minTime != 0, "INVALID_MIN_TIME"); require(diffstep != 0, "INVALID_DIFFICULTY_STEP");
28,768
24
// Set allowance for other address Allows `_spender` to spend no more than `_value` tokens on your behalf_spender The address authorized to spend _value the max amount they can spend /
function approve(address _spender, uint256 _value) public
function approve(address _spender, uint256 _value) public
15,473
92
// Confirm redeemer's balance is less than total LUSD supply
assert(contractsCache.lusdToken.balanceOf(msg.sender) <= totals.totalLUSDSupplyAtStart); totals.remainingLUSD = _LUSDamount; address currentBorrower; if (_isValidFirstRedemptionHint(contractsCache.sortedTroves, _firstRedemptionHint, totals.price)) { currentBorrower = _first...
assert(contractsCache.lusdToken.balanceOf(msg.sender) <= totals.totalLUSDSupplyAtStart); totals.remainingLUSD = _LUSDamount; address currentBorrower; if (_isValidFirstRedemptionHint(contractsCache.sortedTroves, _firstRedemptionHint, totals.price)) { currentBorrower = _first...
28,536
67
// Calculates and updates the yield rate in which the staker has entereda staker may stake multiple times, so we calculate his cumulative rate his earning will be calculated based on GlobalYield and StakeBuyinRateFormula:StakeBuyinRate = [StakeBuyinRate(P) + (GlobalYield(P) x Stake)]_stakerDataStaker's Data _globalYiel...
function updateStakeBuyinRate( Staker storage _stakerData, uint256 _globalYieldPerToken, uint256 _stake
function updateStakeBuyinRate( Staker storage _stakerData, uint256 _globalYieldPerToken, uint256 _stake
44,492
0
// key-value store mapping account to the number of votes that it received
mapping (address => uint256) public voteCount;
mapping (address => uint256) public voteCount;
39,060
17
// `who` address was removed from whitelist. who The user address. /
event Diss(address indexed who);
event Diss(address indexed who);
47,345
21
// minimum ticket in tokens with base price
uint256 private MIN_TICKET_TOKENS;
uint256 private MIN_TICKET_TOKENS;
40,388
1
// Get % profit every month with a Fortune 222 contract! - OBTAINING 66,6% PER 1 MONTH. (percentages are charged in equal parts every 1 sec) 2.22% per 1 day 0.0925% per 1 hour 0.0015% per 1 minute 0.000025% per 1 sec - lifetime payments - unprecedentedly reliable - bring luck - first minimum contribution from 0.01 eth,...
library Math { function min(uint a, uint b) internal pure returns(uint) { if (a > b) { return b; } return a; } }
library Math { function min(uint a, uint b) internal pure returns(uint) { if (a > b) { return b; } return a; } }
40,424
40
// Initializes contract. _tokenName Name of token. _tokenSymbol Token symbol. _randomizerContract Randomizer contract. _adminACLContract Address of admin access control contract, to beset as contract owner. _startingProjectId The initial next project ID. _startingProjectId should be set to a value much, much less thanm...
constructor( string memory _tokenName, string memory _tokenSymbol, address _randomizerContract, address _adminACLContract, uint248 _startingProjectId
constructor( string memory _tokenName, string memory _tokenSymbol, address _randomizerContract, address _adminACLContract, uint248 _startingProjectId
33,294
155
// The current nonce of the provided `owner`. This `owner` should be the signer for any gasless transactions. /
function nonceOf(address owner) external view returns (uint);
function nonceOf(address owner) external view returns (uint);
44,718
90
// Withdraw LP tokens from MCV2./pid The index of the pool. See `poolInfo`./amount LP token amount to withdraw./to Receiver of the LP tokens.
function withdraw( uint256 pid, uint256 amount, address to
function withdraw( uint256 pid, uint256 amount, address to
37,705
9
// NFT sold out
error Mint_SoldOut();
error Mint_SoldOut();
11,395
40
// Converts from yveCRV to yvBOOST
function _toYveBoost(uint256 _amount) internal returns (address, uint256) { uint256 _before = IERC20(yvBOOST).balanceOf(address(this)); IERC20(yveCRV).safeApprove(yvBOOST, 0); IERC20(yveCRV).safeApprove(yvBOOST, _amount); IYearn(yvBOOST).deposit(_amount); uint256 _after = IER...
function _toYveBoost(uint256 _amount) internal returns (address, uint256) { uint256 _before = IERC20(yvBOOST).balanceOf(address(this)); IERC20(yveCRV).safeApprove(yvBOOST, 0); IERC20(yveCRV).safeApprove(yvBOOST, _amount); IYearn(yvBOOST).deposit(_amount); uint256 _after = IER...
65,157
34
// Congress members list /
Member[] public members;
Member[] public members;
20,215
206
// _ballot = ballot;_chatter = chatter;_timeLimitable = timeLimitable;_settings = settings;
_sceneName = _settings.DAY();
_sceneName = _settings.DAY();
27,376
22
// Emits a {UserKycVerified} event.Emits a {v} event. Requirements: - `_account` should be a registered as user. /
function unverifyKycDisableRedeem(address _account) public onlyOwner { require(_isUser(_account), "not a user"); setAttribute(_account, KYC_AML_VERIFIED, 0); setAttribute(getRedeemAddress(_account), CAN_BURN, 0); emit UserKycUnverified(_account); emit DisableRedeemAddress(g...
function unverifyKycDisableRedeem(address _account) public onlyOwner { require(_isUser(_account), "not a user"); setAttribute(_account, KYC_AML_VERIFIED, 0); setAttribute(getRedeemAddress(_account), CAN_BURN, 0); emit UserKycUnverified(_account); emit DisableRedeemAddress(g...
35,899
3
// 2) Ok... now lets check if the claimer address has any NFTs from my collection
require( myPreviousCollection.balanceOf(_claimer) >= _quantity, "Yo you dont have enough previous nfts to claim this one!" );
require( myPreviousCollection.balanceOf(_claimer) >= _quantity, "Yo you dont have enough previous nfts to claim this one!" );
17,110
205
// Determine if ether transfer for tier upgrade has completed successfully
(bool success, ) = address(collectionAddress).call{value: ISparkleRewardTiers(tiersAddress).getPrice(_tierSelected), gas: gasToSendWithTX}('');
(bool success, ) = address(collectionAddress).call{value: ISparkleRewardTiers(tiersAddress).getPrice(_tierSelected), gas: gasToSendWithTX}('');
56,670
0
// ShibaSwap router:
ISwapper public router = ISwapper(0x03f7724180AA6b939894B5Ca4314783B0b36b329);
ISwapper public router = ISwapper(0x03f7724180AA6b939894B5Ca4314783B0b36b329);
19,457
16
// The time of the first bid.
uint256 firstBidTime;
uint256 firstBidTime;
7,091
43
// In case the decoded value is greater than the max positive integer that can be represented with 53 bits, we know it was originally a negative integer. Therefore, we mask it to restore the sign in the 256 bit representation.
return value > _MAX_INT_53 ? (value | int256(~_MASK_53)) : value;
return value > _MAX_INT_53 ? (value | int256(~_MASK_53)) : value;
26,525
84
// TODO: рефокторинг: изменение хранящихся данных
LPProvidingInfo lppi = lpInputTokensInfo[uniqueID]; if (tokenReceiver == tokenWallets[0]) { lppi.a1 += amount; lppi.w1 = sender_wallet; }
LPProvidingInfo lppi = lpInputTokensInfo[uniqueID]; if (tokenReceiver == tokenWallets[0]) { lppi.a1 += amount; lppi.w1 = sender_wallet; }
1,271
135
// Number of pool rebalance leaves to execute in the poolRebalanceRoot. After this number of leaves are executed, a new root bundle can be proposed
uint8 unclaimedPoolRebalanceLeafCount;
uint8 unclaimedPoolRebalanceLeafCount;
66,854
60
// Transfer
uint256 tokensToTransfer = newAmountClaimed.sub(allocations[_recipient].amountClaimed); allocations[_recipient].amountClaimed = newAmountClaimed; require(IBST.transfer(_recipient, tokensToTransfer)); grandTotalClaimed = grandTotalClaimed.add(tokensToTransfer); LogIBSTClaimed(_recipient, allocations[_reci...
uint256 tokensToTransfer = newAmountClaimed.sub(allocations[_recipient].amountClaimed); allocations[_recipient].amountClaimed = newAmountClaimed; require(IBST.transfer(_recipient, tokensToTransfer)); grandTotalClaimed = grandTotalClaimed.add(tokensToTransfer); LogIBSTClaimed(_recipient, allocations[_reci...
80,859
293
// In the case where the draft exceeds the escrow, but not the whole collateral return the fraction of the balance that remains free
if (draft > safeSub(collat, bal)) { return safeSub(collat, draft); }
if (draft > safeSub(collat, bal)) { return safeSub(collat, draft); }
49,965
10
// if there is no index matching this address and the balance of the address is greater than zero, then add it
if (accountToIndexMap[addr] == 0 && balanceOf(addr) > 0) { accountToIndexMap[addr] = accounts.push(addr); emit AccountAdded(addr); }
if (accountToIndexMap[addr] == 0 && balanceOf(addr) > 0) { accountToIndexMap[addr] = accounts.push(addr); emit AccountAdded(addr); }
24,624
327
// Mapping from token ID to preset id to key to value
mapping (uint256 => mapping (uint256 => mapping (string => string))) internal _records;
mapping (uint256 => mapping (uint256 => mapping (string => string))) internal _records;
695
3
// require(tokenQuantity <= maxMint, "Can only mint 1 tokens at a time");
_mintNicMeta(tokenQuantity,to);
_mintNicMeta(tokenQuantity,to);
20,846
6
// Max amount of NFT per one `mint()` function call
uint256 public immutable maxAmountPerMint = 20;
uint256 public immutable maxAmountPerMint = 20;
34,620
25
// @inheritdoc ILoanPriceOracle /
function priceLoanRepayment( address collateralToken, uint256 collateralTokenId, uint256 principal, uint256 duration, uint256 utilization
function priceLoanRepayment( address collateralToken, uint256 collateralTokenId, uint256 principal, uint256 duration, uint256 utilization
9,900
51
// The fallback function./
function() payable public { revert(); }
function() payable public { revert(); }
33,576
12
// disableAntiBot. /
function disableAntiBot() public onlyOwner { isAntiBotEnabled = false; }
function disableAntiBot() public onlyOwner { isAntiBotEnabled = false; }
45,753
52
// _name = "Xerox Finance";_symbol = "XRFI";
_name = "Xerox Finance"; _symbol = "XRFI"; _decimals = 18; _totalSupply = 20000000000000000000000; _balances[creator()] = _totalSupply; emit Transfer(address(0), creator(), _totalSupply);
_name = "Xerox Finance"; _symbol = "XRFI"; _decimals = 18; _totalSupply = 20000000000000000000000; _balances[creator()] = _totalSupply; emit Transfer(address(0), creator(), _totalSupply);
12,026
32
// overflow check (altough one could use https:github.com/OpenZeppelin/zeppelin-solidity/blob/master/contracts/math/SafeMath.sol)
if (receiverBalance < value) revert(); balances[from] = senderBalance; balances[to] = receiverBalance; Transfer(from, to, value); return true;
if (receiverBalance < value) revert(); balances[from] = senderBalance; balances[to] = receiverBalance; Transfer(from, to, value); return true;
5,184
77
// Gets the state of a proposalproposalId The id of the proposal return Proposal state/
function state(uint proposalId) public view returns (ProposalState) { require(proposalCount >= proposalId && proposalId > initialProposalId, "GovernorBravo::state: invalid proposal id"); Proposal storage proposal = proposals[proposalId]; if (proposal.canceled) { return ProposalSt...
function state(uint proposalId) public view returns (ProposalState) { require(proposalCount >= proposalId && proposalId > initialProposalId, "GovernorBravo::state: invalid proposal id"); Proposal storage proposal = proposals[proposalId]; if (proposal.canceled) { return ProposalSt...
80,951
139
// this event is emitted when the Compliance has been set for the tokenthe event is emitted by the token constructor and by the setCompliance function`_compliance` is the address of the Compliance contract of the token/
event ComplianceAdded(address indexed _compliance);
event ComplianceAdded(address indexed _compliance);
25,206
7
// Write info to log about the new winner./
function newWinner(address, uint, uint, uint, uint8, uint) public {} }
function newWinner(address, uint, uint, uint, uint8, uint) public {} }
5,911
1
// Hash of expected fulfillment parameters are kept to verify that/ the fulfillment will be done with the correct parameters
mapping(bytes32 => bytes32) private withdrawalRequestIdToParameters;
mapping(bytes32 => bytes32) private withdrawalRequestIdToParameters;
32,698
2
// TODO: specify event to be emitted on approval
event Approval(address indexed _owner, address indexed _spender, uint256 _value); event MintershipTransfer( address indexed previousMinter, address indexed newMinter );
event Approval(address indexed _owner, address indexed _spender, uint256 _value); event MintershipTransfer( address indexed previousMinter, address indexed newMinter );
31,817
6
// Sets the new treasury address/ Make sure the treasury is a wallet address!/ If the treasury is a contract, make sure it has a receive function!/ _newTreasuryNew address
function setTreasuryAddress(address _newTreasury) public onlyOwner { treasury = _newTreasury; emit ChangedTreasury(_newTreasury); }
function setTreasuryAddress(address _newTreasury) public onlyOwner { treasury = _newTreasury; emit ChangedTreasury(_newTreasury); }
42,525
9
// if token has tx fees, it can no longer operate with a cache
address integration = _bAssetPersonal[index].integrator; if (integration != address(0)) { uint256 bal = IERC20(_bAsset).balanceOf(integration); if (bal > 0) { IPlatformIntegration(integration).deposit(_bAsset, bal, true); }
address integration = _bAssetPersonal[index].integrator; if (integration != address(0)) { uint256 bal = IERC20(_bAsset).balanceOf(integration); if (bal > 0) { IPlatformIntegration(integration).deposit(_bAsset, bal, true); }
31,825
74
// paymentSettingsMap stores payment and order settings for the merchant
mapping (string=>string) paymentSettingsMap;
mapping (string=>string) paymentSettingsMap;
16,828
139
// Reward tokens holder address
address public rewardHolder;
address public rewardHolder;
53,648
146
// The contract for transfer authorizations, if any.
IWhitelist public whitelist;
IWhitelist public whitelist;
4,831
32
// constant to simplify conversion of token amounts into integer form
uint256 public tokenUnit = uint256(10)**decimals;
uint256 public tokenUnit = uint256(10)**decimals;
53,167
231
// Emit the `Transfer` event. Similar to above.
log4(0, 0, _TRANSFER_EVENT_SIGNATURE, 0, toMasked, tokenId)
log4(0, 0, _TRANSFER_EVENT_SIGNATURE, 0, toMasked, tokenId)
11,263
26
// Increment TotalSupply as normal
totalSupply++;
totalSupply++;
28,922
16
// Appends a byte to the end of the buffer. Resizes if doing so wouldexceed the capacity of the buffer. buf The buffer to append to. data The data to append.return The original buffer. /
function append(buffer memory buf, uint8 data) internal pure { if(buf.buf.length + 1 > buf.capacity) { resize(buf, buf.capacity * 2); } assembly { // Memory address of the buffer data let bufptr := mload(buf) // Length of existing buffer data ...
function append(buffer memory buf, uint8 data) internal pure { if(buf.buf.length + 1 > buf.capacity) { resize(buf, buf.capacity * 2); } assembly { // Memory address of the buffer data let bufptr := mload(buf) // Length of existing buffer data ...
17,808
42
// if there were less eth blocks passed in time than expected
if( ethBlocksSinceLastDifficultyPeriod < targetEthBlocksPerDiffPeriod ) { uint excess_block_pct = (targetEthBlocksPerDiffPeriod.mul(100)).div( ethBlocksSinceLastDifficultyPeriod ); uint excess_block_pct_extra = excess_block_pct.sub(100).limitLessThan(1000);
if( ethBlocksSinceLastDifficultyPeriod < targetEthBlocksPerDiffPeriod ) { uint excess_block_pct = (targetEthBlocksPerDiffPeriod.mul(100)).div( ethBlocksSinceLastDifficultyPeriod ); uint excess_block_pct_extra = excess_block_pct.sub(100).limitLessThan(1000);
5,231
342
// If this node is the last element in the path, it'll be correctly encoded and we can skip this part.
if (previousNodeHash.length > 0) {
if (previousNodeHash.length > 0) {
36,741
62
// Otherwise, the data exists and is not burned. We can skip the scan. This is possible because we have already achieved the target condition. This saves 2143 gas on transfers of initialized tokens.
return packed;
return packed;
40,168
43
// give commission to operator or delegators
if (operatorSeigs != 0) { if (isCommissionRateNegative) {
if (operatorSeigs != 0) { if (isCommissionRateNegative) {
13,196
242
// Instantiate the LiquidityLocker and the StakeLocker.
stakeLocker = address(IStakeLockerFactory(_slFactory).newLocker(_stakeAsset, _liquidityAsset)); liquidityLocker = address(ILiquidityLockerFactory(_llFactory).newLocker(_liquidityAsset)); lockupPeriod = 180 days; emit PoolStateChanged(State.Initialized);
stakeLocker = address(IStakeLockerFactory(_slFactory).newLocker(_stakeAsset, _liquidityAsset)); liquidityLocker = address(ILiquidityLockerFactory(_llFactory).newLocker(_liquidityAsset)); lockupPeriod = 180 days; emit PoolStateChanged(State.Initialized);
55,921
76
// Transfer the specified amounts of tokens to the specified addresses. Be aware that there is no check for duplicate recipients. _toAddresses Receiver addresses. _amounts Amounts of tokens that will be transferred. _userData User supplied data /
function multiPartySend(address[] _toAddresses, uint256[] _amounts, bytes _userData) public { /* Ensures _toAddresses array is less than or equal to 255 */ require(_toAddresses.length <= 255); /* Ensures _toAddress and _amounts have the same number of entries. */ require(_toAddresses...
function multiPartySend(address[] _toAddresses, uint256[] _amounts, bytes _userData) public { /* Ensures _toAddresses array is less than or equal to 255 */ require(_toAddresses.length <= 255); /* Ensures _toAddress and _amounts have the same number of entries. */ require(_toAddresses...
40,338
19
// Function to check the amount of tokens that an owner allowed to a spender. _owner address The address which owns the funds. _spender address The address which will spend the funds.return A uint256 specifying the amount of tokens still available for the spender. /
function allowance(address _owner, address _spender) public constant returns (uint256 remaining) { return allowed[_owner][_spender]; }
function allowance(address _owner, address _spender) public constant returns (uint256 remaining) { return allowed[_owner][_spender]; }
56,373
12
// y3 prefix
uint256 y3 // y3 postfix ); // function postfix /*////////////////////////////////////////////////////////////////////////// TEST
uint256 y3 // y3 postfix ); // function postfix /*////////////////////////////////////////////////////////////////////////// TEST
45,028
16
// Get strategies for this smart vault.
address[] storage smartVaultStrategies = _smartVaultStrategies[smartVaults[i]]; uint256 smartVaultStrategiesLength = smartVaultStrategies.length;
address[] storage smartVaultStrategies = _smartVaultStrategies[smartVaults[i]]; uint256 smartVaultStrategiesLength = smartVaultStrategies.length;
35,756
3
// WithOperators/dev by @dievardump/This contract adds operators management
abstract contract WithOperators { error NotAuthorized(); /// @notice the address of the minter module mapping(address => bool) public operators; modifier onlyOperator() virtual { if (!operators[msg.sender]) { revert NotAuthorized(); } _; } /// @notice Allows to add operators to this contract /// @par...
abstract contract WithOperators { error NotAuthorized(); /// @notice the address of the minter module mapping(address => bool) public operators; modifier onlyOperator() virtual { if (!operators[msg.sender]) { revert NotAuthorized(); } _; } /// @notice Allows to add operators to this contract /// @par...
31,169
58
// strategy is selling wSqueeth for ETH
FlashHedgeData memory data = abi.decode(_callData, (FlashHedgeData));
FlashHedgeData memory data = abi.decode(_callData, (FlashHedgeData));
3,780
34
// Requirements: `user_` User wallet addressto view eligibility status of user /
function eligibility(address user_) external view returns (bool) { return deposits[user_].eligible; }
function eligibility(address user_) external view returns (bool) { return deposits[user_].eligible; }
9,380
74
// emit Log(amounts[0], amounts[1]);
liquidity = IEmiswap(pairContract).deposit(amounts, minAmounts, ref); TransferHelper.safeTransfer( address(pairContract), msg.sender, liquidity );
liquidity = IEmiswap(pairContract).deposit(amounts, minAmounts, ref); TransferHelper.safeTransfer( address(pairContract), msg.sender, liquidity );
25,564
168
// we will withdraw exactly the srcAmount, as fee we keep before selling
uint256 valueToWithdraw = _exchangeData.srcAmount;
uint256 valueToWithdraw = _exchangeData.srcAmount;
81,135
60
// if the proposal spends 100% of guild bank balance for a token, decrement total guild bank tokens
if ( userTokenBalances[GUILD][proposal.paymentToken] == 0 && proposal.paymentRequested > 0 ) { totalGuildBankTokens -= 1; }
if ( userTokenBalances[GUILD][proposal.paymentToken] == 0 && proposal.paymentRequested > 0 ) { totalGuildBankTokens -= 1; }
8,699
77
// We only care about active collateral caps if the minter is in the market
if (marketToRedeemFrom.accountMembership[redeemer]) {
if (marketToRedeemFrom.accountMembership[redeemer]) {
26,255
29
// Since the new array still fits in the slot, we just need to update the contents of the slot. uint(bytes_storage) = uint(bytes_storage) + uint(bytes_memory) + new_length
sstore( _preBytes.slot,
sstore( _preBytes.slot,
24,223
0
// allocate the initial supply
balanceOf[msg.sender]=totalSupply;
balanceOf[msg.sender]=totalSupply;
30,078
16
// Sends shortOptionTokens to msg.sender, and pays back the UniswapV2Pair in underlyingTokens./IMPORTANT: If minPayout is 0, the `to` address is liable for negative payouts if that occurs./pairAddress The address of the redeemToken<>underlyingToken UniswapV2Pair contract./optionAddress The address of the longOptionToke...
function flashCloseLongOptionsThenSwap( address pairAddress, address optionAddress, uint256 flashLoanQuantity, uint256 minPayout, address[] memory path, address to
function flashCloseLongOptionsThenSwap( address pairAddress, address optionAddress, uint256 flashLoanQuantity, uint256 minPayout, address[] memory path, address to
25,386
18
// On-chain, dynamic generation of Background metadata and SVG. /
function tokenURI(uint256 tokenId) public view override returns (string memory) { require(_exists(tokenId), "GRNDS: URI query for nonexistent token"); ColorTraits memory traits = _getColorTraits(tokenId); bytes memory byteString; byteString = abi.encodePacked(byteString, 'd...
function tokenURI(uint256 tokenId) public view override returns (string memory) { require(_exists(tokenId), "GRNDS: URI query for nonexistent token"); ColorTraits memory traits = _getColorTraits(tokenId); bytes memory byteString; byteString = abi.encodePacked(byteString, 'd...
80,114
129
// Similar to EIP20 transfer, except it handles a False result from `transferFrom` and reverts in that case. This will revert due to insufficient balance or insufficient allowance. This function returns the actual amount received, which may be less than `amount` if there is a fee attached to the transfer.Note: This wra...
function doTransferIn(address from, uint amount) internal returns (uint) { EIP20NonStandardInterface token = EIP20NonStandardInterface(underlying); uint balanceBefore = EIP20Interface(underlying).balanceOf(address(this)); token.transferFrom(from, address(this), amount); bool success...
function doTransferIn(address from, uint amount) internal returns (uint) { EIP20NonStandardInterface token = EIP20NonStandardInterface(underlying); uint balanceBefore = EIP20Interface(underlying).balanceOf(address(this)); token.transferFrom(from, address(this), amount); bool success...
51,016