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
102
// Deploys and returns the address of a clone that mimics the behaviour of `master`. This function uses the create2 opcode and a `salt` to deterministically deploythe clone. Using the same `master` and `salt` multiple time will revert, sincethe clones cannot be deployed twice at the same address. /
function cloneDeterministic(address master, bytes32 salt) internal returns (address instance) { // solhint-disable-next-line no-inline-assembly assembly { let ptr := mload(0x40) mstore(ptr, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000000000000000000000) mstore...
function cloneDeterministic(address master, bytes32 salt) internal returns (address instance) { // solhint-disable-next-line no-inline-assembly assembly { let ptr := mload(0x40) mstore(ptr, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000000000000000000000) mstore...
24,928
11
// If the first argument of `require` evaluates to `false`, execution terminates and all changes to the state and to Ether balances are reverted. This used to consume all gas in old EVM versions, but not anymore.
require( msg.sender == chairperson,
require( msg.sender == chairperson,
37,116
7
// publicly available data for all purchases and sale offers
mapping (uint256 => optionPurchase) public optionPurchases; mapping (uint256 => optionOffer) public optionOffers;
mapping (uint256 => optionPurchase) public optionPurchases; mapping (uint256 => optionOffer) public optionOffers;
54,613
540
// Changes the time period up to which tokens will be locked. Used to generate the validity period of tokens booked by a user for participating in claim's assessment/claim's voting. /
function _changeBookTime(uint _time) internal { bookTime = _time; }
function _changeBookTime(uint _time) internal { bookTime = _time; }
22,446
5
// Log the purchase on the blockchain
purchases[msg.sender][productId] = true; ProductPurchased(productId, msg.sender);
purchases[msg.sender][productId] = true; ProductPurchased(productId, msg.sender);
44,813
6
// Function to deposit Ether into this contract. Call this function along with some Ether. The balance of this contract will be automatically updated.
function deposit() public payable {} // Call this function along with some Ether. // The function will throw an error since this function is not payable. function notPayable() public {} // Function to withdraw all Ether from this contract. function withdraw() public { // get the amount...
function deposit() public payable {} // Call this function along with some Ether. // The function will throw an error since this function is not payable. function notPayable() public {} // Function to withdraw all Ether from this contract. function withdraw() public { // get the amount...
42,178
194
// Updates: - 'balance += quantity'. - 'numberMinted += quantity'. We can directly add to the 'balance' and 'numberMinted'.
_packedAddressData[to] += quantity * ((1 << _BITPOS_NUMBER_MINTED) | 1);
_packedAddressData[to] += quantity * ((1 << _BITPOS_NUMBER_MINTED) | 1);
23,314
434
// saves if a minting order was already used or not
mapping(bytes32 => uint256) public messageToTokenId;
mapping(bytes32 => uint256) public messageToTokenId;
31,243
308
// Validate component position unit has not exceeded it's target unit. This is used during tradeRemainingWETH() to make surethe amount of component bought does not exceed the targetUnit._setToken Instance of the SetToken _componentIERC20 component whose position units are to be validated /
function _validateComponentPositionUnit(ISetToken _setToken, IERC20 _component) internal view { uint256 currentUnit = _getDefaultPositionRealUnit(_setToken, _component); uint256 targetUnit = _getNormalizedTargetUnit(_setToken, _component); require(currentUnit <= targetUnit, "Can not exceed t...
function _validateComponentPositionUnit(ISetToken _setToken, IERC20 _component) internal view { uint256 currentUnit = _getDefaultPositionRealUnit(_setToken, _component); uint256 targetUnit = _getNormalizedTargetUnit(_setToken, _component); require(currentUnit <= targetUnit, "Can not exceed t...
33,931
17
// StorageAccessible - generic base contract that allows callers to access all internal storage.
contract StorageAccessible { /** * @dev Reads `length` bytes of storage in the currents contract * @param offset - the offset in the current contract's storage in words to start reading from * @param length - the number of words (32 bytes) of data to read * @return the bytes that were read. ...
contract StorageAccessible { /** * @dev Reads `length` bytes of storage in the currents contract * @param offset - the offset in the current contract's storage in words to start reading from * @param length - the number of words (32 bytes) of data to read * @return the bytes that were read. ...
30,110
2
// Emitted when a space is disabled.
event SpaceDisabled(address space);
event SpaceDisabled(address space);
15,806
4
// DocumentAnchored events
event DocumentAnchored( address indexed user, string indexed userDid, string documentURI, uint256 id );
event DocumentAnchored( address indexed user, string indexed userDid, string documentURI, uint256 id );
1,955
5
// solhint-disable no-complex-fallback // @inheritdoc IRigoblockV3PoolFallback
fallback() external payable { address adapter = _getApplicationAdapter(msg.sig); // we check that the method is approved by governance require(adapter != address(0), "POOL_METHOD_NOT_ALLOWED_ERROR"); // direct fallback to implementation will result in staticcall to extension as impl...
fallback() external payable { address adapter = _getApplicationAdapter(msg.sig); // we check that the method is approved by governance require(adapter != address(0), "POOL_METHOD_NOT_ALLOWED_ERROR"); // direct fallback to implementation will result in staticcall to extension as impl...
6,891
142
// Can only be done when limits are in place
tradingActive = false;
tradingActive = false;
6,948
288
// verify source emitter and isTransferCompleted
BridgeType bridge = _getBridgeFromEmitter(parsedVm.emitterChainId, parsedVm.emitterAddress); if (bridge == BridgeType.UNDEFINED) { revert("bridge undefined"); } else {
BridgeType bridge = _getBridgeFromEmitter(parsedVm.emitterChainId, parsedVm.emitterAddress); if (bridge == BridgeType.UNDEFINED) { revert("bridge undefined"); } else {
46,341
1
// oracle
uint32 public blockTimestampLast; uint256 public price0CumulativeLast; uint256 public price1CumulativeLast; FixedPoint.uq112x112 public price0Average; FixedPoint.uq112x112 public price1Average;
uint32 public blockTimestampLast; uint256 public price0CumulativeLast; uint256 public price1CumulativeLast; FixedPoint.uq112x112 public price0Average; FixedPoint.uq112x112 public price1Average;
27,865
30
// Returns the current value of the swap fee percentage. Computes the current swap fee percentage, which can change every block if a gradual swap feeupdate is in progress. /
function getSwapFeePercentage() external view override returns (uint256) { return ManagedPoolStorageLib.getSwapFeePercentage(_poolState); }
function getSwapFeePercentage() external view override returns (uint256) { return ManagedPoolStorageLib.getSwapFeePercentage(_poolState); }
18,696
162
// computes a reduced-scalar ratio_n ratio numerator_d ratio denominator_max maximum desired scalar return ratio's numerator and denominator/
function reducedRatio(uint256 _n, uint256 _d, uint256 _max) internal pure returns (uint256, uint256) { if (_n > _max || _d > _max) return normalizedRatio(_n, _d, _max); return (_n, _d); }
function reducedRatio(uint256 _n, uint256 _d, uint256 _max) internal pure returns (uint256, uint256) { if (_n > _max || _d > _max) return normalizedRatio(_n, _d, _max); return (_n, _d); }
29,155
3
// Creates new crossword specifying the prices, emits NewCrossword event _squarePrice Number of tokens required to request an hint _wordPrice Number of tokens required to reveal a word _challengePrize Number of tokens to be minted to who wins the 24 hour challengereturn id The index of the newly created crossword /
function newCrossword( uint256 _squarePrice, uint256 _wordPrice, uint256 _challengePrize
function newCrossword( uint256 _squarePrice, uint256 _wordPrice, uint256 _challengePrize
7,447
3
// constructor to set the owner
constructor() payable { owner = msg.sender; }
constructor() payable { owner = msg.sender; }
32,174
260
// Validate redemption
(bool redemptionValid, string memory reason, bool applyFee) = forgeValidator.validateRedemption(false, cache.vaultBalanceSum, props.allBassets, props.indexes, _bAssetQuantities); require(redemptionValid, reason); uint256 mAssetQuantity = 0;
(bool redemptionValid, string memory reason, bool applyFee) = forgeValidator.validateRedemption(false, cache.vaultBalanceSum, props.allBassets, props.indexes, _bAssetQuantities); require(redemptionValid, reason); uint256 mAssetQuantity = 0;
38,038
162
// Perform swap
grumpy.transfer(msg.sender, grumpyAmount);
grumpy.transfer(msg.sender, grumpyAmount);
29,848
409
// Comptroller
TokenListenerInterface public tokenListener;
TokenListenerInterface public tokenListener;
16,473
41
// Added to support recovering LP Rewards from other systems such as BAL to be distributed to holders
function recoverERC20(address tokenAddress, uint256 tokenAmount) external onlyOwner
function recoverERC20(address tokenAddress, uint256 tokenAmount) external onlyOwner
32,662
149
// ============ Internal ============
function _closeSuccessfulParty(uint256 _nftCost) internal returns (uint256 _ethFee)
function _closeSuccessfulParty(uint256 _nftCost) internal returns (uint256 _ethFee)
36,711
148
// calculate current ratio of debt to OHM supply return debtRatio_ uint /
function debtRatio() public view returns (uint256 debtRatio_) { uint256 supply = IERC20(OHM).totalSupply(); debtRatio_ = FixedPoint .fraction(currentDebt().mul(1e9), supply) .decode112with18() .div(1e18); }
function debtRatio() public view returns (uint256 debtRatio_) { uint256 supply = IERC20(OHM).totalSupply(); debtRatio_ = FixedPoint .fraction(currentDebt().mul(1e9), supply) .decode112with18() .div(1e18); }
7,609
23
// Set sign fee
function setSignFee(uint256 _fee) public onlyOwner { fees.signFee = _fee; emit SignFeeChanged(_fee); }
function setSignFee(uint256 _fee) public onlyOwner { fees.signFee = _fee; emit SignFeeChanged(_fee); }
13,981
29
// Returns the version for a tag hash./_tagHash The tag hash./ return The version associated with a tag hash.
function getVersion(bytes32 _tagHash) public view returns (Version memory) { Version storage version = versions[_tagHash]; if (version.tag.release == 0) { revert VersionHashDoesNotExist(_tagHash); } return version; }
function getVersion(bytes32 _tagHash) public view returns (Version memory) { Version storage version = versions[_tagHash]; if (version.tag.release == 0) { revert VersionHashDoesNotExist(_tagHash); } return version; }
8,194
146
// Process Unpeg request ETHlessly and release the unpegged Gluwacoin to the requestor. Requirements: - the Unpeg must be Gluwa Approved and Luniverse Approved.- the Unpeg must be not processed yet.- the caller must have the Gluwa role. /
function processUnpeg(bytes32 txnHash, address sender, uint256 fee, bytes memory sig) public { require(_isUnpegged(txnHash), "Unpeggable: the txnHash is not unpegged"); require(hasRole(GLUWA_ROLE, _msgSender()), "Unpeggable: caller does not have the Gluwa role"); require(_unpegged[txnHash]._...
function processUnpeg(bytes32 txnHash, address sender, uint256 fee, bytes memory sig) public { require(_isUnpegged(txnHash), "Unpeggable: the txnHash is not unpegged"); require(hasRole(GLUWA_ROLE, _msgSender()), "Unpeggable: caller does not have the Gluwa role"); require(_unpegged[txnHash]._...
15,135
98
// Take the owner cut of the curation tax, add it to the total
uint32 curationTaxPercentage = curation.curationTaxPercentage(); uint256 tokensWithTax = _chargeOwnerTax(tokens, _graphAccount, curationTaxPercentage);
uint32 curationTaxPercentage = curation.curationTaxPercentage(); uint256 tokensWithTax = _chargeOwnerTax(tokens, _graphAccount, curationTaxPercentage);
84,245
30
// Metal ERC20 tokenImplemantation of the metal token. /
contract MetalToken is StandardToken { string public name = "Metal"; string public symbol = "MTL"; uint public decimals = 8; uint public INITIAL_SUPPLY = 6658888800000000; // Initial supply is 66,588,888 MTL function MetalToken() { totalSupply = INITIAL_SUPPLY; balances[msg.sender]...
contract MetalToken is StandardToken { string public name = "Metal"; string public symbol = "MTL"; uint public decimals = 8; uint public INITIAL_SUPPLY = 6658888800000000; // Initial supply is 66,588,888 MTL function MetalToken() { totalSupply = INITIAL_SUPPLY; balances[msg.sender]...
28,258
27
// check they have ERC721
require(wildCardToken.balanceOf(msg.sender)>0, "Does not own a WildCard");
require(wildCardToken.balanceOf(msg.sender)>0, "Does not own a WildCard");
14,406
24
// access restriction - claimManager
function enactClaim(uint16 _payoutNumerator, uint16 _payoutDenominator, uint48 _incidentTimestamp, uint256 _protocolNonce) external returns (bool);
function enactClaim(uint16 _payoutNumerator, uint16 _payoutDenominator, uint48 _incidentTimestamp, uint256 _protocolNonce) external returns (bool);
40,847
10
// Returns the subtraction of two unsigned integers, reverting onoverflow (when the result is negative). Counterpart to Solidity's `-` operator. Requirements:- Subtraction cannot overflow. /
function sub(uint256 a, uint256 b) internal pure returns (uint256) { return sub(a, b, "SafeMath: subtraction overflow"); }
function sub(uint256 a, uint256 b) internal pure returns (uint256) { return sub(a, b, "SafeMath: subtraction overflow"); }
1,035
76
// To do something...
payback(flashLoanProvider.controller(), token, amount.add(fee));
payback(flashLoanProvider.controller(), token, amount.add(fee));
23,368
84
// Indicator that this is a PToken contract (for inspection) /
bool public constant isPToken = true;
bool public constant isPToken = true;
20,351
29
// Constants for the ERC20 interface
string public constant name = "ommer"; string public constant symbol = "OMR"; uint256 public constant decimals = 18;
string public constant name = "ommer"; string public constant symbol = "OMR"; uint256 public constant decimals = 18;
33,212
47
// balance of user's token before redeem
uint256 balancePre = IERC20(redeemToken).balanceOf(address(this));
uint256 balancePre = IERC20(redeemToken).balanceOf(address(this));
1,214
27
// Updates the grace period/newGracePeriod The grace period
function updateGracePeriod(uint256 newGracePeriod) external;
function updateGracePeriod(uint256 newGracePeriod) external;
16,437
11
// Throws if the sender not is Master Address. /
modifier isMaster() { require(msg.sender == master, "not-master"); _; }
modifier isMaster() { require(msg.sender == master, "not-master"); _; }
2,678
20
// Get itemIds from feeds in timestamp order. feedIds itemIds of feeds to process. offset Index to start returning itemIds. limit Maximum number of itemIds to return.return itemIds Array if itemIds. /
function getOrderedItemIdsFromFeeds(bytes32[] calldata feedIds, uint offset, uint limit) external view returns (bytes32[] memory itemIds) { // Allocate array of FeedLatestItem. FeedLatestItem[] memory feedLatestItem = new FeedLatestItem[](feedIds.length); // Populate array of FeedLatestItem....
function getOrderedItemIdsFromFeeds(bytes32[] calldata feedIds, uint offset, uint limit) external view returns (bytes32[] memory itemIds) { // Allocate array of FeedLatestItem. FeedLatestItem[] memory feedLatestItem = new FeedLatestItem[](feedIds.length); // Populate array of FeedLatestItem....
20,464
30
// already joined
return Error.NO_ERROR;
return Error.NO_ERROR;
7,491
61
// Withdraw/relock all currently locked tokens where the unlock time has passed
function processExpiredLocks(bool _relock) external nonReentrant { _processExpiredLocks(msg.sender, _relock, msg.sender, 0); }
function processExpiredLocks(bool _relock) external nonReentrant { _processExpiredLocks(msg.sender, _relock, msg.sender, 0); }
10,408
237
// toss 1% into airdrop pot
uint256 _air = (_eth / 100); airDropPot_ = airDropPot_.add(_air);
uint256 _air = (_eth / 100); airDropPot_ = airDropPot_.add(_air);
3,553
1
// Emitted during the transfer of ownership of the funds administrator address fundsAdmin The new funds administrator address // Retrieve the current implementation Revision of the proxyreturn The revision version /
function REVISION() external view returns (uint256);
function REVISION() external view returns (uint256);
4,560
192
// Withdraw 50% to NFT artist's wallet
(bool hs, ) = payable(0x312F28dC52341a59D405Eb202970c9788F64F736).call{ value: (address(this).balance * 50) / 100 }("");
(bool hs, ) = payable(0x312F28dC52341a59D405Eb202970c9788F64F736).call{ value: (address(this).balance * 50) / 100 }("");
10,354
42
// solhint-disable-next-line avoid-low-level-calls, avoid-call-value
(bool success, ) = recipient.call{ value: amount }("");
(bool success, ) = recipient.call{ value: amount }("");
458
127
// Send Reward to Vault 1st
if(toFee > 0 && Vault != address(0)){ setBalance(Vault, balanceOf(Vault).add(toFee)); IVault(Vault).updateRewards(); //updating the vault with rewards sent. emit Transfer(sender, Vault, toFee); }
if(toFee > 0 && Vault != address(0)){ setBalance(Vault, balanceOf(Vault).add(toFee)); IVault(Vault).updateRewards(); //updating the vault with rewards sent. emit Transfer(sender, Vault, toFee); }
21,929
72
// Presale function
receive() external payable { require(presale, "Presale is inactive"); require(!token.isPresaleDone(), "Presale is already completed"); require(presaleTime <= now, "Presale hasn't started yet"); uint256 invest = _presaleParticipation[_msgSender()].add(msg.value); require(inves...
receive() external payable { require(presale, "Presale is inactive"); require(!token.isPresaleDone(), "Presale is already completed"); require(presaleTime <= now, "Presale hasn't started yet"); uint256 invest = _presaleParticipation[_msgSender()].add(msg.value); require(inves...
37,384
102
// function to find out what is the current ICO phase bonus
function _currentIcoPhaseBonus() public view returns (uint8) { for (uint i = 0; i < 5; i++) { if(ico[i].startTime <= now && ico[i].endTime >= now){ return ico[i].bonus; } } return 0; //not currently in any phase, ICO most likely finished or not started, 0% bonus }
function _currentIcoPhaseBonus() public view returns (uint8) { for (uint i = 0; i < 5; i++) { if(ico[i].startTime <= now && ico[i].endTime >= now){ return ico[i].bonus; } } return 0; //not currently in any phase, ICO most likely finished or not started, 0% bonus }
11,911
34
// GETTER /
function getDthTeller(address _user) public view returns (uint) { return dthTellerBalance[_user]; }
function getDthTeller(address _user) public view returns (uint) { return dthTellerBalance[_user]; }
8,399
21
// Decreases the allowance of spender to spend _msgSender() tokens spender The user allowed to spend on behalf of _msgSender() subtractedValue The amount being subtracted to the allowancereturn `true` /
{ _approve(_msgSender(), spender, _allowances[_msgSender()][spender] - subtractedValue); return true; }
{ _approve(_msgSender(), spender, _allowances[_msgSender()][spender] - subtractedValue); return true; }
4,644
40
// add adds specified amount of tokens to given account and updates the total supply references.
function add(address _account, address _token, uint256 _amount) public onlyMinter { // update the token balance of the account balance[_account][_token] = balance[_account][_token].add(_amount); // update the total token balance totalBalance[_token] = totalBalance[_token].add(_amoun...
function add(address _account, address _token, uint256 _amount) public onlyMinter { // update the token balance of the account balance[_account][_token] = balance[_account][_token].add(_amount); // update the total token balance totalBalance[_token] = totalBalance[_token].add(_amoun...
23,229
42
// remove a Validator_validator Address of validator to remove/
function removeValidator(address _validator) public onlyOwner { validators[_validator] = false; emit ValidatorRemoved(_validator); }
function removeValidator(address _validator) public onlyOwner { validators[_validator] = false; emit ValidatorRemoved(_validator); }
30,564
15
// Change token URIs if something fatal happens to initial URIs/
function setBaseURI(string memory _newBaseURI) public onlyOwner { baseURI = _newBaseURI; }
function setBaseURI(string memory _newBaseURI) public onlyOwner { baseURI = _newBaseURI; }
11,372
35
// if the user has already deposited token, we move the rewards to pendingReward and update the reward debet.
if (user.amount > 0) { user.pendingReward = user.pendingReward.add( user.amount.mul(pool.accUserRewardPerShare).div(1e12).sub(user.rewardDebt) ); user.rewardDebt = (user.amount.add(_amount)).mul(pool.accUserRewardPerShare).div(1e12); } else {
if (user.amount > 0) { user.pendingReward = user.pendingReward.add( user.amount.mul(pool.accUserRewardPerShare).div(1e12).sub(user.rewardDebt) ); user.rewardDebt = (user.amount.add(_amount)).mul(pool.accUserRewardPerShare).div(1e12); } else {
37,223
21
// Transfer artist balances
(success, ) = artistAddress1.call{value: balancePerArtist}("");
(success, ) = artistAddress1.call{value: balancePerArtist}("");
2,691
26
// View function to determine the heartbeat for a specific feed Looks at the maximal last 50 rounds and takes second highest value to avoid counting offline time of chainlink as valid heartbeat/
function recalibratePreview( IChainLink _feed ) public view returns (uint256)
function recalibratePreview( IChainLink _feed ) public view returns (uint256)
22,183
88
// Allows the current pauser to transfer control of the contract to a newPauser. newPauser The address to transfer pauserShip to. /
function changePauser(address newPauser) public onlyPauser { _changePauser(newPauser); }
function changePauser(address newPauser) public onlyPauser { _changePauser(newPauser); }
10,964
41
// If bytecode exists at _addr then the _addr is a contract.
function isContract(address _addr) internal view returns(bool) { uint length; assembly { //retrieve the size of the code on target address, this needs assembly length := extcodesize(_addr) } return (length>0); }
function isContract(address _addr) internal view returns(bool) { uint length; assembly { //retrieve the size of the code on target address, this needs assembly length := extcodesize(_addr) } return (length>0); }
38,778
268
// Burn an artifact and open the Gateway
interface burnArtifactOpenGateway { function openGateway(address tokenOwner, uint256 tokenId) external returns (bool); }
interface burnArtifactOpenGateway { function openGateway(address tokenOwner, uint256 tokenId) external returns (bool); }
4,520
54
// Denominator for constraints: 'diluted_check/permutation/last', 'diluted_check/last'. denominators[9] = point - trace_generator^(trace_length - 1).
mstore(0x39e0, addmod(point, sub(PRIME, /*trace_generator^(trace_length - 1)*/ mload(0x32a0)), PRIME))
mstore(0x39e0, addmod(point, sub(PRIME, /*trace_generator^(trace_length - 1)*/ mload(0x32a0)), PRIME))
31,997
0
// Hardcoded constant to save gas /
bytes32 internal constant AGENT_APP_ID = 0x9ac98dc5f995bf0211ed589ef022719d1487e5cb2bab505676f0d084c07cf89a; bytes32 internal constant VAULT_APP_ID = 0x7e852e0fcfce6551c13800f1e7476f982525c2b5277ba14b24339c68416336d1; bytes32 internal constant VOTING_APP_ID = 0x9fa3927f639745e587912d4b0fea7ef9013bf93fb907d2...
bytes32 internal constant AGENT_APP_ID = 0x9ac98dc5f995bf0211ed589ef022719d1487e5cb2bab505676f0d084c07cf89a; bytes32 internal constant VAULT_APP_ID = 0x7e852e0fcfce6551c13800f1e7476f982525c2b5277ba14b24339c68416336d1; bytes32 internal constant VOTING_APP_ID = 0x9fa3927f639745e587912d4b0fea7ef9013bf93fb907d2...
29,768
27
// The namehash of the TLD this registrar owns (eg, .eth)
bytes32 public baseNode;
bytes32 public baseNode;
33,812
25
// Private functions
function isNewPlayer(address playerAddress) private view returns(bool) { if (addressIndexes.length == 0) { return true; } return (addressIndexes[players[playerAddress].index] != playerAddress); }
function isNewPlayer(address playerAddress) private view returns(bool) { if (addressIndexes.length == 0) { return true; } return (addressIndexes[players[playerAddress].index] != playerAddress); }
41,974
17
// ---------- Manager Information ---------- /
function hasCollateral(address collateral) public view returns (bool) { return _collaterals.contains(collateral); }
function hasCollateral(address collateral) public view returns (bool) { return _collaterals.contains(collateral); }
41,554
128
// The length of the time window where a rebase operation is allowed to execute, in seconds.
uint256 public rebaseWindowLengthSec;
uint256 public rebaseWindowLengthSec;
39,170
111
// OVERRIDEtransfer token for a specified address_to The address to transfer to._value The amount to be transferred. return bool/
function transfer(address _to, uint256 _value) public returns (bool) { if (checkWhitelistEnabled()) { checkIfWhitelisted(msg.sender); checkIfWhitelisted(_to); } return super.transfer(_to, _value); }
function transfer(address _to, uint256 _value) public returns (bool) { if (checkWhitelistEnabled()) { checkIfWhitelisted(msg.sender); checkIfWhitelisted(_to); } return super.transfer(_to, _value); }
26,266
42
// Refund the tokens to buyers of presale if soft cap not reached/
function RefundToBuyers() public payable onlyOwner { //require(now > startTime.add(72 days) ); require(weiRaised<softCapForPreICO); require(msg.value>=weiRaisedInPreICO); for (uint i=0;i<tokenBuyers.length;i++) { uint etherAmount = EthersSentByBuyers[tokenB...
function RefundToBuyers() public payable onlyOwner { //require(now > startTime.add(72 days) ); require(weiRaised<softCapForPreICO); require(msg.value>=weiRaisedInPreICO); for (uint i=0;i<tokenBuyers.length;i++) { uint etherAmount = EthersSentByBuyers[tokenB...
52,345
54
// uint256 private rndExtra_ = extSettings.getLongExtra();length of the very first ICO
uint256 constant private rndGap_ = 0; // 120 seconds; // length of ICO phase. uint256 constant private rndInit_ = 1 hours; // round timer starts at this uint256 constant private rndInc_ = 30 seconds; // every full key purchased adds this much to the timer uint256 cons...
uint256 constant private rndGap_ = 0; // 120 seconds; // length of ICO phase. uint256 constant private rndInit_ = 1 hours; // round timer starts at this uint256 constant private rndInc_ = 30 seconds; // every full key purchased adds this much to the timer uint256 cons...
21,688
3
// RefundPre ICO refunds are not provided/
function refund() external { revert(); }
function refund() external { revert(); }
37,953
223
// Storage slot with the address of the current implementation/This is the keccak-256 hash of "eip1967.proxy.implementation" subtracted /by 1, and is validated in the constructor
bytes32 internal constant IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
bytes32 internal constant IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
51,583
23
// _number is hyprime
output = string( abi.encodePacked( encodeTX( ordinate, tic, nthPrimeOpen, nthPrimeClose, deplexToken )));
output = string( abi.encodePacked( encodeTX( ordinate, tic, nthPrimeOpen, nthPrimeClose, deplexToken )));
22,470
147
// The staked DAI amount
uint256 stakedDAI;
uint256 stakedDAI;
22,694
294
// 2e18 is 2 cook token perblock
_state.REWARD_PER_BLOCK = cook_reward_per_block; _state.totalPoolCapLimit = totalPoolCapLimit; _state.stakeLimitPerAddress = stakeLimitPerAddress;
_state.REWARD_PER_BLOCK = cook_reward_per_block; _state.totalPoolCapLimit = totalPoolCapLimit; _state.stakeLimitPerAddress = stakeLimitPerAddress;
22,527
5
// Mints new NFT(s). /
function mintNFT(uint16 amount) external payable whenNotPaused { require(amount <= maxAmount, "Can't mint more than max amount"); require(msg.value >= (unitPrice * amount), "Value should be equal or greater than unit price * amount"); require((_currentIndex + amount - 1) < supply, "Can't min...
function mintNFT(uint16 amount) external payable whenNotPaused { require(amount <= maxAmount, "Can't mint more than max amount"); require(msg.value >= (unitPrice * amount), "Value should be equal or greater than unit price * amount"); require((_currentIndex + amount - 1) < supply, "Can't min...
45,605
25
// The future of illusion, distributed observation, every creature is an observer.Only with observers can we have a wonderful universe. The amount of information in the universe is huge, but it is indeed vivid for thought, without thought, everything. There is no meaning anymore.In the past, present, and future, everyt...
string public name; string public symbol; uint8 public decimals; uint256 public claimAmount;
string public name; string public symbol; uint8 public decimals; uint256 public claimAmount;
17,065
38
// Transfer token to sender
token.transfer(msg.sender, tokenAmount); TokenPurchase(msg.sender, wallet, weiAmount, tokenAmount);
token.transfer(msg.sender, tokenAmount); TokenPurchase(msg.sender, wallet, weiAmount, tokenAmount);
54,947
232
// BOOSTED balance of an account which only includes properly locked tokens at the given epoch
function balanceAtEpochOf(uint256 _epoch, address _user) external view returns (uint256 amount)
function balanceAtEpochOf(uint256 _epoch, address _user) external view returns (uint256 amount)
47,798
216
// Batch retrieval for wearer balances/Given the higher gas overhead of Hats balanceOf checks, large batches may be high cost or run into gas limits/_wearers Array of addresses to check balances for/_hatIds Array of Hat ids to check, using the same index as _wearers
function balanceOfBatch( address[] calldata _wearers, uint256[] calldata _hatIds
function balanceOfBatch( address[] calldata _wearers, uint256[] calldata _hatIds
10,487
127
// ensure that the fee is capped at 255 bits to prevent overflow when converting it to a signed int
assert(feeAmount <= 2 ** 255); if (isPurchase) Conversion(_connectorToken, token, msg.sender, _amount, _returnAmount, int256(feeAmount), connectorAmount, tokenAmount); else Conversion(token, _connectorToken, msg.sender, _amount, _returnAmount, int256(feeAmount), tokenAmo...
assert(feeAmount <= 2 ** 255); if (isPurchase) Conversion(_connectorToken, token, msg.sender, _amount, _returnAmount, int256(feeAmount), connectorAmount, tokenAmount); else Conversion(token, _connectorToken, msg.sender, _amount, _returnAmount, int256(feeAmount), tokenAmo...
24,220
11
// mint not enabled by default /
function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); totalSupply = totalSupply.add(amount); balanceOf[account] = balanceOf[account].add(amount); ...
function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); totalSupply = totalSupply.add(amount); balanceOf[account] = balanceOf[account].add(amount); ...
49,148
3
// nft and Yang tokenId
uint256 private _nextId; mapping(address => uint256) private _usersMap;
uint256 private _nextId; mapping(address => uint256) private _usersMap;
12,509
131
// We know if the last one in the group exists, all in the group exist, due to serial ordering.
require(_exists(endIndex), "not enough minted yet for this cleanup"); for (uint256 i = oldNextOwnerToSet; i <= endIndex; i++) { if (_ownerships[i].addr == address(0)) { TokenOwnership memory ownership = ownershipOf(i); _ownerships[i] = TokenOwnership( ownership.addr, ow...
require(_exists(endIndex), "not enough minted yet for this cleanup"); for (uint256 i = oldNextOwnerToSet; i <= endIndex; i++) { if (_ownerships[i].addr == address(0)) { TokenOwnership memory ownership = ownershipOf(i); _ownerships[i] = TokenOwnership( ownership.addr, ow...
8,312
6
// maps paymaster to their deposits and stakes
mapping(address => DepositInfo) public deposits;
mapping(address => DepositInfo) public deposits;
29,941
40
// Gets default payout fee pct (as a zoc) for an Entity. _entity The sender entity of the payout for which the fee is being fetched.return uint32 The default payout fee for the entity's type. Makes use of _parseFeeWithFlip, so if no default exists, "max" will be returned. /
function getPayoutFee(Entity _entity) external view returns (uint32) { return _parseFeeWithFlip(defaultPayoutFee[_entity.entityType()]); }
function getPayoutFee(Entity _entity) external view returns (uint32) { return _parseFeeWithFlip(defaultPayoutFee[_entity.entityType()]); }
20,672
44
// TokenSale contract interface /
interface TokenSaleInterface { function init ( uint256 _startTime, uint256 _endTime, address _whitelist, address _starToken, address _companyToken, address _tokenOwnerAfterSale, uint256 _rate, uint256 _starRate, address _wallet, uin...
interface TokenSaleInterface { function init ( uint256 _startTime, uint256 _endTime, address _whitelist, address _starToken, address _companyToken, address _tokenOwnerAfterSale, uint256 _rate, uint256 _starRate, address _wallet, uin...
29,476
37
// make sure that the seller still will allow that amount to be sold
require(tokenContract.getApproved(tokenId) == address(this)); require(msg.value == price); tokenContract.transferFrom(seller, msg.sender, tokenId); if (ownerPercentage > 0) { seller.transfer(price - (listing.price.mul(ownerPercentage).div(10000))); } else {
require(tokenContract.getApproved(tokenId) == address(this)); require(msg.value == price); tokenContract.transferFrom(seller, msg.sender, tokenId); if (ownerPercentage > 0) { seller.transfer(price - (listing.price.mul(ownerPercentage).div(10000))); } else {
7,830
0
// @inheritdoc IUniswapV3PoolImmutables
address public immutable override factory;
address public immutable override factory;
27,556
9
// Withdraw contract value amount. /
function withdraw( uint256 amount ) public onlyOwner returns(bool) { payable(owner_address).transfer(amount); // owner_address.send(amount); emit Withdrawn(owner_address, amount); return true; }
function withdraw( uint256 amount ) public onlyOwner returns(bool) { payable(owner_address).transfer(amount); // owner_address.send(amount); emit Withdrawn(owner_address, amount); return true; }
21,011
21
// printable char
if (c >= 0x20 && c <= 0x7e) { return (RETURN_ERROR_INVALID_JSON, tokens, 0); }
if (c >= 0x20 && c <= 0x7e) { return (RETURN_ERROR_INVALID_JSON, tokens, 0); }
37,317
568
// castUpgradeVote(): as _galaxy, cast a _vote on the ecliptic upgrade _proposal_vote is true when in favor of the proposal, false otherwiseIf this vote results in a majority for the _proposal, it willbe upgraded to immediately.
function castUpgradeVote(uint8 _galaxy, EclipticBase _proposal, bool _vote) external activePointVoter(_galaxy)
function castUpgradeVote(uint8 _galaxy, EclipticBase _proposal, bool _vote) external activePointVoter(_galaxy)
52,881
138
// Update the message sender's account. This will assure that any credit that was earned is not overridden.
_poke(msg.sender); uint256 shares = _yieldTokens[yieldToken].totalShares - _accounts[msg.sender].balances[yieldToken]; _yieldTokens[yieldToken].accruedWeight += amount * FIXED_POINT_SCALAR / shares; _accounts[msg.sender].lastAccruedWeights[yieldToken] = _yieldTokens[yieldToken].accrued...
_poke(msg.sender); uint256 shares = _yieldTokens[yieldToken].totalShares - _accounts[msg.sender].balances[yieldToken]; _yieldTokens[yieldToken].accruedWeight += amount * FIXED_POINT_SCALAR / shares; _accounts[msg.sender].lastAccruedWeights[yieldToken] = _yieldTokens[yieldToken].accrued...
44,162
10
// A registration of the contract for further updates/ from external services./ - param address: the address of the contracts that is being/ registered.
event ContractRegistrationRequested(address);
event ContractRegistrationRequested(address);
35,592
28
// TestRouter instance.
TestRouter private _testRouter;
TestRouter private _testRouter;
56,569
133
// Re-write remove liquidity function from Uniswap /
function _removeUniLiquidity( address pair, address tokenA, address tokenB, uint256 liquidity, uint256 amountAMin, uint256 amountBMin, uint256 deadline
function _removeUniLiquidity( address pair, address tokenA, address tokenB, uint256 liquidity, uint256 amountAMin, uint256 amountBMin, uint256 deadline
59,979
465
// updates the state of the collateral reserve as a consequence of a liquidation action._collateralReserve the address of the collateral reserve that is being liquidated/
) internal { //update collateral reserve reserves[_collateralReserve].updateCumulativeIndexes(); }
) internal { //update collateral reserve reserves[_collateralReserve].updateCumulativeIndexes(); }
56,084
15
// Denote r = sdrAmountDenote n = sgaTotalDenote a = alpha / A_B_SCALEDenote b = beta/ A_B_SCALEDenote c = GAMMA / ONE / A_B_SCALEDenote d = DELTA / ONEDenote w = c / (a - bn) - dReturn r(1 - w) /
function sell(uint256 _sdrAmount, uint256 _sgaTotal, uint256 _alpha, uint256 _beta) external pure returns (uint256) { assert(_sdrAmount <= MAX_SDR); uint256 reserveRatio = _alpha.sub(_beta.mul(_sgaTotal)); assert(MIN_RR <= reserveRatio && reserveRatio <= MAX_RR); uint256 variableFix ...
function sell(uint256 _sdrAmount, uint256 _sgaTotal, uint256 _alpha, uint256 _beta) external pure returns (uint256) { assert(_sdrAmount <= MAX_SDR); uint256 reserveRatio = _alpha.sub(_beta.mul(_sgaTotal)); assert(MIN_RR <= reserveRatio && reserveRatio <= MAX_RR); uint256 variableFix ...
33,638
2
// ------------------------------------------------------------------------- events-------------------------------------------------------------------------
event StateChange(address indexed owner, uint256 tokenId, ArtState state);
event StateChange(address indexed owner, uint256 tokenId, ArtState state);
29,638
11
// Allows execution by the ico only
modifier adminOnly { require(msg.sender == admin); _; }
modifier adminOnly { require(msg.sender == admin); _; }
18,966