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
114
// Throws if the sender is not the SetToken methodologist /
modifier onlyMethodologist() { require(msg.sender == manager.methodologist(), "Must be methodologist"); _; }
modifier onlyMethodologist() { require(msg.sender == manager.methodologist(), "Must be methodologist"); _; }
38,887
3
// 竞拍参数
address payable public beneficiary;
address payable public beneficiary;
51,502
42
// Convert signed 128.128 fixed point number into signed 64.64-bit fixed pointnumber rounding down.Revert on overflow.x signed 128.128-bin fixed point numberreturn signed 64.64-bit fixed point number /
function from128x128 (int256 x) internal pure returns (int128) { unchecked { int256 result = x >> 64; require (result >= MIN_64x64 && result <= MAX_64x64); return int128 (result); } }
function from128x128 (int256 x) internal pure returns (int128) { unchecked { int256 result = x >> 64; require (result >= MIN_64x64 && result <= MAX_64x64); return int128 (result); } }
32,715
14
// Check to make sure the msg.sender is the owner And it will suicide the contract and return funds to the owner
function killWallet() public isOwner { selfdestruct(owner); }
function killWallet() public isOwner { selfdestruct(owner); }
43,758
254
// returns total debt borrowed in want (which is the delegatedAssets)
return _fromETH( _toETH(balanceOfDebt(), address(investmentToken)), address(want) );
return _fromETH( _toETH(balanceOfDebt(), address(investmentToken)), address(want) );
54,449
165
// Return 0 if already overcollateralized Otherwise, return the deficiency
if (effective_collat_e24 >= desired_collat_e24) return 0; else { return (desired_collat_e24.sub(effective_collat_e24)).div(PRICE_PRECISION); }
if (effective_collat_e24 >= desired_collat_e24) return 0; else { return (desired_collat_e24.sub(effective_collat_e24)).div(PRICE_PRECISION); }
62,189
5
// Locks token(s) to effectively lock them, while keeping in the same wallet.This mechanism prevents them from being transferred, yet still will show correct owner. /
function lock(uint256 tokenId) public virtual nonReentrant { require(hasRole(LOCKER_ROLE, msg.sender), "NOT_LOCKER_ROLE"); _lock(tokenId); }
function lock(uint256 tokenId) public virtual nonReentrant { require(hasRole(LOCKER_ROLE, msg.sender), "NOT_LOCKER_ROLE"); _lock(tokenId); }
30,430
159
// Emitted when a relay is removed (deregistered). `unstakeTime` is the time when unstake will be callable. /
event RelayRemoved(address indexed relay, uint256 unstakeTime);
event RelayRemoved(address indexed relay, uint256 unstakeTime);
45,373
147
// view functon to get number of stakers
function getNumberOfHolders() public view returns (uint) { return holders.length(); }
function getNumberOfHolders() public view returns (uint) { return holders.length(); }
33,403
5
// is the participant a suggeester /
function isSuggester(address _address) public view returns (bool)
function isSuggester(address _address) public view returns (bool)
33,310
5
// function xuất ra thành viên nhóm
function getAuthor() public pure returns(Author memory , Author memory, Author memory , Author memory )
function getAuthor() public pure returns(Author memory , Author memory, Author memory , Author memory )
37,856
60
// Get totalSupply of token /
function totalSupply() external override view returns (uint256) { return totalSupply_; }
function totalSupply() external override view returns (uint256) { return totalSupply_; }
35,097
11
// reward related variables/
uint256 public lastDistributed; uint256 public minHoldingAmount; uint256 private requestID; uint256 public INTERVAL = 86400 seconds; // 1 Day
uint256 public lastDistributed; uint256 public minHoldingAmount; uint256 private requestID; uint256 public INTERVAL = 86400 seconds; // 1 Day
28,918
30
// set a minimum burn rate to prevent no-burn-txs due to precision loss
if (fourPercent == 0 && value > 0) fourPercent = 1;
if (fourPercent == 0 && value > 0) fourPercent = 1;
10,777
18
// Deduce from amount of money we get back the unsettled payout
toSend -= unsettledPayouts; unsettledPayouts = 0;
toSend -= unsettledPayouts; unsettledPayouts = 0;
32,207
36
// Burns `amount` tokens, decreasing the total supply. rawAmount The number of tokens that are bruned /
function burn(uint rawAmount) external { uint96 amount = safe96(rawAmount, "DFL::burn: amount exceeds 96 bits"); _totalSupply = sub96(_totalSupply, amount, "DFL::burn: total supply exceeds"); balances[msg.sender] = sub96(balances[msg.sender], amount, "DFL::burn: burn amount exceeds balance"); _moveDelegates(delegates[msg.sender], address(0), amount); emit Transfer(msg.sender, address(0), amount); }
function burn(uint rawAmount) external { uint96 amount = safe96(rawAmount, "DFL::burn: amount exceeds 96 bits"); _totalSupply = sub96(_totalSupply, amount, "DFL::burn: total supply exceeds"); balances[msg.sender] = sub96(balances[msg.sender], amount, "DFL::burn: burn amount exceeds balance"); _moveDelegates(delegates[msg.sender], address(0), amount); emit Transfer(msg.sender, address(0), amount); }
34,861
125
// Premises: 1. it's impossible to have gaps of uninitialized epochs - any deposit or withdraw initialize the current epoch which requires the previous one to be initialized
if (epochIsInitialized(epochId)) { return poolSize[epochId].size; }
if (epochIsInitialized(epochId)) { return poolSize[epochId].size; }
42,383
861
// Get borrow balance of the specified market and borrower market The address of the market borrower The address of the borrower isVerified Verified / Public protocolreturn Borrow balance of the specified market and borrower /
function getBorrowBalance( address market, address borrower, bool isVerified
function getBorrowBalance( address market, address borrower, bool isVerified
17,654
167
// supply counters total max supply = totalcount - 1
uint256 public totalMints; uint256 public totalCount = 10001;
uint256 public totalMints; uint256 public totalCount = 10001;
22,936
18
// DividendPayout redemption event.
event PayoutRedemption(uint etherAmount, uint indexed id, uint price);
event PayoutRedemption(uint etherAmount, uint indexed id, uint price);
38,748
10
// presale
_presale = true; _whitelist[msg.sender] = true;
_presale = true; _whitelist[msg.sender] = true;
43,855
309
// See {IERC165-supportsInterface}. Time complexity O(1), guaranteed to always use less than 30 000 gas. /
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return _supportedInterfaces[interfaceId]; }
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return _supportedInterfaces[interfaceId]; }
74,125
254
// tx.members
uint256 timestamp = block.timestamp;
uint256 timestamp = block.timestamp;
24,189
129
// User's asset balance check
require( IERC20Swap(assetAdd).balanceOf(msg.sender) >= value && value > 0, "Insufficient Balance" ); if (staking.amount[assetAdd] > 0) { staking.pendingReward = staking.pendingReward.add(tobeClaimed()); staking.amount[assetAdd] = staking.amount[assetAdd].add(value); staking.lastUpdated = now; } else {
require( IERC20Swap(assetAdd).balanceOf(msg.sender) >= value && value > 0, "Insufficient Balance" ); if (staking.amount[assetAdd] > 0) { staking.pendingReward = staking.pendingReward.add(tobeClaimed()); staking.amount[assetAdd] = staking.amount[assetAdd].add(value); staking.lastUpdated = now; } else {
21,391
320
// if the receiver is redirecting his interest towards someone else,adds to the redirected balance the accrued interest and the amountbeing transferred
updateRedirectedBalanceOfRedirectionAddressInternal(_to, toBalanceIncrease.add(_value), 0);
updateRedirectedBalanceOfRedirectionAddressInternal(_to, toBalanceIncrease.add(_value), 0);
12,083
39
// Returns the number of the first codepoint in the slice. self The slice to operate on.return The number of the first codepoint in the slice. /
function ord(slice memory self) internal pure returns (uint ret) { if (self._len == 0) { return 0; } uint word; uint length; uint divisor = 2 ** 248; // Load the rune into the MSBs of b assembly { word:= mload(mload(add(self, 32))) } uint b = word / divisor; if (b < 0x80) { ret = b; length = 1; } else if(b < 0xE0) { ret = b & 0x1F; length = 2; } else if(b < 0xF0) { ret = b & 0x0F; length = 3; } else { ret = b & 0x07; length = 4; } // Check for truncated codepoints if (length > self._len) { return 0; } for (uint i = 1; i < length; i++) { divisor = divisor / 256; b = (word / divisor) & 0xFF; if (b & 0xC0 != 0x80) { // Invalid UTF-8 sequence return 0; } ret = (ret * 64) | (b & 0x3F); } return ret; }
function ord(slice memory self) internal pure returns (uint ret) { if (self._len == 0) { return 0; } uint word; uint length; uint divisor = 2 ** 248; // Load the rune into the MSBs of b assembly { word:= mload(mload(add(self, 32))) } uint b = word / divisor; if (b < 0x80) { ret = b; length = 1; } else if(b < 0xE0) { ret = b & 0x1F; length = 2; } else if(b < 0xF0) { ret = b & 0x0F; length = 3; } else { ret = b & 0x07; length = 4; } // Check for truncated codepoints if (length > self._len) { return 0; } for (uint i = 1; i < length; i++) { divisor = divisor / 256; b = (word / divisor) & 0xFF; if (b & 0xC0 != 0x80) { // Invalid UTF-8 sequence return 0; } ret = (ret * 64) | (b & 0x3F); } return ret; }
5,445
5
// Constructor _setupCost Setup cost of the module_logicContract Contract address that contains the logic related to `description` _polymathRegistry Address of the Polymath registry _isCostInPoly true = cost in Poly, false = USD /
constructor( string memory _version, uint256 _setupCost, address _logicContract, address _polymathRegistry, bool _isCostInPoly ) public ModuleFactory(_setupCost, _polymathRegistry, _isCostInPoly)
constructor( string memory _version, uint256 _setupCost, address _logicContract, address _polymathRegistry, bool _isCostInPoly ) public ModuleFactory(_setupCost, _polymathRegistry, _isCostInPoly)
13,472
8
// aToken address
address aTokenAddress;
address aTokenAddress;
18,087
200
// add to balance of this token
return balanceOf(_account).add(collateral);
return balanceOf(_account).add(collateral);
17,836
70
// Substract the withdrawn token amount from the user balance.
tokens[token][msg.sender] = tokens[token][msg.sender].sub(amount);
tokens[token][msg.sender] = tokens[token][msg.sender].sub(amount);
32,807
117
// 모의 아이디
uint32 matronId;
uint32 matronId;
37,162
4
// Token versionreturn Version /
function version() external view returns (string memory) { return _version; }
function version() external view returns (string memory) { return _version; }
6,406
427
// typically number of Nodes for Skale-chain (16 Nodes)
uint public constant NUMBER_OF_NODES_FOR_SCHAIN = 16;
uint public constant NUMBER_OF_NODES_FOR_SCHAIN = 16;
31,987
64
// Trigger the event notification in the parent master
master.firePaymentReceivedEvent(address(this), msg.sender, msg.value);
master.firePaymentReceivedEvent(address(this), msg.sender, msg.value);
29,953
0
// Constants
bytes32 public constant CONTROLLER_ROLE = bytes32('CONTROLLER'); bytes32 public constant MIGRATOR_ROLE = bytes32('MIGRATOR');
bytes32 public constant CONTROLLER_ROLE = bytes32('CONTROLLER'); bytes32 public constant MIGRATOR_ROLE = bytes32('MIGRATOR');
37,544
310
// Tokens free balance on the indexer stake that can be used for any purpose.Any token that is allocated cannot be used as well as tokens that are going through thethawing period or are withdrawableCalc: tokensStaked - tokensAllocated - tokensLocked stake Stake datareturn Token amount /
function tokensAvailable(Stakes.Indexer memory stake) internal pure returns (uint256) { return stake.tokensAvailableWithDelegation(0); }
function tokensAvailable(Stakes.Indexer memory stake) internal pure returns (uint256) { return stake.tokensAvailableWithDelegation(0); }
84,366
274
// GIVEAWAY
_safeMint(address(0xc5E08104c19DAfd00Fe40737490Da9552Db5bfE5), 31); _safeMint(address(0xc5E08104c19DAfd00Fe40737490Da9552Db5bfE5), 32); _safeMint(address(0xc5E08104c19DAfd00Fe40737490Da9552Db5bfE5), 33);
_safeMint(address(0xc5E08104c19DAfd00Fe40737490Da9552Db5bfE5), 31); _safeMint(address(0xc5E08104c19DAfd00Fe40737490Da9552Db5bfE5), 32); _safeMint(address(0xc5E08104c19DAfd00Fe40737490Da9552Db5bfE5), 33);
48,847
33
// Modifier for Dao functions
modifier onlyDao {if (recipient != 0) throw; _;}
modifier onlyDao {if (recipient != 0) throw; _;}
12,109
11
// send back any excess ETH
if(msg.value > (valueToSend + 0.5 ether)) { msg.sender.transfer(msg.value - valueToSend - 0.5 ether); }
if(msg.value > (valueToSend + 0.5 ether)) { msg.sender.transfer(msg.value - valueToSend - 0.5 ether); }
71,929
214
// Check if a loan has been in the credit market long enough start Timestamp at which rating beganreturn Whether a loan has been rated for long enough /
function votingLastedLongEnough(uint256 start) public view returns (bool) { return start.add(votingPeriod) <= block.timestamp; }
function votingLastedLongEnough(uint256 start) public view returns (bool) { return start.add(votingPeriod) <= block.timestamp; }
7,490
63
// The minimum amount of time in seconds required for the old uniswap price accumulator to be replaced
uint public immutable anchorPeriod;
uint public immutable anchorPeriod;
12,863
17
// To support Opensea token metadata https:docs.opensea.io/docs/metadata-standards
function tokenURI(uint256 _tokenId) public view override(ERC721) returns (string memory)
function tokenURI(uint256 _tokenId) public view override(ERC721) returns (string memory)
1,942
58
// Updates the merkle root that is stored in this contract. This can only be called bythe owner. If more addresses are added to the list, a new merkle tree and a merkle root node should be generated,and merkleRoot should be updated accordingly. merkleRoot_ a new merkle root node that contains a list of deposit allowed addresses /
function updateMerkleRoot(bytes32 merkleRoot_) external onlyOwner { merkleRoot = merkleRoot_; emit NewMerkleRoot(merkleRoot_); }
function updateMerkleRoot(bytes32 merkleRoot_) external onlyOwner { merkleRoot = merkleRoot_; emit NewMerkleRoot(merkleRoot_); }
34,757
135
// Update APY Only callable by owner. Change APY. /
function updateNewAPY(uint256 _newAPY) external onlyOwner { _updatePool(); apy = _newAPY; emit NewAPY(_newAPY); }
function updateNewAPY(uint256 _newAPY) external onlyOwner { _updatePool(); apy = _newAPY; emit NewAPY(_newAPY); }
19,025
15
// Supplier -> Manufacturer
RawMaterial(_addr).pickPackage(msg.sender);
RawMaterial(_addr).pickPackage(msg.sender);
23,543
121
// See {ERC20-_mint}. Requirements: - the caller must have the {CFORole}. /
function mint(address _account, uint256 _amount) public onlyCFO whenNotPaused { _mint(_account, _amount); }
function mint(address _account, uint256 _amount) public onlyCFO whenNotPaused { _mint(_account, _amount); }
436
3
// Event emitted when tokens are paid to provider.
event ProviderPaid(address indexed provider, uint256 indexed vidyaAmount);
event ProviderPaid(address indexed provider, uint256 indexed vidyaAmount);
41,865
92
// change the contract address _nameKey is the key for the contract address mapping _newAddress is the new contract address /
function changeAddress(string _nameKey, address _newAddress) public onlyOwner { bytes32 key = keccak256(bytes(_nameKey)); emit LogChangeAddress(_nameKey, storedAddresses[key], _newAddress); storedAddresses[key] = _newAddress; }
function changeAddress(string _nameKey, address _newAddress) public onlyOwner { bytes32 key = keccak256(bytes(_nameKey)); emit LogChangeAddress(_nameKey, storedAddresses[key], _newAddress); storedAddresses[key] = _newAddress; }
49,629
4
// Utility library of inline functions on addresses /
library AddressUtils { /** * Returns whether the target address is a contract * @dev This function will return false if invoked during the constructor of a contract, * as the code is not actually created until after the constructor finishes. * @param _addr address to check * @return whether the target address is a contract */ function isContract(address _addr) internal view returns (bool) { uint256 size; // XXX Currently there is no better way to check if there is a contract in an address // than to check the size of the code at that address. // See https://ethereum.stackexchange.com/a/14016/36603 // for more details about how this works. // TODO Check this again before the Serenity release, because all addresses will be // contracts then. // solium-disable-next-line security/no-inline-assembly assembly { size := extcodesize(_addr) } return size > 0; } }
library AddressUtils { /** * Returns whether the target address is a contract * @dev This function will return false if invoked during the constructor of a contract, * as the code is not actually created until after the constructor finishes. * @param _addr address to check * @return whether the target address is a contract */ function isContract(address _addr) internal view returns (bool) { uint256 size; // XXX Currently there is no better way to check if there is a contract in an address // than to check the size of the code at that address. // See https://ethereum.stackexchange.com/a/14016/36603 // for more details about how this works. // TODO Check this again before the Serenity release, because all addresses will be // contracts then. // solium-disable-next-line security/no-inline-assembly assembly { size := extcodesize(_addr) } return size > 0; } }
3,775
13
// It should revert because process will call handle() in an empty address
function test_notProcessLegacyProvenMessageEmptyAddress() public { bytes32 sender = bytes32(uint256(uint160(vm.addr(134)))); bytes32 receiver = bytes32(uint256(uint160(vm.addr(431)))); uint32 nonce = 0; bytes memory messageBody = "0x"; bytes memory message = Message.formatMessage( remoteDomain, sender, nonce, homeDomain, receiver, messageBody ); replica.setMessageStatus(message, replica.LEGACY_STATUS_PROVEN()); vm.expectRevert(); replica.process(message); }
function test_notProcessLegacyProvenMessageEmptyAddress() public { bytes32 sender = bytes32(uint256(uint160(vm.addr(134)))); bytes32 receiver = bytes32(uint256(uint160(vm.addr(431)))); uint32 nonce = 0; bytes memory messageBody = "0x"; bytes memory message = Message.formatMessage( remoteDomain, sender, nonce, homeDomain, receiver, messageBody ); replica.setMessageStatus(message, replica.LEGACY_STATUS_PROVEN()); vm.expectRevert(); replica.process(message); }
1,473
34
// Returns the amount of tokens this contract is willing to exchange of ETH/ return amount of tokens
function tokenAmountNeeded() public view returns (uint256) { IPayer _payer = payer; uint256 _tokensAvailable = paymentToken.balanceOf(address(_payer)); uint256 totalDebt = _payer.totalDebt(); unchecked { uint256 neededTokens = baselinePaymentTokenAmount + totalDebt; if (_tokensAvailable > neededTokens) { return 0; } return neededTokens - _tokensAvailable; } }
function tokenAmountNeeded() public view returns (uint256) { IPayer _payer = payer; uint256 _tokensAvailable = paymentToken.balanceOf(address(_payer)); uint256 totalDebt = _payer.totalDebt(); unchecked { uint256 neededTokens = baselinePaymentTokenAmount + totalDebt; if (_tokensAvailable > neededTokens) { return 0; } return neededTokens - _tokensAvailable; } }
28,803
26
// Apply a discount to incentivize arbitraguers
optionPremium = optionPremium.mul(premiumDiscount).div( 100 * Vault.PREMIUM_DISCOUNT_MULTIPLIER ); require( optionPremium <= type(uint96).max, "optionPremium > type(uint96) max value!" ); return optionPremium;
optionPremium = optionPremium.mul(premiumDiscount).div( 100 * Vault.PREMIUM_DISCOUNT_MULTIPLIER ); require( optionPremium <= type(uint96).max, "optionPremium > type(uint96) max value!" ); return optionPremium;
45,475
121
// @inheritdoc IStaking /
function stake(uint256 amount, bytes calldata) external override { _stake(msg.sender, msg.sender, amount); }
function stake(uint256 amount, bytes calldata) external override { _stake(msg.sender, msg.sender, amount); }
41,828
12
// If baseUnit is zero this will return zero instead of reverting.
z := div(z, baseUnit)
z := div(z, baseUnit)
6,067
46
// ERC20 TransferFrom function
function TRANSFERFROM360(address from, address to, uint value) public override returns (bool success) { //inject NONSTANDARD NAMING require(value <= allowance[from][msg.sender], 'Must not send more than allowance'); allowance[from][msg.sender] -= value; _TRANSFER893(from, to, value); return true; }
function TRANSFERFROM360(address from, address to, uint value) public override returns (bool success) { //inject NONSTANDARD NAMING require(value <= allowance[from][msg.sender], 'Must not send more than allowance'); allowance[from][msg.sender] -= value; _TRANSFER893(from, to, value); return true; }
22,797
29
// Function to construct some basic parameters_mintDuration the duration in which only mint token is available_commitDuration the duration in which putting forward commitment is available_revealDuration the duration in which revealing commitment is available/
constructor(uint _mintDuration, uint _commitDuration, uint _revealDuration) public{ require(_mintDuration > 0 && _commitDuration > 0 && _revealDuration > 0); startTime = now; blindAuctionTime = startTime.add(_mintDuration); commitDuration = _commitDuration; revealDuration = _revealDuration; owner = msg.sender; }
constructor(uint _mintDuration, uint _commitDuration, uint _revealDuration) public{ require(_mintDuration > 0 && _commitDuration > 0 && _revealDuration > 0); startTime = now; blindAuctionTime = startTime.add(_mintDuration); commitDuration = _commitDuration; revealDuration = _revealDuration; owner = msg.sender; }
23,400
4
// Mainnet: ETH/USD 0x5f4ec3df9cbd43714fe2740f5e3616155c5b8419
priceFeed = AggregatorV3Interface(priceFeedContract); _owner = msg.sender; _setupRole(DEFAULT_ADMIN_ROLE, msg.sender); _setRoleAdmin(CONTRACT_ADMIN_ROLE, DEFAULT_ADMIN_ROLE);
priceFeed = AggregatorV3Interface(priceFeedContract); _owner = msg.sender; _setupRole(DEFAULT_ADMIN_ROLE, msg.sender); _setRoleAdmin(CONTRACT_ADMIN_ROLE, DEFAULT_ADMIN_ROLE);
22,049
70
// message unnecessarily. For custom revert reasons use {tryMod}. 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). Requirements: - The divisor cannot be zero. /
function mod( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { require(b > 0, errorMessage); return a % b; }
function mod( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { require(b > 0, errorMessage); return a % b; }
19,371
35
// Modular function to set the transaction route of LP token 1 /
{ require( _route[0] == wrapped && _route[_route.length - 1] == lpToken1, "Bad path || !auth" ); wrappedToLp1Route = _route; wrappedToLp1Router = _router; emit SetWrappedToLp1Route(_route, _router); }
{ require( _route[0] == wrapped && _route[_route.length - 1] == lpToken1, "Bad path || !auth" ); wrappedToLp1Route = _route; wrappedToLp1Router = _router; emit SetWrappedToLp1Route(_route, _router); }
7,692
401
// assetPrice-of-underwaterAsset(1+liquidationDiscount)
Exp memory priceUnderwaterAssetTimesLiquidationMultiplier;
Exp memory priceUnderwaterAssetTimesLiquidationMultiplier;
12,282
21
// Event emitted for each sale/to address sale was made to/quantity quantity of the minted nfts/pricePerToken price for each token/firstPurchasedTokenId first purchased token ID (to get range add to quantity for max)
event Sale( address indexed to, uint256 indexed quantity, uint256 indexed pricePerToken, uint256 firstPurchasedTokenId );
event Sale( address indexed to, uint256 indexed quantity, uint256 indexed pricePerToken, uint256 firstPurchasedTokenId );
5,763
95
// attackee
uint256 _b2 = balanceOf(token_address, attackInfo.attackee); if (_b2 > 0) { uint256 _w2 = _b2.mul(actualPrizeRation).div(attackPricePrecentBase * 100); // 100 since maxAttackPrizePercent has 100 basis attackInfo.attackerWinnings[token_address] = _w2; }
uint256 _b2 = balanceOf(token_address, attackInfo.attackee); if (_b2 > 0) { uint256 _w2 = _b2.mul(actualPrizeRation).div(attackPricePrecentBase * 100); // 100 since maxAttackPrizePercent has 100 basis attackInfo.attackerWinnings[token_address] = _w2; }
11,504
12
// Retrieves the current mint nonce of an addressowner Address to check /
function getMintNonce(address owner) public view returns (uint256) { return mint_nonce[owner]; }
function getMintNonce(address owner) public view returns (uint256) { return mint_nonce[owner]; }
7,831
166
// Calculate the updated accumulation factor, based on the current epoch /
function _accumulationFactorAt(uint256 epoch) private view returns(int128) { uint256 _nUnupdatedEpochs = epoch - lastUpdatedEpoch; return accumulationFactor.mul(epy.pow(_nUnupdatedEpochs)); }
function _accumulationFactorAt(uint256 epoch) private view returns(int128) { uint256 _nUnupdatedEpochs = epoch - lastUpdatedEpoch; return accumulationFactor.mul(epy.pow(_nUnupdatedEpochs)); }
58,322
229
// 30 - 39 -> glow 10%
if (((100 - index) > 60) && ((100 - index) <= 70)) { return "glow"; }
if (((100 - index) > 60) && ((100 - index) <= 70)) { return "glow"; }
47,249
505
// Get bin and index of _id
(bin, index) = getIDBinIndex(_id);
(bin, index) = getIDBinIndex(_id);
9,878
21
// See {BEP20-totalSupply}. /
function totalSupply() external override view returns (uint256) { return _totalSupply; }
function totalSupply() external override view returns (uint256) { return _totalSupply; }
38,958
307
// Holds the bankroll controller info
ZethrBankrollControllerInterface controller;
ZethrBankrollControllerInterface controller;
32,491
175
// This function will keep track of consumed discounts by a given user.It will also grant discount tokens to the creator who is granting the discount based on theamount of discount and compensation rate.This function is invoked by a previously deployed lock only. /
function recordConsumedDiscount( uint _discount, uint /* _tokens */ ) public onlyFromDeployedLock()
function recordConsumedDiscount( uint _discount, uint /* _tokens */ ) public onlyFromDeployedLock()
49,532
74
// calculate token amount to sell
uint256 _tokens = _getTokenAmount(_exToken, _amount); require(_tokens >= 10**18, "at least buy 1 tokens per purchase"); _forwardFunds(_exToken, _amount); _processPurchase(msg.sender, _tokens); emit TokensPurchased(msg.sender, _exToken, _amount, _tokens);
uint256 _tokens = _getTokenAmount(_exToken, _amount); require(_tokens >= 10**18, "at least buy 1 tokens per purchase"); _forwardFunds(_exToken, _amount); _processPurchase(msg.sender, _tokens); emit TokensPurchased(msg.sender, _exToken, _amount, _tokens);
48,301
242
// -------------------------------------------------------- Storage--------------------------------------------------------
using Strings for uint256;
using Strings for uint256;
8,533
2
// ERC1820Implementer allows your contract to implement an interface for another account in the sense of ERC1820.That account or one of its ERC1820 managers can register the implementer in the ERC1820 registry, but the registrywill first check with the implementer if it agrees to it, and only allow it if it does. Using the internalfunction _registerInterfaceForAddress provided by this contract, you are expressing this agreement,and you will be able to register the contract as an implementer in the registry for that account. /
contract ERC1820Implementer is IERC1820Implementer { bytes32 constant private ERC1820_ACCEPT_MAGIC = keccak256(abi.encodePacked("ERC1820_ACCEPT_MAGIC")); mapping(bytes32 => mapping(address => bool)) private _supportedInterfaces; function canImplementInterfaceForAddress(bytes32 interfaceHash, address account) external view returns (bytes32) { return _supportedInterfaces[interfaceHash][account] ? ERC1820_ACCEPT_MAGIC : bytes32(0x00); } function _registerInterfaceForAddress(bytes32 interfaceHash, address account) internal { _supportedInterfaces[interfaceHash][account] = true; } }
contract ERC1820Implementer is IERC1820Implementer { bytes32 constant private ERC1820_ACCEPT_MAGIC = keccak256(abi.encodePacked("ERC1820_ACCEPT_MAGIC")); mapping(bytes32 => mapping(address => bool)) private _supportedInterfaces; function canImplementInterfaceForAddress(bytes32 interfaceHash, address account) external view returns (bytes32) { return _supportedInterfaces[interfaceHash][account] ? ERC1820_ACCEPT_MAGIC : bytes32(0x00); } function _registerInterfaceForAddress(bytes32 interfaceHash, address account) internal { _supportedInterfaces[interfaceHash][account] = true; } }
37,937
24
// Cast a vote with a reason and additional encoded parameters Emits a {VoteCast} or {VoteCastWithParams} event depending on the length of params. /
function castVoteWithReasonAndParams(
function castVoteWithReasonAndParams(
17,083
7
// _bridgeSendType One of the {MsgDataTypes.BridgeSendType} enum. /
function sendTokenTransfer( address _receiver, address _token, uint256 _amount, uint64 _dstChainId, uint64 _nonce, uint32 _maxSlippage, MsgDataTypes.BridgeSendType _bridgeSendType, address _messageBus ) internal returns (bytes32 transferId, address bridge) {
function sendTokenTransfer( address _receiver, address _token, uint256 _amount, uint64 _dstChainId, uint64 _nonce, uint32 _maxSlippage, MsgDataTypes.BridgeSendType _bridgeSendType, address _messageBus ) internal returns (bytes32 transferId, address bridge) {
19,380
10
// Performs a Solidity function call using a low level `call`. A plain `call` is an unsafe replacement for a function call: use this function instead. If `target` reverts with a revert reason, it is bubbled up by this function (like regular Solidity function calls). Returns the raw returned data. To convert to the expected return value, Requirements: - `target` must be a contract. - calling `target` with `data` must not revert. _Available since v3.1._/
function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); }
function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); }
41,562
52
// ignore dust
if (nonEscrowedRewardAmount > 1) { rewardToken.safeTransfer(_receiver, nonEscrowedRewardAmount); }
if (nonEscrowedRewardAmount > 1) { rewardToken.safeTransfer(_receiver, nonEscrowedRewardAmount); }
67,919
103
// The MGN TOKEN!
MarginlyToken public marginly;
MarginlyToken public marginly;
47,150
21
// Burn process is just a funtion to calculate burn amount depending on an amount of Tokens
function cutForBurn(uint256 a) public pure returns (uint256) { uint256 c = a.div(20); return c; }
function cutForBurn(uint256 a) public pure returns (uint256) { uint256 c = a.div(20); return c; }
35,010
111
// Deposit collateral in Yearn vault
function _reinvest() internal virtual override { uint256 _collateralBalance = collateralToken.balanceOf(address(this)); if (_collateralBalance != 0) { yToken.deposit(_collateralBalance); } }
function _reinvest() internal virtual override { uint256 _collateralBalance = collateralToken.balanceOf(address(this)); if (_collateralBalance != 0) { yToken.deposit(_collateralBalance); } }
5,782
1,634
// Only used when initially populating the contract storage. OVM_ExecutionManager will perform a `hasContractStorage` INVALID_STATE_ACCESS check before putting any contract storage because writing to zero when the actual value is nonzero causes a gas discrepancy. Could be moved into a new `putVerifiedContractStorage` function, or something along those lines.
if (verifiedContractStorage[_contract][_key] == false) { verifiedContractStorage[_contract][_key] = true; }
if (verifiedContractStorage[_contract][_key] == false) { verifiedContractStorage[_contract][_key] = true; }
57,278
111
// BetexStorage /
contract BetexStorage is Ownable { // minimum funding to get volume bonus uint256 public constant VOLUME_BONUS_CONDITION = 50 ether; // minimum funding to get volume extra bonus uint256 public constant VOLUME_EXTRA_BONUS_CONDITION = 100 ether; // extra bonus amount during first bonus round, % uint256 public constant FIRST_VOLUME_EXTRA_BONUS = 20; // extra bonus amount during second bonus round, % uint256 public constant SECOND_VOLUME_EXTRA_BONUS = 10; // bonus amount during first bonus round, % uint256 public constant FIRST_VOLUME_BONUS = 10; // bonus amount during second bonus round, % uint256 public constant SECOND_VOLUME_BONUS = 5; // oraclize funding order struct Order { address beneficiary; uint256 funds; uint256 bonus; uint256 rate; } // oraclize funding orders mapping (bytes32 => Order) public orders; // oraclize orders for unsold tokens allocation mapping (bytes32 => bool) public unsoldAllocationOrders; // addresses allowed to buy tokens mapping (address => bool) public whitelist; // funded mapping (address => bool) public funded; // funders address[] public funders; // pre ico funders address[] public preICOFunders; // tokens to allocate before ico sale starts mapping (address => uint256) public preICOBalances; // is preICO data initialized bool public preICODataInitialized; /** * @dev Constructor */ function BetexStorage() public { // pre sale round 1 preICOFunders.push(0x233Fd2B3d7a0924Fe1Bb0dd7FA168eEF8C522E65); preICOBalances[0x233Fd2B3d7a0924Fe1Bb0dd7FA168eEF8C522E65] = 15000000000000000000000; preICOFunders.push(0x2712ba56cB3Cf8783693c8a1796F70ABa57132b1); preICOBalances[0x2712ba56cB3Cf8783693c8a1796F70ABa57132b1] = 15000000000000000000000; preICOFunders.push(0x6f3DDfb726eA637e125C4fbf6694B940711478f4); preICOBalances[0x6f3DDfb726eA637e125C4fbf6694B940711478f4] = 15000000000000000000000; preICOFunders.push(0xAf7Ff6f381684707001d517Bf83C4a3538f9C82a); preICOBalances[0xAf7Ff6f381684707001d517Bf83C4a3538f9C82a] = 22548265874120000000000; preICOFunders.push(0x51219a9330c196b8bd7fA0737C8e0db53c1ad628); preICOBalances[0x51219a9330c196b8bd7fA0737C8e0db53c1ad628] = 32145215844400000000000; preICOFunders.push(0xA2D42D689769f7BA32712f27B09606fFD8F3b699); preICOBalances[0xA2D42D689769f7BA32712f27B09606fFD8F3b699] = 15000000000000000000000; preICOFunders.push(0xB7C9D3AAbF44296232538B8b184F274B57003994); preICOBalances[0xB7C9D3AAbF44296232538B8b184F274B57003994] = 20000000000000000000000; preICOFunders.push(0x58667a170F53b809CA9143c1CeEa00D2Df866577); preICOBalances[0x58667a170F53b809CA9143c1CeEa00D2Df866577] = 184526257787000000000000; preICOFunders.push(0x0D4b2A1a47b1059d622C033c2a58F2F651010553); preICOBalances[0x0D4b2A1a47b1059d622C033c2a58F2F651010553] = 17845264771100000000000; preICOFunders.push(0x982F59497026473d2227f5dd02cdf6fdCF237AE0); preICOBalances[0x982F59497026473d2227f5dd02cdf6fdCF237AE0] = 31358989521120000000000; preICOFunders.push(0x250d540EFeabA7b5C0407A955Fd76217590dbc37); preICOBalances[0x250d540EFeabA7b5C0407A955Fd76217590dbc37] = 15000000000000000000000; preICOFunders.push(0x2Cde7768B7d5dcb12c5b5572daEf3F7B855c8685); preICOBalances[0x2Cde7768B7d5dcb12c5b5572daEf3F7B855c8685] = 17500000000000000000000; preICOFunders.push(0x89777c2a4C1843a99B2fF481a4CEF67f5d7A1387); preICOBalances[0x89777c2a4C1843a99B2fF481a4CEF67f5d7A1387] = 15000000000000000000000; preICOFunders.push(0x63699D4d309e48e8B575BE771700570A828dC655); preICOBalances[0x63699D4d309e48e8B575BE771700570A828dC655] = 15000000000000000000000; preICOFunders.push(0x9bc92E0da2e4aC174b8E33D7c74b5009563a8e2A); preICOBalances[0x9bc92E0da2e4aC174b8E33D7c74b5009563a8e2A] = 21542365440880000000000; preICOFunders.push(0xA1CA632CF8Fb3a965c84668e09e3BEdb3567F35D); preICOBalances[0xA1CA632CF8Fb3a965c84668e09e3BEdb3567F35D] = 15000000000000000000000; preICOFunders.push(0x1DCeF74ddD26c82f34B300E027b5CaA4eC4F8C83); preICOBalances[0x1DCeF74ddD26c82f34B300E027b5CaA4eC4F8C83] = 15000000000000000000000; preICOFunders.push(0x51B7Bf4B7C1E89cfe7C09938Ad0096F9dFFCA4B7); preICOBalances[0x51B7Bf4B7C1E89cfe7C09938Ad0096F9dFFCA4B7] = 17533640761380000000000; // pre sale round 2 preICOFunders.push(0xD2Cdc0905877ee3b7d08220D783bd042de825AEb); preICOBalances[0xD2Cdc0905877ee3b7d08220D783bd042de825AEb] = 5000000000000000000000; preICOFunders.push(0x3b217081702AF670e2c2fD25FD7da882620a68E8); preICOBalances[0x3b217081702AF670e2c2fD25FD7da882620a68E8] = 7415245400000000000000; preICOFunders.push(0xbA860D4B9423bF6b517B29c395A49fe80Da758E3); preICOBalances[0xbA860D4B9423bF6b517B29c395A49fe80Da758E3] = 5000000000000000000000; preICOFunders.push(0xF64b80DdfB860C0D1bEb760fd9fC663c4D5C4dC3); preICOBalances[0xF64b80DdfB860C0D1bEb760fd9fC663c4D5C4dC3] = 75000000000000000000000; preICOFunders.push(0x396D5A35B5f41D7cafCCF9BeF225c274d2c7B6E2); preICOBalances[0x396D5A35B5f41D7cafCCF9BeF225c274d2c7B6E2] = 74589245777000000000000; preICOFunders.push(0x4d61A4aD175E96139Ae8c5d951327e3f6Cc3f764); preICOBalances[0x4d61A4aD175E96139Ae8c5d951327e3f6Cc3f764] = 5000000000000000000000; preICOFunders.push(0x4B490F6A49C17657A5508B8Bf8F1D7f5aAD8c921); preICOBalances[0x4B490F6A49C17657A5508B8Bf8F1D7f5aAD8c921] = 200000000000000000000000; preICOFunders.push(0xC943038f2f1dd1faC6E10B82039C14bd20ff1F8E); preICOBalances[0xC943038f2f1dd1faC6E10B82039C14bd20ff1F8E] = 174522545811300000000000; preICOFunders.push(0xBa87D63A8C4Ed665b6881BaCe4A225a07c418F22); preICOBalances[0xBa87D63A8C4Ed665b6881BaCe4A225a07c418F22] = 5000000000000000000000; preICOFunders.push(0x753846c0467cF320BcDA9f1C67fF86dF39b1438c); preICOBalances[0x753846c0467cF320BcDA9f1C67fF86dF39b1438c] = 5000000000000000000000; preICOFunders.push(0x3773bBB1adDF9D642D5bbFaafa13b0690Fb33460); preICOBalances[0x3773bBB1adDF9D642D5bbFaafa13b0690Fb33460] = 5000000000000000000000; preICOFunders.push(0x456Cf70345cbF483779166af117B40938B8F0A9c); preICOBalances[0x456Cf70345cbF483779166af117B40938B8F0A9c] = 50000000000000000000000; preICOFunders.push(0x662AE260D736F041Db66c34617d5fB22eC0cC2Ee); preICOBalances[0x662AE260D736F041Db66c34617d5fB22eC0cC2Ee] = 40000000000000000000000; preICOFunders.push(0xEa7e647F167AdAa4df52AF630A873a1379f68E3F); preICOBalances[0xEa7e647F167AdAa4df52AF630A873a1379f68E3F] = 40000000000000000000000; preICOFunders.push(0x352913f3F7CA96530180b93C18C86f38b3F0c429); preICOBalances[0x352913f3F7CA96530180b93C18C86f38b3F0c429] = 45458265454000000000000; preICOFunders.push(0xB21bf8391a6500ED210Af96d125867124261f4d4); preICOBalances[0xB21bf8391a6500ED210Af96d125867124261f4d4] = 5000000000000000000000; preICOFunders.push(0xDecBd29B42c66f90679D2CB34e73E571F447f6c5); preICOBalances[0xDecBd29B42c66f90679D2CB34e73E571F447f6c5] = 7500000000000000000000; preICOFunders.push(0xE36106a0DC0F07e87f7194694631511317909b8B); preICOBalances[0xE36106a0DC0F07e87f7194694631511317909b8B] = 5000000000000000000000; preICOFunders.push(0xe9114cd97E0Ee4fe349D3F57d0C9710E18581b69); preICOBalances[0xe9114cd97E0Ee4fe349D3F57d0C9710E18581b69] = 40000000000000000000000; preICOFunders.push(0xC73996ce45752B9AE4e85EDDf056Aa9aaCaAD4A2); preICOBalances[0xC73996ce45752B9AE4e85EDDf056Aa9aaCaAD4A2] = 100000000000000000000000; preICOFunders.push(0x6C1407d9984Dc2cE33456b67acAaEC78c1784673); preICOBalances[0x6C1407d9984Dc2cE33456b67acAaEC78c1784673] = 5000000000000000000000; preICOFunders.push(0x987e93429004CA9fa2A42604658B99Bb5A574f01); preICOBalances[0x987e93429004CA9fa2A42604658B99Bb5A574f01] = 124354548881022000000000; preICOFunders.push(0x4c3B81B5f9f9c7efa03bE39218E6760E8D2A1609); preICOBalances[0x4c3B81B5f9f9c7efa03bE39218E6760E8D2A1609] = 5000000000000000000000; preICOFunders.push(0x33fA8cd89B151458Cb147ecC497e469f2c1D38eA); preICOBalances[0x33fA8cd89B151458Cb147ecC497e469f2c1D38eA] = 60000000000000000000000; // main sale (01-31 of Marh) preICOFunders.push(0x9AfA1204afCf48AB4302F246Ef4BE5C1D733a751); preICOBalances[0x9AfA1204afCf48AB4302F246Ef4BE5C1D733a751] = 154551417972192330000000; } /** * @dev Add a new address to the funders * @param _funder funder's address */ function addFunder(address _funder) public onlyOwner { if (!funded[_funder]) { funders.push(_funder); funded[_funder] = true; } } /** * @return true if address is a funder address * @param _funder funder's address */ function isFunder(address _funder) public view returns(bool) { return funded[_funder]; } /** * @return funders count */ function getFundersCount() public view returns(uint256) { return funders.length; } /** * @return number of preICO funders count */ function getPreICOFundersCount() public view returns(uint256) { return preICOFunders.length; } /** * @dev Add a new oraclize funding order * @param _orderId oraclize order id * @param _beneficiary who'll get the tokens * @param _funds paid wei amount * @param _bonus bonus amount */ function addOrder( bytes32 _orderId, address _beneficiary, uint256 _funds, uint256 _bonus ) public onlyOwner { orders[_orderId].beneficiary = _beneficiary; orders[_orderId].funds = _funds; orders[_orderId].bonus = _bonus; } /** * @dev Get oraclize funding order by order id * @param _orderId oraclize order id * @return beneficiaty address, paid funds amount and bonus amount */ function getOrder(bytes32 _orderId) public view returns(address, uint256, uint256) { address _beneficiary = orders[_orderId].beneficiary; uint256 _funds = orders[_orderId].funds; uint256 _bonus = orders[_orderId].bonus; return (_beneficiary, _funds, _bonus); } /** * @dev Set eth/usd rate for the specified oraclize order * @param _orderId oraclize order id * @param _rate eth/usd rate */ function setRateForOrder(bytes32 _orderId, uint256 _rate) public onlyOwner { orders[_orderId].rate = _rate; } /** * @dev Add a new oraclize unsold tokens allocation order * @param _orderId oraclize order id */ function addUnsoldAllocationOrder(bytes32 _orderId) public onlyOwner { unsoldAllocationOrders[_orderId] = true; } /** * @dev Whitelist the address * @param _address address to be whitelisted */ function addToWhitelist(address _address) public onlyOwner { whitelist[_address] = true; } /** * @dev Check if address is whitelisted * @param _address address that needs to be verified * @return true if address is whitelisted */ function isWhitelisted(address _address) public view returns(bool) { return whitelist[_address]; } /** * @dev Get bonus amount for token purchase * @param _funds amount of the funds * @param _bonusChangeTime bonus change time * @return corresponding bonus value */ function getBonus(uint256 _funds, uint256 _bonusChangeTime) public view returns(uint256) { if (_funds < VOLUME_BONUS_CONDITION) return 0; if (now < _bonusChangeTime) { // solium-disable-line security/no-block-members if (_funds >= VOLUME_EXTRA_BONUS_CONDITION) return FIRST_VOLUME_EXTRA_BONUS; else return FIRST_VOLUME_BONUS; } else { if (_funds >= VOLUME_EXTRA_BONUS_CONDITION) return SECOND_VOLUME_EXTRA_BONUS; else return SECOND_VOLUME_BONUS; } return 0; } }
contract BetexStorage is Ownable { // minimum funding to get volume bonus uint256 public constant VOLUME_BONUS_CONDITION = 50 ether; // minimum funding to get volume extra bonus uint256 public constant VOLUME_EXTRA_BONUS_CONDITION = 100 ether; // extra bonus amount during first bonus round, % uint256 public constant FIRST_VOLUME_EXTRA_BONUS = 20; // extra bonus amount during second bonus round, % uint256 public constant SECOND_VOLUME_EXTRA_BONUS = 10; // bonus amount during first bonus round, % uint256 public constant FIRST_VOLUME_BONUS = 10; // bonus amount during second bonus round, % uint256 public constant SECOND_VOLUME_BONUS = 5; // oraclize funding order struct Order { address beneficiary; uint256 funds; uint256 bonus; uint256 rate; } // oraclize funding orders mapping (bytes32 => Order) public orders; // oraclize orders for unsold tokens allocation mapping (bytes32 => bool) public unsoldAllocationOrders; // addresses allowed to buy tokens mapping (address => bool) public whitelist; // funded mapping (address => bool) public funded; // funders address[] public funders; // pre ico funders address[] public preICOFunders; // tokens to allocate before ico sale starts mapping (address => uint256) public preICOBalances; // is preICO data initialized bool public preICODataInitialized; /** * @dev Constructor */ function BetexStorage() public { // pre sale round 1 preICOFunders.push(0x233Fd2B3d7a0924Fe1Bb0dd7FA168eEF8C522E65); preICOBalances[0x233Fd2B3d7a0924Fe1Bb0dd7FA168eEF8C522E65] = 15000000000000000000000; preICOFunders.push(0x2712ba56cB3Cf8783693c8a1796F70ABa57132b1); preICOBalances[0x2712ba56cB3Cf8783693c8a1796F70ABa57132b1] = 15000000000000000000000; preICOFunders.push(0x6f3DDfb726eA637e125C4fbf6694B940711478f4); preICOBalances[0x6f3DDfb726eA637e125C4fbf6694B940711478f4] = 15000000000000000000000; preICOFunders.push(0xAf7Ff6f381684707001d517Bf83C4a3538f9C82a); preICOBalances[0xAf7Ff6f381684707001d517Bf83C4a3538f9C82a] = 22548265874120000000000; preICOFunders.push(0x51219a9330c196b8bd7fA0737C8e0db53c1ad628); preICOBalances[0x51219a9330c196b8bd7fA0737C8e0db53c1ad628] = 32145215844400000000000; preICOFunders.push(0xA2D42D689769f7BA32712f27B09606fFD8F3b699); preICOBalances[0xA2D42D689769f7BA32712f27B09606fFD8F3b699] = 15000000000000000000000; preICOFunders.push(0xB7C9D3AAbF44296232538B8b184F274B57003994); preICOBalances[0xB7C9D3AAbF44296232538B8b184F274B57003994] = 20000000000000000000000; preICOFunders.push(0x58667a170F53b809CA9143c1CeEa00D2Df866577); preICOBalances[0x58667a170F53b809CA9143c1CeEa00D2Df866577] = 184526257787000000000000; preICOFunders.push(0x0D4b2A1a47b1059d622C033c2a58F2F651010553); preICOBalances[0x0D4b2A1a47b1059d622C033c2a58F2F651010553] = 17845264771100000000000; preICOFunders.push(0x982F59497026473d2227f5dd02cdf6fdCF237AE0); preICOBalances[0x982F59497026473d2227f5dd02cdf6fdCF237AE0] = 31358989521120000000000; preICOFunders.push(0x250d540EFeabA7b5C0407A955Fd76217590dbc37); preICOBalances[0x250d540EFeabA7b5C0407A955Fd76217590dbc37] = 15000000000000000000000; preICOFunders.push(0x2Cde7768B7d5dcb12c5b5572daEf3F7B855c8685); preICOBalances[0x2Cde7768B7d5dcb12c5b5572daEf3F7B855c8685] = 17500000000000000000000; preICOFunders.push(0x89777c2a4C1843a99B2fF481a4CEF67f5d7A1387); preICOBalances[0x89777c2a4C1843a99B2fF481a4CEF67f5d7A1387] = 15000000000000000000000; preICOFunders.push(0x63699D4d309e48e8B575BE771700570A828dC655); preICOBalances[0x63699D4d309e48e8B575BE771700570A828dC655] = 15000000000000000000000; preICOFunders.push(0x9bc92E0da2e4aC174b8E33D7c74b5009563a8e2A); preICOBalances[0x9bc92E0da2e4aC174b8E33D7c74b5009563a8e2A] = 21542365440880000000000; preICOFunders.push(0xA1CA632CF8Fb3a965c84668e09e3BEdb3567F35D); preICOBalances[0xA1CA632CF8Fb3a965c84668e09e3BEdb3567F35D] = 15000000000000000000000; preICOFunders.push(0x1DCeF74ddD26c82f34B300E027b5CaA4eC4F8C83); preICOBalances[0x1DCeF74ddD26c82f34B300E027b5CaA4eC4F8C83] = 15000000000000000000000; preICOFunders.push(0x51B7Bf4B7C1E89cfe7C09938Ad0096F9dFFCA4B7); preICOBalances[0x51B7Bf4B7C1E89cfe7C09938Ad0096F9dFFCA4B7] = 17533640761380000000000; // pre sale round 2 preICOFunders.push(0xD2Cdc0905877ee3b7d08220D783bd042de825AEb); preICOBalances[0xD2Cdc0905877ee3b7d08220D783bd042de825AEb] = 5000000000000000000000; preICOFunders.push(0x3b217081702AF670e2c2fD25FD7da882620a68E8); preICOBalances[0x3b217081702AF670e2c2fD25FD7da882620a68E8] = 7415245400000000000000; preICOFunders.push(0xbA860D4B9423bF6b517B29c395A49fe80Da758E3); preICOBalances[0xbA860D4B9423bF6b517B29c395A49fe80Da758E3] = 5000000000000000000000; preICOFunders.push(0xF64b80DdfB860C0D1bEb760fd9fC663c4D5C4dC3); preICOBalances[0xF64b80DdfB860C0D1bEb760fd9fC663c4D5C4dC3] = 75000000000000000000000; preICOFunders.push(0x396D5A35B5f41D7cafCCF9BeF225c274d2c7B6E2); preICOBalances[0x396D5A35B5f41D7cafCCF9BeF225c274d2c7B6E2] = 74589245777000000000000; preICOFunders.push(0x4d61A4aD175E96139Ae8c5d951327e3f6Cc3f764); preICOBalances[0x4d61A4aD175E96139Ae8c5d951327e3f6Cc3f764] = 5000000000000000000000; preICOFunders.push(0x4B490F6A49C17657A5508B8Bf8F1D7f5aAD8c921); preICOBalances[0x4B490F6A49C17657A5508B8Bf8F1D7f5aAD8c921] = 200000000000000000000000; preICOFunders.push(0xC943038f2f1dd1faC6E10B82039C14bd20ff1F8E); preICOBalances[0xC943038f2f1dd1faC6E10B82039C14bd20ff1F8E] = 174522545811300000000000; preICOFunders.push(0xBa87D63A8C4Ed665b6881BaCe4A225a07c418F22); preICOBalances[0xBa87D63A8C4Ed665b6881BaCe4A225a07c418F22] = 5000000000000000000000; preICOFunders.push(0x753846c0467cF320BcDA9f1C67fF86dF39b1438c); preICOBalances[0x753846c0467cF320BcDA9f1C67fF86dF39b1438c] = 5000000000000000000000; preICOFunders.push(0x3773bBB1adDF9D642D5bbFaafa13b0690Fb33460); preICOBalances[0x3773bBB1adDF9D642D5bbFaafa13b0690Fb33460] = 5000000000000000000000; preICOFunders.push(0x456Cf70345cbF483779166af117B40938B8F0A9c); preICOBalances[0x456Cf70345cbF483779166af117B40938B8F0A9c] = 50000000000000000000000; preICOFunders.push(0x662AE260D736F041Db66c34617d5fB22eC0cC2Ee); preICOBalances[0x662AE260D736F041Db66c34617d5fB22eC0cC2Ee] = 40000000000000000000000; preICOFunders.push(0xEa7e647F167AdAa4df52AF630A873a1379f68E3F); preICOBalances[0xEa7e647F167AdAa4df52AF630A873a1379f68E3F] = 40000000000000000000000; preICOFunders.push(0x352913f3F7CA96530180b93C18C86f38b3F0c429); preICOBalances[0x352913f3F7CA96530180b93C18C86f38b3F0c429] = 45458265454000000000000; preICOFunders.push(0xB21bf8391a6500ED210Af96d125867124261f4d4); preICOBalances[0xB21bf8391a6500ED210Af96d125867124261f4d4] = 5000000000000000000000; preICOFunders.push(0xDecBd29B42c66f90679D2CB34e73E571F447f6c5); preICOBalances[0xDecBd29B42c66f90679D2CB34e73E571F447f6c5] = 7500000000000000000000; preICOFunders.push(0xE36106a0DC0F07e87f7194694631511317909b8B); preICOBalances[0xE36106a0DC0F07e87f7194694631511317909b8B] = 5000000000000000000000; preICOFunders.push(0xe9114cd97E0Ee4fe349D3F57d0C9710E18581b69); preICOBalances[0xe9114cd97E0Ee4fe349D3F57d0C9710E18581b69] = 40000000000000000000000; preICOFunders.push(0xC73996ce45752B9AE4e85EDDf056Aa9aaCaAD4A2); preICOBalances[0xC73996ce45752B9AE4e85EDDf056Aa9aaCaAD4A2] = 100000000000000000000000; preICOFunders.push(0x6C1407d9984Dc2cE33456b67acAaEC78c1784673); preICOBalances[0x6C1407d9984Dc2cE33456b67acAaEC78c1784673] = 5000000000000000000000; preICOFunders.push(0x987e93429004CA9fa2A42604658B99Bb5A574f01); preICOBalances[0x987e93429004CA9fa2A42604658B99Bb5A574f01] = 124354548881022000000000; preICOFunders.push(0x4c3B81B5f9f9c7efa03bE39218E6760E8D2A1609); preICOBalances[0x4c3B81B5f9f9c7efa03bE39218E6760E8D2A1609] = 5000000000000000000000; preICOFunders.push(0x33fA8cd89B151458Cb147ecC497e469f2c1D38eA); preICOBalances[0x33fA8cd89B151458Cb147ecC497e469f2c1D38eA] = 60000000000000000000000; // main sale (01-31 of Marh) preICOFunders.push(0x9AfA1204afCf48AB4302F246Ef4BE5C1D733a751); preICOBalances[0x9AfA1204afCf48AB4302F246Ef4BE5C1D733a751] = 154551417972192330000000; } /** * @dev Add a new address to the funders * @param _funder funder's address */ function addFunder(address _funder) public onlyOwner { if (!funded[_funder]) { funders.push(_funder); funded[_funder] = true; } } /** * @return true if address is a funder address * @param _funder funder's address */ function isFunder(address _funder) public view returns(bool) { return funded[_funder]; } /** * @return funders count */ function getFundersCount() public view returns(uint256) { return funders.length; } /** * @return number of preICO funders count */ function getPreICOFundersCount() public view returns(uint256) { return preICOFunders.length; } /** * @dev Add a new oraclize funding order * @param _orderId oraclize order id * @param _beneficiary who'll get the tokens * @param _funds paid wei amount * @param _bonus bonus amount */ function addOrder( bytes32 _orderId, address _beneficiary, uint256 _funds, uint256 _bonus ) public onlyOwner { orders[_orderId].beneficiary = _beneficiary; orders[_orderId].funds = _funds; orders[_orderId].bonus = _bonus; } /** * @dev Get oraclize funding order by order id * @param _orderId oraclize order id * @return beneficiaty address, paid funds amount and bonus amount */ function getOrder(bytes32 _orderId) public view returns(address, uint256, uint256) { address _beneficiary = orders[_orderId].beneficiary; uint256 _funds = orders[_orderId].funds; uint256 _bonus = orders[_orderId].bonus; return (_beneficiary, _funds, _bonus); } /** * @dev Set eth/usd rate for the specified oraclize order * @param _orderId oraclize order id * @param _rate eth/usd rate */ function setRateForOrder(bytes32 _orderId, uint256 _rate) public onlyOwner { orders[_orderId].rate = _rate; } /** * @dev Add a new oraclize unsold tokens allocation order * @param _orderId oraclize order id */ function addUnsoldAllocationOrder(bytes32 _orderId) public onlyOwner { unsoldAllocationOrders[_orderId] = true; } /** * @dev Whitelist the address * @param _address address to be whitelisted */ function addToWhitelist(address _address) public onlyOwner { whitelist[_address] = true; } /** * @dev Check if address is whitelisted * @param _address address that needs to be verified * @return true if address is whitelisted */ function isWhitelisted(address _address) public view returns(bool) { return whitelist[_address]; } /** * @dev Get bonus amount for token purchase * @param _funds amount of the funds * @param _bonusChangeTime bonus change time * @return corresponding bonus value */ function getBonus(uint256 _funds, uint256 _bonusChangeTime) public view returns(uint256) { if (_funds < VOLUME_BONUS_CONDITION) return 0; if (now < _bonusChangeTime) { // solium-disable-line security/no-block-members if (_funds >= VOLUME_EXTRA_BONUS_CONDITION) return FIRST_VOLUME_EXTRA_BONUS; else return FIRST_VOLUME_BONUS; } else { if (_funds >= VOLUME_EXTRA_BONUS_CONDITION) return SECOND_VOLUME_EXTRA_BONUS; else return SECOND_VOLUME_BONUS; } return 0; } }
24,211
160
// burn owned tokens amount the amount of tokens to burn /
function burn(uint amount) external { _burn(msg.sender, amount); }
function burn(uint amount) external { _burn(msg.sender, amount); }
54,921
11
// create pair This:ETH
swapV2Pair = factory.createPair(address(this), router.WETH()); excludeFromMaxTrading(address(swapV2Pair), true); _setAutomatedMarketMakerPair(address(swapV2Pair), true);
swapV2Pair = factory.createPair(address(this), router.WETH()); excludeFromMaxTrading(address(swapV2Pair), true); _setAutomatedMarketMakerPair(address(swapV2Pair), true);
820
20
// Allows the pendingAdmin address to finalize the change admin process. /
function claimAdmin() public { require(pendingAdmin == msg.sender); AdminClaimed(pendingAdmin, admin); admin = pendingAdmin; pendingAdmin = address(0); }
function claimAdmin() public { require(pendingAdmin == msg.sender); AdminClaimed(pendingAdmin, admin); admin = pendingAdmin; pendingAdmin = address(0); }
236
6
// Max fee rates can't over then 1%
uint256 public constant maxLiquidateFeeRate = FEE_COEFFICIENT / 100; uint256 public constant maxLiquidateMXPFeeRate = FEE_COEFFICIENT / 100;
uint256 public constant maxLiquidateFeeRate = FEE_COEFFICIENT / 100; uint256 public constant maxLiquidateMXPFeeRate = FEE_COEFFICIENT / 100;
25,281
170
// This token will decrease in the vault, so transfer from vault to proposer. (Transfer out of vault: round down)
uint256 transferAmount =_weighted( trustedRSV.totalSupply(), oldWeight.sub(newWeight), RoundingMode.DOWN );
uint256 transferAmount =_weighted( trustedRSV.totalSupply(), oldWeight.sub(newWeight), RoundingMode.DOWN );
30,501
13
// Integer division of two numbers truncating the quotient, reverts on division by zero./
function div(uint256 a, uint256 b) internal pure returns (uint256) { require(b > 0); // Solidity only automatically asserts when dividing by 0 uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; }
function div(uint256 a, uint256 b) internal pure returns (uint256) { require(b > 0); // Solidity only automatically asserts when dividing by 0 uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; }
17,591
3
// Returns the amount of ether in wei that are equivalent to 1 unit (10decimals) of asset asset quoted currencyreturn price in ether /
function getAssetToEthRate(address asset) public view returns (uint) { if (asset == ETH || asset == stETH) { return 1 ether; } address aggregatorAddress = aggregators[asset]; if (aggregatorAddress == address(0)) { revert("PriceFeedOracle: Oracle asset not found"); } int rate = Aggregator(aggregatorAddress).latestAnswer(); require(rate > 0, "PriceFeedOracle: Rate must be > 0"); return uint(rate); }
function getAssetToEthRate(address asset) public view returns (uint) { if (asset == ETH || asset == stETH) { return 1 ether; } address aggregatorAddress = aggregators[asset]; if (aggregatorAddress == address(0)) { revert("PriceFeedOracle: Oracle asset not found"); } int rate = Aggregator(aggregatorAddress).latestAnswer(); require(rate > 0, "PriceFeedOracle: Rate must be > 0"); return uint(rate); }
81,963
76
// update last selector slot position info
ds.facets[lastSelector] = (oldFacet & CLEAR_ADDRESS_MASK) | bytes20(ds.facets[lastSelector]);
ds.facets[lastSelector] = (oldFacet & CLEAR_ADDRESS_MASK) | bytes20(ds.facets[lastSelector]);
40,974
5
// payment token
IERC20 internal immutable dai = IERC20(0x6B175474E89094C44Da98b954EedeAC495271d0F);
IERC20 internal immutable dai = IERC20(0x6B175474E89094C44Da98b954EedeAC495271d0F);
5,125
115
// Check bid amount
require(isGreaterBid(_token,_tokenid,_value),"check bid amount failed");
require(isGreaterBid(_token,_tokenid,_value),"check bid amount failed");
14,486
2
// adds inamount to paymentBalance, so that tokens given to contract, but not fulfilled, can be refunded/
external payable{ require(msg.value == flatcost, 'invalid payment'); currentid++; paymentBalance[currentid] += flatcost; requester[currentid] = msg.sender; inaddress[currentid] = intoken; outaddress[currentid] = outtoken; inamt[currentid] = inamount; outamt[currentid] = outamount; deadline[currentid] = expiretime; outexact[currentid] = true; ERC20 it = ERC20(intoken); it.transferFrom(msg.sender, address(this), inamount); //transfer tokens from user to this emit Requested(currentid, msg.sender, intoken, outtoken, inamt[currentid], outamt[currentid], expiretime, outexact[currentid]); }
external payable{ require(msg.value == flatcost, 'invalid payment'); currentid++; paymentBalance[currentid] += flatcost; requester[currentid] = msg.sender; inaddress[currentid] = intoken; outaddress[currentid] = outtoken; inamt[currentid] = inamount; outamt[currentid] = outamount; deadline[currentid] = expiretime; outexact[currentid] = true; ERC20 it = ERC20(intoken); it.transferFrom(msg.sender, address(this), inamount); //transfer tokens from user to this emit Requested(currentid, msg.sender, intoken, outtoken, inamt[currentid], outamt[currentid], expiretime, outexact[currentid]); }
26,725
40
// Must be higher than total pooled DAI
if (cap < _getTotalPooledDai()) { revert LSDai__DepositCapLowerThanTotalPooledDai(); }
if (cap < _getTotalPooledDai()) { revert LSDai__DepositCapLowerThanTotalPooledDai(); }
2,729
300
// Instantiate a new memory view. This should generally not be called directly. Prefer `ref` wherever possible. Instantiate a new memory view. This should generally not be called directly. Prefer `ref` wherever possible. _type The type _locThe memory address _lenThe lengthreturnnewView - The new view with the specified type, location and length /
function build(uint256 _type, uint256 _loc, uint256 _len) internal pure returns (bytes29 newView) { uint256 _end = _loc.add(_len); assembly { // solium-disable-previous-line security/no-inline-assembly if gt(_end, mload(0x40)) { _end := 0 } } if (_end == 0) { return NULL; } newView = unsafeBuildUnchecked(_type, _loc, _len); }
function build(uint256 _type, uint256 _loc, uint256 _len) internal pure returns (bytes29 newView) { uint256 _end = _loc.add(_len); assembly { // solium-disable-previous-line security/no-inline-assembly if gt(_end, mload(0x40)) { _end := 0 } } if (_end == 0) { return NULL; } newView = unsafeBuildUnchecked(_type, _loc, _len); }
21,568
171
// Withdraw LP tokens from MasterChef.
function withdraw(uint256 _pid, uint256 _amount) public { PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][msg.sender]; require(user.amount >= _amount, "withdraw: not good"); updatePool(_pid); uint256 pending = user.amount.mul(pool.accPicklePerShare).div(1e12).sub( user.rewardDebt ); safePickleTransfer(msg.sender, pending); user.amount = user.amount.sub(_amount); user.rewardDebt = user.amount.mul(pool.accPicklePerShare).div(1e12); pool.lpToken.safeTransfer(address(msg.sender), _amount); emit Withdraw(msg.sender, _pid, _amount); }
function withdraw(uint256 _pid, uint256 _amount) public { PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][msg.sender]; require(user.amount >= _amount, "withdraw: not good"); updatePool(_pid); uint256 pending = user.amount.mul(pool.accPicklePerShare).div(1e12).sub( user.rewardDebt ); safePickleTransfer(msg.sender, pending); user.amount = user.amount.sub(_amount); user.rewardDebt = user.amount.mul(pool.accPicklePerShare).div(1e12); pool.lpToken.safeTransfer(address(msg.sender), _amount); emit Withdraw(msg.sender, _pid, _amount); }
1,318
105
// recalculate amount & pool
_amount = _amount.mul(multiple); _pool = _pool - _amount; if (totalSupply() == 0) { shares = _amount; } else {
_amount = _amount.mul(multiple); _pool = _pool - _amount; if (totalSupply() == 0) { shares = _amount; } else {
15,340
90
// To prevent `fulfill` / `cancel` from being called multiple times, the preparedBlockNumber is set to 0 before being hashed. The value of the mapping is explicitly not zeroed out so users who come online without a store can tell the difference between a transaction that has not been prepared, and a transaction that was already completed on the receiver chain.
variantTransactionData[digest] = hashVariantTransactionData(txData.amount, txData.expiry, 0);
variantTransactionData[digest] = hashVariantTransactionData(txData.amount, txData.expiry, 0);
33,358
13
// Returns the amount of tokens that was unlocked for the/ recipient to date. Includes both withdrawn and non-withdrawn tokens./recipient Address of the recipient/ return unlocked Amount of tokens unlocked for the recipient
function getUnlocked(address recipient) private view returns (uint256 unlocked)
function getUnlocked(address recipient) private view returns (uint256 unlocked)
29,779
17
// Moderated restricts execution of 'onlyModerator' modified functions to the contract moderator restricts execution of 'ifUnrestricted' modified functions to when unrestrictedboolean state is true allows for the extraction of ether or other ERC20 tokens mistakenly sent to this address /
contract Moderated { address public moderator; bool public unrestricted; modifier onlyModerator { require(msg.sender == moderator); _; } modifier ifUnrestricted { require(unrestricted); _; } modifier onlyPayloadSize(uint256 numWords) { assert(msg.data.length >= numWords * 32 + 4); _; } function Moderated() public { moderator = msg.sender; unrestricted = true; } function reassignModerator(address newModerator) public onlyModerator { moderator = newModerator; } function restrict() public onlyModerator { unrestricted = false; } function unrestrict() public onlyModerator { unrestricted = true; } /// This method can be used to extract tokens mistakenly sent to this contract. /// @param _token The address of the token contract that you want to recover function extract(address _token) public returns (bool) { require(_token != address(0x0)); Token token = Token(_token); uint256 balance = token.balanceOf(this); return token.transfer(moderator, balance); } function isContract(address _addr) internal view returns (bool) { uint256 size; assembly { size := extcodesize(_addr) } return (size > 0); } }
contract Moderated { address public moderator; bool public unrestricted; modifier onlyModerator { require(msg.sender == moderator); _; } modifier ifUnrestricted { require(unrestricted); _; } modifier onlyPayloadSize(uint256 numWords) { assert(msg.data.length >= numWords * 32 + 4); _; } function Moderated() public { moderator = msg.sender; unrestricted = true; } function reassignModerator(address newModerator) public onlyModerator { moderator = newModerator; } function restrict() public onlyModerator { unrestricted = false; } function unrestrict() public onlyModerator { unrestricted = true; } /// This method can be used to extract tokens mistakenly sent to this contract. /// @param _token The address of the token contract that you want to recover function extract(address _token) public returns (bool) { require(_token != address(0x0)); Token token = Token(_token); uint256 balance = token.balanceOf(this); return token.transfer(moderator, balance); } function isContract(address _addr) internal view returns (bool) { uint256 size; assembly { size := extcodesize(_addr) } return (size > 0); } }
55,497
8
// event EmergencyWithdraw(address indexed user, uint256 indexed pid, uint256 amount);
constructor( uint256 _dmmPerBlock, uint256 _startBlock, int256 _startState, int256 _minState, int256 _maxState, uint256 _minPastBlockActivate, uint256 _activateReward
constructor( uint256 _dmmPerBlock, uint256 _startBlock, int256 _startState, int256 _minState, int256 _maxState, uint256 _minPastBlockActivate, uint256 _activateReward
34,466