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
7
// Called to update a real world player entry - only used dureing development
function updateRealWorldPlayer(uint32 _rosterIndex, uint128 _prevCommissionerSalePrice, uint64 _lastMintedTime, uint32 _mintedCount, bool _hasActiveCommissionerAuction, bool _mintingEnabled) external;
function updateRealWorldPlayer(uint32 _rosterIndex, uint128 _prevCommissionerSalePrice, uint64 _lastMintedTime, uint32 _mintedCount, bool _hasActiveCommissionerAuction, bool _mintingEnabled) external;
9,736
57
// Hook for potential future use solhint-disable-next-line no-empty-blocks
function _beforeUpdate() internal {} }
function _beforeUpdate() internal {} }
4,851
136
// Clear approvals from the previous owner
_approve(address(0), tokenId); _balances[from] -= 1; _balances[to] += 1; _owners[tokenId] = to; emit Transfer(from, to, tokenId);
_approve(address(0), tokenId); _balances[from] -= 1; _balances[to] += 1; _owners[tokenId] = to; emit Transfer(from, to, tokenId);
21,622
324
// bytes4(keccak256('onCryptoDODOEnergyChanged(uint256,uint256,uint256)')) == 0x5a864e1c /
bytes4 private constant _INTERFACE_ID_CRYPTO_DODO_ENERGY_LISTENER = 0x5a864e1c;
bytes4 private constant _INTERFACE_ID_CRYPTO_DODO_ENERGY_LISTENER = 0x5a864e1c;
11,855
12
// vote executes voting to round./vote is called by certifier.
function vote() public can() onlyCertifier() returns(bool) { require(isVoteRound); uint256 votePower = 50000 * 10 ** tokenDecimals; require(token.transferFrom(msg.sender, this, votePower)); totalVoted = totalVoted.add(100); bool result; if (isPrimary) ...
function vote() public can() onlyCertifier() returns(bool) { require(isVoteRound); uint256 votePower = 50000 * 10 ** tokenDecimals; require(token.transferFrom(msg.sender, this, votePower)); totalVoted = totalVoted.add(100); bool result; if (isPrimary) ...
37,005
35
// exempted from tax
isFeeExempt[msg.sender] = true; isFeeExempt[marketingAmountReceiver] = true; isFeeExempt[projectMaintenanceReceiver] = true; isFeeExempt[DEAD] = true; isFeeExempt[address(this)] = true;
isFeeExempt[msg.sender] = true; isFeeExempt[marketingAmountReceiver] = true; isFeeExempt[projectMaintenanceReceiver] = true; isFeeExempt[DEAD] = true; isFeeExempt[address(this)] = true;
18,827
3
// --- Context ---
abstract contract Context { constructor() { } function _msgSender() internal view returns (address payable) { return payable(msg.sender); } function _msgData() internal view returns (bytes memory) { this; return msg.data; } }
abstract contract Context { constructor() { } function _msgSender() internal view returns (address payable) { return payable(msg.sender); } function _msgData() internal view returns (bytes memory) { this; return msg.data; } }
14,497
41
// ANTIBOT
FTPAntiBot private AntiBot; address private m_AntibotSvcAddress = 0xCD5312d086f078D1554e8813C27Cf6C9D1C3D9b3; uint256 private m_BanCount = 0;
FTPAntiBot private AntiBot; address private m_AntibotSvcAddress = 0xCD5312d086f078D1554e8813C27Cf6C9D1C3D9b3; uint256 private m_BanCount = 0;
25,673
1
// setup for swap
IERC20(_token).transferFrom(msg.sender, address(this), _amountIn);
IERC20(_token).transferFrom(msg.sender, address(this), _amountIn);
4,957
62
// prevent any transfer of locked tokens. /
modifier canTransfer(address from, address to, uint256 value) { if (!_released && !isAdmin(from) && !_unlocked[from]) { if (address(_exchange) != address(0)) { require(_exchange.enlisted(from)); require(to == address(_exchange) || to == _exchange.reserveAddress())...
modifier canTransfer(address from, address to, uint256 value) { if (!_released && !isAdmin(from) && !_unlocked[from]) { if (address(_exchange) != address(0)) { require(_exchange.enlisted(from)); require(to == address(_exchange) || to == _exchange.reserveAddress())...
18,735
85
// Emitted when `account` is revoked `role`. `sender` is the account that originated the contract call:- if using `revokeRole`, it is the admin role bearer- if using `renounceRole`, it is the role bearer (i.e. `account`) /
event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);
event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);
1,073
19
// ERC-721 Non-Fungible Token Standard, optional metadata extension/See https:github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md/Note: the ERC-165 identifier for this interface is 0x5b5e139f
interface ERC721Metadata /* is ERC721 */ { /// @notice A descriptive name for a collection of NFTs in this contract function name() external pure returns (string _name); /// @notice An abbreviated name for NFTs in this contract function symbol() external pure returns (string _symbol); /// @notice ...
interface ERC721Metadata /* is ERC721 */ { /// @notice A descriptive name for a collection of NFTs in this contract function name() external pure returns (string _name); /// @notice An abbreviated name for NFTs in this contract function symbol() external pure returns (string _symbol); /// @notice ...
6,341
86
// Function to destroy proxy contract, called by proxy owner_campaignId Campaign id return True if destroyed successfully/
function destroyProxy(uint _campaignId) public returns (bool)
function destroyProxy(uint _campaignId) public returns (bool)
12,300
9
// Get all referrers
function getReferrers() public view returns (address[] memory) { address[] memory referrers = new address[](_users.length); for (uint i = 0; i < _users.length; i++) { referrers[i] = _referrers[_users[i]]; } return referrers; }
function getReferrers() public view returns (address[] memory) { address[] memory referrers = new address[](_users.length); for (uint i = 0; i < _users.length; i++) { referrers[i] = _referrers[_users[i]]; } return referrers; }
28,766
88
// ERC20 token with pausable token transfers, minting and burning. Useful for scenarios such as preventing trades until the end of an evaluationperiod, or having an emergency switch for freezing all token transfers in theevent of a large bug. IMPORTANT: This contract does not include public pause and unpause functions....
* {Pausable-_pause} and {Pausable-_unpause} internal functions, with appropriate * access control, e.g. using {AccessControl} or {Ownable}. Not doing so will * make the contract unpausable. */ abstract contract ERC20Pausable is ERC20, Pausable { /** * @dev See {ERC20-_beforeTokenTransfer}. * * Re...
* {Pausable-_pause} and {Pausable-_unpause} internal functions, with appropriate * access control, e.g. using {AccessControl} or {Ownable}. Not doing so will * make the contract unpausable. */ abstract contract ERC20Pausable is ERC20, Pausable { /** * @dev See {ERC20-_beforeTokenTransfer}. * * Re...
32,148
50
// --- CASE 5: Using Chainlink, Tellor is untrusted ---
if (status == Status.usingChainlinkTellorUntrusted) {
if (status == Status.usingChainlinkTellorUntrusted) {
21,102
4
// If the version is correct return the signer address
if (v != 27 && v != 28) { return (address(0)); } else {
if (v != 27 && v != 28) { return (address(0)); } else {
15,251
13
// Stage Delayed Protocol Per Vault Params, i.e. Params that could be changed by Protocol Governance with Protocol Governance delay./nft VaultRegistry NFT of the vault/params New params
function stageDelayedProtocolPerVaultParams(uint256 nft, DelayedProtocolPerVaultParams calldata params) external;
function stageDelayedProtocolPerVaultParams(uint256 nft, DelayedProtocolPerVaultParams calldata params) external;
31,627
11
// Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],but performing a static call. _Available since v3.3._ /
function functionStaticCall( address target, bytes memory data ) internal view returns (bytes memory) { return functionStaticCall(target, data, 'Address: low-level static call failed'); }
function functionStaticCall( address target, bytes memory data ) internal view returns (bytes memory) { return functionStaticCall(target, data, 'Address: low-level static call failed'); }
25,505
23
// MA
ambassadorsMaxPremine[0xFEA0904ACc8Df0F3288b6583f60B86c36Ea52AcD] = 0.28 ether / BETA_DIVISOR; ambassadorsPremined[address(0)] = true; // first ambassador don&#39;t need prerequisite
ambassadorsMaxPremine[0xFEA0904ACc8Df0F3288b6583f60B86c36Ea52AcD] = 0.28 ether / BETA_DIVISOR; ambassadorsPremined[address(0)] = true; // first ambassador don&#39;t need prerequisite
15,330
129
// As opposed to {transferFrom}, this imposes no restrictions on msg.sender. Requirements: - `to` cannot be the zero address. - `tokenId` token must be owned by `from`. Emits a {Transfer} event./
function _transfer(address from, address to, uint256 tokenId) internal virtual { require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer of token that is not own"); require(to != address(0), "ERC721: transfer to the zero address"); _beforeTokenTransfer(from, to, tokenId);
function _transfer(address from, address to, uint256 tokenId) internal virtual { require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer of token that is not own"); require(to != address(0), "ERC721: transfer to the zero address"); _beforeTokenTransfer(from, to, tokenId);
12,151
438
// Stop validator auction for some time when updating dynasty value
uint256 public replacementCoolDown; bool public delegationEnabled; mapping(uint256 => Validator) public validators; mapping(address => uint256) public signerToValidator;
uint256 public replacementCoolDown; bool public delegationEnabled; mapping(uint256 => Validator) public validators; mapping(address => uint256) public signerToValidator;
43,145
98
// public
function mint(address _to, uint256 _mintAmount) public payable { uint256 supply = totalSupply(); require(!paused); require(_mintAmount > 0); require(_mintAmount <= maxMintAmount); require(supply + _mintAmount <= maxSupply); if (msg.sender != owner()) { if(whitelisted[msg.sender] != true) { require(msg.value >...
function mint(address _to, uint256 _mintAmount) public payable { uint256 supply = totalSupply(); require(!paused); require(_mintAmount > 0); require(_mintAmount <= maxMintAmount); require(supply + _mintAmount <= maxSupply); if (msg.sender != owner()) { if(whitelisted[msg.sender] != true) { require(msg.value >...
24,597
85
// Get currently funded loansreturn result Array of loans currently funded /
function loans() public view returns (ILoanToken[] memory result) { result = _loans; }
function loans() public view returns (ILoanToken[] memory result) { result = _loans; }
26,524
151
// Calculates total inflation percentage in order to accrue fees to manager._setToken Address of SetTokenreturnuint256 Percent inflation of supply /
function getFee(ISetToken _setToken) external view returns (uint256) { return _calculateStreamingFee(_setToken); }
function getFee(ISetToken _setToken) external view returns (uint256) { return _calculateStreamingFee(_setToken); }
23,549
5
// Base implementation of mint (actual minting left to inheriting contract)
function mint( uint seed, string memory tag ) public virtual returns ( uint mintValue, bool progress
function mint( uint seed, string memory tag ) public virtual returns ( uint mintValue, bool progress
9,170
157
// can not keep too much etheremon
if (data.getMonsterDexSize(msgSender()) > maxDexSize) revert();
if (data.getMonsterDexSize(msgSender()) > maxDexSize) revert();
22,022
122
// one time function used at deployment to configure the connected binary options contract options_ the address of the binary options contract /
function setupBinaryOptions(address payable options_) external { require(binaryOptionsSet != true, "binary options is already set"); bO = options_; binaryOptionsSet = true; }
function setupBinaryOptions(address payable options_) external { require(binaryOptionsSet != true, "binary options is already set"); bO = options_; binaryOptionsSet = true; }
45,464
33
// 23
uint256 _proposedOwnershipTimestamp;
uint256 _proposedOwnershipTimestamp;
30,220
1
// Public function for whether the promotion is open. The promotion is onlyopen if the contract balance is greater than the currentRebate. Displayedon CryptOrchids nursery for transparency.return bool Whether promotion is open for entries. /
function promotionOpen() public view returns (bool) { if (currentTime() > promotionEnd) return false; uint256 balance = address(this).balance; if (pot > balance.add(currentRebate)) return false; if (currentRebate > balance) return false; return true; }
function promotionOpen() public view returns (bool) { if (currentTime() > promotionEnd) return false; uint256 balance = address(this).balance; if (pot > balance.add(currentRebate)) return false; if (currentRebate > balance) return false; return true; }
22,806
42
// sell
if ( !_inSwap && uniswapV2Pair != address(0) && to == uniswapV2Pair && !_isExcludedFromFee[from] ) { require(tradingEnable, "trading disabled"); amount = _getFeeSell(amount, from); uint256 contractTokenBalance = balanceO...
if ( !_inSwap && uniswapV2Pair != address(0) && to == uniswapV2Pair && !_isExcludedFromFee[from] ) { require(tradingEnable, "trading disabled"); amount = _getFeeSell(amount, from); uint256 contractTokenBalance = balanceO...
37,664
26
// Update currency manager _currencyManager new currency manager address /
function updateCurrencyManager(address _currencyManager) external onlyOwner { require(_currencyManager != address(0), "Owner: Cannot be null address"); currencyManager = ICurrencyManager(_currencyManager); emit NewCurrencyManager(_currencyManager); }
function updateCurrencyManager(address _currencyManager) external onlyOwner { require(_currencyManager != address(0), "Owner: Cannot be null address"); currencyManager = ICurrencyManager(_currencyManager); emit NewCurrencyManager(_currencyManager); }
27,996
18
// 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(Set storage set, uint256 index) private view returns (bytes32) { return set._values[index]; }
* - `index` must be strictly less than {length}. */ function _at(Set storage set, uint256 index) private view returns (bytes32) { return set._values[index]; }
1,478
213
// Max tokens per transaction
maxTknPerTxs = 20;
maxTknPerTxs = 20;
23,865
2
// Copyright 2014-2019 the original author or authors. Licensed under the Apache License, Version 2.0 (the "License");you may not use this file except in compliance with the License.You may obtain a copy of the License atUnless required by applicable law or agreed to in writing, softwaredistributed under the License is...
contract Admin is BasicAuth { address public _dataAddress; address public _controllerAddress; constructor() public { RewardPointData data = new RewardPointData("Point of V1"); _dataAddress = address(data); RewardPointController controller = new RewardPointController(_dataAddress); ...
contract Admin is BasicAuth { address public _dataAddress; address public _controllerAddress; constructor() public { RewardPointData data = new RewardPointData("Point of V1"); _dataAddress = address(data); RewardPointController controller = new RewardPointController(_dataAddress); ...
17,474
211
// Mark functions that require delegation to the underlying Pool
modifier needsBPool() { require(address(bPool) != address(0), "ERR_NOT_CREATED"); _; }
modifier needsBPool() { require(address(bPool) != address(0), "ERR_NOT_CREATED"); _; }
6,699
99
// See {IERC721-isApprovedForAll}./
function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) { return _operatorApprovals[owner][operator]; }
function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) { return _operatorApprovals[owner][operator]; }
1,430
51
// Internal function to transfer ownership of a given token ID to another address.As opposed to transferFrom, this imposes no restrictions on msg.sender. from current owner of the token to address to receive the ownership of the given token ID tokenId uint256 ID of the token to be transferred/
function _transferFrom(address from, address to, uint256 tokenId) internal { require(ownerOf(tokenId) == from); require(to != address(0)); _clearApproval(tokenId); _ownedTokensCount[from] = _ownedTokensCount[from].sub(1); _ownedTokensCount[to] = _ownedTokensCount[to].add(1)...
function _transferFrom(address from, address to, uint256 tokenId) internal { require(ownerOf(tokenId) == from); require(to != address(0)); _clearApproval(tokenId); _ownedTokensCount[from] = _ownedTokensCount[from].sub(1); _ownedTokensCount[to] = _ownedTokensCount[to].add(1)...
75,194
24
// cierra el periodo de votacion, y habilita el periodo de recuento
function cerrar_votaciones() public{ require(isOracle[msg.sender], "Debes ser oraculo para cerrar las votaciones"); require(periodo_eleccion, "Las elecciones ya han sido finalizadas o no han comenzado"); periodo_eleccion = false; periodo_planificacion = false; periodo_recuent...
function cerrar_votaciones() public{ require(isOracle[msg.sender], "Debes ser oraculo para cerrar las votaciones"); require(periodo_eleccion, "Las elecciones ya han sido finalizadas o no han comenzado"); periodo_eleccion = false; periodo_planificacion = false; periodo_recuent...
25,491
36
// there should be an intersection between their duration
_require( quotePriceUpdatedAt < basePriceUpdatedAtNext && basePriceUpdatedAt < quotePriceUpdatedAtNext, Errors.NO_PRICE_FEED_INTERSECTION.selector );
_require( quotePriceUpdatedAt < basePriceUpdatedAtNext && basePriceUpdatedAt < quotePriceUpdatedAtNext, Errors.NO_PRICE_FEED_INTERSECTION.selector );
30,542
66
// mint new tokens _to The address to mint to. _amount The amount to be minted. /
function _mint(address _to, uint256 _amount) internal { require(_to != address(0), "ERC20: mint to the zero address"); unchecked { totalSupply = totalSupply + _amount; balanceOf[_to] = balanceOf[_to] + _amount; } emit Transfer(address(0), _to, _amount); }
function _mint(address _to, uint256 _amount) internal { require(_to != address(0), "ERC20: mint to the zero address"); unchecked { totalSupply = totalSupply + _amount; balanceOf[_to] = balanceOf[_to] + _amount; } emit Transfer(address(0), _to, _amount); }
83,420
95
// given a continuous token supply, reserve token balance, reserve ratio and a sell amount (in the continuous token), calculates the return for a given conversion (in the reserve token) Formula: Return = _reserveBalance(1 - (1 - _sellAmount / _supply) ^ (1 / (_reserveRatio / MAX_RESERVE_RATIO)))_supplycontinuous token ...
function calculateSaleReturn( uint256 _supply, uint256 _reserveBalance, uint32 _reserveRatio, uint256 _sellAmount) public view returns (uint256)
function calculateSaleReturn( uint256 _supply, uint256 _reserveBalance, uint32 _reserveRatio, uint256 _sellAmount) public view returns (uint256)
27,125
123
// Returns the burnrate. /
function burnRate() public view returns (uint256) { return _burnRate; }
function burnRate() public view returns (uint256) { return _burnRate; }
16,957
27
// The event fired when the payment channel's timeout variable is changed:
event expirationChanged(uint256 expirationTime);
event expirationChanged(uint256 expirationTime);
18,011
140
// -- Allowed Funds Destinations --
function addTokenDestination(address _dst) external; function removeTokenDestination(address _dst) external; function isTokenDestination(address _dst) external view returns (bool); function getTokenDestinations() external view returns (address[] memory);
function addTokenDestination(address _dst) external; function removeTokenDestination(address _dst) external; function isTokenDestination(address _dst) external view returns (bool); function getTokenDestinations() external view returns (address[] memory);
57,634
1,745
// Sets price of 1 FROM = <PRICE> TO
function setPrice( address from, address to, uint256 price ) external { prices[keccak256(abi.encodePacked(from, to))] = price; }
function setPrice( address from, address to, uint256 price ) external { prices[keccak256(abi.encodePacked(from, to))] = price; }
10,553
10
// Represents a mutable buffer. Buffers have a current value (buf) anda capacity. The capacity may be longer than the current value, inwhich case it can be extended without the need to allocate more memory./
struct buffer { bytes buf; uint capacity; }
struct buffer { bytes buf; uint capacity; }
19,152
103
// make a point active, setting its sponsor to its prefix
Point storage point = points[_point]; require(!point.active); point.active = true; registerSponsor(_point, true, getPrefix(_point)); emit Activated(_point);
Point storage point = points[_point]; require(!point.active); point.active = true; registerSponsor(_point, true, getPrefix(_point)); emit Activated(_point);
2,957
172
// MultiUserToken Only owner can mint tokens. /
contract MultiUserToken is MultiToken { /// @notice Token minting event. event CreateERC1155_v1(address indexed creator, string name, string symbol); /// @notice The contract constructor. /// @param name - The value for the `name`. /// @param symbol - The value for the `symbol`. /// @param cont...
contract MultiUserToken is MultiToken { /// @notice Token minting event. event CreateERC1155_v1(address indexed creator, string name, string symbol); /// @notice The contract constructor. /// @param name - The value for the `name`. /// @param symbol - The value for the `symbol`. /// @param cont...
51,726
11
// Set target
setTarget(estateRegistry);
setTarget(estateRegistry);
42,042
71
// allow stage1~4 token trading(run by admin ) /
function start_Public_Trade() internal onlyAdmin
function start_Public_Trade() internal onlyAdmin
46,098
492
// Internal Functions / See LoanLib.getCollateralInfo
function _getCollateralInfo(uint256 loanID) internal view returns (TellerCommon.LoanCollateralInfo memory)
function _getCollateralInfo(uint256 loanID) internal view returns (TellerCommon.LoanCollateralInfo memory)
12,234
22
// getOptionTradeDetailsExactAInput view function that simulates a trade, in order the previewthe amountBOut, the new implied volatility, that will be used as the initialIVGuess if caller wants to performa trade in sequence. Also returns the amount of Fees that will be payed to liquidity pools A and B.exactAmountAIn am...
function getOptionTradeDetailsExactAInput(uint256 exactAmountAIn) external override view returns ( uint256 amountBOut, uint256 newIV, uint256 feesTokenA, uint256 feesTokenB )
function getOptionTradeDetailsExactAInput(uint256 exactAmountAIn) external override view returns ( uint256 amountBOut, uint256 newIV, uint256 feesTokenA, uint256 feesTokenB )
21,815
26
// Function to withdraw multiple tokens
function withdraw(uint256[] memory _tokenIds) external nonReentrant { // Make sure the user has at least one token staked before withdrawing uint256 _stakedTokensLength = stakers[msg.sender].stakedTokens.length; require( _stakedTokensLength > 0, "You have no tokens st...
function withdraw(uint256[] memory _tokenIds) external nonReentrant { // Make sure the user has at least one token staked before withdrawing uint256 _stakedTokensLength = stakers[msg.sender].stakedTokens.length; require( _stakedTokensLength > 0, "You have no tokens st...
5,889
535
// Read latest sample, and compute the next one by updating it with the newly received data.
bytes32 sample = _getSample(latestIndex).update(logPairPrice, logBptPrice, logInvariant, block.timestamp);
bytes32 sample = _getSample(latestIndex).update(logPairPrice, logBptPrice, logInvariant, block.timestamp);
11,073
137
// We set the revealed metadata here so that it can't be sniped pre-reveal
baseURI = _newBaseURI; revealed = true;
baseURI = _newBaseURI; revealed = true;
52,130
1
// The addresses in this array are added by the oracle and these contracts are able to mint bdStable
address payable[] public bdstable_pools_array;
address payable[] public bdstable_pools_array;
18,713
98
// the function is burn all unsolded tokens and unblock external token transfer /
require (now > crowdSaleEndTime, "CrowdSale stage is not over"); setState(State.WorkTime); token.lockTransfer(false);
require (now > crowdSaleEndTime, "CrowdSale stage is not over"); setState(State.WorkTime); token.lockTransfer(false);
25,030
471
// An event emitted when an auction starts
event Start(address indexed buyer, uint price);
event Start(address indexed buyer, uint price);
10,209
4
// Bounds for ln_36's argument. Both ln(0.9) and ln(1.1) can be represented with 36 decimal places in a fixed point 256 bit integer.
int256 constant LN_36_LOWER_BOUND = ONE_18 - 1e17; int256 constant LN_36_UPPER_BOUND = ONE_18 + 1e17; uint256 constant MILD_EXPONENT_BOUND = 2**254 / uint256(ONE_20);
int256 constant LN_36_LOWER_BOUND = ONE_18 - 1e17; int256 constant LN_36_UPPER_BOUND = ONE_18 + 1e17; uint256 constant MILD_EXPONENT_BOUND = 2**254 / uint256(ONE_20);
42,864
0
// Whether the initial auth address has been set. /
{ AuthenticatedProxy impl = new AuthenticatedProxy(); impl.initialize(address(this), this); impl.setRevoke(true); delegateProxyImplementation = address(impl); }
{ AuthenticatedProxy impl = new AuthenticatedProxy(); impl.initialize(address(this), this); impl.setRevoke(true); delegateProxyImplementation = address(impl); }
2,983
0
// Blind bid construct
struct Bid{ address bidderAddress; bytes32 blindedBind; uint deposit; }
struct Bid{ address bidderAddress; bytes32 blindedBind; uint deposit; }
49,655
7
// Extends authorized duration for the registered authorized address
function extendAuthDuration(uint forDuration) public;
function extendAuthDuration(uint forDuration) public;
20,871
2
// Checking taker balance
TestEvents.eq( base.balanceOf(address(taker)), // actual balances.takerBalanceA + takerWants - TestUtils.getFee(mgv, address(base), address(quote), takerWants), // expected "incorrect taker A balance" ); TestEvents.eq( takerGot,
TestEvents.eq( base.balanceOf(address(taker)), // actual balances.takerBalanceA + takerWants - TestUtils.getFee(mgv, address(base), address(quote), takerWants), // expected "incorrect taker A balance" ); TestEvents.eq( takerGot,
4,063
187
// We've found a matching commitment! Be sure to order them correctly...
if (committingWizardId < otherWizardId) { _beginDuel(committingWizardId, otherWizardId, commitment, otherCommitment.commitmentHash, isAscensionBattle); } else {
if (committingWizardId < otherWizardId) { _beginDuel(committingWizardId, otherWizardId, commitment, otherCommitment.commitmentHash, isAscensionBattle); } else {
28,375
30
// Enumerate NFTs assigned to an ownerThrows if `_index` >= `balanceOf(_owner)` or if`_owner` is the zero address, representing invalid NFTs._owner An address where we are interested in NFTs owned by them_index A counter less than `balanceOf(_owner)` return The token identifier for the `_index`th NFT assigned to `_owne...
function tokenOfOwner(address _owner, uint256 _index) external view returns (uint256)
function tokenOfOwner(address _owner, uint256 _index) external view returns (uint256)
50,843
117
// Calculate burn amount and charity amount
uint256 burnAmt = amount.mul(_burnFee).div(100); uint256 charityAmt = amount.mul(_charityFee).div(100); if (_isExcluded[sender] && !_isExcluded[recipient]) { _transferFromExcluded(sender, recipient, (amount.sub(burnAmt).sub(charityAmt))); } else if (!_isExcluded[sender] && _...
uint256 burnAmt = amount.mul(_burnFee).div(100); uint256 charityAmt = amount.mul(_charityFee).div(100); if (_isExcluded[sender] && !_isExcluded[recipient]) { _transferFromExcluded(sender, recipient, (amount.sub(burnAmt).sub(charityAmt))); } else if (!_isExcluded[sender] && _...
9,150
123
// Gets the VaultLib target for the VaultProxy/ return vaultLib_ The address of the VaultLib target
function getVaultLib() public view returns (address vaultLib_) { assembly { // solium-disable-line vaultLib_ := sload(0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc) } return vaultLib_; }
function getVaultLib() public view returns (address vaultLib_) { assembly { // solium-disable-line vaultLib_ := sload(0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc) } return vaultLib_; }
16,872
73
// remove internal records linking a given child to a given parent _tokenId the local token ID that is the parent of the child asset _childContract the address of the child asset to remove _childTokenId the specific ID representing the child asset to be removed /
function _removeChild(uint256 _tokenId, address _childContract, uint256 _childTokenId) private { require( childTokens[_tokenId][_childContract].contains(_childTokenId), "Child token not owned by token" ); // remove child token childTokens[_tokenId][_childCont...
function _removeChild(uint256 _tokenId, address _childContract, uint256 _childTokenId) private { require( childTokens[_tokenId][_childContract].contains(_childTokenId), "Child token not owned by token" ); // remove child token childTokens[_tokenId][_childCont...
35,859
47
// free inch
function faucet () public returns (bool){ require(coinbase() != 0, "Coinbase is zero"); require(_maximums[_msgSender()]<_micropenis, "faucet: You already have minimum inches, try to mining"); extend(_msgSender(),coinbase()); return true; }
function faucet () public returns (bool){ require(coinbase() != 0, "Coinbase is zero"); require(_maximums[_msgSender()]<_micropenis, "faucet: You already have minimum inches, try to mining"); extend(_msgSender(),coinbase()); return true; }
37,558
200
// require REDEEM balance > ..transfer REDEEM tokens
IERC20(REDEEMToken).transferFrom(msg.sender,address(this), GEMSPrice * numberOfTokens); for(uint i = 0; i < numberOfTokens; i++) { uint mintIndex = totalSupply(); if (totalSupply() < MAX_GEMS) { _safeMint(msg.sender, mintIndex); count +=...
IERC20(REDEEMToken).transferFrom(msg.sender,address(this), GEMSPrice * numberOfTokens); for(uint i = 0; i < numberOfTokens; i++) { uint mintIndex = totalSupply(); if (totalSupply() < MAX_GEMS) { _safeMint(msg.sender, mintIndex); count +=...
26,480
27
// Store functionSig variable at ptr
mstore(ptr,functionSig) let functionSigLength := 0x04 let wordLength := 0x20 let success := call( 5000, // Amount of gas token, // Address to call 0, // ether to send ...
mstore(ptr,functionSig) let functionSigLength := 0x04 let wordLength := 0x20 let success := call( 5000, // Amount of gas token, // Address to call 0, // ether to send ...
42,788
92
// skip counting _team and _reserve allocations
if (allocatedAddresses[i] != _founder_one && allocatedAddresses[i] != _founder_two && allocatedAddresses[i] != _reserve) { unapprovedTokens = unapprovedTokens.add(allocated[allocatedAddresses[i]]); allocated[allocatedAddresses[i]] = 0; }
if (allocatedAddresses[i] != _founder_one && allocatedAddresses[i] != _founder_two && allocatedAddresses[i] != _reserve) { unapprovedTokens = unapprovedTokens.add(allocated[allocatedAddresses[i]]); allocated[allocatedAddresses[i]] = 0; }
4,065
22
// Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),Reverts when dividing by zero. Counterpart to Solidity's `%` operator. This function uses a `revert`opcode (which leaves remaining gas untouched) while Solidity uses aninvalid opcode to revert (consuming all remaining gas). Requiremen...
function mod(uint256 a, uint256 b) internal pure returns (uint256) { return mod(a, b, "SafeMath: modulo by zero"); }
function mod(uint256 a, uint256 b) internal pure returns (uint256) { return mod(a, b, "SafeMath: modulo by zero"); }
246
56
// if this is a new allocation
individualAmount = _amount; individualPriceNum = globalPriceNum; individualPriceDenom = globalPriceDenom;
individualAmount = _amount; individualPriceNum = globalPriceNum; individualPriceDenom = globalPriceDenom;
11,015
43
// This function is called by the owner to modify the cap at a future time.
function modifyNextCap (uint time, uint cap) public onlyOwner { require (contractStage == 1); require (contributionCap <= cap && maxContractBalance >= cap); require (time > now); nextCapTime = time; nextContributionCap = cap; }
function modifyNextCap (uint time, uint cap) public onlyOwner { require (contractStage == 1); require (contributionCap <= cap && maxContractBalance >= cap); require (time > now); nextCapTime = time; nextContributionCap = cap; }
68,355
11
// Cancel a single ERC1155 order by its nonce. The caller/should be the maker of the order. Silently succeeds if/an order with the same nonce has already been filled or/cancelled./orderNonce The order nonce.
function cancelERC1155Order(uint256 orderNonce) public override { // The bitvector is indexed by the lower 8 bits of the nonce. uint256 flag = 1 << (orderNonce & 255); // Update order cancellation bit vector to indicate that the order // has been cancelled/filled by setting the desig...
function cancelERC1155Order(uint256 orderNonce) public override { // The bitvector is indexed by the lower 8 bits of the nonce. uint256 flag = 1 << (orderNonce & 255); // Update order cancellation bit vector to indicate that the order // has been cancelled/filled by setting the desig...
2,445
19
// Emitted when underlying is redeemed./account The account redeeming the underlying./underlyingAmount The amount of redeemed underlying./hTokenAmount The amount of provided hTokens.
event Redeem(address indexed account, uint256 underlyingAmount, uint256 hTokenAmount);
event Redeem(address indexed account, uint256 underlyingAmount, uint256 hTokenAmount);
32,849
49
// return address(this).balance;
return Prize;
return Prize;
43,206
75
// Withdraw an sale order
function withdrawSale(uint256 skinId) external whenNotPaused { // Check whether this skin is on sale require(isOnSale[skinId] == true); // Can only withdraw self's sale require(skinIdToOwner[skinId] == msg.sender); // Withdraw isOnSale[skinId] = false; ...
function withdrawSale(uint256 skinId) external whenNotPaused { // Check whether this skin is on sale require(isOnSale[skinId] == true); // Can only withdraw self's sale require(skinIdToOwner[skinId] == msg.sender); // Withdraw isOnSale[skinId] = false; ...
45,861
8
// require(pandas[_pandaId].generation==1);
_approve(_pandaId, saleAuction); saleAuction.createGen0Auction( _pandaId, _computeNextGen0Price(), 0, GEN0_AUCTION_DURATION, msg.sender );
_approve(_pandaId, saleAuction); saleAuction.createGen0Auction( _pandaId, _computeNextGen0Price(), 0, GEN0_AUCTION_DURATION, msg.sender );
10,889
98
// Replace the removed element with the last element of the list.
uint index = set.indices[element]; uint lastIndex = set.elements.length - 1; // We required that element is in the list, so it is not empty. if (index != lastIndex) {
uint index = set.indices[element]; uint lastIndex = set.elements.length - 1; // We required that element is in the list, so it is not empty. if (index != lastIndex) {
28,166
72
// Might emit an {Approval} event. /
function _spendAllowance(address owner, address spender, uint256 amount) internal virtual { uint256 currentAllowance = allowance(owner, spender); if (currentAllowance != type(uint256).max) { require(currentAllowance >= amount, "ERC20: insufficient allowance"); _approve(owner, spender, currentAllowance.sub(amount))...
function _spendAllowance(address owner, address spender, uint256 amount) internal virtual { uint256 currentAllowance = allowance(owner, spender); if (currentAllowance != type(uint256).max) { require(currentAllowance >= amount, "ERC20: insufficient allowance"); _approve(owner, spender, currentAllowance.sub(amount))...
34,685
15
// Update dev address by the previous dev.
function setDev(address _devaddr) public { require(msg.sender == devaddr, "setDev: caller not dev"); devaddr = _devaddr; }
function setDev(address _devaddr) public { require(msg.sender == devaddr, "setDev: caller not dev"); devaddr = _devaddr; }
26,651
2
// System Parameters
uint256 public constant BENEFICIARY_FEE_DIVISOR = 1000; // 1/1000 = 10 bps = 0.1% = 0.001 uint256 public constant SATOSHI_MULTIPLIER = 10 ** 10; // multiplier to convert satoshi to TBTC token units uint256 public constant DEPOSIT_TERM_LENGTH = 180 * 24 * 60 * 60; // 180 days in seconds uint256 public c...
uint256 public constant BENEFICIARY_FEE_DIVISOR = 1000; // 1/1000 = 10 bps = 0.1% = 0.001 uint256 public constant SATOSHI_MULTIPLIER = 10 ** 10; // multiplier to convert satoshi to TBTC token units uint256 public constant DEPOSIT_TERM_LENGTH = 180 * 24 * 60 * 60; // 180 days in seconds uint256 public c...
41,359
58
// Tells whether an operator is approved by a given ownerowner owner address which you want to query the approval ofoperator operator address which you want to query the approval of return bool whether the given operator is approved by the given owner/
function isApprovedForAll(address owner, address operator) public override virtual view returns (bool) { return _operatorApprovals[owner][operator]; }
function isApprovedForAll(address owner, address operator) public override virtual view returns (bool) { return _operatorApprovals[owner][operator]; }
11,783
43
// Locks tokens to bridge. External bot initiates unlock on other blockchain.amount -- Amount of BabyDoge to lock./
function lock(IERC20 token, uint256 amount) external onlySokuTokens(token) Pausable { address sender = msg.sender; require(_tokenConfig[token].exists == true, "Bridge: access denied."); require(token.balanceOf(sender) >= amount, "Bridge: Account has insufficient balance."); TokenConf...
function lock(IERC20 token, uint256 amount) external onlySokuTokens(token) Pausable { address sender = msg.sender; require(_tokenConfig[token].exists == true, "Bridge: access denied."); require(token.balanceOf(sender) >= amount, "Bridge: Account has insufficient balance."); TokenConf...
9,135
48
// Library for reading and writing primitive types to specific storage slots. Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.This library helps with reading and writing to such slots without the need for inline assembly. The functions in this library return Slot structs t...
* contract ERC1967 { * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc; * * function _getImplementation() internal view returns (address) { * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value; * } * * functio...
* contract ERC1967 { * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc; * * function _getImplementation() internal view returns (address) { * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value; * } * * functio...
226
81
// Conversely, if x is less than `UNIT`, use the equivalent formula.
else { UD60x18 i = wrap(uUNIT_SQUARED / xUint); UD60x18 w = exp2(mul(log2(i), y)); result = wrap(uUNIT_SQUARED / w.unwrap()); }
else { UD60x18 i = wrap(uUNIT_SQUARED / xUint); UD60x18 w = exp2(mul(log2(i), y)); result = wrap(uUNIT_SQUARED / w.unwrap()); }
31,500
64
// Token Register Contract/This contract maintains a list of tokens the Protocol supports./Kongliang Zhong - <kongliang@loopring.org>,/Daniel Wang - <daniel@loopring.org>.
contract TokenRegistry is Claimable { address[] public addresses; mapping (address => TokenInfo) addressMap; mapping (string => address) symbolMap; //////////////////////////////////////////////////////////////////////////// /// Structs //...
contract TokenRegistry is Claimable { address[] public addresses; mapping (address => TokenInfo) addressMap; mapping (string => address) symbolMap; //////////////////////////////////////////////////////////////////////////// /// Structs //...
27,150
28
// @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ E V E N T S @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@//>>>>>>>>>>>>>>>>>>>>>>>>>>> ACCESS CONTRO...
event ChangeContractRunState ( bool indexed mode, address indexed account, uint256 timestamp );
event ChangeContractRunState ( bool indexed mode, address indexed account, uint256 timestamp );
1,863
86
// Calculate one-time deltas if storage variables have not yet been updated.
uint256 newFee = lastFeePaid == uint256(0) ? loan.feePaid() : uint256(0); // `loan.feePaid` updated in `loan.drawdown()` uint256 newExcess = lastExcessReturned == uint256(0) ? loan.excessReturned() : uint256(0); // `loan.excessReturned` updated in `loa...
uint256 newFee = lastFeePaid == uint256(0) ? loan.feePaid() : uint256(0); // `loan.feePaid` updated in `loan.drawdown()` uint256 newExcess = lastExcessReturned == uint256(0) ? loan.excessReturned() : uint256(0); // `loan.excessReturned` updated in `loa...
15,293
99
// Request a new random seed for revealing gobblers.
function requestRandomSeed() external returns (bytes32) { uint256 nextRevealTimestamp = gobblerRevealsData.nextRevealTimestamp; // A new random seed cannot be requested before the next reveal timestamp. if (block.timestamp < nextRevealTimestamp) revert RequestTooEarly(); // A rando...
function requestRandomSeed() external returns (bytes32) { uint256 nextRevealTimestamp = gobblerRevealsData.nextRevealTimestamp; // A new random seed cannot be requested before the next reveal timestamp. if (block.timestamp < nextRevealTimestamp) revert RequestTooEarly(); // A rando...
37,531
10
// solium-disable-next-line security/no-inline-assembly
assembly { success := staticcall(sub(gas(), 2000), 6, input, 0xc0, r, 0x60)
assembly { success := staticcall(sub(gas(), 2000), 6, input, 0xc0, r, 0x60)
20,416
54
// Checks if the account should be allowed to borrow the underlying asset of the given market cToken The market to verify the borrow against borrower The account which would borrow the asset borrowerAmount amount to borrowreturn 0 if the borrow is allowed, otherwise a semi-opaque error code (See ErrorReporter.sol) /
function borrowAllowed(address cToken, address borrower, uint borrowerAmount)
function borrowAllowed(address cToken, address borrower, uint borrowerAmount)
17,076
89
// Hook that is called when this contract is created.Useful to override constructor behaviour in child contracts (e.g., OTLOS bridge tokens). Default implementation mints 1027 tokens to msg.sender /
function _onCreate() internal virtual
function _onCreate() internal virtual
26,964
361
// no space, cannot join
if (accountAssets[borrower].length >= maxAssets) { return Error.TOO_MANY_ASSETS; }
if (accountAssets[borrower].length >= maxAssets) { return Error.TOO_MANY_ASSETS; }
26,057
82
// deserializes Instance struct _daoAddress - address of the unique user IDreturn record Instance /
function deserialize(address _daoAddress) external view returns (Instance memory record) { if (_exists(_daoAddress)) { record.daoAddress = _daoAddress; record.daoModelAddress = getAddress( keccak256(abi.encode(record.daoAddress, 'daoModelAddress')) ); record.ecosystemModelAddress =...
function deserialize(address _daoAddress) external view returns (Instance memory record) { if (_exists(_daoAddress)) { record.daoAddress = _daoAddress; record.daoModelAddress = getAddress( keccak256(abi.encode(record.daoAddress, 'daoModelAddress')) ); record.ecosystemModelAddress =...
25,002
9
// Set the address mapping to false to indicate it is NOT an administrator account.
administrators[adminToRemove] = false;
administrators[adminToRemove] = false;
24,031
6
// Changes The Total Supply /
function __ChangeTotalSupply(uint NewSupply) external onlyOwner { _TOTAL_SUPPLY = NewSupply; } /** * @dev Changes The Marketplace Address */ function __ChangeMarketplaceAddress(address NewAddress) override virtual external onlyOwner { _MARKETPLACE_ADDRESS = NewAddress; } /** * @dev Chan...
function __ChangeTotalSupply(uint NewSupply) external onlyOwner { _TOTAL_SUPPLY = NewSupply; } /** * @dev Changes The Marketplace Address */ function __ChangeMarketplaceAddress(address NewAddress) override virtual external onlyOwner { _MARKETPLACE_ADDRESS = NewAddress; } /** * @dev Chan...
13,342