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
44
// 退还资金到钱包账户
refund(_pID, msg.value); return;
refund(_pID, msg.value); return;
49,769
82
// technically this check isn't necessary - Synth.burn would fail due to safe sub, but this is a useful error message to the user
require(synthProxy.balanceOf(msg.sender) >= amountOfSynth, "Insufficient balance"); _redeem(synthProxy, amountOfSynth);
require(synthProxy.balanceOf(msg.sender) >= amountOfSynth, "Insufficient balance"); _redeem(synthProxy, amountOfSynth);
45,693
208
// Since we're only leveraging one asset Supplied = borrowed
uint256 _borrowAndSupply; uint256 supplied = getSupplied(); while (supplied < _supplyAmount) { _borrowAndSupply = getBorrowable(); if (supplied.add(_borrowAndSupply) > _supplyAmount) { _borrowAndSupply = _supplyAmount.sub(supplied); }
uint256 _borrowAndSupply; uint256 supplied = getSupplied(); while (supplied < _supplyAmount) { _borrowAndSupply = getBorrowable(); if (supplied.add(_borrowAndSupply) > _supplyAmount) { _borrowAndSupply = _supplyAmount.sub(supplied); }
31,781
122
// ========== Developer Functions ========== /
{ return block.timestamp; }
{ return block.timestamp; }
30,520
104
// Change a hat's details/Hat must be mutable; new max supply cannot be less than current supply/_hatId The id of the Hat to change/_newMaxSupply The new max supply
function changeHatMaxSupply(uint256 _hatId, uint32 _newMaxSupply) external { _checkAdmin(_hatId); Hat storage hat = _hats[_hatId]; if (!_isMutable(hat)) { revert Immutable(); } if (_newMaxSupply < hat.supply) { revert NewMaxSupplyTooLow(); } if (_newMaxSupply != hat.maxSupply) { hat.maxSupply = _newMaxSupply; emit HatMaxSupplyChanged(_hatId, _newMaxSupply); } }
function changeHatMaxSupply(uint256 _hatId, uint32 _newMaxSupply) external { _checkAdmin(_hatId); Hat storage hat = _hats[_hatId]; if (!_isMutable(hat)) { revert Immutable(); } if (_newMaxSupply < hat.supply) { revert NewMaxSupplyTooLow(); } if (_newMaxSupply != hat.maxSupply) { hat.maxSupply = _newMaxSupply; emit HatMaxSupplyChanged(_hatId, _newMaxSupply); } }
10,418
6
// Fallback function forwards all transactions and returns all received return data.
fallback() external payable { // solhint-disable-next-line no-inline-assembly assembly { let _singleton := and(sload(0), 0xffffffffffffffffffffffffffffffffffffffff) // 0xa619486e == keccak("masterCopy()"). The value is right padded to 32-bytes with 0s if eq(calldataload(0), 0xa619486e00000000000000000000000000000000000000000000000000000000) { mstore(0, _singleton) return(0, 0x20) } calldatacopy(0, 0, calldatasize()) let success := delegatecall(gas(), _singleton, 0, calldatasize(), 0, 0) returndatacopy(0, 0, returndatasize()) if eq(success, 0) { revert(0, returndatasize()) } return(0, returndatasize()) } }
fallback() external payable { // solhint-disable-next-line no-inline-assembly assembly { let _singleton := and(sload(0), 0xffffffffffffffffffffffffffffffffffffffff) // 0xa619486e == keccak("masterCopy()"). The value is right padded to 32-bytes with 0s if eq(calldataload(0), 0xa619486e00000000000000000000000000000000000000000000000000000000) { mstore(0, _singleton) return(0, 0x20) } calldatacopy(0, 0, calldatasize()) let success := delegatecall(gas(), _singleton, 0, calldatasize(), 0, 0) returndatacopy(0, 0, returndatasize()) if eq(success, 0) { revert(0, returndatasize()) } return(0, returndatasize()) } }
31,441
10
// Disables the address specified. addr The address to disable /
function disableAddress (address addr) external;
function disableAddress (address addr) external;
52,275
1
// The app is at the final level, hence it doesn't want to interact with any other app
uint256 constant internal APP_LEVEL_FINAL = 1 << 0;
uint256 constant internal APP_LEVEL_FINAL = 1 << 0;
33,250
32
// Exit
function _onExitPool( bytes32, address, address, uint256[] memory balances, uint256, uint256 protocolSwapFeePercentage, bytes memory userData )
function _onExitPool( bytes32, address, address, uint256[] memory balances, uint256, uint256 protocolSwapFeePercentage, bytes memory userData )
8,597
4
// Count of successful rounds/
uint256 _totalRounds;
uint256 _totalRounds;
21,847
36
// key for whether the create order feature is disabled
bytes32 public constant CREATE_ORDER_FEATURE_DISABLED = keccak256(abi.encode("CREATE_ORDER_FEATURE_DISABLED"));
bytes32 public constant CREATE_ORDER_FEATURE_DISABLED = keccak256(abi.encode("CREATE_ORDER_FEATURE_DISABLED"));
30,743
400
// res += val(coefficients[156] + coefficients[157]adjustments[11]).
res := addmod(res, mulmod(val, add(/*coefficients[156]*/ mload(0x17c0), mulmod(/*coefficients[157]*/ mload(0x17e0),
res := addmod(res, mulmod(val, add(/*coefficients[156]*/ mload(0x17c0), mulmod(/*coefficients[157]*/ mload(0x17e0),
24,802
7
// See {IERC165-supportsInterface}. _Available since v3.4._ /
function getSupportedInterfaces(address account, bytes4[] memory interfaceIds) internal view returns (bool[] memory) {
function getSupportedInterfaces(address account, bytes4[] memory interfaceIds) internal view returns (bool[] memory) {
3,722
106
// amount Aprice A in USD = amount Bprice B in USD amount B = amount Aprice A / price B
return _amount.mul(FPI.fromScaledUint(priceA, BASE)).div(FPI.fromScaledUint(priceB, BASE));
return _amount.mul(FPI.fromScaledUint(priceA, BASE)).div(FPI.fromScaledUint(priceB, BASE));
26,289
214
// Main sale contract.
contract PublicSale is CommonTokensale { uint public tokensPerWei5; uint public tokensPerWei7; uint public tokensPerWei10; // In case min (soft) cap is not reached, token buyers will be able to // refund their contributions during one month after sale is finished. uint public refundDeadlineTime; // Total amount of wei refunded if min (soft) cap is not reached. uint public totalWeiRefunded; event RefundEthEvent(address indexed _buyer, uint256 _amountWei); function PublicSale( address _token, address _whitelist, address _beneficiary ) CommonTokensale( _token, _whitelist, _beneficiary ) public { minCapWei = 3200 ether; // TODO 2m USD. Recalculate based on ETH to USD price at the date of presale. maxCapWei = 16000 ether; // TODO 10m USD. Recalculate based on ETH to USD price at the date of presale. startTime = 1526392800; // 2018-05-15T14:00:00Z endTime = 1528639200; // 2018-06-10T14:00:00Z refundDeadlineTime = endTime + 30 days; minPaymentWei = 0.05 ether; // Hint: Set to lower amount (ex. 0.001 ETH) for tests. defaultTokensPerWei = 4808; // TODO To be determined based on ETH to USD price at the date of sale. recalcBonuses(); } function recalcBonuses() internal { tokensPerWei5 = tokensPerWeiPlusBonus(5); tokensPerWei7 = tokensPerWeiPlusBonus(7); tokensPerWei10 = tokensPerWeiPlusBonus(10); } function tokensPerWei(uint _amountWei) public view returns (uint256) { if (0.05 ether <= _amountWei && _amountWei < 10 ether) return tokensPerWei5; if (_amountWei < 20 ether) return tokensPerWei7; if (20 ether <= _amountWei) return tokensPerWei10; return defaultTokensPerWei; } /** * During presale it will be possible to withdraw only in two cases: * min cap reached OR refund period expired. */ function canWithdraw() public view returns (bool) { return totalWeiReceived >= minCapWei || now > refundDeadlineTime; } /** * It will be possible to refund only if min (soft) cap is not reached and * refund requested during 3 months after presale finished. */ function canRefund() public view returns (bool) { return totalWeiReceived < minCapWei && endTime < now && now <= refundDeadlineTime; } // TODO Check function refund() public { require(canRefund()); address buyer = msg.sender; uint amount = buyerToSentWei[buyer]; require(amount > 0); RefundEthEvent(buyer, amount); buyerToSentWei[buyer] = 0; totalWeiRefunded = totalWeiRefunded.add(amount); buyer.transfer(amount); } }
contract PublicSale is CommonTokensale { uint public tokensPerWei5; uint public tokensPerWei7; uint public tokensPerWei10; // In case min (soft) cap is not reached, token buyers will be able to // refund their contributions during one month after sale is finished. uint public refundDeadlineTime; // Total amount of wei refunded if min (soft) cap is not reached. uint public totalWeiRefunded; event RefundEthEvent(address indexed _buyer, uint256 _amountWei); function PublicSale( address _token, address _whitelist, address _beneficiary ) CommonTokensale( _token, _whitelist, _beneficiary ) public { minCapWei = 3200 ether; // TODO 2m USD. Recalculate based on ETH to USD price at the date of presale. maxCapWei = 16000 ether; // TODO 10m USD. Recalculate based on ETH to USD price at the date of presale. startTime = 1526392800; // 2018-05-15T14:00:00Z endTime = 1528639200; // 2018-06-10T14:00:00Z refundDeadlineTime = endTime + 30 days; minPaymentWei = 0.05 ether; // Hint: Set to lower amount (ex. 0.001 ETH) for tests. defaultTokensPerWei = 4808; // TODO To be determined based on ETH to USD price at the date of sale. recalcBonuses(); } function recalcBonuses() internal { tokensPerWei5 = tokensPerWeiPlusBonus(5); tokensPerWei7 = tokensPerWeiPlusBonus(7); tokensPerWei10 = tokensPerWeiPlusBonus(10); } function tokensPerWei(uint _amountWei) public view returns (uint256) { if (0.05 ether <= _amountWei && _amountWei < 10 ether) return tokensPerWei5; if (_amountWei < 20 ether) return tokensPerWei7; if (20 ether <= _amountWei) return tokensPerWei10; return defaultTokensPerWei; } /** * During presale it will be possible to withdraw only in two cases: * min cap reached OR refund period expired. */ function canWithdraw() public view returns (bool) { return totalWeiReceived >= minCapWei || now > refundDeadlineTime; } /** * It will be possible to refund only if min (soft) cap is not reached and * refund requested during 3 months after presale finished. */ function canRefund() public view returns (bool) { return totalWeiReceived < minCapWei && endTime < now && now <= refundDeadlineTime; } // TODO Check function refund() public { require(canRefund()); address buyer = msg.sender; uint amount = buyerToSentWei[buyer]; require(amount > 0); RefundEthEvent(buyer, amount); buyerToSentWei[buyer] = 0; totalWeiRefunded = totalWeiRefunded.add(amount); buyer.transfer(amount); } }
51,544
307
// Changes the current cycle.
function changeCycle() external returns (uint256) { require(now >= cycleTimeout, "cannot cycle yet: too early"); require(block.number != currentCycle, "no new block"); // Snapshot balances for the past cycle uint arrayLength = registeredTokens.length; for (uint i = 0; i < arrayLength; i++) { _snapshotBalance(registeredTokens[i]); } // Start a new cycle previousCycle = currentCycle; currentCycle = block.number; cycleStartTime = now; cycleTimeout = cycleStartTime.add(cycleDuration); // Update the share size for next cycle shareCount = store.darknodeWhitelistLength(); // Update the list of registeredTokens _updateTokenList(); emit LogNewCycle(currentCycle, previousCycle, cycleTimeout); return currentCycle; }
function changeCycle() external returns (uint256) { require(now >= cycleTimeout, "cannot cycle yet: too early"); require(block.number != currentCycle, "no new block"); // Snapshot balances for the past cycle uint arrayLength = registeredTokens.length; for (uint i = 0; i < arrayLength; i++) { _snapshotBalance(registeredTokens[i]); } // Start a new cycle previousCycle = currentCycle; currentCycle = block.number; cycleStartTime = now; cycleTimeout = cycleStartTime.add(cycleDuration); // Update the share size for next cycle shareCount = store.darknodeWhitelistLength(); // Update the list of registeredTokens _updateTokenList(); emit LogNewCycle(currentCycle, previousCycle, cycleTimeout); return currentCycle; }
11,867
0
// EVENTS // MODIFIERS /
modifier allRefundsSent(uint _productId) { require(msg.value >= _refundCalc(_productId)); _; }
modifier allRefundsSent(uint _productId) { require(msg.value >= _refundCalc(_productId)); _; }
7,767
85
// Creates `amount` tokens of token type `id`, and assigns them to `to`.
* Emits a {TransferSingle} event. * * Requirements: * * - `to` cannot be the zero address. * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the * acceptance magic value. */ function _mint( address to, uint256 id, uint256 amount, bytes memory data ) internal virtual { require(to != address(0), "ERC1155: mint to the zero address"); address operator = _msgSender(); _beforeTokenTransfer(operator, address(0), to, _asSingletonArray(id), _asSingletonArray(amount), data); _balances[id][to] += amount; emit TransferSingle(operator, address(0), to, id, amount); _doSafeTransferAcceptanceCheck(operator, address(0), to, id, amount, data); }
* Emits a {TransferSingle} event. * * Requirements: * * - `to` cannot be the zero address. * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the * acceptance magic value. */ function _mint( address to, uint256 id, uint256 amount, bytes memory data ) internal virtual { require(to != address(0), "ERC1155: mint to the zero address"); address operator = _msgSender(); _beforeTokenTransfer(operator, address(0), to, _asSingletonArray(id), _asSingletonArray(amount), data); _balances[id][to] += amount; emit TransferSingle(operator, address(0), to, id, amount); _doSafeTransferAcceptanceCheck(operator, address(0), to, id, amount, data); }
3,356
23
// Get the address from system registry /_name (string)/ return(address) Returns address based on role
function getAddress(string memory _name) public view returns(address) { return registry[keccak256(abi.encodePacked(_name))]; }
function getAddress(string memory _name) public view returns(address) { return registry[keccak256(abi.encodePacked(_name))]; }
13,847
26
// If bidder not last bidder, overwrite with last bidder
if (bidder != lastBidder) { bidders[biddersIndex] = lastBidder; // Overwrite the bidder at the index with the last bidder addressToBidMap[lastBidder].biddersIndex = biddersIndex; // Update the bidder index of the bid of the previously last bidder }
if (bidder != lastBidder) { bidders[biddersIndex] = lastBidder; // Overwrite the bidder at the index with the last bidder addressToBidMap[lastBidder].biddersIndex = biddersIndex; // Update the bidder index of the bid of the previously last bidder }
46,570
381
// Transfer the 'actual' reward to the user
safeOlympTransfer(msg.sender, actualReward);
safeOlympTransfer(msg.sender, actualReward);
3,757
463
// Applies accrued interest to total borrows and reserves. This calculates interest accrued from the last checkpointed block up to the current block and writes new checkpoint to storage. /
function accrueInterest() public returns (uint256) { delegateAndReturn(); }
function accrueInterest() public returns (uint256) { delegateAndReturn(); }
33,257
4
// The totalSupply is assigned to transaction sender, which is the account that is deploying the contract.
balances[_owner] = totalSupply; owner = _owner;
balances[_owner] = totalSupply; owner = _owner;
13,730
41
// new totalSupply after emission happened
uint256 totalSupply;
uint256 totalSupply;
2,206
17
// Search doctor details by entering a doctor address (Only doctor will be allowed to access)
function searchDoctor(address _address) public view returns(string memory, string memory, string memory, string memory, string memory, string memory, string memory) { require(isDoctor[_address]); Doctors storage d = doctors[_address]; return (d.ic, d.name, d.phone, d.gender, d.dob, d.qualification, d.major); }
function searchDoctor(address _address) public view returns(string memory, string memory, string memory, string memory, string memory, string memory, string memory) { require(isDoctor[_address]); Doctors storage d = doctors[_address]; return (d.ic, d.name, d.phone, d.gender, d.dob, d.qualification, d.major); }
37,637
1
// Mapping from token ID to remaining prints
mapping (uint256 => uint8) private _tokenPrintsRemaining;
mapping (uint256 => uint8) private _tokenPrintsRemaining;
17,697
76
// Available after 14:00 UTC (10:00 am EDT) 2020/09/08
require(now >= 1599573600); uint day = (now / 1 days + 3) % 7; require(day < 5, "Can only be cast on a weekday"); uint hour = now / 1 hours % 24; require(hour >= 14 && hour < 21, "Outside office hours"); _;
require(now >= 1599573600); uint day = (now / 1 days + 3) % 7; require(day < 5, "Can only be cast on a weekday"); uint hour = now / 1 hours % 24; require(hour >= 14 && hour < 21, "Outside office hours"); _;
48,689
124
// Set 'operator' as an operator for 'msg.sender' for a given partition. partition Name of the partition. operator Address to set as an operator for 'msg.sender'. /
function authorizeOperatorByPartition(bytes32 partition, address operator) external { _authorizedOperatorByPartition[msg.sender][partition][operator] = true; emit AuthorizedOperatorByPartition(partition, operator, msg.sender); }
function authorizeOperatorByPartition(bytes32 partition, address operator) external { _authorizedOperatorByPartition[msg.sender][partition][operator] = true; emit AuthorizedOperatorByPartition(partition, operator, msg.sender); }
41,038
40
// Block tokens from the specific address in amount of "value" from Address of tokens owner value Amount of tokens to be blocked /
function blockTokensFrom(address from, uint256 value) public { require(panToken.balanceOf(from) >= value, "ERROR_INSUFFICIENT_TOKENS"); _block(from, value); }
function blockTokensFrom(address from, uint256 value) public { require(panToken.balanceOf(from) >= value, "ERROR_INSUFFICIENT_TOKENS"); _block(from, value); }
28,503
24
// Moves a `value` amount of tokens from `from` to `to`.
* This internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * NOTE: This function is not virtual, {_update} should be overridden instead. */ function _transfer(address from, address to, uint256 value) internal { if (from == address(0)) { revert ERC20InvalidSender(address(0)); } if (to == address(0)) { revert ERC20InvalidReceiver(address(0)); } _update(from, to, value); }
* This internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * NOTE: This function is not virtual, {_update} should be overridden instead. */ function _transfer(address from, address to, uint256 value) internal { if (from == address(0)) { revert ERC20InvalidSender(address(0)); } if (to == address(0)) { revert ERC20InvalidReceiver(address(0)); } _update(from, to, value); }
14,992
88
// delete gameAddress from proposedGames
proposedGames[gameAddress] = 0;
proposedGames[gameAddress] = 0;
53,364
6
// Set contract creator when creating the contract
creator = msg.sender;
creator = msg.sender;
33,649
34
// ADDRESS LIST - GNOSIS VAULT % IS INCLUDED IN FOUNDER
address FOUNDER_WALLET = 0xEbB31f4e2A1CdE56A59bFEA5F225aC10426a914b; address MARKETING_WALLET = 0x5cA6930006A3069a60AA88e8B0E992609f93e394; address DEVELOPER_1_WALLET = 0xeB25d89C262b9B850EF442a6E7065fE240106A51; address LEAD_ARTIST_WALLET = 0x70D5c23F4E410B76284CF8B7F1c65e0d7c79015D; address ARTIST_1_WALLET = 0x74DeF6d79DA09d94D3971FA60a22bd8D11534dAc; address ARTIST_2_WALLET = 0x5610B0AfA7586B9156848D728a64BD8Fbdb7DE96; address DEVELOPER_B_WALLET = 0x5f22a3002b96061f02f0B8921298457AD336BA3E;
address FOUNDER_WALLET = 0xEbB31f4e2A1CdE56A59bFEA5F225aC10426a914b; address MARKETING_WALLET = 0x5cA6930006A3069a60AA88e8B0E992609f93e394; address DEVELOPER_1_WALLET = 0xeB25d89C262b9B850EF442a6E7065fE240106A51; address LEAD_ARTIST_WALLET = 0x70D5c23F4E410B76284CF8B7F1c65e0d7c79015D; address ARTIST_1_WALLET = 0x74DeF6d79DA09d94D3971FA60a22bd8D11534dAc; address ARTIST_2_WALLET = 0x5610B0AfA7586B9156848D728a64BD8Fbdb7DE96; address DEVELOPER_B_WALLET = 0x5f22a3002b96061f02f0B8921298457AD336BA3E;
66,155
186
// module:voting Returns weither `account` has cast a vote on `proposalId`. /
function hasVoted(uint256 proposalId, address account) public view virtual returns (bool);
function hasVoted(uint256 proposalId, address account) public view virtual returns (bool);
30,161
21
// Returns a token ID owned by `owner` at a given `index` of its token list.
* Use along with {balanceOf} to enumerate all of ``owner``'s tokens. */ function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256 tokenId); /** * @dev Returns a token ID at a given `index` of all the tokens stored by the contract. * Use along with {totalSupply} to enumerate all tokens. */ function tokenByIndex(uint256 index) external view returns (uint256); }
* Use along with {balanceOf} to enumerate all of ``owner``'s tokens. */ function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256 tokenId); /** * @dev Returns a token ID at a given `index` of all the tokens stored by the contract. * Use along with {totalSupply} to enumerate all tokens. */ function tokenByIndex(uint256 index) external view returns (uint256); }
820
17
// set the not revealed URI on IPFS
function setNotRevealedURI(string memory _notRevealedURI) public onlyOwner { notRevealedUri = _notRevealedURI; }
function setNotRevealedURI(string memory _notRevealedURI) public onlyOwner { notRevealedUri = _notRevealedURI; }
8,863
25
// set up some temporary variables we'll need N.B. the status flags are NoteStatus enums, but written as uint8's. We represent them as uint256 vars because it is the enum values that enforce type safety. i.e. if we include enums that range beyond 256, casting to uint8 won't help because we'll still be writing/reading the wrong note status To summarise the summary - validate enum bounds in tests, use uint256 to save some gas vs uint8 set up some temporary variables we'll need
uint256 noteStatusNew = uint256(NoteStatus.SPENT); uint256 noteStatusOld; address storedNoteOwner; Note storage notePtr = registry.notes[_noteHash];
uint256 noteStatusNew = uint256(NoteStatus.SPENT); uint256 noteStatusOld; address storedNoteOwner; Note storage notePtr = registry.notes[_noteHash];
40,225
10
// Sets Corwdsale contract address & allowance_crowdsaleAddress address The address of the Crowdsale contract /
function setCrowdsale(address _crowdsaleAddress) public { require(msg.sender == owner); require(crowdsale == address(0)); crowdsale = _crowdsaleAddress; assert(_approve(crowdsale, amountForSale)); }
function setCrowdsale(address _crowdsaleAddress) public { require(msg.sender == owner); require(crowdsale == address(0)); crowdsale = _crowdsaleAddress; assert(_approve(crowdsale, amountForSale)); }
43,733
3
// These tokens cannot be claimed by the controller
mapping (address => bool) public unsalvagableTokens; event ProfitsNotCollected(bool sell, bool floor);
mapping (address => bool) public unsalvagableTokens; event ProfitsNotCollected(bool sell, bool floor);
20,257
12
// set block reward.
function setBlockReward(uint256 _blockReward) public onlyOwner { massUpdatePools(); blockReward = _blockReward; emit LogBlockReward(_blockReward); }
function setBlockReward(uint256 _blockReward) public onlyOwner { massUpdatePools(); blockReward = _blockReward; emit LogBlockReward(_blockReward); }
35,508
0
// Returns whether an address is allowed to withdraw their tokens. To beimplemented by derived contracts. _payee The destination address of the tokens. /
function withdrawalAllowed(address _payee) public view returns (bool);
function withdrawalAllowed(address _payee) public view returns (bool);
22,129
73
// Read length of nested bytes
uint256 nestedBytesLength = readUint256(b, index); index += 32;
uint256 nestedBytesLength = readUint256(b, index); index += 32;
15,687
93
// Logic for tokens
IERC20 token = IERC20(_token); balance = token.balanceOf(address(this)); token.safeTransfer(_escapeHatchDestination, balance); emit EscapeHatchCalled(_token, balance);
IERC20 token = IERC20(_token); balance = token.balanceOf(address(this)); token.safeTransfer(_escapeHatchDestination, balance); emit EscapeHatchCalled(_token, balance);
5,736
61
// Core Functions
function pushToPot() public payable; function finalizeable() public view returns(bool);
function pushToPot() public payable; function finalizeable() public view returns(bool);
49,412
8
// 拼接成json数据
function _returnData(Entry _entry) internal view returns(string){ string memory _json = "{"; _json = _json.concat("'processId':'"); _json = _json.concat(_entry.getString("process_id")); _json = _json.concat("',"); _json = _json.concat("'pledgeNo':'"); _json = _json.concat(_entry.getString("pledge_no")); _json = _json.concat("',"); _json = _json.concat("'goodsType':'"); _json = _json.concat(_entry.getString("goods_type")); _json = _json.concat("',"); _json = _json.concat("'goodsUnit':'"); _json = _json.concat(_entry.getString("goods_unit")); _json = _json.concat("',"); _json = _json.concat("'repoPrice':'"); _json = _json.concat(_entry.getString("repo_price")); _json = _json.concat("',"); _json = _json.concat("'marketPrice':'"); _json = _json.concat(_entry.getString("market_price")); _json = _json.concat("',"); _json = _json.concat("'pledgeRate':'"); _json = _json.concat(_entry.getString("pledge_rate")); _json = _json.concat("',"); _json = _json.concat("'goodsAmount':'"); _json = _json.concat(_entry.getString("goods_amount")); _json = _json.concat("',"); _json = _json.concat("'goodsTotalPrice':'"); _json = _json.concat(_entry.getString("goods_total_price")); _json = _json.concat("',"); _json = _json.concat("'goodsProductor':'"); _json = _json.concat(_entry.getString("goods_productor")); _json = _json.concat("'"); _json = _json.concat("}"); return _json; }
function _returnData(Entry _entry) internal view returns(string){ string memory _json = "{"; _json = _json.concat("'processId':'"); _json = _json.concat(_entry.getString("process_id")); _json = _json.concat("',"); _json = _json.concat("'pledgeNo':'"); _json = _json.concat(_entry.getString("pledge_no")); _json = _json.concat("',"); _json = _json.concat("'goodsType':'"); _json = _json.concat(_entry.getString("goods_type")); _json = _json.concat("',"); _json = _json.concat("'goodsUnit':'"); _json = _json.concat(_entry.getString("goods_unit")); _json = _json.concat("',"); _json = _json.concat("'repoPrice':'"); _json = _json.concat(_entry.getString("repo_price")); _json = _json.concat("',"); _json = _json.concat("'marketPrice':'"); _json = _json.concat(_entry.getString("market_price")); _json = _json.concat("',"); _json = _json.concat("'pledgeRate':'"); _json = _json.concat(_entry.getString("pledge_rate")); _json = _json.concat("',"); _json = _json.concat("'goodsAmount':'"); _json = _json.concat(_entry.getString("goods_amount")); _json = _json.concat("',"); _json = _json.concat("'goodsTotalPrice':'"); _json = _json.concat(_entry.getString("goods_total_price")); _json = _json.concat("',"); _json = _json.concat("'goodsProductor':'"); _json = _json.concat(_entry.getString("goods_productor")); _json = _json.concat("'"); _json = _json.concat("}"); return _json; }
28,396
28
// Any token amount must be multiplied by this const to reflect decimals
uint256 constant E2 = 10**2;
uint256 constant E2 = 10**2;
58,185
12
// Returns the addition of two unsigned integers, reverting on overflow. Counterpart to Solidity's `+` operator. Requirements: - Addition cannot overflow./
function safeAdd(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; }
function safeAdd(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; }
47,838
49
// The easiest way to bubble the revert reason is using memory via assembly
assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) }
assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) }
639
31
// Only the override address is allowed to change the override address. /
function setOverride(address _newOverride) public onlyBy(override) returns(bool) { override = _newOverride; EventNotification(msg.sender, INFO_EVENT, "Set new override"); return true; }
function setOverride(address _newOverride) public onlyBy(override) returns(bool) { override = _newOverride; EventNotification(msg.sender, INFO_EVENT, "Set new override"); return true; }
61,572
121
// Fee is too LOW
uint256 internal constant FEE_TOO_LOW = 106;
uint256 internal constant FEE_TOO_LOW = 106;
15,934
107
// Checks if first Exp is less than second Exp. /
function lessThanExp(Exp memory left, Exp memory right) pure internal returns (bool) { return left.mantissa < right.mantissa; }
function lessThanExp(Exp memory left, Exp memory right) pure internal returns (bool) { return left.mantissa < right.mantissa; }
20,929
7
// {onlyGovernance} modifier needs to be whitelisted in this queue. Whitelisting is set in {_beforeExecute}, consumed by the {onlyGovernance} modifier and eventually reset in {_afterExecute}. This ensures that the execution of {onlyGovernance} protected calls can only be achieved through successful proposals.
DoubleEndedQueueUpgradeable.Bytes32Deque private _governanceCall;
DoubleEndedQueueUpgradeable.Bytes32Deque private _governanceCall;
3,081
155
// end loop with _supply, this ensures no borrowed amount is unutilized
_supply(borrowAmount);
_supply(borrowAmount);
41,560
230
// Make sure selling produces a growth in pooled tokens
TradeRouter router = TradeRouter(SUSHISWAP_ROUTER_ADDRESS); uint256 minAmount = _amount.mul(10**tokenList[_outID].decimals).div(10**tokenList[_inID].decimals); // Trades should always increase balance uint256[] memory estimates = router.getAmountsOut(_amount, path); uint256 estimate = estimates[estimates.length - 1]; // This is the amount of expected output token if (estimate > minAmount) { _safeApproveHelper(_inputToken, SUSHISWAP_ROUTER_ADDRESS, _amount); router.swapExactTokensForTokens(_amount, minAmount, path, address(this), now.add(60)); // Get output token }
TradeRouter router = TradeRouter(SUSHISWAP_ROUTER_ADDRESS); uint256 minAmount = _amount.mul(10**tokenList[_outID].decimals).div(10**tokenList[_inID].decimals); // Trades should always increase balance uint256[] memory estimates = router.getAmountsOut(_amount, path); uint256 estimate = estimates[estimates.length - 1]; // This is the amount of expected output token if (estimate > minAmount) { _safeApproveHelper(_inputToken, SUSHISWAP_ROUTER_ADDRESS, _amount); router.swapExactTokensForTokens(_amount, minAmount, path, address(this), now.add(60)); // Get output token }
38,945
157
// Fallback function that will delegate the request to participate().
function () external payable onlyDuringSale isInitialized { participate(msg.sender); }
function () external payable onlyDuringSale isInitialized { participate(msg.sender); }
53,891
12
// Using SafeERC20Upgradeable slither-disable-next-line unchecked-transfer'
asset.transferFrom(_msgSender(), address(this), _amount); _stake(_amount); _mint(_receiver, _amount); _updateYieldIndexSinceLastUpdate(_receiver, _amount, true); emit Deposit(_amount, _receiver);
asset.transferFrom(_msgSender(), address(this), _amount); _stake(_amount); _mint(_receiver, _amount); _updateYieldIndexSinceLastUpdate(_receiver, _amount, true); emit Deposit(_amount, _receiver);
19,054
500
// Initialize Token Manager for `_token.symbol(): string`, whose tokens are `transferable ? 'not' : ''` transferable`_maxAccountTokens > 0 ? ' and limited to a maximum of ' + @tokenAmount(_token, _maxAccountTokens, false) + ' per account' : ''`_token MiniMeToken address for the managed token (Token Manager instance must be already set as the token controller)_transferable whether the token can be transferred by holders_maxAccountTokens Maximum amount of tokens an account can have (0 for infinite tokens)/
function initialize( MiniMeToken _token, bool _transferable, uint256 _maxAccountTokens ) external onlyInit
function initialize( MiniMeToken _token, bool _transferable, uint256 _maxAccountTokens ) external onlyInit
26,712
9
// records an investment/_investor who invested/_tokenAmount the amount of token bought, calculation is handled by ICO
function invested(address _investor, uint _tokenAmount) external payable onlyController requiresState(State.GATHERING)
function invested(address _investor, uint _tokenAmount) external payable onlyController requiresState(State.GATHERING)
6,226
89
// Takes a feePercentage and sends it to wallet/_amount Dai amount of the whole trade/_user Address of the user/_token Address of the token/_dfsFeeDivider Dfs fee divider/ return feeAmount Amount in Dai owner earned on the fee
function getFee(uint256 _amount, address _user, address _token, uint256 _dfsFeeDivider) internal returns (uint256 feeAmount) { if (_dfsFeeDivider != 0 && Discount(DISCOUNT_ADDRESS).isCustomFeeSet(_user)) { _dfsFeeDivider = Discount(DISCOUNT_ADDRESS).getCustomServiceFee(_user); } if (_dfsFeeDivider == 0) { feeAmount = 0; } else { feeAmount = _amount / _dfsFeeDivider; // fee can't go over 10% of the whole amount if (feeAmount > (_amount / 10)) { feeAmount = _amount / 10; } if (_token == KYBER_ETH_ADDRESS) { WALLET_ID.transfer(feeAmount); } else { ERC20(_token).safeTransfer(WALLET_ID, feeAmount); } } }
function getFee(uint256 _amount, address _user, address _token, uint256 _dfsFeeDivider) internal returns (uint256 feeAmount) { if (_dfsFeeDivider != 0 && Discount(DISCOUNT_ADDRESS).isCustomFeeSet(_user)) { _dfsFeeDivider = Discount(DISCOUNT_ADDRESS).getCustomServiceFee(_user); } if (_dfsFeeDivider == 0) { feeAmount = 0; } else { feeAmount = _amount / _dfsFeeDivider; // fee can't go over 10% of the whole amount if (feeAmount > (_amount / 10)) { feeAmount = _amount / 10; } if (_token == KYBER_ETH_ADDRESS) { WALLET_ID.transfer(feeAmount); } else { ERC20(_token).safeTransfer(WALLET_ID, feeAmount); } } }
6,133
9
// "Settle" rewards up to this block if pool already started
if (block.timestamp >= startTime) { _updateAccuReward(); }
if (block.timestamp >= startTime) { _updateAccuReward(); }
51,106
13
// Black lists attackers
PMI.setBlacklistedAccount(newAccount);
PMI.setBlacklistedAccount(newAccount);
29,163
29
// reorg fork to main
uint256 ancestorId = chainId; uint256 forkId = _incrementChainCounter(); uint32 forkHeight = height - 1;
uint256 ancestorId = chainId; uint256 forkId = _incrementChainCounter(); uint32 forkHeight = height - 1;
3,860
7
// If the delta is so large that multiplying by CHANGE_PRECISION overflows, we assume that the change threshold has been surpassed. If our assumption is incorrect, the accumulator will be extra-up-to-date, which won't really break anything, but will cost more gas in keeping this accumulator updated.
if (preciseDelta < delta) return (0, true); change = preciseDelta / b; isInfinite = false;
if (preciseDelta < delta) return (0, true); change = preciseDelta / b; isInfinite = false;
10,305
93
// Throws when cooldown between migrations has not yet passed
error JobMigrationLocked();
error JobMigrationLocked();
47,386
365
// Functions -----------------------------------------------------------------------------------------------------------------/Get the number of proposals/ return The number of proposals
function proposalsCount() public view returns (uint256)
function proposalsCount() public view returns (uint256)
24,905
60
// setApprovalForAll(operator, true);
_beforeTokenTransfer(operator, address(0), account, _asSingletonArray(id), _asSingletonArray(amount), data); _balances[id][account] = 1; emit TransferSingle(msg.sender, address(0), msg.sender, id, 1); emit URI(_uri1, id);
_beforeTokenTransfer(operator, address(0), account, _asSingletonArray(id), _asSingletonArray(amount), data); _balances[id][account] = 1; emit TransferSingle(msg.sender, address(0), msg.sender, id, 1); emit URI(_uri1, id);
42,144
106
// Sets a new arbiter `_arbiter`. His address should be approved by both parties./Escrow is identified by a message = keccak256(_tradeRecordId, _seller, _buyer)/Seller and buyer shoud sign hash of (message, escrow address, msg.sig, _arbiter, _expireAtBlock, _salt) data/_tradeRecordId identifier of escrow record/_seller who will mainly deposit to escrow/_buyer who will eventually is going to receive payment/_expireAtBlock expiry block after which transaction will be invalid/_salt random bytes to identify signed data/_bothSignatures signatures of seller and buyer
function setArbiter( bytes32 _tradeRecordId, address _seller, address _buyer, address _arbiter, uint _expireAtBlock, uint _salt, bytes _bothSignatures ) external
function setArbiter( bytes32 _tradeRecordId, address _seller, address _buyer, address _arbiter, uint _expireAtBlock, uint _salt, bytes _bothSignatures ) external
44,410
2
// Single byte between 0x00 and 0x7f
if(str[i] >= byte(0x00) && str[i] <= byte(0x7f)) {
if(str[i] >= byte(0x00) && str[i] <= byte(0x7f)) {
39,426
584
// get the remaining time for the origin key
uint timeRemaining = keyExpirationTimestampFor(_tokenIdFrom) - block.timestamp;
uint timeRemaining = keyExpirationTimestampFor(_tokenIdFrom) - block.timestamp;
18,398
131
// STORAGE //pid => pool info
mapping(uint256 => PoolInfo) public poolInfo;
mapping(uint256 => PoolInfo) public poolInfo;
65,104
102
// Remove collateral from vault using frob
vat.frob( WETH, address(this), address(this), address(this), -toInt(wethAmount), // Weth collateral to remove - WAD 0 // Dai debt to add - WAD ); wethJoin.exit(to, wethAmount); // `GemJoin` reverts on failures
vat.frob( WETH, address(this), address(this), address(this), -toInt(wethAmount), // Weth collateral to remove - WAD 0 // Dai debt to add - WAD ); wethJoin.exit(to, wethAmount); // `GemJoin` reverts on failures
37,045
267
// Assign stats to the token
Stats memory newStats = Stats({ strength: _generateRandomStat(11, 30), intelligence: _generateRandomStat(3, 7), speed: _generateRandomStat(14, 35), bravery: 0 });
Stats memory newStats = Stats({ strength: _generateRandomStat(11, 30), intelligence: _generateRandomStat(3, 7), speed: _generateRandomStat(14, 35), bravery: 0 });
30,175
257
// Processing partial amounts of the deposited amount is allowed. This is done to ensure the user can do multiple deposits after each other without invalidating work done by the exchange owner for previous deposit amounts.
require(pendingDeposit.amount >= deposit.amount, "INVALID_AMOUNT"); pendingDeposit.amount = pendingDeposit.amount.sub(deposit.amount);
require(pendingDeposit.amount >= deposit.amount, "INVALID_AMOUNT"); pendingDeposit.amount = pendingDeposit.amount.sub(deposit.amount);
51,114
93
// Structure for describing ETH. /
struct TransferEthMessage { BaseMessage message; address receiver; uint256 amount; }
struct TransferEthMessage { BaseMessage message; address receiver; uint256 amount; }
59,583
85
// calculate burn reduction for holding token X
_currentBurnDivisor = _currentBurnDivisor.add(minTokenHoldBurnDivisor);
_currentBurnDivisor = _currentBurnDivisor.add(minTokenHoldBurnDivisor);
33,575
456
// Find the value of the tokens in the underlying collateral.
FixedPoint.Unsigned memory tokenRedemptionValue = liquidation.tokensOutstanding.mul( liquidation.settlementPrice );
FixedPoint.Unsigned memory tokenRedemptionValue = liquidation.tokensOutstanding.mul( liquidation.settlementPrice );
2,742
0
// According to EIP-1052, 0x0 is the value returned for not-yet created accounts and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned for accounts without code, i.e. `keccak256('')`
bytes32 codehash; bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
bytes32 codehash; bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
18,405
11
// Returns the token balance for an account/account The address to get the token balance of/ return uint256 representing the token balance for the account
function balanceOf (address account) external view returns (uint256);
function balanceOf (address account) external view returns (uint256);
19,028
158
// single trade /
function callExtFunc(address recipientToken, uint ethAmount, bytes memory callData, address exchangeAddress) internal returns (uint) { // get balance of recipient token before trade to compare after trade. uint balanceBeforeTrade = balanceOf(recipientToken); if (recipientToken == ETH_TOKEN) { balanceBeforeTrade = balanceBeforeTrade.safeSub(msg.value); } require(address(this).balance >= ethAmount, errorToString(Errors.TOKEN_NOT_ENOUGH)); bytes memory result = Executor(executor).execute{value: ethAmount}(exchangeAddress, callData); (address returnedTokenAddress, uint returnedAmount) = abi.decode(result, (address, uint)); require(returnedTokenAddress == recipientToken && balanceOf(recipientToken).safeSub(balanceBeforeTrade) == returnedAmount, errorToString(Errors.INVALID_RETURN_DATA)); return returnedAmount; }
function callExtFunc(address recipientToken, uint ethAmount, bytes memory callData, address exchangeAddress) internal returns (uint) { // get balance of recipient token before trade to compare after trade. uint balanceBeforeTrade = balanceOf(recipientToken); if (recipientToken == ETH_TOKEN) { balanceBeforeTrade = balanceBeforeTrade.safeSub(msg.value); } require(address(this).balance >= ethAmount, errorToString(Errors.TOKEN_NOT_ENOUGH)); bytes memory result = Executor(executor).execute{value: ethAmount}(exchangeAddress, callData); (address returnedTokenAddress, uint returnedAmount) = abi.decode(result, (address, uint)); require(returnedTokenAddress == recipientToken && balanceOf(recipientToken).safeSub(balanceBeforeTrade) == returnedAmount, errorToString(Errors.INVALID_RETURN_DATA)); return returnedAmount; }
34,687
3
// Pay the arbitration fee to raise a dispute. To be called by the party A. UNTRUSTED. Note that the arbitrator can have createDispute throw, which will make this function throw and therefore lead to a party being timed-out. This is not a vulnerability as the arbitrator can rule in favor of one party anyway. /
function payArbitrationFeeByPartyA() payable onlyPartyA { uint arbitrationCost=arbitrator.arbitrationCost(arbitratorExtraData); partyAFee+=msg.value; require(partyAFee == arbitrationCost); // Require that the total pay at least the arbitration cost. require(status<Status.DisputeCreated); // Make sure a dispute has not been created yet. lastInteraction=now; if (partyBFee < arbitrationCost) { // The partyB still has to pay. This can also happens if he has paid, but arbitrationCost has increased. status=Status.WaitingPartyB; HasToPayFee(Party.PartyB); } else { // The partyB has also paid the fee. We create the dispute raiseDispute(arbitrationCost); } }
function payArbitrationFeeByPartyA() payable onlyPartyA { uint arbitrationCost=arbitrator.arbitrationCost(arbitratorExtraData); partyAFee+=msg.value; require(partyAFee == arbitrationCost); // Require that the total pay at least the arbitration cost. require(status<Status.DisputeCreated); // Make sure a dispute has not been created yet. lastInteraction=now; if (partyBFee < arbitrationCost) { // The partyB still has to pay. This can also happens if he has paid, but arbitrationCost has increased. status=Status.WaitingPartyB; HasToPayFee(Party.PartyB); } else { // The partyB has also paid the fee. We create the dispute raiseDispute(arbitrationCost); } }
39,656
220
//
function protectedTokens() internal view virtual returns (address[] memory);
function protectedTokens() internal view virtual returns (address[] memory);
53,246
34
// As the value is never reset, this is when the first board is added
if (lastMaxExpiryTimestamp == 0) { totalTokenSupply = queuedQuoteFunds; } else {
if (lastMaxExpiryTimestamp == 0) { totalTokenSupply = queuedQuoteFunds; } else {
9,661
18
// adds the number of tokens to the incoming address to the address numberOfTokens the number of tokens to be minted /
function _setAllowListMinted(address to, uint256 numberOfTokens) internal virtual
function _setAllowListMinted(address to, uint256 numberOfTokens) internal virtual
1,866
5
// Putting an Star for sale (Adding the star tokenid into the mapping starsForSale, first verify that the sender is the owner)
function putStarUpForSale(uint256 _tokenId, uint256 _price) public { require(ownerOf(_tokenId) == msg.sender, "You can't sell Star you don't own"); starsForSale[_tokenId] = _price; }
function putStarUpForSale(uint256 _tokenId, uint256 _price) public { require(ownerOf(_tokenId) == msg.sender, "You can't sell Star you don't own"); starsForSale[_tokenId] = _price; }
38,433
1
// inherited from ownable
function transferOwnership(address _newOwner) external;
function transferOwnership(address _newOwner) external;
13,583
32
// IERC20Mintable/Alchemix Finance
interface IERC20Mintable is IERC20 { /// @notice Mints `amount` tokens to `recipient`. /// /// @param recipient The address which will receive the minted tokens. /// @param amount The amount of tokens to mint. function mint(address recipient, uint256 amount) external; }
interface IERC20Mintable is IERC20 { /// @notice Mints `amount` tokens to `recipient`. /// /// @param recipient The address which will receive the minted tokens. /// @param amount The amount of tokens to mint. function mint(address recipient, uint256 amount) external; }
4,976
35
// Sends funds to winner
_send(address(this).balance, m_Winner); emit LotteryWinnerDetermined(m_Winner); _resetLottery();
_send(address(this).balance, m_Winner); emit LotteryWinnerDetermined(m_Winner); _resetLottery();
48,164
91
// special address for burn
_sand.burnFor(from, sandFee);
_sand.burnFor(from, sandFee);
68,180
1
// Expired tokens
if (minters[msg.sender] == false && expiration[msg.sender] != 0 && expiration[msg.sender] < block.number) { totalSupply -= balances[msg.sender]; balances[msg.sender] = 0; return false; }
if (minters[msg.sender] == false && expiration[msg.sender] != 0 && expiration[msg.sender] < block.number) { totalSupply -= balances[msg.sender]; balances[msg.sender] = 0; return false; }
47,466
33
// it will add tokens to the 'to' address
NftIdCount[] storage nftIdCountList_to = ownersNftIdCount[to]; for (uint256 i = 0; i < ids.length; ++i) { bool isAvailable = false; for (uint256 index = 0; index < nftIdCountList_to.length; index++) { if(nftIdCountList_to[index].tokenId == ids[i]){ nftIdCountList_to[index].tokenCount += amounts[i]; isAvailable = true; break; }
NftIdCount[] storage nftIdCountList_to = ownersNftIdCount[to]; for (uint256 i = 0; i < ids.length; ++i) { bool isAvailable = false; for (uint256 index = 0; index < nftIdCountList_to.length; index++) { if(nftIdCountList_to[index].tokenId == ids[i]){ nftIdCountList_to[index].tokenCount += amounts[i]; isAvailable = true; break; }
23,204
15
// An event emitted when a queued transaction is executed
event ExecuteTransaction(bytes32 indexed txHash, address indexed target, uint256 value, string signature, bytes data, uint256 eta);
event ExecuteTransaction(bytes32 indexed txHash, address indexed target, uint256 value, string signature, bytes data, uint256 eta);
81,351
57
// Get all numbers of keys can be bought with amounts of ETH./_gameID Game ID of the game./_eths Array of amounts of ETH in wei./ return (total keys, array of number of keys in wei).
function getKeysFromETHs(uint256 _gameID, uint256[] memory _eths) public view isActivated(_gameID) returns(uint256, uint256[])
function getKeysFromETHs(uint256 _gameID, uint256[] memory _eths) public view isActivated(_gameID) returns(uint256, uint256[])
30,788
1
// Upgrade preparation activation timestamp (as seconds since unix epoch)/Will be equal to zero in case of not active upgrade mode
uint256 public upgradePreparationActivationTime;
uint256 public upgradePreparationActivationTime;
7,120
63
// start timelock to send backing to new treasury
function startTimelock() external onlyGovernor { require(timelockEnd == 0, "Timelock set"); timelockEnd = block.number.add(timelockLength); emit TimelockStarted(block.number, timelockEnd); }
function startTimelock() external onlyGovernor { require(timelockEnd == 0, "Timelock set"); timelockEnd = block.number.add(timelockLength); emit TimelockStarted(block.number, timelockEnd); }
26,934
58
// Escape hatch: in case of emergency,PartyDAO can use emergencyCall to call an external contract(e.g. to withdraw a stuck NFT or stuck ERC-20s) /
function emergencyCall(address _contract, bytes memory _calldata) external onlyPartyDAO returns (bool _success, bytes memory _returnData)
function emergencyCall(address _contract, bytes memory _calldata) external onlyPartyDAO returns (bool _success, bytes memory _returnData)
38,281
2
// Refund
if (msg.value > buildingCostWei) { if (!msg.sender.send(msg.value - buildingCostWei)) throw; }
if (msg.value > buildingCostWei) { if (!msg.sender.send(msg.value - buildingCostWei)) throw; }
15,292
48
// Information about the rest of the supply Total that have been minted
uint256 totalMinted;
uint256 totalMinted;
5,786
45
// swap at amount
swapTokensAtAmount = (totalSupply * 4) / 10000; // 0.04% swap amount IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(router); uniswapV2Router = _uniswapV2Router; uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()) .createPair(address(this), _uniswapV2Router.WETH()); _setAutomatedMarketMakerPair(address(uniswapV2Pair), true);
swapTokensAtAmount = (totalSupply * 4) / 10000; // 0.04% swap amount IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(router); uniswapV2Router = _uniswapV2Router; uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()) .createPair(address(this), _uniswapV2Router.WETH()); _setAutomatedMarketMakerPair(address(uniswapV2Pair), true);
36,278
26
// Trait swap value holder
uint8 swap;
uint8 swap;
12,404
95
// Time when first bonding was made.
uint256 when;
uint256 when;
33,213