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
2
// This is a pseudo member, representing all the disconnected members
MemberData internal _disconnectedMembers;
MemberData internal _disconnectedMembers;
23,652
15
// Only allow transactions originating from a designated member address.
require(addressIsMember_[msg.sender]); _;
require(addressIsMember_[msg.sender]); _;
83,415
620
// Safe axial transfer function, just in case if rounding error causes pool to not have enough AXIALs.
function safeAxialTransfer(address _to, uint256 _amount) internal { uint256 axialBal = axial.balanceOf(address(this)); if (_amount > axialBal) { axial.transfer(_to, axialBal); } else { axial.transfer(_to, _amount); } }
function safeAxialTransfer(address _to, uint256 _amount) internal { uint256 axialBal = axial.balanceOf(address(this)); if (_amount > axialBal) { axial.transfer(_to, axialBal); } else { axial.transfer(_to, _amount); } }
10,885
148
// If the token is wBTC then we just approve spend and deposit directly into the wbtc vault.
if (args._token == address(wBTC)) { token.safeApprove(args._vault, token.balanceOf(address(this))); } else {
if (args._token == address(wBTC)) { token.safeApprove(args._vault, token.balanceOf(address(this))); } else {
23,037
0
// Aave's StaticATokens allow wrapping either an aToken or the underlying asset. We can query which token to pull and approve from the wrapper contract.
IERC20 dynamicToken = fromUnderlying ? staticToken.ASSET() : staticToken.ATOKEN();
IERC20 dynamicToken = fromUnderlying ? staticToken.ASSET() : staticToken.ATOKEN();
27,872
83
// ----------------------------------------------------------------------
function transfer(address _to, uint _amount) public returns (bool success) { // Cannot transfer before crowdsale ends // require(finalised); // require(flg002transfer); // Cannot transfer if Client verification is required //require(!clientRequired[msg.sender]); // S...
function transfer(address _to, uint _amount) public returns (bool success) { // Cannot transfer before crowdsale ends // require(finalised); // require(flg002transfer); // Cannot transfer if Client verification is required //require(!clientRequired[msg.sender]); // S...
21,225
5
// Return the appropriate contract interface for token. /
function getTokenContract(uint16 tokenId) private view returns (IFoxGameNFT) { return tokenId <= 10000 ? foxNFTGen0 : foxNFTGen1; }
function getTokenContract(uint16 tokenId) private view returns (IFoxGameNFT) { return tokenId <= 10000 ? foxNFTGen0 : foxNFTGen1; }
82,293
0
// ERC20 Token Standard, optional extension: Burnable./See https:eips.ethereum.org/EIPS/eip-20/Note: the ERC-165 identifier for this interface is 0x3b5a0bf8.
interface IERC20Burnable { /// @notice Burns an amount of tokens from the sender, decreasing the total supply. /// @dev Reverts if the sender does not have at least `value` of balance. /// @dev Emits an {IERC20-Transfer} event with `to` set to the zero address. /// @param value The amount of tokens to b...
interface IERC20Burnable { /// @notice Burns an amount of tokens from the sender, decreasing the total supply. /// @dev Reverts if the sender does not have at least `value` of balance. /// @dev Emits an {IERC20-Transfer} event with `to` set to the zero address. /// @param value The amount of tokens to b...
29,492
445
// Compute `e^(alphaln(feeRatio/stakeRatio))` if feeRatio <= stakeRatio or `e^(alpaln(stakeRatio/feeRatio))` if feeRatio > stakeRatio
int256 n = feeRatio <= stakeRatio ? LibFixedMath.div(feeRatio, stakeRatio) : LibFixedMath.div(stakeRatio, feeRatio); n = LibFixedMath.exp( LibFixedMath.mulDiv( LibFixedMath.ln(n), int256(alphaNumerator), int256(alphaDeno...
int256 n = feeRatio <= stakeRatio ? LibFixedMath.div(feeRatio, stakeRatio) : LibFixedMath.div(stakeRatio, feeRatio); n = LibFixedMath.exp( LibFixedMath.mulDiv( LibFixedMath.ln(n), int256(alphaNumerator), int256(alphaDeno...
23,059
9
// send leftovers to investor
uint256 _token0Leftover = _liquidityAmounts.amount0Desired - _amount0Invested; if (_token0Leftover > 0) { _farmBot.stakingToken0().safeTransfer(msg.sender, _token0Leftover); }
uint256 _token0Leftover = _liquidityAmounts.amount0Desired - _amount0Invested; if (_token0Leftover > 0) { _farmBot.stakingToken0().safeTransfer(msg.sender, _token0Leftover); }
17,403
19
// Burn half the tip
_tip = _tip / 2; IController(TELLOR_ADDRESS).burn(_tip);
_tip = _tip / 2; IController(TELLOR_ADDRESS).burn(_tip);
58,654
5
// Calls internal function _removeMinter with message senderas the parameter /
function renounceMinter() public { _removeMinter(msg.sender); }
function renounceMinter() public { _removeMinter(msg.sender); }
23,818
15
// The authorized address for each NFT
mapping (uint256 => address) internal tokenApprovals;
mapping (uint256 => address) internal tokenApprovals;
14,648
5
// Mapping for operator approvals
mapping(address => mapping(address => bool)) internal _operatorApprovals;
mapping(address => mapping(address => bool)) internal _operatorApprovals;
2,073
176
// 1 = Monday, 7 = Sunday
function getDayOfWeek(uint256 timestamp) internal pure returns (uint256 dayOfWeek)
function getDayOfWeek(uint256 timestamp) internal pure returns (uint256 dayOfWeek)
3,903
10
// See '_setTickers()' in {OracleHouse}. restricted to admin only. /
function setTickers( string memory _tickerUsdFiat, string memory _tickerReserveAsset ) external override onlyRole(DEFAULT_ADMIN_ROLE) { _setTickers(_tickerUsdFiat, _tickerReserveAsset); }
function setTickers( string memory _tickerUsdFiat, string memory _tickerReserveAsset ) external override onlyRole(DEFAULT_ADMIN_ROLE) { _setTickers(_tickerUsdFiat, _tickerReserveAsset); }
8,554
229
// Sanity check to ensure we don't overflow arithmetic
require(avePrice == uint256(uint128(avePrice))); uint256 nextPrice = avePrice + (avePrice / 2);
require(avePrice == uint256(uint128(avePrice))); uint256 nextPrice = avePrice + (avePrice / 2);
24,088
40
// - Emits a {BenefitStarted} event if `beneficiary_` is not null - This contract must be allowed to transfer NuCyber tokens on behalf of the caller/
function stake(uint256 tokenId_, address beneficiary_, Rarity rarity_, Proof calldata proof_) public isState(ACTIVE) { if (fxChildTunnel == address(0)) { revert NCS_REWARDS_NOT_SET(); }
function stake(uint256 tokenId_, address beneficiary_, Rarity rarity_, Proof calldata proof_) public isState(ACTIVE) { if (fxChildTunnel == address(0)) { revert NCS_REWARDS_NOT_SET(); }
27,469
18
// deposit cvxfpis
function stake(uint256 _amount) public nonReentrant{ require(_amount > 0, 'RewardPool : Cannot stake 0'); //mint will call _updateReward _mint(msg.sender, _amount); //pull cvxfpis IERC20(cvxfpis).safeTransferFrom(msg.sender, address(this), _amount); emit St...
function stake(uint256 _amount) public nonReentrant{ require(_amount > 0, 'RewardPool : Cannot stake 0'); //mint will call _updateReward _mint(msg.sender, _amount); //pull cvxfpis IERC20(cvxfpis).safeTransferFrom(msg.sender, address(this), _amount); emit St...
23,593
307
// Get the remaining balance for marketing /
function geMarketingBalance() public view returns (uint256) { return getTotalEarnedMarketingBalance() - communityBalanceSpent[2]; }
function geMarketingBalance() public view returns (uint256) { return getTotalEarnedMarketingBalance() - communityBalanceSpent[2]; }
46,750
36
// check if game approved;
require(CreditGAMEInterface(creditGameAddress).isGameApproved(address(this)) == true); uint tokensToTake = processTransaction(_from, _value); IERC20Token(tokenAddress).transferFrom(_from, address(this), tokensToTake);
require(CreditGAMEInterface(creditGameAddress).isGameApproved(address(this)) == true); uint tokensToTake = processTransaction(_from, _value); IERC20Token(tokenAddress).transferFrom(_from, address(this), tokensToTake);
56,850
92
// converts bytes32 to string /
function bytes32ToString(bytes32 _bytes32) internal pure returns(string memory) { uint256 i = 0; while (i < 32 && _bytes32[i] != 0) { i++; }
function bytes32ToString(bytes32 _bytes32) internal pure returns(string memory) { uint256 i = 0; while (i < 32 && _bytes32[i] != 0) { i++; }
31,589
13
// solhint-disable-next-line no-simple-event-func-name
event Transfer( address indexed from, address indexed to, uint256 value ); event Approval( address indexed owner, address indexed spender, uint256 value
event Transfer( address indexed from, address indexed to, uint256 value ); event Approval( address indexed owner, address indexed spender, uint256 value
23,547
742
// Changes the available owedToken amount. This changes both the variable to track the totalamount as well as the variable to track a particular bucket. bucketThe bucket numberamountThe amount to change the available amount byincreaseTrue if positive change, false if negative change /
function updateAvailable( uint256 bucket, uint256 amount, bool increase ) private
function updateAvailable( uint256 bucket, uint256 amount, bool increase ) private
72,505
10
// Display the time
function Display_Time() public view returns (uint256) { return now; }
function Display_Time() public view returns (uint256) { return now; }
12,152
18
// Convert string to address
function _stringToAddress(string memory _a) internal pure returns (address){ bytes memory tmp = bytes(_a); uint iaddress = 0; uint b1; uint b2; for (uint i=2; i<2+2*20; i+=2){ iaddress *= 256; b1 = uint(uint8(tmp[i])); b2 = uint(uint8(tmp...
function _stringToAddress(string memory _a) internal pure returns (address){ bytes memory tmp = bytes(_a); uint iaddress = 0; uint b1; uint b2; for (uint i=2; i<2+2*20; i+=2){ iaddress *= 256; b1 = uint(uint8(tmp[i])); b2 = uint(uint8(tmp...
4,621
6
// validate request off-chain, call event to be picked upby eventfilters. /
validateRequest(msg.sender, _amount_produced);
validateRequest(msg.sender, _amount_produced);
45,672
6
// make sure signature is valid and get the address of the signer
address signer = _verify(voucher);
address signer = _verify(voucher);
4,811
3
// Verifies if a given account address is allowed to withdraw tokens/_address address to verify/ return true if the account is allowed to withdraw, false otherwise
function allowedToWithdraw(address _address) internal pure returns (bool) { // TODO: check using access control contract return true; }
function allowedToWithdraw(address _address) internal pure returns (bool) { // TODO: check using access control contract return true; }
52,529
4
// Price of each key is 0.001 ETH
uint256 public keyPrice = 1000000000000000; mapping (bytes32 => address) public pAddrxName; // (addr => pName) returns player address by name mapping (address => DataStructs.Player) public plyr_; // (addr => data) player data mapping (address => mapping (uint256 => DataStructs.PlayerRounds)...
uint256 public keyPrice = 1000000000000000; mapping (bytes32 => address) public pAddrxName; // (addr => pName) returns player address by name mapping (address => DataStructs.Player) public plyr_; // (addr => data) player data mapping (address => mapping (uint256 => DataStructs.PlayerRounds)...
11,335
5
// solhint-disable func-name-mixedcase
function InvalidFromAddressError( address from ) internal pure returns (bytes memory)
function InvalidFromAddressError( address from ) internal pure returns (bytes memory)
16,589
8
// Get the balance of an account's Tokens _ownerThe address of the token holder _id ID of the TokenreturnThe _owner's balance of the Token type requested /
function balanceOf(address _owner, uint256 _id) external view returns (uint256);
function balanceOf(address _owner, uint256 _id) external view returns (uint256);
2,632
10
// order status for punk ID
uint16[] public orderedPunkIds; mapping(uint16 => OrderDetails) public orderStatus;
uint16[] public orderedPunkIds; mapping(uint16 => OrderDetails) public orderStatus;
45,083
5
// Set how long the pool will yield interest
poolDurationByBlock = _poolDurationByBlock;
poolDurationByBlock = _poolDurationByBlock;
24,038
53
// _maxTotalSupply The maximum liquidity token supply the contract allows
function setMaxTotalSupply(uint256 _maxTotalSupply) external onlyOwner { maxTotalSupply = _maxTotalSupply; emit MaxTotalSupplySet(_maxTotalSupply); }
function setMaxTotalSupply(uint256 _maxTotalSupply) external onlyOwner { maxTotalSupply = _maxTotalSupply; emit MaxTotalSupplySet(_maxTotalSupply); }
58,810
174
// Set starting block for the sale
function setStartingBlock(uint256 _startingBlock) external onlyOwner { startingBlock = _startingBlock; }
function setStartingBlock(uint256 _startingBlock) external onlyOwner { startingBlock = _startingBlock; }
33,582
7
// Deploy a new contract with the desired initialization code to thehome address corresponding to a given key. Two conditions must be met: thesubmitter must be designated as the controller of the home address (withthe initial controller set to the address corresponding to the first twentybytes of the key), and there mu...
function deploy(bytes32 key, bytes calldata initializationCode) external payable returns (address homeAddress, bytes32 runtimeCodeHash);
function deploy(bytes32 key, bytes calldata initializationCode) external payable returns (address homeAddress, bytes32 runtimeCodeHash);
22,422
18
// Update creator
creator[id] = _msgSender();
creator[id] = _msgSender();
28,578
3
// Withdraws tokens for the caller from the staking contract/token the token to withdraw/amount the amount to withdraw
function withdraw(address token, uint amount) external;
function withdraw(address token, uint amount) external;
18,530
53
// Moves `amount` tokens from the caller's account to `recipient`. Returns a boolean value indicating whether the operation succeeded.
* Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Retur...
* Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Retur...
8,470
120
// Send transfers to dead address
if (burnAmt > 0) { _transferStandard(sender, deadWallet, burnAmt); }
if (burnAmt > 0) { _transferStandard(sender, deadWallet, burnAmt); }
35,685
12
// Data about each collateral type
mapping (bytes32 => CollateralType) public collateralTypes; SAFEEngineLike public safeEngine;
mapping (bytes32 => CollateralType) public collateralTypes; SAFEEngineLike public safeEngine;
54,092
15
// Check that signer is an oracle
require(orcl[signer] == 1, "Median/invalid-oracle");
require(orcl[signer] == 1, "Median/invalid-oracle");
43,368
84
// 0x434f4e54524143545f4f424a4543545f4f574e45525348495000000000000000
bytes32 public constant CONTRACT_OBJECT_OWNERSHIP = "CONTRACT_OBJECT_OWNERSHIP";
bytes32 public constant CONTRACT_OBJECT_OWNERSHIP = "CONTRACT_OBJECT_OWNERSHIP";
63,726
293
// contracts/Pool.sol/ pragma solidity 0.6.11; // import "lib/openzeppelin-contracts/contracts/token/ERC20/SafeERC20.sol"; // import "./interfaces/IBPool.sol"; // import "./interfaces/IDebtLocker.sol"; // import "./interfaces/IMapleGlobals.sol"; // import "./interfaces/ILiquidityLocker.sol"; // import "./interfaces/ILi...
contract Pool is PoolFDT { using SafeMath for uint256; using SafeERC20 for IERC20; uint256 constant WAD = 10 ** 18; uint8 public constant DL_FACTORY = 1; // Factory type of `DebtLockerFactory`. IERC20 public immutable liquidityAsset; // The asset deposited by Lenders into the LiquidityLocker...
contract Pool is PoolFDT { using SafeMath for uint256; using SafeERC20 for IERC20; uint256 constant WAD = 10 ** 18; uint8 public constant DL_FACTORY = 1; // Factory type of `DebtLockerFactory`. IERC20 public immutable liquidityAsset; // The asset deposited by Lenders into the LiquidityLocker...
42,120
711
// Denotes current round
uint256 private roundNumber;
uint256 private roundNumber;
56,173
21
// Мапа адрес получателя - nonce, нужно для того, чтобы нельзя было повторно запросить withdraw /
function() payable { require(msg.value != 0); }
function() payable { require(msg.value != 0); }
21,871
154
// sets up token list and rewards token /
function initialize() internal { //Initialize token list addToken(address(DAI), address(ANYDAI)); //Initialize rewards token list addRewardToken(address(CRV)); addRewardToken(address(CVX)); }
function initialize() internal { //Initialize token list addToken(address(DAI), address(ANYDAI)); //Initialize rewards token list addRewardToken(address(CRV)); addRewardToken(address(CVX)); }
8,992
3
// Not possible, but just in case - 100% APY
return uint256(100e16) / 365 days;
return uint256(100e16) / 365 days;
43,232
339
// Snapshots are created by the internal {_snapshot} function, which will emit the {Snapshot} event and return asnapshot id. To get the total supply at the time of a snapshot, call the function {totalSupplyAt} with the snapshotid. To get the balance of an account at the time of a snapshot, call the {balanceOfAt} functi...
using Arrays for uint256[]; using Counters for Counters.Counter;
using Arrays for uint256[]; using Counters for Counters.Counter;
25,836
30
// keeper performUpkeep function executes batchTransaction once per day
// function batchTransaction() external payable { // // daily range to check whether user has purchase to be made today // uint today = block.timestamp; // uint todayStart = today - (12 * 60 * 60); // uint todayEnd = today + (12 * 60 * 60); // // loop over liveStrategies ...
// function batchTransaction() external payable { // // daily range to check whether user has purchase to be made today // uint today = block.timestamp; // uint todayStart = today - (12 * 60 * 60); // uint todayEnd = today + (12 * 60 * 60); // // loop over liveStrategies ...
21,116
22
// 一个人只能发起一个投票人提案
bool exist = _proposals.votingExist(TYPE_VOTE, msg.sender); require(!exist, "only one voter proposal per user in voting."); if (_proposals.insertTopic(topicId, timestamp, endtime, TYPE_VOTE, 0, 0, target, msg.sender)) { emit CreateProposal(topicId, TYPE_VOTE, 0, target); return true; }
bool exist = _proposals.votingExist(TYPE_VOTE, msg.sender); require(!exist, "only one voter proposal per user in voting."); if (_proposals.insertTopic(topicId, timestamp, endtime, TYPE_VOTE, 0, 0, target, msg.sender)) { emit CreateProposal(topicId, TYPE_VOTE, 0, target); return true; }
20,519
292
// For user to mint the subdomain of a exists tokenURI to address which will set as the subdomain owner tokenId the parent token Id of the subdomain label the label of the subdomain /
function mintSubURI(address to, uint256 tokenId, string calldata label) external override onlyApprovedOrOwner(tokenId)
function mintSubURI(address to, uint256 tokenId, string calldata label) external override onlyApprovedOrOwner(tokenId)
34,225
22
// A distinct Uniform Resource Identifier (URI) for a given asset. Throws if `_tokenId` is not a valid NFT. URIs are defined in RFC 3986. The URI may point to a JSON file that conforms to the "ERC721 Metadata JSON Schema". _tokenId The tokenID we're inquiring aboutreturn String representing the URI for the requested to...
function tokenURI(
function tokenURI(
41,521
99
// Transfer tokens from default partitions. Used as a helper method for ERC-20 compatibility. _operator The address performing the transfer. _from Token holder. _to Token recipient. _value Number of tokens to transfer. _data Information attached to the transfer, and intended for thetoken holder (`_from`). Should contai...
function _transferByDefaultPartition( address _operator, address _from, address _to, uint256 _value, bytes memory _data
function _transferByDefaultPartition( address _operator, address _from, address _to, uint256 _value, bytes memory _data
44,481
1
// return if the forwarder is trusted to forward relayed transactions to us.the forwarder is required to verify the sender's signature, and verifythe call is not a replay. /
function isTrustedForwarder(address forwarder) public view returns (bool);
function isTrustedForwarder(address forwarder) public view returns (bool);
10,780
152
// check if diffrent days > 0
require(diffDays > 0, "You can send withdraw request tomorrow");
require(diffDays > 0, "You can send withdraw request tomorrow");
16,473
180
// convert amount to be denominated in collateral
return ( collateralAmount, _convertAmountOnLivePrice( strikeNeeded, otokenDetails.otokenStrikeAsset, otokenDetails.otokenCollateralAsset ) ...
return ( collateralAmount, _convertAmountOnLivePrice( strikeNeeded, otokenDetails.otokenStrikeAsset, otokenDetails.otokenCollateralAsset ) ...
22,628
131
// Bad counts
return (ErrorCode.ERR_TOO_MANY_LENGTH_OR_DISTANCE_CODES, lencode, distcode);
return (ErrorCode.ERR_TOO_MANY_LENGTH_OR_DISTANCE_CODES, lencode, distcode);
31,535
52
// Given an amount and a currency, transfer the currency to this contract.If the currency is ETH (0x0), attempt to wrap the amount as WETH /
function _handleIncomingBid(uint256 amount, address currency) internal { // If this is an ETH bid, ensure they sent enough and convert it to WETH under the hood if(currency == address(0)) { require(msg.value == amount, "Sent ETH Value does not match specified bid amount"); IW...
function _handleIncomingBid(uint256 amount, address currency) internal { // If this is an ETH bid, ensure they sent enough and convert it to WETH under the hood if(currency == address(0)) { require(msg.value == amount, "Sent ETH Value does not match specified bid amount"); IW...
31,813
200
// we have enough balance to cover the liquidation available
return (_amountNeeded, 0);
return (_amountNeeded, 0);
2,814
154
// FrAactionHub owner => return True if owner already voted for the appointed player
mapping(address => bool) public votersPlayer;
mapping(address => bool) public votersPlayer;
55,261
29
// Base date to calculate team, marketing and platform tokens lock
uint256 lockStartDate =
uint256 lockStartDate =
35,554
520
// Attempts to fill the desired amount of makerAsset and trasnfer purchased assets to msg.sender.
( wethSpentAmount, makerAssetAcquiredAmount ) = _marketBuyFillOrKill( orders, makerAssetBuyAmount, signatures );
( wethSpentAmount, makerAssetAcquiredAmount ) = _marketBuyFillOrKill( orders, makerAssetBuyAmount, signatures );
39,670
203
// send some amount of arbitrary ERC20 Tokens_externalToken the address of the Token Contract_to address of the beneficiary_value the amount of ether (in Wei) to send return bool which represents a success/
function externalTokenTransfer(IERC20 _externalToken, address _to, uint256 _value, Avatar _avatar) external onlyRegisteredScheme onlySubjectToConstraint("externalTokenTransfer") isAvatarValid(address(_avatar)) returns(bool)
function externalTokenTransfer(IERC20 _externalToken, address _to, uint256 _value, Avatar _avatar) external onlyRegisteredScheme onlySubjectToConstraint("externalTokenTransfer") isAvatarValid(address(_avatar)) returns(bool)
40,472
6
// cast bytes in position 0x40 to uint256 data; deployData_ plus 0x40 due to padding
data_ := mload(add(deployData_, 0x40))
data_ := mload(add(deployData_, 0x40))
31,103
7
// The main Event struct. Every event in Loketh is/represented by a copy of this structure.
struct Event { // Event name. string name; // Address of event owner. address organizer; // Timestamp as seconds since unix epoch. uint startTime; // Timestamp as seconds since unix epoch. // Should be bigger than `startTime`. uint endTime; ...
struct Event { // Event name. string name; // Address of event owner. address organizer; // Timestamp as seconds since unix epoch. uint startTime; // Timestamp as seconds since unix epoch. // Should be bigger than `startTime`. uint endTime; ...
27,429
69
// Set initial parameters under Donation conversion handler
IHandleCampaignDeployment(proxyDonationConversionHandler).setInitialParamsDonationConversionHandler( tokenName, tokenSymbol, _currency, msg.sender, //contractor proxyDonationCampaign, address(TWO_KEY_SINGLETON_REGISTRY) );
IHandleCampaignDeployment(proxyDonationConversionHandler).setInitialParamsDonationConversionHandler( tokenName, tokenSymbol, _currency, msg.sender, //contractor proxyDonationCampaign, address(TWO_KEY_SINGLETON_REGISTRY) );
24,402
138
// if _to == ETH no need additional convert, just return ETH amount
if(_to == address(ETH_TOKEN_ADDRESS)){ return totalETH; }
if(_to == address(ETH_TOKEN_ADDRESS)){ return totalETH; }
5,031
31
// ERC20 Transfer event
Transfer(STO, _contributor, _amountOfSecurityTokens);
Transfer(STO, _contributor, _amountOfSecurityTokens);
41,636
36
// Update the invariant with the balances the Pool will have after the exit, in order to compute the protocol swap fee amounts due in future joins and exits.
_updateInvariantAfterExit(balances, amountsOut); return (bptAmountIn, amountsOut, dueProtocolFeeAmounts);
_updateInvariantAfterExit(balances, amountsOut); return (bptAmountIn, amountsOut, dueProtocolFeeAmounts);
25,324
666
// burn warrior
function burnWarrior(uint256 _warriorId) whenNotPaused external { coreContract.burnWarrior(_warriorId, msg.sender); soulCounter[msg.sender] ++; WarriorBurned(_warriorId, msg.sender); }
function burnWarrior(uint256 _warriorId) whenNotPaused external { coreContract.burnWarrior(_warriorId, msg.sender); soulCounter[msg.sender] ++; WarriorBurned(_warriorId, msg.sender); }
66,542
21
// update the locking for this account
IToken(tokenAddress).setTokenLock(tokens, msg.sender);
IToken(tokenAddress).setTokenLock(tokens, msg.sender);
8,895
120
// WITHDRAW | FARMING ASSETS (TOKENS) | RE-ENTRANCY DEFENSE
function withdraw(uint256 _pid, uint256 _amount) public { PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][msg.sender]; require(user.amount >= _amount, "withdraw: not good"); updatePool(_pid); uint256 pending = user.amount.mul(pool.accGDAOPerShar...
function withdraw(uint256 _pid, uint256 _amount) public { PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][msg.sender]; require(user.amount >= _amount, "withdraw: not good"); updatePool(_pid); uint256 pending = user.amount.mul(pool.accGDAOPerShar...
38,952
17
// the DyDx will call `callFunction(address sender, Info memory accountInfo, bytes memory data) public` after during `operate` call
function flashloan(address token, uint256 amount, bytes memory data) internal
function flashloan(address token, uint256 amount, bytes memory data) internal
59,181
4
// a intance of FirstContract so deploys another contract This way the owner would be this contract address and not the user calling it FirstContract newAAdress = new FirstContract();
FirstContract newAAdress = new FirstContract(msg.sender); deployedFirstContract.push(newAAdress);
FirstContract newAAdress = new FirstContract(msg.sender); deployedFirstContract.push(newAAdress);
36,499
301
// You're always free to change this default implementation and pack more data in byte array which can be decoded back in L1
return abi.encode(tokenURI(tokenId));
return abi.encode(tokenURI(tokenId));
26,053
422
// Gauge whether this tracker has ever-used data for the given wallet, type and currency/wallet The address of the concerned wallet/_type The balance type/currencyCt The address of the concerned currency contract (address(0) == ETH)/currencyId The ID of the concerned currency (0 for ETH and ERC20)/ return true if data ...
function hasEverUsedCurrency(address wallet, bytes32 _type, address currencyCt, uint256 currencyId) public view returns (bool)
function hasEverUsedCurrency(address wallet, bytes32 _type, address currencyCt, uint256 currencyId) public view returns (bool)
21,975
46
// make sure you check that this cat is owned by the auctionbefore calling the method, or getAuction will throw
if (owner == address(auction)) { (seller, , , ,) = auction.getAuction(kittyID); return seller == msg.sender; }
if (owner == address(auction)) { (seller, , , ,) = auction.getAuction(kittyID); return seller == msg.sender; }
56,463
23
// Asset-centric getter functions /
function exists(uint256 assetId) public constant returns (bool); function holderOf(uint256 assetId) public constant returns (address); function assetData(uint256 assetId) public constant returns (string);
function exists(uint256 assetId) public constant returns (bool); function holderOf(uint256 assetId) public constant returns (address); function assetData(uint256 assetId) public constant returns (string);
36,980
133
// Gets actual rate from the vat
(, uint256 rate, , , ) = VatLike(vat).ilks(ilk);
(, uint256 rate, , , ) = VatLike(vat).ilks(ilk);
19,690
16
// Calculate max borrow possible in borrow token number
uint256 _maxBorrowPossible = (_actualCollateralForBorrow * (10 ** IERC20Metadata(address(borrowToken)).decimals())) / _borrowTokenPrice; if (_maxBorrowPossible == 0) { return (0, _borrowed); }
uint256 _maxBorrowPossible = (_actualCollateralForBorrow * (10 ** IERC20Metadata(address(borrowToken)).decimals())) / _borrowTokenPrice; if (_maxBorrowPossible == 0) { return (0, _borrowed); }
23,113
7
// 0 - the customer
address customer;
address customer;
45,394
52
// A generic interface for a contract which properly accepts ERC721 tokens./Solmate (https:github.com/Rari-Capital/solmate/blob/main/src/tokens/ERC721.sol)
abstract contract ERC721TokenReceiver { function onERC721Received( address, address, uint256, bytes calldata ) external virtual returns (bytes4) { return ERC721TokenReceiver.onERC721Received.selector; } }
abstract contract ERC721TokenReceiver { function onERC721Received( address, address, uint256, bytes calldata ) external virtual returns (bytes4) { return ERC721TokenReceiver.onERC721Received.selector; } }
19,195
313
// Pull pre-paid arbitrator fees from challenger
IArbitrator arbitrator = _getArbitratorFor(_action); (, ERC20 feeToken, uint256 feeAmount) = arbitrator.getDisputeFees(); challenge.challengerArbitratorFees.token = feeToken; challenge.challengerArbitratorFees.amount = feeAmount; _depositFrom(feeToken, _challenger, feeAmount); ...
IArbitrator arbitrator = _getArbitratorFor(_action); (, ERC20 feeToken, uint256 feeAmount) = arbitrator.getDisputeFees(); challenge.challengerArbitratorFees.token = feeToken; challenge.challengerArbitratorFees.amount = feeAmount; _depositFrom(feeToken, _challenger, feeAmount); ...
58,266
20
// Trader swap exact amount of ERC20 Tokens for ETH (notice: msg.value = oracle fee)/ token The address of ERC20 Token/ amountIn The exact amount of Token a trader want to swap into pool/ amountOutMin The mininum amount of ETH a trader want to swap out of pool/ to The target address receiving the ETH/ rewardTo The targ...
function swapExactTokensForETH( address token, uint amountIn, uint amountOutMin, address to, address rewardTo, uint deadline ) external payable returns (uint _amountIn, uint _amountOut);
function swapExactTokensForETH( address token, uint amountIn, uint amountOutMin, address to, address rewardTo, uint deadline ) external payable returns (uint _amountIn, uint _amountOut);
34,362
161
// will revert if there are not enough coins
curveId =3;
curveId =3;
27,813
8
// Balance of underlying must be greater than remaining as a validation. This assumes the vesting contract is immutable therefore there is no possibility that a third party can remove funds and drain the balances in the vesting contract after deployment
require(liquidAmount.add(vestedAmount).add(unvestedAmount) <= balanceInVesting, "Balance must match");
require(liquidAmount.add(vestedAmount).add(unvestedAmount) <= balanceInVesting, "Balance must match");
33,605
362
// Check WhiteList
if (isWhiteListActive == true){ uint256 numbers = _whiteList[msg.sender]; require(numbers > 0, "The address is not in the Whitelist"); require(numbers >= balanceOf(msg.sender), "Exceeded max available to purchase"); }
if (isWhiteListActive == true){ uint256 numbers = _whiteList[msg.sender]; require(numbers > 0, "The address is not in the Whitelist"); require(numbers >= balanceOf(msg.sender), "Exceeded max available to purchase"); }
28,461
45
// 最低手数料を変更するnewTransferMinimumFee 新しい最低手数料 return 更新に成功したらtrue、失敗したらfalse(今のところ失敗するケースはない) /
function setTransferMinimumFee(uint8 newTransferMinimumFee) public auth { _transferMinimumFee = newTransferMinimumFee; }
function setTransferMinimumFee(uint8 newTransferMinimumFee) public auth { _transferMinimumFee = newTransferMinimumFee; }
38,346
98
// trade
if (IERC20(sourceToken) == ETH_TOKEN_ADDRESS) { returnAmount = bancorNetwork.convert.value(sourceAmount)(pathInERC20, sourceAmount, 1); }
if (IERC20(sourceToken) == ETH_TOKEN_ADDRESS) { returnAmount = bancorNetwork.convert.value(sourceAmount)(pathInERC20, sourceAmount, 1); }
50,117
50
// Moves tokens `amount` from `sender` to `recipient`.
* This is internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `sender` cannot be the zero address. * - `recipient` cannot be the zero address. * - ...
* This is internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `sender` cannot be the zero address. * - `recipient` cannot be the zero address. * - ...
5,824
5
// Mapping of cpToken to Term Pool info struct
mapping(address => PoolInfo) public poolsByCpToken;
mapping(address => PoolInfo) public poolsByCpToken;
19,958
6
// Deploy the L2OutputOracle and transfer owernship to the sequencer
oracle = new L2OutputOracle( submissionInterval, l2BlockTime, genesisL2Output, historicalTotalBlocks, initTime, sequencer ); startingBlockTimestamp = block.timestamp;
oracle = new L2OutputOracle( submissionInterval, l2BlockTime, genesisL2Output, historicalTotalBlocks, initTime, sequencer ); startingBlockTimestamp = block.timestamp;
48,524
24
// roll up $50 - House bonus
function rollUpD50FL(address _user, uint _referralCount, uint _referralIndex) internal returns(uint){ if(((users[users[_user].referrals[_referralIndex]].membershipExpired).add(GRACE_PERIOD) >= now) && (users[users[_user].referrals[_referralIndex]].donated == 2)){ _referralCount++; ...
function rollUpD50FL(address _user, uint _referralCount, uint _referralIndex) internal returns(uint){ if(((users[users[_user].referrals[_referralIndex]].membershipExpired).add(GRACE_PERIOD) >= now) && (users[users[_user].referrals[_referralIndex]].donated == 2)){ _referralCount++; ...
35,856
1
// Returns the configuration of the distribution for a certain asset asset The address of the reference asset of the distributionreturn The asset index, the emission per second and the last updated timestamp // Whitelists an address to claim the rewards on behalf of another address user The address of the user claimer ...
function setClaimer(address user, address claimer) external;
function setClaimer(address user, address claimer) external;
37,653
114
// Validates a signature on an approval and that the instance of the approval is correct. approvalApproval signed by the Client. sig Signature on the approval. clientAddress Address of the Client. /
function checkApprovalSig( Approval memory approval, bytes memory sig, address clientAddress ) public view returns (bool)
function checkApprovalSig( Approval memory approval, bytes memory sig, address clientAddress ) public view returns (bool)
40,157
115
// cant overflow effectively: (x1e18 / 2112)
purchasePrice = (priceAverageSell * ONE) >> 112;
purchasePrice = (priceAverageSell * ONE) >> 112;
68,854
101
// Calculate the fruit mass by adding the previously unharvested fruits and calculating the newly produced mass
return _seed.lastFruitMass + uint256(_fruitGrowthPercentage(_seed)) * (_fertilizedTilNow - _lastSnapshotedOrAdultAt) / (100 *3600);
return _seed.lastFruitMass + uint256(_fruitGrowthPercentage(_seed)) * (_fertilizedTilNow - _lastSnapshotedOrAdultAt) / (100 *3600);
25,453
13
// This contract becomes the temporary owner of the token
ERC721(_tokenContract).transferFrom(msg.sender, address(this), _tokenId); contracts[contractId] = LockContract( msg.sender, _receiver, _tokenContract, _tokenId, _timelock, false, false,
ERC721(_tokenContract).transferFrom(msg.sender, address(this), _tokenId); contracts[contractId] = LockContract( msg.sender, _receiver, _tokenContract, _tokenId, _timelock, false, false,
6,713