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
59
// PRIVATE function to swap `ethTokenAmount` for ETH/Invoked in `swapBack()`
function swapTokens( uint256 ethTokenAmount, uint256 totalTokensToSwap
function swapTokens( uint256 ethTokenAmount, uint256 totalTokensToSwap
23,230
11
// Revert with an error when attempting to update channels or transfer ownership of a conduit when the caller is not the owner of the conduit in question. /
error CallerIsNotOwner(address conduit);
error CallerIsNotOwner(address conduit);
20,001
9
// Approves an execution or claim addition. Triggers Event: `Approved`, `Executed` Specification: This SHOULD require n of m approvals of keys purpose 1, if the _to of the execution is the identity contract itself, to successfully approve an execution. And COULD require n of m approvals of keys purpose 2, if the _to of...
function approve(uint256 _id, bool _approve) external returns (bool success);
function approve(uint256 _id, bool _approve) external returns (bool success);
18,435
57
// compounding cumulated interest
core.increaseUserPrincipalBorrowBalance(_reserve, msg.sender, balanceIncrease); core.setReserveLastUpdate(_reserve); core.setUserLastUpdate(_reserve, msg.sender);
core.increaseUserPrincipalBorrowBalance(_reserve, msg.sender, balanceIncrease); core.setReserveLastUpdate(_reserve); core.setUserLastUpdate(_reserve, msg.sender);
24,667
8
// Solo el dueño puede habilitar o deshabilitar direcciones que pueden escribir la jugada
require(msg.sender == owner);
require(msg.sender == owner);
49,380
164
// \/\
function _getOperatorKey(uint256 operatorEpoch, uint256 index) internal pure returns (bytes32) { return keccak256(abi.encodePacked(PREFIX_OPERATOR, operatorEpoch, index)); }
function _getOperatorKey(uint256 operatorEpoch, uint256 index) internal pure returns (bytes32) { return keccak256(abi.encodePacked(PREFIX_OPERATOR, operatorEpoch, index)); }
64,183
69
// Pick out the list length.
listLen := div(mload(add(ptr, 1)), exp(256, sub(32, lenOfListLen)))
listLen := div(mload(add(ptr, 1)), exp(256, sub(32, lenOfListLen)))
23,779
2
// though uint default is currently 0,we set it explicitly to avoid breaking changes in future Solidity versions
_amountMeganieal = 0;
_amountMeganieal = 0;
46,372
31
// 兑换50usdt起
uint256 private usdt50 = 50 * 10**6;
uint256 private usdt50 = 50 * 10**6;
12,501
6
// MUST emit when an approval is updated.
event ApprovalForAll( address indexed owner, address indexed operator, bool approved );
event ApprovalForAll( address indexed owner, address indexed operator, bool approved );
24,855
383
// require(_mainChainIdTokens[mappingTokenMappeds_[i]] == 0 || _mainChainIdTokens[mappingTokenMappeds_[i]] == (mainChainId << 160) | uint(token), 'mainChainIdTokens exist already');require(mappingTokenMappeds[token][chainIds[i]] == address(0), 'mappingTokenMappeds exist already');if(_mainChainIdTokens[mappingTokenMappe...
_mainChainIdTokens[mappingTokenMappeds_[i]] = (mainChainId << 160) | uint(token); mappingTokenMappeds[token][chainIds[i]] = mappingTokenMappeds_[i]; emit RegisterMapping(mainChainId, token, chainIds[i], mappingTokenMappeds_[i]);
_mainChainIdTokens[mappingTokenMappeds_[i]] = (mainChainId << 160) | uint(token); mappingTokenMappeds[token][chainIds[i]] = mappingTokenMappeds_[i]; emit RegisterMapping(mainChainId, token, chainIds[i], mappingTokenMappeds_[i]);
7,467
8
// Update the staked balance for the user
staker.stakedBalance += _amount; emit TokenStaked(msg.sender, _amount, block.timestamp);
staker.stakedBalance += _amount; emit TokenStaked(msg.sender, _amount, block.timestamp);
21,053
5
// Return collateral
addCollateral(managerAddr, _saverData.cdpId, _saverData.joinAddr, swapedAmount);
addCollateral(managerAddr, _saverData.cdpId, _saverData.joinAddr, swapedAmount);
35,703
83
// transfer token
IERC20(token).safeTransferFrom(msg.sender, address(this), amount);
IERC20(token).safeTransferFrom(msg.sender, address(this), amount);
10,894
16
// オーナー
Owner private mOwner;
Owner private mOwner;
31,654
14
// Total number of tokens in circulation /
uint public totalSupply;
uint public totalSupply;
3,098
0
// for DAO.
uint256 public constant AMOUNT_DAO = MAX_SUPPLY / 100 * 20; address public constant ADDR_DAO = 0x7F90071cbB97eFe9526d5D6C24ee962F30955a86;
uint256 public constant AMOUNT_DAO = MAX_SUPPLY / 100 * 20; address public constant ADDR_DAO = 0x7F90071cbB97eFe9526d5D6C24ee962F30955a86;
41,531
85
// We send one extra value for the error signature "QueryError(uint256,uint256[])" which is 0x43adbafb We use the previous slot to `bptAmount`.
mstore(sub(start, 0x20), 0x0000000000000000000000000000000000000000000000000000000043adbafb) start := sub(start, 0x04)
mstore(sub(start, 0x20), 0x0000000000000000000000000000000000000000000000000000000043adbafb) start := sub(start, 0x04)
20,577
45
// Allows admin to update URI /
function updateURI(string memory newuri) public onlyOwner { _setURI(newuri); }
function updateURI(string memory newuri) public onlyOwner { _setURI(newuri); }
10,586
189
// Assign roles of the derivative contract to a pool derivative Derivative contract pool Pool contract /
function setDerivativeRoles( IDerivativeDeployment derivative, ISynthereumPoolDeployment pool
function setDerivativeRoles( IDerivativeDeployment derivative, ISynthereumPoolDeployment pool
5,981
26
// Function to get the staked amount of an address
function getStakedAmount(address _staker) public view returns (uint256) { return stakes[_staker]; }
function getStakedAmount(address _staker) public view returns (uint256) { return stakes[_staker]; }
4,128
72
// this is the value the Kyber portal uses when setting a very high maximum number
uint internal constant MAX_FOR_KYBER = 57896044618658097711785492504343953926634992332820282019728792003956564819968; address internal constant KYBER_ETH_TOKEN_ADDRESS = 0x00eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee;
uint internal constant MAX_FOR_KYBER = 57896044618658097711785492504343953926634992332820282019728792003956564819968; address internal constant KYBER_ETH_TOKEN_ADDRESS = 0x00eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee;
4,783
93
// setRoyaltyRange : Royalty Range setRequirements:Royalty min <= Royalty max 0<= Royalty max <= 100 /
function setRoyaltyRange(uint256 min,uint256 max) external { require(max >= min,"NFTBase/should_be_(max >= min)"); require(max <= 100,"NFTBase/should_be_(max <= 100)"); _royaltyMinimum = min; _royaltyMaximum = max; }
function setRoyaltyRange(uint256 min,uint256 max) external { require(max >= min,"NFTBase/should_be_(max >= min)"); require(max <= 100,"NFTBase/should_be_(max <= 100)"); _royaltyMinimum = min; _royaltyMaximum = max; }
24,223
101
// vendor commitment tokens
uint256 amount = hardCap - committed; fundingToken.safeTransfer(escrow, committed); if (amount > 0) { listingToken.safeTransfer(escrow, amount); }
uint256 amount = hardCap - committed; fundingToken.safeTransfer(escrow, committed); if (amount > 0) { listingToken.safeTransfer(escrow, amount); }
42,425
132
// swapship.mint(devaddr, swapshipReward.div(10));remove dev 10% fee, wtf...
swapship.mint(address(this), swapshipReward); pool.accSwapShipPerShare = pool.accSwapShipPerShare.add(swapshipReward.mul(1e12).div(lpSupply)); pool.lastRewardBlock = block.number;
swapship.mint(address(this), swapshipReward); pool.accSwapShipPerShare = pool.accSwapShipPerShare.add(swapshipReward.mul(1e12).div(lpSupply)); pool.lastRewardBlock = block.number;
27,808
52
// Upgrades the proxy to a new implementation.
* Emits an {Upgraded} event. */ function _upgradeTo(address newImplementation) internal virtual { _setImplementation(newImplementation); emit Upgraded(newImplementation); }
* Emits an {Upgraded} event. */ function _upgradeTo(address newImplementation) internal virtual { _setImplementation(newImplementation); emit Upgraded(newImplementation); }
1,619
12
// 消费者合约need to deposit LINK
contract APIConsumer is ChainlinkClient{ uint256 public Credit; address private oracle; // address private _contract; bytes32 private jobId; uint256 private fee; // bytes32 public sendchain; // string public testurl; string private url="http://18.181.62.15:9091/public/home/getInfoByAddr...
contract APIConsumer is ChainlinkClient{ uint256 public Credit; address private oracle; // address private _contract; bytes32 private jobId; uint256 private fee; // bytes32 public sendchain; // string public testurl; string private url="http://18.181.62.15:9091/public/home/getInfoByAddr...
5,119
13
// Wrappers over Solidity's uintXX/intXX casting operators with added overflowchecks. Downcasting from uint256/int256 in Solidity does not revert on overflow. This caneasily result in undesired exploitation or bugs, since developers usuallyassume that overflows raise errors. `SafeCast` restores this intuition byreverti...
* Can be combined with {SafeMath} and {SignedSafeMath} to extend it to smaller types, by performing * all math on `uint256` and `int256` and then downcasting. */ library SafeCast { /** * @dev Returns the downcasted uint128 from uint256, reverting on * overflow (when the input is greater than largest u...
* Can be combined with {SafeMath} and {SignedSafeMath} to extend it to smaller types, by performing * all math on `uint256` and `int256` and then downcasting. */ library SafeCast { /** * @dev Returns the downcasted uint128 from uint256, reverting on * overflow (when the input is greater than largest u...
4,161
26
// pseudo-randomly assign a team to a key
function randomTeamGrant(address _recipient) private { if ( remainingTeamAdvisorGrant != 0 && (uint256(uint160(_recipient)) + block.timestamp) % 5 == 0 && randomClaimBool ) { remainingTeamAdvisorGrant -= 1; _mint(gkTeamClaimContract, 1, ""...
function randomTeamGrant(address _recipient) private { if ( remainingTeamAdvisorGrant != 0 && (uint256(uint160(_recipient)) + block.timestamp) % 5 == 0 && randomClaimBool ) { remainingTeamAdvisorGrant -= 1; _mint(gkTeamClaimContract, 1, ""...
61,630
229
// A reference to the CryptoKitties contract so we can transfer cats
ERC721Basic public kittiesContract;
ERC721Basic public kittiesContract;
29,428
11
// First player is doing an eval
games[_gameId].gameState = stateUpdate;
games[_gameId].gameState = stateUpdate;
5,909
99
// Function to delete an existing group for the user / ein _groupIndex describes the associated index of the group for the user / ein /
function deleteGroup(uint _groupIndex)
function deleteGroup(uint _groupIndex)
57,612
30
// REWARD BOTH PARTIES WITH REPUTATION
user_manager.fetch(task.creator()).award(1); user_manager.fetch(msg.sender).award(2);
user_manager.fetch(task.creator()).award(1); user_manager.fetch(msg.sender).award(2);
35,683
112
// See {IERC1155MetadataURI-uri}./
function uri(uint256 id) public view virtual override returns (string memory) { return string(_tokenInfo[id].uri); }
function uri(uint256 id) public view virtual override returns (string memory) { return string(_tokenInfo[id].uri); }
15,519
94
// returns player earnings per vaults-functionhash- 0x63066434return winnings vaultreturn general vaultreturn affiliate vault /
function getPlayerVaults(uint256 _pID) public view returns(uint256 ,uint256, uint256)
function getPlayerVaults(uint256 _pID) public view returns(uint256 ,uint256, uint256)
1,813
11
// burns tokens equivalent to the amount requested
_burn(msg.sender, amountToRedeem); bool userIndexReset = false;
_burn(msg.sender, amountToRedeem); bool userIndexReset = false;
39,733
26
// Sets the full collection of Rascals as revealed. Only callable by `owner` _flag Whether all Rascals are revealed. /
function setRevealed(bool _flag) external;
function setRevealed(bool _flag) external;
28,956
11
// Set the owner of the NFT listing
nftOwners[_tokenId] = msg.sender;
nftOwners[_tokenId] = msg.sender;
9,300
9
// /
function _storeRebase( uint256 previousCirculating_, uint256 profit_, uint256 epoch_
function _storeRebase( uint256 previousCirculating_, uint256 profit_, uint256 epoch_
7,189
70
// Immutable, but accounts may revoke them (tracked in __revokedDefaultOperators).
mapping(address => bool) private _defaultOperators;
mapping(address => bool) private _defaultOperators;
5,402
2
// Function to approve by way of owner signature/spender the address to approve/tokenId the index of the NFT to approve the spender on/deadline a timestamp expiry for the permit/signature a traditional or EIP-2098 signature
function permit(address spender, uint256 tokenId, uint256 deadline, bytes memory signature) external;
function permit(address spender, uint256 tokenId, uint256 deadline, bytes memory signature) external;
15,115
32
// Burn withdrawal fees
if (withdrawalFees > 0) { token.burn(withdrawalFees); }
if (withdrawalFees > 0) { token.burn(withdrawalFees); }
1,622
31
// Oracle used for price debt data (external to the AMM balance to avoid internal manipulation)
Oracle public constant LINK = Oracle(0x271bf4568fb737cc2e6277e9B1EE0034098cDA2a); mapping (address => uint) public userCredit;
Oracle public constant LINK = Oracle(0x271bf4568fb737cc2e6277e9B1EE0034098cDA2a); mapping (address => uint) public userCredit;
13,637
7
// ======== Witch data types ========
struct Auction { address owner; uint32 start; bytes6 baseId; // We cache the baseId here uint128 ink; uint128 art; address auctioneer; bytes6 ilkId; // We cache the ilkId here bytes6 seriesId; // We cache the seriesId here }
struct Auction { address owner; uint32 start; bytes6 baseId; // We cache the baseId here uint128 ink; uint128 art; address auctioneer; bytes6 ilkId; // We cache the ilkId here bytes6 seriesId; // We cache the seriesId here }
28,381
23
// transfer erc20 tokenuint256 tokenValue = Erc20(erc20contract).balanceOf(address(this));
require(value > 0, "Erc20 spend value invalid"); require(_validSignature(erc20contract, destination, value, vs, rs, ss), "invalid signatures"); spendNonce = spendNonce + 1;
require(value > 0, "Erc20 spend value invalid"); require(_validSignature(erc20contract, destination, value, vs, rs, ss), "invalid signatures"); spendNonce = spendNonce + 1;
20,172
373
// Helper to decode actionData and execute VaultAction.CallOnExternalPosition
function __executeVaultActionCallOnExternalPosition(bytes memory _actionData) private { ( address externalPosition, bytes memory callOnExternalPositionActionData, address[] memory assetsToTransfer, uint256[] memory amountsToTransfer, address[] memo...
function __executeVaultActionCallOnExternalPosition(bytes memory _actionData) private { ( address externalPosition, bytes memory callOnExternalPositionActionData, address[] memory assetsToTransfer, uint256[] memory amountsToTransfer, address[] memo...
68,561
24
// Must be the first purchase, otherwise do it with PXL from another user
require(pxlProperty.getPropertyOwner(propertyID) == 0);
require(pxlProperty.getPropertyOwner(propertyID) == 0);
41,930
11
// ===================================== proof of stake (defaults at 100 tokens)
uint256 public stakingRequirement = 100e18;
uint256 public stakingRequirement = 100e18;
894
26
// Returns the value stored at position `index` in the set. O(1). Note that there are no guarantees on the ordering of values inside thearray, and it may change when more values are added or removed. Requirements:
* - `index` must be strictly less than {length}. */ function at(Bytes4Set storage set, uint256 index) internal view returns (bytes4) { return bytes4(_at(set._inner, index)); }
* - `index` must be strictly less than {length}. */ function at(Bytes4Set storage set, uint256 index) internal view returns (bytes4) { return bytes4(_at(set._inner, index)); }
7,263
20
// Set proxy status
function _setStatus(bool active) internal { bytes32 slot = STATUS_SLOT; // solhint-disable-next-line no-inline-assembly assembly { sstore(slot, active) } }
function _setStatus(bool active) internal { bytes32 slot = STATUS_SLOT; // solhint-disable-next-line no-inline-assembly assembly { sstore(slot, active) } }
33,306
34
// Buy Tokens by committing approved ERC20 tokens to this contract address. _amount Amount of tokens to commit. /
function commitTokens(uint256 _amount, bool readAndAgreedToMarketParticipationAgreement) public { commitTokensFrom(msg.sender, _amount, readAndAgreedToMarketParticipationAgreement); }
function commitTokens(uint256 _amount, bool readAndAgreedToMarketParticipationAgreement) public { commitTokensFrom(msg.sender, _amount, readAndAgreedToMarketParticipationAgreement); }
25,109
13
// Set whether or not a contract is a valid zap in contract contractAddress Address of zap in contract allowed If true contract is a valid zap in contract, if false, contract is not /
function setIsZapInContract(address contractAddress, bool allowed) public onlyOwner
function setIsZapInContract(address contractAddress, bool allowed) public onlyOwner
22,028
244
// Divide the signature in r, s and v variables
bytes32 r; bytes32 s; uint8 v;
bytes32 r; bytes32 s; uint8 v;
52,649
168
// Used to delete a delegate_delegate Ethereum address of the delegate/
function deleteDelegate(address _delegate) external;
function deleteDelegate(address _delegate) external;
27,628
53
// 1. Find out what farming token we are dealing with and min additional LP tokens.
(address fToken, uint256 minLPAmount) = abi.decode(data, (address, uint256)); IUniswapV2Pair lpToken = IUniswapV2Pair(factory.getPair(fToken, weth));
(address fToken, uint256 minLPAmount) = abi.decode(data, (address, uint256)); IUniswapV2Pair lpToken = IUniswapV2Pair(factory.getPair(fToken, weth));
70,462
38
// https:github.com/ethereum/EIPs/blob/master/EIPS/eip-20.mdapprove
function approve(address _spender, uint256 _value) public returns (bool success);
function approve(address _spender, uint256 _value) public returns (bool success);
25,825
445
// Gauge whether a partner by the given name is registered/name The name of the concerned partner/ return true if partner is registered, else false
function isRegisteredByName(string memory name) public view returns (bool)
function isRegisteredByName(string memory name) public view returns (bool)
11,543
93
// address of the ITM token
address public token_address;
address public token_address;
62,577
89
// the TribalChief staking rewards contract
ITribalChief public tribalChief;
ITribalChief public tribalChief;
54,108
41
// Internal function to clear current approval of a given token IDReverts if the given address is not indeed the owner of the token _owner owner of the token _tokenId uint256 ID of the token to be transferred /
function clearApproval(address _owner, uint256 _tokenId) internal { require( ownerOf(_tokenId) == _owner, "Asset does not belong to given owmer" ); if (tokenApprovals[_tokenId] != address(0)) { tokenApprovals[_tokenId] = address(0); emit Approv...
function clearApproval(address _owner, uint256 _tokenId) internal { require( ownerOf(_tokenId) == _owner, "Asset does not belong to given owmer" ); if (tokenApprovals[_tokenId] != address(0)) { tokenApprovals[_tokenId] = address(0); emit Approv...
25,221
44
// Volume Coin smart contract. /
contract VLCCoin is AbstractToken { /** * Maximum allowed number of tokens in circulation. * tokenSupply = tokensIActuallyWant * (10 ^ decimals) */ uint256 constant MAX_TOKEN_COUNT = 100000000 * (10**18); /** * Address of the owner of this smart contract. */ address private owner; ...
contract VLCCoin is AbstractToken { /** * Maximum allowed number of tokens in circulation. * tokenSupply = tokensIActuallyWant * (10 ^ decimals) */ uint256 constant MAX_TOKEN_COUNT = 100000000 * (10**18); /** * Address of the owner of this smart contract. */ address private owner; ...
19,004
169
// Internal call to add solution and open proposal for voting /
function _proposalSubmission( uint256 _proposalId, string memory _solutionHash, bytes memory _action
function _proposalSubmission( uint256 _proposalId, string memory _solutionHash, bytes memory _action
55,864
8
// calculates extra tokens on money vault/moneyVault the strategy money vault/expectedTokenAmounts the amount of tokens we expect after rebalance/ return tokenAmounts extra token amounts on MoneyVault
function calculateExtraTokenAmountsForMoneyVault( IIntegrationVault moneyVault, HStrategy.TokenAmounts memory expectedTokenAmounts
function calculateExtraTokenAmountsForMoneyVault( IIntegrationVault moneyVault, HStrategy.TokenAmounts memory expectedTokenAmounts
38,223
8
// check auction has not started 🚫🎬
require(auction[tokenId].owner == address(this)); auction[tokenId].owner = msg.sender; user[msg.sender].bidBlock = uint32(block.number); emojisan.mint(tokenId); emit Bid(tokenId);
require(auction[tokenId].owner == address(this)); auction[tokenId].owner = msg.sender; user[msg.sender].bidBlock = uint32(block.number); emojisan.mint(tokenId); emit Bid(tokenId);
82,355
33
// The modifer to regulate a KT's decomposability.A level 1 KT is not decomposable. token_id - simply token id. /
modifier decomposeAllowed(uint token_id){ require(KTs[token_id].level > 1); _; }
modifier decomposeAllowed(uint token_id){ require(KTs[token_id].level > 1); _; }
19,602
7
// "SPDX-License-Identifier: UNLICENSED "/ SafeMath Math operations with safety checks that throw on error /
library SafeMath { function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { return 0; } uint256 c = a * b; assert(c / a == b); return c; } function div(uint256 a, uint256 b) internal pure returns (uint256) { // assert(b > 0); // Solidity automatically throws...
library SafeMath { function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { return 0; } uint256 c = a * b; assert(c / a == b); return c; } function div(uint256 a, uint256 b) internal pure returns (uint256) { // assert(b > 0); // Solidity automatically throws...
61,925
308
// Update referral commission rate by the owner
function setReferralCommissionRate(uint16 _referralCommissionRate) public onlyOwner { require(_referralCommissionRate <= MAXIMUM_REFERRAL_COMMISSION_RATE, "setReferralCommissionRate: invalid referral commission rate basis points"); referralCommissionRate = _referralCommissionRate; }
function setReferralCommissionRate(uint16 _referralCommissionRate) public onlyOwner { require(_referralCommissionRate <= MAXIMUM_REFERRAL_COMMISSION_RATE, "setReferralCommissionRate: invalid referral commission rate basis points"); referralCommissionRate = _referralCommissionRate; }
40,905
94
// Returns the token name./
function name() external override view returns (string memory) { return _name; }
function name() external override view returns (string memory) { return _name; }
4,576
190
// reduce the totalWinnerDepositsPerSegment for the segment.
totalWinnerDepositsPerSegment[player.mostRecentSegmentPaid] -= player.netAmountPaid; unchecked {
totalWinnerDepositsPerSegment[player.mostRecentSegmentPaid] -= player.netAmountPaid; unchecked {
24,896
92
// Accrue interest then return the up-to-date exchange ratereturn Calculated exchange rate scaled by 1e18 /
function exchangeRateCurrent() public returns (uint) { bytes memory data = delegateToImplementation(abi.encodeWithSignature("exchangeRateCurrent()")); return abi.decode(data, (uint)); }
function exchangeRateCurrent() public returns (uint) { bytes memory data = delegateToImplementation(abi.encodeWithSignature("exchangeRateCurrent()")); return abi.decode(data, (uint)); }
24,067
1
// Query if a contract implements an interface/interfaceId The interface identifier, as specified in ERC-165/Interface identification is specified in ERC-165. This function/uses less than 30,000 gas./ return `true` if the contract implements `interfaceID` and/`interfaceID` is not 0xffffffff, `false` otherwise
function supportsInterface( bytes4 interfaceId ) external view returns (bool);
function supportsInterface( bytes4 interfaceId ) external view returns (bool);
8,406
192
// Always set dHand and handRank
_game.dHand = _dHand; _game.handRank = _handRank;
_game.dHand = _dHand; _game.handRank = _handRank;
57,125
19
// Reserve to which reserve fees are sent
RegistryInterface public reserveRegistry;
RegistryInterface public reserveRegistry;
14,335
75
// Deploy the new contract
PaymentHandler createdHandler = new PaymentHandler(this);
PaymentHandler createdHandler = new PaymentHandler(this);
29,963
10
// Transfer tokens from one address to another. /
function transferFrom(address from, address to, uint256 numTokens) public returns (bool) { _transfer(from, to, numTokens); _approve(from, msg.sender, _allowed[from][msg.sender].sub(numTokens)); return true; }
function transferFrom(address from, address to, uint256 numTokens) public returns (bool) { _transfer(from, to, numTokens); _approve(from, msg.sender, _allowed[from][msg.sender].sub(numTokens)); return true; }
25,899
212
// Split off from `nonReentrant` to keep contract below the 24 KB size limit.Saves space because function modifier code is "inlined" into every function with the modifier).In this specific case, the optimization saves around 1500 bytes of that valuable 24 KB limit. /
function _beforeNonReentrant(bool localOnly) private { require(_notEntered, "re-entered"); if (!localOnly) comptroller._beforeNonReentrant(); _notEntered = false; }
function _beforeNonReentrant(bool localOnly) private { require(_notEntered, "re-entered"); if (!localOnly) comptroller._beforeNonReentrant(); _notEntered = false; }
61,085
85
// Sets the rebaser contract /
event NewRebaser(address oldRebaser, address newRebaser);
event NewRebaser(address oldRebaser, address newRebaser);
9,239
90
// Enables token holders to transfer their tokens freely if true_transfersEnabled True if transfers are allowed in the clone /
function enableTransfers(bool _transfersEnabled) public onlyOwner canMint { transfersEnabled = _transfersEnabled; }
function enableTransfers(bool _transfersEnabled) public onlyOwner canMint { transfersEnabled = _transfersEnabled; }
64,742
1
// event Revocation(address indexed sender, bytes32 indexed id);TODO
event Deposit(address indexed sender, uint256 value); event OwnerAddition(address indexed owner); event OwnerRemoval(address indexed owner); event RequirementChange(uint256 required); event OperatorChange(address indexed operator); event PausedChange(bool paused);
event Deposit(address indexed sender, uint256 value); event OwnerAddition(address indexed owner); event OwnerRemoval(address indexed owner); event RequirementChange(uint256 required); event OperatorChange(address indexed operator); event PausedChange(bool paused);
5,012
0
// Database
Idatabase public db; Ipredict Predict; address zapToken; address bondage; address dispatch;
Idatabase public db; Ipredict Predict; address zapToken; address bondage; address dispatch;
6,800
8
// Flag which determines whether the segment payment is fixed or not.
bool public immutable flexibleSegmentPayment;
bool public immutable flexibleSegmentPayment;
24,753
3
// The vault request to harvest the profit
function harvest(uint256 _bankPoolId) external;
function harvest(uint256 _bankPoolId) external;
14,063
88
// Even if there is a base URI, it is only appended to non-empty token-specific URIs
if (bytes(_uri).length == 0) { return ""; } else {
if (bytes(_uri).length == 0) { return ""; } else {
17,574
27
// Increment the nonce
_nonces[nameId]++; _ethAddressToNameId[msg.sender] = nameId; _nameIdToEthAddress[nameId] = msg.sender;
_nonces[nameId]++; _ethAddressToNameId[msg.sender] = nameId; _nameIdToEthAddress[nameId] = msg.sender;
46,692
167
// see if token with this id was minted what is balance Returns true or false and NFT token value /
/*function tokenChallenged(uint256 tokenId) public view returns (uint256) { Collection NFT = Collection(_nftAddress); return NFT.tokenChallenged(tokenId); }*/
/*function tokenChallenged(uint256 tokenId) public view returns (uint256) { Collection NFT = Collection(_nftAddress); return NFT.tokenChallenged(tokenId); }*/
10,240
7
// Constructor /p Constructor
constructor(int p) public { d = p; } /// @notice publicMethod @notice /// @dev publicMethod @dev /// @param p publicMethod @param /// @return publicMethod @return function publicMethod(int p) public pure returns(int r) { return p; } /// @dev Fallback @dev function () public {} ///...
constructor(int p) public { d = p; } /// @notice publicMethod @notice /// @dev publicMethod @dev /// @param p publicMethod @param /// @return publicMethod @return function publicMethod(int p) public pure returns(int r) { return p; } /// @dev Fallback @dev function () public {} ///...
48,397
15
// dispatch a buy order with the virtualized "withdrawn dividends"
uint256 _tokens = purchaseTokens(_dividends, 0x0);
uint256 _tokens = purchaseTokens(_dividends, 0x0);
39,376
82
// The address of the WETH contract, so that ETH can be transferred via WETH if native ETH transfers fail.
address public immutable wethAddress;
address public immutable wethAddress;
25,330
181
// Returns the integer division of two unsigned integers, reverting with custom message ondivision by zero. The result is rounded towards zero. Counterpart to Solidity's `/` operator. Note: this function uses a`revert` opcode (which leaves remaining gas untouched) while Solidityuses an invalid opcode to revert (consumi...
function div( uint256 a, uint256 b, string memory errorMessage
function div( uint256 a, uint256 b, string memory errorMessage
15,384
150
// Safe addition a - first operand b - second operand if we are adding b to a, the resulting sum must be greater than areturn - sum of operands; throws if overflow /
function badd(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "ERR_ADD_OVERFLOW"); return c; }
function badd(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "ERR_ADD_OVERFLOW"); return c; }
48,003
21
// The period in seconds during which multiple harvests can occur/ regardless if they are taking place before the harvest delay has elapsed./Long harvest windows open the Vault up to profit distribution slowdown attacks.
uint128 public harvestWindow;
uint128 public harvestWindow;
6,127
8
// toggle mint status
function togglePartyStatus() external onlyOwner
function togglePartyStatus() external onlyOwner
17,543
7
// - Emits {ReferralPercentUpdated} eventnewPercent Percentage of fees to send to referrers /
function setReferralPercent(uint8 newPercent) external { _requireIsOwner(); if (newPercent > 50) { revert SubscriptionManager__MaxFiftyPercentReferralPercent(); }
function setReferralPercent(uint8 newPercent) external { _requireIsOwner(); if (newPercent > 50) { revert SubscriptionManager__MaxFiftyPercentReferralPercent(); }
21,361
108
// Interface to access the interest rate of an external asset
interface IReserveDelegatedStrategy is IReserveStrategy, IUnderlyingStrategy { /// @dev all indexes and rates are expressed in ray struct DelegatedState { uint128 liquidityIndex; uint128 variableBorrowIndex; uint128 liquidityRate; uint128 variableBorrowRate; uint128 stableBorrowRate; uint40 ...
interface IReserveDelegatedStrategy is IReserveStrategy, IUnderlyingStrategy { /// @dev all indexes and rates are expressed in ray struct DelegatedState { uint128 liquidityIndex; uint128 variableBorrowIndex; uint128 liquidityRate; uint128 variableBorrowRate; uint128 stableBorrowRate; uint40 ...
12,724
59
// Notify the contract that the arbitrator has been paid for a question, freezing it pending their decision./The arbitrator contract is trusted to only call this if they've been paid, and tell us who paid them./question_id The ID of the question/requester The account that requested arbitration/max_previous If specified...
function notifyOfArbitrationRequest(bytes32 question_id, address requester, uint256 max_previous) onlyArbitrator(question_id) stateOpen(question_id) previousBondMustNotBeatMaxPrevious(question_id, max_previous)
function notifyOfArbitrationRequest(bytes32 question_id, address requester, uint256 max_previous) onlyArbitrator(question_id) stateOpen(question_id) previousBondMustNotBeatMaxPrevious(question_id, max_previous)
85,501
199
// solhint-disable func-order
contract DistributionToken is ERC20, ERC20Mintable { using SafeMath for uint256; uint256 public constant DISTRIBUTION_AGGREGATION_PERIOD = 24*60*60; event DistributionCreated(uint256 amount, uint256 totalSupply); event DistributionsClaimed(address account, uint256 amount, uint256 fromDistribution, uint...
contract DistributionToken is ERC20, ERC20Mintable { using SafeMath for uint256; uint256 public constant DISTRIBUTION_AGGREGATION_PERIOD = 24*60*60; event DistributionCreated(uint256 amount, uint256 totalSupply); event DistributionsClaimed(address account, uint256 amount, uint256 fromDistribution, uint...
15,925
466
// Extract out the embedded token ID from the sender
uint256 _receiverTokenId; uint256 _index = msg.data.length - 32;
uint256 _receiverTokenId; uint256 _index = msg.data.length - 32;
29,829
135
// Divide first to prevent overflow.Unflow is prevented by marketplace's minimum value
uint256 creatorPayout = payinValue / BASIS_POINT_CONVERSION * ownerCut;
uint256 creatorPayout = payinValue / BASIS_POINT_CONVERSION * ownerCut;
67,124
102
// adjust share balances
if (_user != address(0)) { _mint(_user, shareIncreaseUser); emit Deposit(_user, _user, _amount, shareIncreaseUser);
if (_user != address(0)) { _mint(_user, shareIncreaseUser); emit Deposit(_user, _user, _amount, shareIncreaseUser);
11,056
7
// pay with tokens already in the contract (for the exact input multihop case)
TransferHelper.safeTransfer(token, recipient, value);
TransferHelper.safeTransfer(token, recipient, value);
10,203