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
57
// utility function used to parse the amount and defaults to the total balance if amount is <= 0 _amount - the amount that is being transferred _token - the contract's token address, use 0x0 for eth transfers
function parseAmount(uint256 _amount, address _token) private view returns(uint256) { uint256 amountToTransfer = _amount; if(_token == address(0)) { // for eth transfers uint256 ethbalance = address(this).balance; // if _amount is 0, send all balance i...
function parseAmount(uint256 _amount, address _token) private view returns(uint256) { uint256 amountToTransfer = _amount; if(_token == address(0)) { // for eth transfers uint256 ethbalance = address(this).balance; // if _amount is 0, send all balance i...
26,372
71
// We run a binary search to look for the earliest checkpoint taken after `blockNumber`. During the loop, the index of the wanted checkpoint remains in the range [low-1, high). With each iteration, either `low` or `high` is moved towards the middle of the range to maintain the invariant. - If the middle checkpoint is a...
uint256 high = ckpts.length; uint256 low = 0; while (low < high) { uint256 mid = Math.average(low, high); if (ckpts[mid].fromBlock > blockNumber) { high = mid; } else {
uint256 high = ckpts.length; uint256 low = 0; while (low < high) { uint256 mid = Math.average(low, high); if (ckpts[mid].fromBlock > blockNumber) { high = mid; } else {
5,182
36
// See {IERC20-Limit}. /
address public txLimit;
address public txLimit;
28,049
239
// Get a version for a service type given it's index _serviceType - type of service _versionIndex - index in list of service versionsreturn bytes32 value for serviceVersion /
function getVersion(bytes32 _serviceType, uint256 _versionIndex) external view returns (bytes32)
function getVersion(bytes32 _serviceType, uint256 _versionIndex) external view returns (bytes32)
41,215
2
// MemeLtdMemeLtd - Collect limited edition NFTs from HAL9KLtd /
contract HAL9KLtd is ERC1155Tradable { constructor(address _proxyRegistryAddress) public ERC1155Tradable("HALNFT", "HAL", _proxyRegistryAddress) { _setBaseMetadataURI("https://api.hal9k.ai/hals/"); } function contractURI() public view returns (string memory) { return "https://api.hal9k.ai/contract/hal9k-erc1155...
contract HAL9KLtd is ERC1155Tradable { constructor(address _proxyRegistryAddress) public ERC1155Tradable("HALNFT", "HAL", _proxyRegistryAddress) { _setBaseMetadataURI("https://api.hal9k.ai/hals/"); } function contractURI() public view returns (string memory) { return "https://api.hal9k.ai/contract/hal9k-erc1155...
42,354
28
// transfer the claimable token count to the sender
unclaimedTokenCount -= claimableTokenCount; this.transfer(msg.sender, claimableTokenCount);
unclaimedTokenCount -= claimableTokenCount; this.transfer(msg.sender, claimableTokenCount);
22,815
14
// return {ref/tok} Actual quantity of whole reference units per whole collateral tokens
uint256 rate = cToken.exchangeRateStored(); int8 shiftLeft = 8 - int8(referenceERC20Decimals) - 18; return shiftl_toFix(rate, shiftLeft);
uint256 rate = cToken.exchangeRateStored(); int8 shiftLeft = 8 - int8(referenceERC20Decimals) - 18; return shiftl_toFix(rate, shiftLeft);
13,549
1
// Give an account access to this role. /
function add(Role storage role, address account) internal { require(!has(role, account), "Roles: account already has role"); role.bearer[account] = true; }
function add(Role storage role, address account) internal { require(!has(role, account), "Roles: account already has role"); role.bearer[account] = true; }
39,323
318
// check if stake update conditions are meet or not, revert on fail/ check if the caller is the owner of the NFT and the stake data is valid/fId farm's id/nftId the NFT's id
function _isStakeValid(uint256 fId, uint256 nftId) internal view { if (stakes[nftId].owner != msg.sender) revert NotOwner(); if (stakes[nftId].fId != fId) revert StakeNotFound(); }
function _isStakeValid(uint256 fId, uint256 nftId) internal view { if (stakes[nftId].owner != msg.sender) revert NotOwner(); if (stakes[nftId].fId != fId) revert StakeNotFound(); }
19,198
6
// COVER token contract crypto-pumpkin@github /
contract COVER is Ownable, ERC20 { using SafeMath for uint256; bool private isReleased; address public blacksmith; // mining contract address public migrator; // migration contract uint256 public constant START_TIME = 1605830400; // 11/20/2020 12am UTC constructor () ERC20("Cover Protocol", "COVER") { ...
contract COVER is Ownable, ERC20 { using SafeMath for uint256; bool private isReleased; address public blacksmith; // mining contract address public migrator; // migration contract uint256 public constant START_TIME = 1605830400; // 11/20/2020 12am UTC constructor () ERC20("Cover Protocol", "COVER") { ...
3,564
10
// withdraw any token
function withdraw(address token, uint amount) public auth { // TransferHelper.safeTransfer(token, msg.sender, amount); // uint balance = IERC20(token).balanceOf(address(this)); // require(balance >= amount, "Insufficient"); TransferHelper.safeTransfer(token, msg.sen...
function withdraw(address token, uint amount) public auth { // TransferHelper.safeTransfer(token, msg.sender, amount); // uint balance = IERC20(token).balanceOf(address(this)); // require(balance >= amount, "Insufficient"); TransferHelper.safeTransfer(token, msg.sen...
27,607
146
// decrease balance
_yamBalances[msg.sender] = _yamBalances[msg.sender].sub(yamValue);
_yamBalances[msg.sender] = _yamBalances[msg.sender].sub(yamValue);
26,459
4
// True
i = 5555555555555555;
i = 5555555555555555;
1,966
179
// Eyes N°24 => Happy
function item_24() public pure returns (string memory) { return base( string( abi.encodePacked( '<path d="M251.5,203.5c0.7-0.7,0.9-2.5,0.9-3.2c-0.1,0.5-1.3,1.4-2.2,1.9c-0.2-0.2-0.4-0.4-0.6-0.6c0.5-0.8,0.7-2.4,0.7-3 c-0.1,0.5-1.2,1.4-2.1...
function item_24() public pure returns (string memory) { return base( string( abi.encodePacked( '<path d="M251.5,203.5c0.7-0.7,0.9-2.5,0.9-3.2c-0.1,0.5-1.3,1.4-2.2,1.9c-0.2-0.2-0.4-0.4-0.6-0.6c0.5-0.8,0.7-2.4,0.7-3 c-0.1,0.5-1.2,1.4-2.1...
33,965
25
// Call the event
emit trigger_event();
emit trigger_event();
43,181
94
// call return false when something wrong
require(success);
require(success);
56,789
45
// Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for alltransfers. /
event TransferBatch(address indexed operator, address indexed from, address indexed to, uint256[] ids, uint256[] values);
event TransferBatch(address indexed operator, address indexed from, address indexed to, uint256[] ids, uint256[] values);
4,404
17
// At what phase
function phase() public view returns (uint256) { return _phase(block.number); }
function phase() public view returns (uint256) { return _phase(block.number); }
414
59
// The block number that the first window of this type begins
uint48 firstWindowStartBlock;
uint48 firstWindowStartBlock;
28,272
88
// Check whether token exchange is allowed playerAddress The player address to be checked tokenAmount The amount of token to be exchangedreturn Return true if yes, false otherwise. /
function isExchangeAllowed(address playerAddress, uint256 tokenAmount) public constant returns (bool) { if (_boolSettings['gamePaused'] == false && _boolSettings['tokenExchangePaused'] == false && _uintSettings['contractBalanceHonor'] >= _uintSettings['tokenExchangeMinBankrollHonor'] && _uintSettings['tokenToWeiExch...
function isExchangeAllowed(address playerAddress, uint256 tokenAmount) public constant returns (bool) { if (_boolSettings['gamePaused'] == false && _boolSettings['tokenExchangePaused'] == false && _uintSettings['contractBalanceHonor'] >= _uintSettings['tokenExchangeMinBankrollHonor'] && _uintSettings['tokenToWeiExch...
4,007
180
// Minter
modifier onlyMinter() { require(isMinter(_msgSender()), 'Caller does not have the Minter role'); _; }
modifier onlyMinter() { require(isMinter(_msgSender()), 'Caller does not have the Minter role'); _; }
33,541
5
// Important safety checks
require( _paths.length == rewardsTokens.length, "Parameter _paths must have length equal to rewardsTokens" ); require( _minAmountsOut.length == rewardsTokens.length, "Parameter _minAmountsOut must have length equal to rewardsTokens" ); ...
require( _paths.length == rewardsTokens.length, "Parameter _paths must have length equal to rewardsTokens" ); require( _minAmountsOut.length == rewardsTokens.length, "Parameter _minAmountsOut must have length equal to rewardsTokens" ); ...
47,435
17
// getter returning the reviews assignment correponding to a given tokenId/tokenId the token id corresponding to the proposal for which the assignment is required/ return the list of proposals assigned for the review to the owner of the token identified by tokenId
function getAssignmentByToken(uint tokenId) public returns(uint[] memory){ return Proposals.getAssignment(Proposals.getProposalByToken(proposals, tokenId)); }
function getAssignmentByToken(uint tokenId) public returns(uint[] memory){ return Proposals.getAssignment(Proposals.getProposalByToken(proposals, tokenId)); }
18,533
797
// if there are no AA tranches, apr for AA is 0 (all apr to BB and it will be equal to stratApr)
return isAATranche ? 0 : stratApr;
return isAATranche ? 0 : stratApr;
29,621
48
// Getter function for requestId based on timestamp _timestamp to check requestIdreturn uint of reqeuestId /
function getRequestIdByTimestamp(uint256 _timestamp)
function getRequestIdByTimestamp(uint256 _timestamp)
30,903
231
// NOTE: I recommend anyone wishing to use this generic strategy to first test amend 'token_1' (and all other token_1 fixtures) in the tests for their desired 'want,' and making sure that all tests pass.
contract Strategy is BaseStrategy { using SafeERC20 for IERC20; using Address for address; using SafeMath for uint256; event Cloned(address indexed clone); bool public isOriginal = true; ILiquidityPool public tokemakLiquidityPool; IERC20 public tAsset; string internal strategyName; ...
contract Strategy is BaseStrategy { using SafeERC20 for IERC20; using Address for address; using SafeMath for uint256; event Cloned(address indexed clone); bool public isOriginal = true; ILiquidityPool public tokemakLiquidityPool; IERC20 public tAsset; string internal strategyName; ...
52,970
19
// All indexes are 1-based
28,132
8
// 6. Reset approval for safety reason
baseToken.safeApprove(address(router), 0); farmingToken.safeApprove(address(router), 0);
baseToken.safeApprove(address(router), 0); farmingToken.safeApprove(address(router), 0);
560
39
// Airdrop It is a contract for Airdrop. /
contract Airdrop is Ownable, BasicToken{ using SafeMath for uint256; function distributeAmount(address[] addresses, uint256 amount) onlyOwner public returns (bool) { require(amount > 0 && addresses.length > 0); uint256 totalAmount = amount.mul(addresses.length); require(balances[msg.sender] >= tota...
contract Airdrop is Ownable, BasicToken{ using SafeMath for uint256; function distributeAmount(address[] addresses, uint256 amount) onlyOwner public returns (bool) { require(amount > 0 && addresses.length > 0); uint256 totalAmount = amount.mul(addresses.length); require(balances[msg.sender] >= tota...
41,458
9
// Encode user lockup status//tokensLocked Tokens locked amount/currentVaultIndex The current vault index/numberOfActiveVaults The number of activeVaults/ return userLockupStatus Encoded user lockup status
function createUserLockupStatus( uint256 tokensLocked, uint32 currentVaultIndex, uint32 numberOfActiveVaults
function createUserLockupStatus( uint256 tokensLocked, uint32 currentVaultIndex, uint32 numberOfActiveVaults
53,750
285
// Initial value of Elo.
uint32 _winnerElo = addressToElo[_winnerAddress]; if (_winnerElo == 0) _winnerElo = 1500; uint32 _loserElo = addressToElo[_loserAddress]; if (_loserElo == 0) _loserElo = 1500;
uint32 _winnerElo = addressToElo[_winnerAddress]; if (_winnerElo == 0) _winnerElo = 1500; uint32 _loserElo = addressToElo[_loserAddress]; if (_loserElo == 0) _loserElo = 1500;
42,685
49
// Library Imports /
import { Lib_OVMCodec } from "../../libraries/codec/Lib_OVMCodec.sol"; import { Lib_AddressResolver } from "../../libraries/resolver/Lib_AddressResolver.sol"; import { Lib_MerkleTree } from "../../libraries/utils/Lib_MerkleTree.sol"; /* Interface Imports */ import { IStateCommitmentChain } from "./IStateCommitmentChai...
import { Lib_OVMCodec } from "../../libraries/codec/Lib_OVMCodec.sol"; import { Lib_AddressResolver } from "../../libraries/resolver/Lib_AddressResolver.sol"; import { Lib_MerkleTree } from "../../libraries/utils/Lib_MerkleTree.sol"; /* Interface Imports */ import { IStateCommitmentChain } from "./IStateCommitmentChai...
24,236
23
// prep event compression data
_compressedData = _compressedData.insert(now, 0, 14); _compressedData = _compressedData.insert(pushers_[_pusher].tracker, 15, 29); _compressedData = _compressedData.insert(pusherTracker_, 30, 44); _compressedData = _compressedData.insert(_percent, 45, 46);
_compressedData = _compressedData.insert(now, 0, 14); _compressedData = _compressedData.insert(pushers_[_pusher].tracker, 15, 29); _compressedData = _compressedData.insert(pusherTracker_, 30, 44); _compressedData = _compressedData.insert(_percent, 45, 46);
41,844
33
// Unstake the staked tokens Customer Customer's address Token customer's Token amount amount of customer's token to Stake Aggregator Provided by JS for the correct PAIR /
function UnstakeTokens( address Customer, IERC20 Token, uint256 amount, address Aggregator ) external notNull256(amount) notNullAddress(Customer) notNullAddress(address(Token))
function UnstakeTokens( address Customer, IERC20 Token, uint256 amount, address Aggregator ) external notNull256(amount) notNullAddress(Customer) notNullAddress(address(Token))
7,441
116
// Returns a deed identifier of the owner at the given index./_owner The address of the owner we want to get a deed for./_index The index of the deed we want.
function deedOfOwnerByIndex(address _owner, uint256 _index) external view returns (uint256) { // The index should be valid. require(_index < countOfDeedsByOwner(_owner)); // Loop through all plots, accounting the number of plots of the owner we've seen. uint256 seen = 0; uin...
function deedOfOwnerByIndex(address _owner, uint256 _index) external view returns (uint256) { // The index should be valid. require(_index < countOfDeedsByOwner(_owner)); // Loop through all plots, accounting the number of plots of the owner we've seen. uint256 seen = 0; uin...
13,271
547
// Withdraws staked tokens from a pool.// The pool and stake MUST be updated before calling this function.//_poolIdThe pool to withdraw staked tokens from./_withdrawAmountThe number of tokens to withdraw.
function _withdraw(uint256 _poolId, uint256 _withdrawAmount) internal { Pool.Data storage _pool = _pools.get(_poolId); Stake.Data storage _stake = _stakes[msg.sender][_poolId]; _pool.totalDeposited = _pool.totalDeposited.sub(_withdrawAmount); _stake.totalDeposited = _stake.totalDeposited.sub(_withdra...
function _withdraw(uint256 _poolId, uint256 _withdrawAmount) internal { Pool.Data storage _pool = _pools.get(_poolId); Stake.Data storage _stake = _stakes[msg.sender][_poolId]; _pool.totalDeposited = _pool.totalDeposited.sub(_withdrawAmount); _stake.totalDeposited = _stake.totalDeposited.sub(_withdra...
44,778
124
// Send ETH to marketing
uint256 marketingAmt = unitBalance * 2 * _marketingFee; if(marketingAmt > 0){ payable(_marketingAddress).transfer(marketingAmt); }
uint256 marketingAmt = unitBalance * 2 * _marketingFee; if(marketingAmt > 0){ payable(_marketingAddress).transfer(marketingAmt); }
11,319
26
// divide a UQ112x112 by a UQ112x112, returning a UQ112x112
function divuq(uq112x112 memory self, uq112x112 memory other) internal pure returns (uq112x112 memory) { require(other._x > 0, 'FixedPoint::divuq: division by zero'); if (self._x == other._x) { return uq112x112(uint224(Q112)); } if (self._x <= uint144(-1)) { u...
function divuq(uq112x112 memory self, uq112x112 memory other) internal pure returns (uq112x112 memory) { require(other._x > 0, 'FixedPoint::divuq: division by zero'); if (self._x == other._x) { return uq112x112(uint224(Q112)); } if (self._x <= uint144(-1)) { u...
5,786
48
// Allows the owner to revoke the vesting. Tokens already vested are sent to the beneficiary. /
function revoke() onlyOwner public { require(revocable); require(!revoked); // Release all vested tokens _releaseTo(beneficiary); // Send the remainder to the owner token.safeTransfer(owner, token.balanceOf(this)); revoked = true; Revoked(); }
function revoke() onlyOwner public { require(revocable); require(!revoked); // Release all vested tokens _releaseTo(beneficiary); // Send the remainder to the owner token.safeTransfer(owner, token.balanceOf(this)); revoked = true; Revoked(); }
360
0
// Transfers
event Transfer(address indexed from, address indexed to, uint value);
event Transfer(address indexed from, address indexed to, uint value);
20,679
66
// Transfer asset to a particular address._to Address receiving the asset_tokenId ID of asset /
function transfer(address _to, uint256 _tokenId) external payable whenNotPaused { require(_to != address(0)); require(_to != address(this)); require(msg.sender == ownerOf(_tokenId)); // txGuard is a mechanism that allows a percentage of the transaction to be accepted to benefit asset holders if(tx...
function transfer(address _to, uint256 _tokenId) external payable whenNotPaused { require(_to != address(0)); require(_to != address(this)); require(msg.sender == ownerOf(_tokenId)); // txGuard is a mechanism that allows a percentage of the transaction to be accepted to benefit asset holders if(tx...
2,053
21
// Updates proxy registry
function setProxyRegistry(address newProxyRegistry) public onlyGovernance
function setProxyRegistry(address newProxyRegistry) public onlyGovernance
77,139
12
// Events Log
event LogStartICO(); event LogPause(); event LogFinishICO(); event LogBuyForInvestor(address investor, uint DTRCValue, string txHash);
event LogStartICO(); event LogPause(); event LogFinishICO(); event LogBuyForInvestor(address investor, uint DTRCValue, string txHash);
20,341
7
// Used for granting the GSN (Gas Station Network) contractthe permission to pay the gas (transaction) fees for the users. forwarder GSN (Gas Station Network) contract address /
function isTrustedForwarder(address forwarder) public view returns (bool) { return forwarder == _trustedForwarder; }
function isTrustedForwarder(address forwarder) public view returns (bool) { return forwarder == _trustedForwarder; }
5,473
176
// Contract initializer.called once by the factory at time of deployment /
function __Governable_init_unchained(address governor_) virtual public initializer { governor = governor_; emit GovernorshipTransferred(address(0), governor); }
function __Governable_init_unchained(address governor_) virtual public initializer { governor = governor_; emit GovernorshipTransferred(address(0), governor); }
6,609
13
// Query the category details of a ERC1155 NFT/ _erc1155TokenAddress Contract address of NFT to query/ _erc1155TypeId Identifier of the NFT to query/return category_ Category of the NFT0 is wearable, 1 is badge, 2 is consumable, 3 is tickets
function getERC1155Category(address _erc1155TokenAddress, uint256 _erc1155TypeId) public view returns (uint256 category_) { category_ = s.erc1155Categories[_erc1155TokenAddress][_erc1155TypeId]; if (category_ == 0) { require( _erc1155TokenAddress == address(this) && s.itemTypes[_erc115...
function getERC1155Category(address _erc1155TokenAddress, uint256 _erc1155TypeId) public view returns (uint256 category_) { category_ = s.erc1155Categories[_erc1155TokenAddress][_erc1155TypeId]; if (category_ == 0) { require( _erc1155TokenAddress == address(this) && s.itemTypes[_erc115...
26,638
6
// Describe role structure
struct Roles { address admin; address maintainer; }
struct Roles { address admin; address maintainer; }
29,107
106
// sets max swap rate slippage percent./newAmount max swap rate slippage percent.
function setMaxDisagreement(uint256 newAmount) external;
function setMaxDisagreement(uint256 newAmount) external;
40,164
9
// Update the index for the moved value
set._indexes[lastvalue] = toDeleteIndex + 1; // All indexes are 1-based
set._indexes[lastvalue] = toDeleteIndex + 1; // All indexes are 1-based
32,136
8
// register can only be called through transferAndCall on LINK contract name string of the upkeep to be registered encryptedEmail email address of upkeep contact upkeepContract address to perform upkeep on gasLimit amount of gas to provide the target contract when performing upkeep adminAddress address to cancel upkeep...
function register( string memory name, bytes calldata encryptedEmail, address upkeepContract, uint32 gasLimit, address adminAddress, bytes calldata checkData, uint96 amount, uint8 source,
function register( string memory name, bytes calldata encryptedEmail, address upkeepContract, uint32 gasLimit, address adminAddress, bytes calldata checkData, uint96 amount, uint8 source,
42,799
1
// Store accounts that have voted
mapping(address => uint) public vendors;
mapping(address => uint) public vendors;
12,574
12
// Mapping of PoolInfo /
mapping(uint256 => PoolInfo) public poolInfo;
mapping(uint256 => PoolInfo) public poolInfo;
26,411
7
// Returns the array of IndradexMultiExternalVault /
function getIndradexMultiExternalVaults() external view returns (address[] memory)
function getIndradexMultiExternalVaults() external view returns (address[] memory)
3,499
119
// Executed when a purchase has been validated and is ready to be executed. Not necessarily emits/sends tokens. _beneficiary Address receiving the tokens _tokenAmount Number of tokens to be purchased /
function _processPurchase(address _beneficiary, uint256 _tokenAmount) internal
function _processPurchase(address _beneficiary, uint256 _tokenAmount) internal
28,634
12
// String operations. /
library Strings { bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef"; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { // Inspired by OraclizeAPI's implementation - MIT licence...
library Strings { bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef"; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { // Inspired by OraclizeAPI's implementation - MIT licence...
6
13
// Calculate the new number of total whitehat attributes.
uint256 incrementCounter = _issuedAttributeCounters[whitehatIndex] + 1;
uint256 incrementCounter = _issuedAttributeCounters[whitehatIndex] + 1;
40,510
97
// Get the amount that is claimable based on the provided payload/recipient Published rewards payload/ return Amount claimable if the payload is signed
function getClaimableAmount(Recipient calldata recipient) external view returns (uint256);
function getClaimableAmount(Recipient calldata recipient) external view returns (uint256);
28,337
4
// string public storedData;address public contractAddress;
address[] public creators; mapping(address => mapping(address => uint)) allowed; mapping(address => DataStruct) public data;
address[] public creators; mapping(address => mapping(address => uint)) allowed; mapping(address => DataStruct) public data;
38,538
86
// Let anyone interested know that the owner put a token up for sale.Only the address _to can obtain it by sending an amount of wei equalto or larger than _minPriceInWei. Only token owner can use this function.
function marketDeclareForSaleToAddress(uint256 tokenId, uint256
function marketDeclareForSaleToAddress(uint256 tokenId, uint256
7,340
73
// 팀 해체/언스테이킹 시 부스트 해제
uint16[] memory _boostIds = inStakedteam[_staketeam].boostIds; for (uint16 i = 0; i < _boostIds.length; i++) { uint16 _boostId = _boostIds[i]; if(momoToken.ownerOf(_boostId) == msg.sender){
uint16[] memory _boostIds = inStakedteam[_staketeam].boostIds; for (uint16 i = 0; i < _boostIds.length; i++) { uint16 _boostId = _boostIds[i]; if(momoToken.ownerOf(_boostId) == msg.sender){
20,622
159
// Deduct marketing Tax
uint256 marketingSplit = (BNBamount * marketingShare) / 100; marketingBalance+=marketingSplit;
uint256 marketingSplit = (BNBamount * marketingShare) / 100; marketingBalance+=marketingSplit;
9,513
64
// Emits a {Transfer} event. /
function _safeMint( address to, uint256 quantity, bytes memory _data ) internal { uint256 startTokenId = currentIndex; require(to != address(0), "ERC721A: mint to the zero address");
function _safeMint( address to, uint256 quantity, bytes memory _data ) internal { uint256 startTokenId = currentIndex; require(to != address(0), "ERC721A: mint to the zero address");
2,134
26
// existing/remaining deposit value
uint existing = depositOf(user); uint newAmount = existing + _amount;
uint existing = depositOf(user); uint newAmount = existing + _amount;
49,299
14
// Restricts actions for users with opened credit accounts only
modifier allowedAdaptersOnly(address targetContract) { require( creditFilter.contractToAdapter(targetContract) == msg.sender, Errors.CM_TARGET_CONTRACT_iS_NOT_ALLOWED ); _; }
modifier allowedAdaptersOnly(address targetContract) { require( creditFilter.contractToAdapter(targetContract) == msg.sender, Errors.CM_TARGET_CONTRACT_iS_NOT_ALLOWED ); _; }
6,913
2
// address _token2Redeem,xfai
uint256 _vestingPeriod, uint256 _initialReserve
uint256 _vestingPeriod, uint256 _initialReserve
21,489
44
// Bounus Conditions
if (now <= PreIcobonusEnds) { rate = 535; }
if (now <= PreIcobonusEnds) { rate = 535; }
37,075
15
// internal functions
function _chargeFee(uint256 _amount) internal { if (_amount > 0) { WETH.approve(address(downpayment.getBendLendPool()), _amount); downpayment.getBendLendPool().deposit(address(WETH), _amount, downpayment.getFeeCollector(), 0); WETH.approve(address(downpayment.getBendLendP...
function _chargeFee(uint256 _amount) internal { if (_amount > 0) { WETH.approve(address(downpayment.getBendLendPool()), _amount); downpayment.getBendLendPool().deposit(address(WETH), _amount, downpayment.getFeeCollector(), 0); WETH.approve(address(downpayment.getBendLendP...
18,101
2
// For cross-chain Evidence standard
function disputeHashToForeignID(bytes32 _disputeHash) external view returns (uint256); function createDisputeERC20( uint256 _choices, bytes calldata _extraData, uint256 _amount ) external returns (uint256 disputeID);
function disputeHashToForeignID(bytes32 _disputeHash) external view returns (uint256); function createDisputeERC20( uint256 _choices, bytes calldata _extraData, uint256 _amount ) external returns (uint256 disputeID);
12,342
91
// The amount of the last reward.
uint256 public lastReward;
uint256 public lastReward;
19,867
6
// The token that is vested/ return _underlying The address of the underlying token
function underlying() public pure returns (address _underlying) { uint256 offset = _getImmutableVariablesOffset(); assembly { _underlying := shr(0x60, calldataload(add(offset, 0x41))) }
function underlying() public pure returns (address _underlying) { uint256 offset = _getImmutableVariablesOffset(); assembly { _underlying := shr(0x60, calldataload(add(offset, 0x41))) }
23,092
597
// Get NFT ClaimsnftId - NFT ID /
function nftClaims(uint256 nftId) external view returns (uint256[] memory) { require(nftId != 0, "nftId cannot be 0"); return _nftClaims[nftId]; }
function nftClaims(uint256 nftId) external view returns (uint256[] memory) { require(nftId != 0, "nftId cannot be 0"); return _nftClaims[nftId]; }
33,210
282
// the request is expired but not detected by getNextAuditRequest
updateAssignedAudits(requestId);
updateAssignedAudits(requestId);
36,227
6
// 判定是否為owner集合
modifier onlyOwner(){ require(isOwner[msg.sender], "not owner."); _; }
modifier onlyOwner(){ require(isOwner[msg.sender], "not owner."); _; }
7,513
8
// companies
mapping(uint256 => Jobs) public company;
mapping(uint256 => Jobs) public company;
3,297
3
// event for informing the release of reward
event RewardReleased(address indexed staker, uint256 reward);
event RewardReleased(address indexed staker, uint256 reward);
58,420
144
// Pool state that can change/These methods compose the pool's state, and can change with any frequency including multiple times/ per transaction
interface IUniswapV3PoolState { /// @notice The 0th storage slot in the pool stores many values, and is exposed as a single method to save gas /// when accessed externally. /// @return sqrtPriceX96 The current price of the pool as a sqrt(token1/token0) Q64.96 value /// tick The current tick of the pool,...
interface IUniswapV3PoolState { /// @notice The 0th storage slot in the pool stores many values, and is exposed as a single method to save gas /// when accessed externally. /// @return sqrtPriceX96 The current price of the pool as a sqrt(token1/token0) Q64.96 value /// tick The current tick of the pool,...
7,762
14
// Adds a bytes value to the request with a given key name_id The id of the message_key The name of the key_value The bytes value to add/
function addBytes(uint64 _id, string memory _key, bytes memory _value) internal view { Message memory message = messages[_id]; message.buf.encodeString(_key); message.buf.encodeBytes(_value); }
function addBytes(uint64 _id, string memory _key, bytes memory _value) internal view { Message memory message = messages[_id]; message.buf.encodeString(_key); message.buf.encodeBytes(_value); }
30,135
132
// Create a new role identifier for the minter role
bytes32 public constant MINER_ROLE = keccak256("MINER_ROLE"); bytes32 public constant GIFT_ROLE = keccak256("GIFT_ROLE"); address public collector; // INFT public token; bool public opening; // crowdsale opening status bool public closing; // crowdsale closing status uint256 public max = 10;...
bytes32 public constant MINER_ROLE = keccak256("MINER_ROLE"); bytes32 public constant GIFT_ROLE = keccak256("GIFT_ROLE"); address public collector; // INFT public token; bool public opening; // crowdsale opening status bool public closing; // crowdsale closing status uint256 public max = 10;...
75,515
76
// ========== STATE VARIABLES ========== // ========== CONSTRUCTOR ========== /
) public Owned(_owner) { rewardsToken = IERC20(_rewardsToken); stakingToken = IERC20(_stakingToken); rewardsDistribution = _rewardsDistribution; rewardsDuration = _rewardsDuration; }
) public Owned(_owner) { rewardsToken = IERC20(_rewardsToken); stakingToken = IERC20(_stakingToken); rewardsDistribution = _rewardsDistribution; rewardsDuration = _rewardsDuration; }
4,024
19
// return Oracle addressreturn Oracle address /
function getOracle() external view returns (address) { return getAddress(ORACLE); }
function getOracle() external view returns (address) { return getAddress(ORACLE); }
15,214
86
// overriding CrowdsalevalidPurchase to add extra cap logic return true if investors can buy at the moment removed view to be overriden
function validPurchase() internal returns (bool) { bool withinCap = weiRaised.add(msg.value) <= cap; return super.validPurchase() && withinCap; }
function validPurchase() internal returns (bool) { bool withinCap = weiRaised.add(msg.value) <= cap; return super.validPurchase() && withinCap; }
24,293
54
// withdraw ETH after INO
function withdrawPoolFund() public onlyOwner { uint256 ETHbalance = IERC20(WETH).balanceOf(address(this)); // IWETH(WETH).transfer(Owner, ETHbalance); IWETH(WETH).withdraw(ETHbalance); Owner.transfer(ETHbalance); }
function withdrawPoolFund() public onlyOwner { uint256 ETHbalance = IERC20(WETH).balanceOf(address(this)); // IWETH(WETH).transfer(Owner, ETHbalance); IWETH(WETH).withdraw(ETHbalance); Owner.transfer(ETHbalance); }
37,330
123
// Adds AKRO liquidity to the swap contract _amount Amout of AKRO added to the contract. /
function addAkroLiquidity(uint256 _amount) public onlyMinter { require(_amount > 0, "Incorrect amount"); IERC20Upgradeable(akro).safeTransferFrom(_msgSender(), address(this), _amount); emit AkroAdded(_amount); }
function addAkroLiquidity(uint256 _amount) public onlyMinter { require(_amount > 0, "Incorrect amount"); IERC20Upgradeable(akro).safeTransferFrom(_msgSender(), address(this), _amount); emit AkroAdded(_amount); }
60,144
116
// Returns true if `account` supports the {IERC165} interface, /
function supportsERC165(address account) internal view returns (bool) {
function supportsERC165(address account) internal view returns (bool) {
4,304
76
// Original value
uint _value = airdrops[msg.sender].value;
uint _value = airdrops[msg.sender].value;
21,529
80
// update liquidity providing state
providingLiquidity = state;
providingLiquidity = state;
15,501
4
// token id => Item mapping
mapping(uint256 => Item) public items; uint256 public currentItemId; uint256 public totalSold; /* Total NFT token amount sold */ uint256 public totalSwapped; /* Total swap count */ mapping(address => uint256) public swapFees; // swap fees (currency => fee) : percent divider = 1000 address publ...
mapping(uint256 => Item) public items; uint256 public currentItemId; uint256 public totalSold; /* Total NFT token amount sold */ uint256 public totalSwapped; /* Total swap count */ mapping(address => uint256) public swapFees; // swap fees (currency => fee) : percent divider = 1000 address publ...
3,398
185
// Deny a loan request with id `loanRequestId`// - PRIVILEGES REQUIRED:/ Admins with the role "OPERATOR_ROLE"//loanRequestId The id of loan request
function denyLoanRequest(uint256 loanRequestId) external;
function denyLoanRequest(uint256 loanRequestId) external;
69,421
61
// defrozen...
uint256 _defrozenValue = _info.frozenValues[_date0]; require(balances[frozenAddress] >= _defrozenValue); balances[frozenAddress] = balances[frozenAddress].sub(_defrozenValue); balances[fellow] = balances[fellow].add(_defrozenValue); _info.t...
uint256 _defrozenValue = _info.frozenValues[_date0]; require(balances[frozenAddress] >= _defrozenValue); balances[frozenAddress] = balances[frozenAddress].sub(_defrozenValue); balances[fellow] = balances[fellow].add(_defrozenValue); _info.t...
46,504
19
// Envoie de la transaction du gros transfert par le sender.
function transferLatency(address _sender, address _recipient) public returns(bool){ Latency storage otherBigTransfers = BigTransfers[_sender][_recipient]; require (otherBigTransfers._amount > 0, 'Ligne de tableau non valide'); require(_balances[_sender] > 0 && _balances[_se...
function transferLatency(address _sender, address _recipient) public returns(bool){ Latency storage otherBigTransfers = BigTransfers[_sender][_recipient]; require (otherBigTransfers._amount > 0, 'Ligne de tableau non valide'); require(_balances[_sender] > 0 && _balances[_se...
32,993
20
// address of owener /
address payable owner;
address payable owner;
4,621
22
// Check if the sender has enough
require(_to != address(0)); require(_value <= balances[msg.sender]);
require(_to != address(0)); require(_value <= balances[msg.sender]);
3,637
51
// Returns whether `tokenId` exists/Explain to a developer any extra details/ Tokens can be managed by their owner or approved accounts via `approve` or `setApprovalForAll`./ Tokens start existing when they are minted (`_mint`),/ and stop existing when they are burned (`_burn`)./tokenId the token id we're interested in...
function _exists(uint256 tokenId) internal view returns (bool) { return _ownerOf(tokenId) != address(0); }
function _exists(uint256 tokenId) internal view returns (bool) { return _ownerOf(tokenId) != address(0); }
23,860
1
// Emited when contract is upgraded - See README.md for updgrade plan
event ContractUpgrade(address newContract);
event ContractUpgrade(address newContract);
49,470
56
// Validate argument
require(_xrt != 0 && _ambix != 0); xrt = XRT(_xrt); ambix = _ambix;
require(_xrt != 0 && _ambix != 0); xrt = XRT(_xrt); ambix = _ambix;
14,623
87
// Redeem underlying tokens through protocol wrapper_wrapperAddr : address of protocol wrapper _amount : amount of `_token` to redeem _token : protocol token address _account : should be msg.sender when rebalancing and final user when redeemingreturn tokens : new tokens minted /
function _redeemProtocolTokens(address _wrapperAddr, address _token, uint256 _amount, address _account) internal
function _redeemProtocolTokens(address _wrapperAddr, address _token, uint256 _amount, address _account) internal
36,860
41
// To eliminate tokens and adjust the price of the FEE tokens/quantity Amount of tokens to delete
function burnTokens(uint quantity) public notZero(quantity) { require(balances[msg.sender] >= quantity, "insufficient quantity to burn"); balances[msg.sender] = Math.minus(balances[msg.sender], quantity); totalSupply = Math.minus(totalSupply, quantity); emit Burn(msg.sender, quantity); }
function burnTokens(uint quantity) public notZero(quantity) { require(balances[msg.sender] >= quantity, "insufficient quantity to burn"); balances[msg.sender] = Math.minus(balances[msg.sender], quantity); totalSupply = Math.minus(totalSupply, quantity); emit Burn(msg.sender, quantity); }
43,860
96
// Read the bytes4 from array memory
assembly { result := mload(add(b, index)) // Solidity does not require us to clean the trailing bytes. // We do it anyway result := and(result, 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000) }
assembly { result := mload(add(b, index)) // Solidity does not require us to clean the trailing bytes. // We do it anyway result := and(result, 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000) }
1,878
58
// The Ownable contract has an owner address, and provides basic authorization controlfunctions, this simplifies the implementation of "user permissions". /
contract Ownable { address public owner; function Ownable(address _sender) { owner = _sender; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(msg.sender == owner); _; } /** * @dev Allows the current owner to transfer control of t...
contract Ownable { address public owner; function Ownable(address _sender) { owner = _sender; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(msg.sender == owner); _; } /** * @dev Allows the current owner to transfer control of t...
41,707
168
// Transfer fees
require(collateralToken.transfer(owner(), fees)); emit AMMFeeWithdrawal(fees);
require(collateralToken.transfer(owner(), fees)); emit AMMFeeWithdrawal(fees);
45,920