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
28
// --------------------------- Withdrawal -------------------------- // Reverts when attempting to withdraw funds to a disallowed address /
error WithdrawRecipientInvalid();
error WithdrawRecipientInvalid();
15,114
23
// Increment the staker's amount staked
staker.amountStaked++;
staker.amountStaked++;
26,773
30
// Apply fill fraction to get offer item amount to transfer.
uint256 amount = _applyFraction( offerItem.startAmount, offerItem.endAmount, numerator, denominator, startTime, endTime, false );
uint256 amount = _applyFraction( offerItem.startAmount, offerItem.endAmount, numerator, denominator, startTime, endTime, false );
33,520
79
// Move the cash from the contract's cash balances account to the sender. This must happen before the call to insert the trade below in order for the free collateral check to work properly.
Escrow().withdrawFromMarket(account, CASH_GROUP, cash, fee);
Escrow().withdrawFromMarket(account, CASH_GROUP, cash, fee);
32,551
27
// Burn the canonical tokens
super._burn(msg.sender, token_amount);
super._burn(msg.sender, token_amount);
57,924
140
// debt ratio in same terms as reserve bonds return uint /
function standardizedDebtRatio() external view returns ( uint ) { return debtRatio().mul( uint( assetPrice() ) ).div( 1e8 ); // ETH feed is 8 decimals }
function standardizedDebtRatio() external view returns ( uint ) { return debtRatio().mul( uint( assetPrice() ) ).div( 1e8 ); // ETH feed is 8 decimals }
27,625
117
// Reverts if the auction is not complete. Auction is complete if there was a bid, and the time has run out.
modifier auctionComplete(uint256 tokenId) { require( // Auction is complete if there has been a bid, and the current time // is greater than the auction's end time. auctions[tokenId].firstBidTime > 0 && block.timestamp >= auctionEnds(tokenId), "Auction hasn't completed" ); _; }
modifier auctionComplete(uint256 tokenId) { require( // Auction is complete if there has been a bid, and the current time // is greater than the auction's end time. auctions[tokenId].firstBidTime > 0 && block.timestamp >= auctionEnds(tokenId), "Auction hasn't completed" ); _; }
25,357
351
// ManateezComic Extends ERC721 Non-Fungible Token Standard basic implementation /
contract ManateezComic is ERC721, Ownable { using SafeMath for uint256; uint256 public COMIC_PRICE = 0.01 ether; uint256 public TEAM_TOKEN_COUNT = 0; uint256 public constant TEAM_TOKEN_MAX = 500; uint256 public constant MAX_COMICS = 5000; uint256 constant public BASE_RATE = 5 ether; uint256 constant public INITIAL_ISSUANCE = 100 ether; bool public isLive = false; // 12/31/2031 @11:59:59 EST uint256 constant public END = 1956545999; mapping(address => uint256) public rewards; mapping(address => uint256) public lastUpdate; mapping(address => uint256) public userBalance; AlgaeToken public algaetoken; IERC721Enumerable public mightymanateez; IERC721Enumerable public merchpass; function mintComics(uint numberOfTokens) public payable { require(isLive, "Can not mint Comics before the sale has started"); require(totalSupply().add(numberOfTokens) <= MAX_COMICS, "Purchase would exceed max supply of Comics"); require(COMIC_PRICE.mul(numberOfTokens) <= msg.value, "Ether value sent is not correct"); updateRewardOnMint(msg.sender, numberOfTokens); userBalance[msg.sender] = userBalance[msg.sender].add(numberOfTokens); for (uint i = 0; i < numberOfTokens; i++) { uint mintIndex = totalSupply(); if (totalSupply() < MAX_COMICS) { _safeMint(msg.sender, mintIndex); } } } // function getReward(address _to) external { // // require(canBurn[msg.sender]); // uint256 reward = rewards[_to]; // if (reward > 0) { // rewards[_to] = 0; // _mint(_to, reward); // } // } function getTotalClaimable(address _user) external view returns (uint256) { uint256 time = min(block.timestamp, END); uint256 pending = userBalance[_user].mul(BASE_RATE.mul((time.sub(lastUpdate[_user])))).div(86400); return rewards[_user] + pending; } function updateReward(address _from, address _to) private { uint256 time = min(block.timestamp, END); uint256 timerFrom = lastUpdate[_from]; if (timerFrom > 0) rewards[_from] += userBalance[_from].mul(BASE_RATE.mul((time.sub(timerFrom)))).div(86400); if (timerFrom != END) lastUpdate[_from] = time; if (_to != address(0)) { uint256 timerTo = lastUpdate[_to]; if (timerTo > 0) rewards[_to] += userBalance[_to].mul(BASE_RATE.mul((time.sub(timerTo)))).div(86400); if (timerTo != END) lastUpdate[_to] = time; } } function getReward() external { uint256 reward = rewards[msg.sender]; uint256 time = min(block.timestamp, END); uint256 pending = userBalance[msg.sender].mul(BASE_RATE.mul((time.sub(lastUpdate[msg.sender])))).div(86400); if (reward > 0) { rewards[msg.sender] = rewards[msg.sender].add(pending); algaetoken.sendAlgae(msg.sender, rewards[msg.sender]); rewards[msg.sender] = 0; } } function transferFrom(address from, address to, uint256 tokenId) public override { updateReward(from, to); userBalance[from]--; userBalance[to]++; ERC721.transferFrom(from, to, tokenId); } function updateRewardOnMint(address _user, uint256 _amount) private { uint256 time = min(block.timestamp, END); uint256 timerUser = lastUpdate[_user]; if (timerUser > 0) rewards[_user] = rewards[_user].add(userBalance[_user].mul(BASE_RATE.mul((time.sub(timerUser)))).div(86400) .add(_amount.mul(INITIAL_ISSUANCE))); else rewards[_user] = rewards[_user].add(_amount.mul(INITIAL_ISSUANCE)); lastUpdate[_user] = time; } function reserveForTeam(uint _amount, address _to) external onlyOwner { require(TEAM_TOKEN_COUNT.add(_amount) <= TEAM_TOKEN_MAX, "Can not mint more than 500 tokens for the team"); TEAM_TOKEN_COUNT = TEAM_TOKEN_COUNT.add(_amount); updateRewardOnMint(_to, _amount); userBalance[msg.sender] = userBalance[msg.sender].add(_amount); uint supply = totalSupply(); uint i; for (i = 0; i < _amount; i++) { _safeMint(_to, supply + i); } } function min(uint256 a, uint256 b) internal pure returns (uint256) { return a < b ? a : b; } function setBaseURI(string memory baseURI) public onlyOwner { _setBaseURI(baseURI); } function setAlgaeToken(address _algae) external onlyOwner { algaetoken = AlgaeToken(_algae); } function updateNFTPrice(uint256 _price) external onlyOwner { COMIC_PRICE = _price; } function goLive() external onlyOwner { isLive = true; } function stopLive() external onlyOwner { isLive = false; } function withdraw() public onlyOwner { uint256 balance = address(this).balance; msg.sender.transfer(balance); } function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory _data) public override { updateReward(from, to); userBalance[from]--; userBalance[to]++; ERC721.safeTransferFrom(from, to, tokenId, _data); } function sendAlgaeToManateezOwners() public onlyOwner{ uint256 count = totalSupply(); for(uint i = 0; i < count; i++){ address owner = ownerOf(i); rewards[owner] = rewards[owner].add(500 ether); } } function sendAlgaeToMerchPassOwners() public onlyOwner{ uint256 count = merchpass.totalSupply(); for(uint i = 0; i < count; i++){ address owner = merchpass.ownerOf(i); rewards[owner] = rewards[owner].add(100 ether); } } constructor(AlgaeToken _algae, IERC721Enumerable _mightyManateez, IERC721Enumerable _merchPass) ERC721("MightyManateez Comic Issue #1", "MMCOMIC") { mightymanateez = IERC721Enumerable(_mightyManateez); merchpass = IERC721Enumerable(_merchPass); algaetoken = AlgaeToken(_algae); } }
contract ManateezComic is ERC721, Ownable { using SafeMath for uint256; uint256 public COMIC_PRICE = 0.01 ether; uint256 public TEAM_TOKEN_COUNT = 0; uint256 public constant TEAM_TOKEN_MAX = 500; uint256 public constant MAX_COMICS = 5000; uint256 constant public BASE_RATE = 5 ether; uint256 constant public INITIAL_ISSUANCE = 100 ether; bool public isLive = false; // 12/31/2031 @11:59:59 EST uint256 constant public END = 1956545999; mapping(address => uint256) public rewards; mapping(address => uint256) public lastUpdate; mapping(address => uint256) public userBalance; AlgaeToken public algaetoken; IERC721Enumerable public mightymanateez; IERC721Enumerable public merchpass; function mintComics(uint numberOfTokens) public payable { require(isLive, "Can not mint Comics before the sale has started"); require(totalSupply().add(numberOfTokens) <= MAX_COMICS, "Purchase would exceed max supply of Comics"); require(COMIC_PRICE.mul(numberOfTokens) <= msg.value, "Ether value sent is not correct"); updateRewardOnMint(msg.sender, numberOfTokens); userBalance[msg.sender] = userBalance[msg.sender].add(numberOfTokens); for (uint i = 0; i < numberOfTokens; i++) { uint mintIndex = totalSupply(); if (totalSupply() < MAX_COMICS) { _safeMint(msg.sender, mintIndex); } } } // function getReward(address _to) external { // // require(canBurn[msg.sender]); // uint256 reward = rewards[_to]; // if (reward > 0) { // rewards[_to] = 0; // _mint(_to, reward); // } // } function getTotalClaimable(address _user) external view returns (uint256) { uint256 time = min(block.timestamp, END); uint256 pending = userBalance[_user].mul(BASE_RATE.mul((time.sub(lastUpdate[_user])))).div(86400); return rewards[_user] + pending; } function updateReward(address _from, address _to) private { uint256 time = min(block.timestamp, END); uint256 timerFrom = lastUpdate[_from]; if (timerFrom > 0) rewards[_from] += userBalance[_from].mul(BASE_RATE.mul((time.sub(timerFrom)))).div(86400); if (timerFrom != END) lastUpdate[_from] = time; if (_to != address(0)) { uint256 timerTo = lastUpdate[_to]; if (timerTo > 0) rewards[_to] += userBalance[_to].mul(BASE_RATE.mul((time.sub(timerTo)))).div(86400); if (timerTo != END) lastUpdate[_to] = time; } } function getReward() external { uint256 reward = rewards[msg.sender]; uint256 time = min(block.timestamp, END); uint256 pending = userBalance[msg.sender].mul(BASE_RATE.mul((time.sub(lastUpdate[msg.sender])))).div(86400); if (reward > 0) { rewards[msg.sender] = rewards[msg.sender].add(pending); algaetoken.sendAlgae(msg.sender, rewards[msg.sender]); rewards[msg.sender] = 0; } } function transferFrom(address from, address to, uint256 tokenId) public override { updateReward(from, to); userBalance[from]--; userBalance[to]++; ERC721.transferFrom(from, to, tokenId); } function updateRewardOnMint(address _user, uint256 _amount) private { uint256 time = min(block.timestamp, END); uint256 timerUser = lastUpdate[_user]; if (timerUser > 0) rewards[_user] = rewards[_user].add(userBalance[_user].mul(BASE_RATE.mul((time.sub(timerUser)))).div(86400) .add(_amount.mul(INITIAL_ISSUANCE))); else rewards[_user] = rewards[_user].add(_amount.mul(INITIAL_ISSUANCE)); lastUpdate[_user] = time; } function reserveForTeam(uint _amount, address _to) external onlyOwner { require(TEAM_TOKEN_COUNT.add(_amount) <= TEAM_TOKEN_MAX, "Can not mint more than 500 tokens for the team"); TEAM_TOKEN_COUNT = TEAM_TOKEN_COUNT.add(_amount); updateRewardOnMint(_to, _amount); userBalance[msg.sender] = userBalance[msg.sender].add(_amount); uint supply = totalSupply(); uint i; for (i = 0; i < _amount; i++) { _safeMint(_to, supply + i); } } function min(uint256 a, uint256 b) internal pure returns (uint256) { return a < b ? a : b; } function setBaseURI(string memory baseURI) public onlyOwner { _setBaseURI(baseURI); } function setAlgaeToken(address _algae) external onlyOwner { algaetoken = AlgaeToken(_algae); } function updateNFTPrice(uint256 _price) external onlyOwner { COMIC_PRICE = _price; } function goLive() external onlyOwner { isLive = true; } function stopLive() external onlyOwner { isLive = false; } function withdraw() public onlyOwner { uint256 balance = address(this).balance; msg.sender.transfer(balance); } function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory _data) public override { updateReward(from, to); userBalance[from]--; userBalance[to]++; ERC721.safeTransferFrom(from, to, tokenId, _data); } function sendAlgaeToManateezOwners() public onlyOwner{ uint256 count = totalSupply(); for(uint i = 0; i < count; i++){ address owner = ownerOf(i); rewards[owner] = rewards[owner].add(500 ether); } } function sendAlgaeToMerchPassOwners() public onlyOwner{ uint256 count = merchpass.totalSupply(); for(uint i = 0; i < count; i++){ address owner = merchpass.ownerOf(i); rewards[owner] = rewards[owner].add(100 ether); } } constructor(AlgaeToken _algae, IERC721Enumerable _mightyManateez, IERC721Enumerable _merchPass) ERC721("MightyManateez Comic Issue #1", "MMCOMIC") { mightymanateez = IERC721Enumerable(_mightyManateez); merchpass = IERC721Enumerable(_merchPass); algaetoken = AlgaeToken(_algae); } }
7,693
5
// Mint tokens for each ids in _ids _to The address to mint tokens to _idsArray of ids to mint _amountsArray of amount of tokens to mint per id _dataData to pass if receiver is contract /
function _batchMint( address _to, uint256[] memory _ids, uint256[] memory _amounts, bytes memory _data
function _batchMint( address _to, uint256[] memory _ids, uint256[] memory _amounts, bytes memory _data
29,644
126
// This function shows what the allowance is for a certain pair of addresses.
function allowance(address owner, address spender) external view override returns (uint256) { return wallets[owner].allowances[spender]; }
function allowance(address owner, address spender) external view override returns (uint256) { return wallets[owner].allowances[spender]; }
26,559
166
// Energy Gravitational
string public constant item225 = 'iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAMAAABEpIrGAAAAM1BMVEUAAAAaI34oNZMwP585SasxG5JFJ6BRLahKFIxqG5pmCzyPeh6/uHaQilmIDk//9Z392DUxN+cPAAAAAXRSTlMAQObYZgAAAIFJREFUeAFiGAWAXshABWEYBqJelsRz067//7VaEcnknCCwB9AHKQ+4gwFs8smA718izxm7EV64X5s5/6gtoraBqla5qlqF0gu3WvursAgXOxQXSyoX68klX/sX/7g3OFfQjR3jdWDdBizCaONhe+gwvM8N0Y2e4f15AjszQZwO4Q485wN1/wY9BgAAAABJRU5ErkJggg==';
string public constant item225 = 'iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAMAAABEpIrGAAAAM1BMVEUAAAAaI34oNZMwP585SasxG5JFJ6BRLahKFIxqG5pmCzyPeh6/uHaQilmIDk//9Z392DUxN+cPAAAAAXRSTlMAQObYZgAAAIFJREFUeAFiGAWAXshABWEYBqJelsRz067//7VaEcnknCCwB9AHKQ+4gwFs8smA718izxm7EV64X5s5/6gtoraBqla5qlqF0gu3WvursAgXOxQXSyoX68klX/sX/7g3OFfQjR3jdWDdBizCaONhe+gwvM8N0Y2e4f15AjszQZwO4Q485wN1/wY9BgAAAABJRU5ErkJggg==';
5,847
83
// external sales and private ico
return account == crowdsale || account == deferredKyc;
return account == crowdsale || account == deferredKyc;
36,561
6
// part_2 is 3 bytes 112 = 32 + 80(part_1)
mstore(add(txData, 112 ), mload(add(data, add(txDataOffset, 32))))
mstore(add(txData, 112 ), mload(add(data, add(txDataOffset, 32))))
27,593
51
// Price ceiling
uint256 public ceiling;
uint256 public ceiling;
49,813
7
// Returns the downcasted uint200 from uint256, reverting on overflow (when the input is greater than largest uint200). Counterpart to Solidity's `uint200` operator. Requirements: - input must fit into 200 bits _Available since v4.7._/
function toUint200(uint256 value) internal pure returns (uint200) { require(value <= type(uint200).max, "SafeCast: value doesn't fit in 200 bits"); return uint200(value); }
function toUint200(uint256 value) internal pure returns (uint200) { require(value <= type(uint200).max, "SafeCast: value doesn't fit in 200 bits"); return uint200(value); }
26,663
4
// Called by a freezer to mark an account as frozen account The account to be frozen /
function freeze(address account) public onlyFreezer { _frozen[account] = true; emit Freeze(account); }
function freeze(address account) public onlyFreezer { _frozen[account] = true; emit Freeze(account); }
33,277
13
// The USD/ETH UPDATE CHANGE RATE WITH CURRENT RATE WHEN DEPLOYING This value is given in USD CENTS
uint public usdPerEth = 1100 * 100;
uint public usdPerEth = 1100 * 100;
11,104
3
// ============ Constructor ============ //Set state variables_synthetixExchangerAddressAddress of Synthetix's Exchanger contract /
constructor(address _synthetixExchangerAddress) public { synthetixExchangerAddress = _synthetixExchangerAddress; }
constructor(address _synthetixExchangerAddress) public { synthetixExchangerAddress = _synthetixExchangerAddress; }
31,874
14
// The total amount of AION paid out (contract paid out)
uint public totalPaid;
uint public totalPaid;
11,921
10
// keeps track of the rent each user has paid for each card, for Safe mode payout
mapping(address => mapping(uint256 => uint256)) public override rentCollectedPerUserPerCard;
mapping(address => mapping(uint256 => uint256)) public override rentCollectedPerUserPerCard;
24,884
3
// Deposit funds into contract
function createBox(address _recipient, ERC20Interface _sendToken, uint _sendValue, ERC20Interface _requestToken, uint _requestValue, bytes32 _passHashHash) external payable
function createBox(address _recipient, ERC20Interface _sendToken, uint _sendValue, ERC20Interface _requestToken, uint _requestValue, bytes32 _passHashHash) external payable
56,271
206
// swap 4-byte long pairs
v = ((v & 0xFFFFFFFF00000000FFFFFFFF00000000) >> 32) | ((v & 0x00000000FFFFFFFF00000000FFFFFFFF) << 32);
v = ((v & 0xFFFFFFFF00000000FFFFFFFF00000000) >> 32) | ((v & 0x00000000FFFFFFFF00000000FFFFFFFF) << 32);
6,680
3
// Author : AAVE Function to calculate the interest using a compounded interest rate formulaTo avoid expensive exponentiation, the calculation is performed using a binomial approximation: (1+x)^n = 1+nx+[n/2(n-1)]x^2+[n/6(n-1)(n-2)x^3... The approximation slightly underpays liquidity providers and undercharges borrowers, with the advantage of great gas cost reductionsThe whitepaper contains reference to the approximation and a table showing the margin of error per different time periodsrate The interest rate, in ray lastUpdateTimestamp The timestamp of the last update of the interestreturn The interest rate compounded during the timeDelta, in ray /
) internal pure returns (uint256) { //solium-disable-next-line uint256 exp = currentTimestamp - lastUpdateTimestamp; if (exp == 0) { return WadRayMath.ray(); } uint256 expMinusOne = exp - 1; uint256 expMinusTwo = exp > 2 ? exp - 2 : 0; // loss of precision is endurable // slither-disable-next-line divide-before-multiply uint256 ratePerSecond = rate / SECONDSPERYEAR; uint256 basePowerTwo = ratePerSecond.rayMul(ratePerSecond); uint256 basePowerThree = basePowerTwo.rayMul(ratePerSecond); uint256 secondTerm = (exp * expMinusOne * basePowerTwo) / 2; uint256 thirdTerm = (exp * expMinusOne * expMinusTwo * basePowerThree) / 6; return WadRayMath.ray() + (ratePerSecond * exp) + secondTerm + thirdTerm; }
) internal pure returns (uint256) { //solium-disable-next-line uint256 exp = currentTimestamp - lastUpdateTimestamp; if (exp == 0) { return WadRayMath.ray(); } uint256 expMinusOne = exp - 1; uint256 expMinusTwo = exp > 2 ? exp - 2 : 0; // loss of precision is endurable // slither-disable-next-line divide-before-multiply uint256 ratePerSecond = rate / SECONDSPERYEAR; uint256 basePowerTwo = ratePerSecond.rayMul(ratePerSecond); uint256 basePowerThree = basePowerTwo.rayMul(ratePerSecond); uint256 secondTerm = (exp * expMinusOne * basePowerTwo) / 2; uint256 thirdTerm = (exp * expMinusOne * expMinusTwo * basePowerThree) / 6; return WadRayMath.ray() + (ratePerSecond * exp) + secondTerm + thirdTerm; }
3,172
104
// Utility; removes a prefix from a path. _path Path to remove the prefix from.return _unprefixedKey Unprefixed key. /
function _removeHexPrefix( bytes memory _path ) private pure returns ( bytes memory _unprefixedKey )
function _removeHexPrefix( bytes memory _path ) private pure returns ( bytes memory _unprefixedKey )
23,034
123
// the below allows for a consolidated handling of the necessary math to support the possible transfer+tax combinations
( uint256 reflectionsToDebit, // sender uint256 reflectionsToCredit, // recipient uint256 reflectionsToRemove, // to all the hodlers uint256 reflectionsForTreasury // to treasury ) = _getValues(amountOfTokens);
( uint256 reflectionsToDebit, // sender uint256 reflectionsToCredit, // recipient uint256 reflectionsToRemove, // to all the hodlers uint256 reflectionsForTreasury // to treasury ) = _getValues(amountOfTokens);
23,406
0
// IOriginsNFT Interface for OriginsNFT contract Amberfi /
interface IOriginsNFT { /** * @dev Mint NFT with ID `tokenId_` (called by MarketManager) * @param to_ (address) Mint to address * @param tokenId_ (uint256) Token ID to mint */ function mint(address to_, uint256 tokenId_) external; }
interface IOriginsNFT { /** * @dev Mint NFT with ID `tokenId_` (called by MarketManager) * @param to_ (address) Mint to address * @param tokenId_ (uint256) Token ID to mint */ function mint(address to_, uint256 tokenId_) external; }
35,019
27
// get the staking epoch
function _stakingEpochId(uint128 epochId) pure internal returns (uint128) { return epochId + EPOCHS_DELAYED_FROM_STAKING_CONTRACT; }
function _stakingEpochId(uint128 epochId) pure internal returns (uint128) { return epochId + EPOCHS_DELAYED_FROM_STAKING_CONTRACT; }
50,832
249
// ----------------- SETTERS ----------------- we put all together to save contract bytecode (!)
function setStrategyParams( uint16 _targetLTVMultiplier, uint16 _warningLTVMultiplier, uint256 _acceptableCostsRay, uint16 _aaveReferral, uint256 _maxTotalBorrowIT, bool _isWantIncentivised, bool _isInvestmentTokenIncentivised, bool _leaveDebtBehind, uint256 _maxLoss
function setStrategyParams( uint16 _targetLTVMultiplier, uint16 _warningLTVMultiplier, uint256 _acceptableCostsRay, uint16 _aaveReferral, uint256 _maxTotalBorrowIT, bool _isWantIncentivised, bool _isInvestmentTokenIncentivised, bool _leaveDebtBehind, uint256 _maxLoss
26,508
54
// Monthly transfer limit - hardcoded to 100,000
uint256 public constant MONTHLY_LIMIT = 100000 ether;
uint256 public constant MONTHLY_LIMIT = 100000 ether;
79,444
4
// Emitted when `tokenId` token is transferred from `from` to `to`. /
event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
18,542
59
// Domain separator for EIP-712 signatures.
bytes32 internal _DOMAIN_SEPARATOR_;
bytes32 internal _DOMAIN_SEPARATOR_;
43,817
10
// Batch version of create function /
) external onlyGameContractOrOwner { require(initialSupply_.length > 0, "Args array can't be empty"); require(initialSupply_.length > 0 && initialSupply_.length == uri_.length, "Args length dont match"); uint256 id = nextId; uint256[] memory ids = new uint256[](initialSupply_.length); for (uint256 i; i < ids.length; i++) { ids[i] = id; if (bytes(uri_[i]).length > 0) { emit URI(uri_[i], id); } _tokenURIs[id] = uri_[i]; _tokenSupply[id] = initialSupply_[i]; id++; } nextId = id; _mintBatch(to_, ids, initialSupply_, data_); emit TokenBatchCreated(to_, ids, initialSupply_, uri_); }
) external onlyGameContractOrOwner { require(initialSupply_.length > 0, "Args array can't be empty"); require(initialSupply_.length > 0 && initialSupply_.length == uri_.length, "Args length dont match"); uint256 id = nextId; uint256[] memory ids = new uint256[](initialSupply_.length); for (uint256 i; i < ids.length; i++) { ids[i] = id; if (bytes(uri_[i]).length > 0) { emit URI(uri_[i], id); } _tokenURIs[id] = uri_[i]; _tokenSupply[id] = initialSupply_[i]; id++; } nextId = id; _mintBatch(to_, ids, initialSupply_, data_); emit TokenBatchCreated(to_, ids, initialSupply_, uri_); }
2,988
33
// Advisors & Mentors multisig wallet
address public _mentors = 0x589789B67aE612f47503E80ED14A18593C1C79BE;
address public _mentors = 0x589789B67aE612f47503E80ED14A18593C1C79BE;
14,815
9
// supposedly, send and transfer are discouraged since ether istanbul update
(bool sent,) = msg.sender.call{value: bnbToSend}("");
(bool sent,) = msg.sender.call{value: bnbToSend}("");
5,542
45
// result, user will get $skinsInBox skins
uint256[] memory selectedIds = new uint256[](skinsInBox); uint256[] memory amounts = new uint256[](skinsInBox); for (uint256 i = 0; i < skinsInBox; i++) {
uint256[] memory selectedIds = new uint256[](skinsInBox); uint256[] memory amounts = new uint256[](skinsInBox); for (uint256 i = 0; i < skinsInBox; i++) {
20,957
123
// "Consume a nonce": return the current value and increment. _Available since v4.1._ /
function _useNonce(address owner) internal virtual returns (uint256 current) { Counters.Counter storage nonce = _nonces[owner]; current = nonce.current(); nonce.increment(); }
function _useNonce(address owner) internal virtual returns (uint256 current) { Counters.Counter storage nonce = _nonces[owner]; current = nonce.current(); nonce.increment(); }
6,941
13
// if nothing is found we try at common rarity
if (rarirtyToPolliwogTraitIds[((_ageSexType * 10) + rarity)].length == 0) { rarity = 1; }
if (rarirtyToPolliwogTraitIds[((_ageSexType * 10) + rarity)].length == 0) { rarity = 1; }
25,347
45
// set a 1 ETH deposit limit until fully tested for security violations
require(_deposit <= 1 ether, 'deposit limit crossed');
require(_deposit <= 1 ether, 'deposit limit crossed');
6,438
2
// Move the last element to the index of array
_array[_index] = _array[_array.length - 1];
_array[_index] = _array[_array.length - 1];
35,214
71
// Adds a transaction that gets called for a downstream receiver of rebases destination Address of contract destination data Transaction data payload /
function addTransaction(address destination, bytes calldata data) external onlyOwner
function addTransaction(address destination, bytes calldata data) external onlyOwner
45,136
108
// address internal constant HelmetAddress = 0x948d2a81086A075b3130BAc19e4c6DEe1D2E3fE8;
address internal constant BurnAddress = 0x000000000000000000000000000000000000dEaD; uint private __lastUpdateTime3; // obsolete IERC20 private __rewardsToken3; // obsolete mapping(IERC20 => uint) public totalSupply3; // rewardsToken3 => totalSupply3 mapping(IERC20 => uint) internal _rewardPerToken3; // rewardsToken3 => _rewardPerToken3 mapping(IERC20 => uint) public begin3; // rewardsToken3 => begin3 mapping(IERC20 => uint) public end3; // rewardsToken3 => end3 mapping(IERC20 => uint) public claimTime3; // rewardsToken3 => claimTime3 mapping(IERC20 => uint) public ticketVol3; // rewardsToken3 => ticketVol3
address internal constant BurnAddress = 0x000000000000000000000000000000000000dEaD; uint private __lastUpdateTime3; // obsolete IERC20 private __rewardsToken3; // obsolete mapping(IERC20 => uint) public totalSupply3; // rewardsToken3 => totalSupply3 mapping(IERC20 => uint) internal _rewardPerToken3; // rewardsToken3 => _rewardPerToken3 mapping(IERC20 => uint) public begin3; // rewardsToken3 => begin3 mapping(IERC20 => uint) public end3; // rewardsToken3 => end3 mapping(IERC20 => uint) public claimTime3; // rewardsToken3 => claimTime3 mapping(IERC20 => uint) public ticketVol3; // rewardsToken3 => ticketVol3
65,820
321
// Allows the owner to withdraw tokens that have not been dripped yet./to The address to withdraw to/amount The amount to withdraw
function withdrawTo(address to, uint256 amount) external onlyOwner { drip(); uint256 assetTotalSupply = asset.balanceOf(address(this)); uint256 availableTotalSupply = assetTotalSupply.sub(totalUnclaimed); require(amount <= availableTotalSupply, "TokenFaucet/insufficient-funds"); asset.transfer(to, amount); emit Withdrawn(to, amount); }
function withdrawTo(address to, uint256 amount) external onlyOwner { drip(); uint256 assetTotalSupply = asset.balanceOf(address(this)); uint256 availableTotalSupply = assetTotalSupply.sub(totalUnclaimed); require(amount <= availableTotalSupply, "TokenFaucet/insufficient-funds"); asset.transfer(to, amount); emit Withdrawn(to, amount); }
36,057
72
// function to allow admin to claim other ERC20 tokens sent to this contract (by mistake) Admin cannot transfer out deposit tokens from this smart contract Admin can transfer out reward tokens from this address once adminClaimableTime has reached
function transferAnyERC20Tokens(address _tokenAddr, address _to, uint _amount) public onlyOwner { require(_tokenAddr != trustedDepositTokenAddress, "Admin cannot transfer out Deposit Tokens from this contract!"); require((_tokenAddr != trustedRewardTokenAddress) || (now > adminClaimableTime), "Admin cannot Transfer out Reward Tokens yet!"); Token(_tokenAddr).transfer(_to, _amount); }
function transferAnyERC20Tokens(address _tokenAddr, address _to, uint _amount) public onlyOwner { require(_tokenAddr != trustedDepositTokenAddress, "Admin cannot transfer out Deposit Tokens from this contract!"); require((_tokenAddr != trustedRewardTokenAddress) || (now > adminClaimableTime), "Admin cannot Transfer out Reward Tokens yet!"); Token(_tokenAddr).transfer(_to, _amount); }
53,574
0
// multiply by 4/3 rounded up
uint256 encodedLen = 4 * ((len + 2) / 3);
uint256 encodedLen = 4 * ((len + 2) / 3);
13,904
1
// BToken error codes
bytes32 public constant BTOKEN_INVALID_DEPOSIT_ID = "300"; //"BToken: Invalid deposit ID!" bytes32 public constant BTOKEN_INVALID_BALANCE = "301"; //"BToken: Address balance should be always greater than the pool balance!" bytes32 public constant BTOKEN_INVALID_BURN_AMOUNT = "302"; //"BToken: The number of BTokens to be burn should be greater than 0!" bytes32 public constant BTOKEN_CONTRACTS_DISALLOWED_DEPOSITS = "303"; //"BToken: Contracts cannot make BTokens deposits!" bytes32 public constant BTOKEN_DEPOSIT_AMOUNT_ZERO = "304"; //"BToken: The deposit amount must be greater than zero!" bytes32 public constant BTOKEN_DEPOSIT_BURN_FAIL = "305"; //"BToken: Burn failed during the deposit!" bytes32 public constant BTOKEN_MARKET_SPREAD_TOO_LOW = "306"; //"BToken: requires at least 4 WEI" bytes32 public constant BTOKEN_MINT_INSUFFICIENT_ETH = "307"; //"BToken: could not mint deposit with minimum BTokens given the ether sent!" bytes32 public constant BTOKEN_MINIMUM_MINT_NOT_MET = "308"; //"BToken: could not mint minimum BTokens" bytes32 public constant BTOKEN_MINIMUM_BURN_NOT_MET = "309"; //"BToken: Couldn't burn the minEth amount"
bytes32 public constant BTOKEN_INVALID_DEPOSIT_ID = "300"; //"BToken: Invalid deposit ID!" bytes32 public constant BTOKEN_INVALID_BALANCE = "301"; //"BToken: Address balance should be always greater than the pool balance!" bytes32 public constant BTOKEN_INVALID_BURN_AMOUNT = "302"; //"BToken: The number of BTokens to be burn should be greater than 0!" bytes32 public constant BTOKEN_CONTRACTS_DISALLOWED_DEPOSITS = "303"; //"BToken: Contracts cannot make BTokens deposits!" bytes32 public constant BTOKEN_DEPOSIT_AMOUNT_ZERO = "304"; //"BToken: The deposit amount must be greater than zero!" bytes32 public constant BTOKEN_DEPOSIT_BURN_FAIL = "305"; //"BToken: Burn failed during the deposit!" bytes32 public constant BTOKEN_MARKET_SPREAD_TOO_LOW = "306"; //"BToken: requires at least 4 WEI" bytes32 public constant BTOKEN_MINT_INSUFFICIENT_ETH = "307"; //"BToken: could not mint deposit with minimum BTokens given the ether sent!" bytes32 public constant BTOKEN_MINIMUM_MINT_NOT_MET = "308"; //"BToken: could not mint minimum BTokens" bytes32 public constant BTOKEN_MINIMUM_BURN_NOT_MET = "309"; //"BToken: Couldn't burn the minEth amount"
25,884
30
// userDeposit-persentWithdraw-(userDeposit8/100)
uint withdrawalAmount = userDeposit[msg.sender].sub(persentWithdraw[msg.sender]).sub(userDeposit[msg.sender].mul(projectPercent).div(100));
uint withdrawalAmount = userDeposit[msg.sender].sub(persentWithdraw[msg.sender]).sub(userDeposit[msg.sender].mul(projectPercent).div(100));
16,293
2
// Track when a discount has been applied to an address.
mapping (address => bool) private discountsAppliedToAddresses; error WrongValue(); error BadID(); error NoAccess(); error SoldOut(); error NotEnoughCanto(); error WithdrawalFailed(); constructor(
mapping (address => bool) private discountsAppliedToAddresses; error WrongValue(); error BadID(); error NoAccess(); error SoldOut(); error NotEnoughCanto(); error WithdrawalFailed(); constructor(
14,053
8
// Cancel a specific order, marking it gone to disallow anyone to trade against it.
function cancel(Order memory ord) external nonReentrant { require(ord.maker == msg.sender, '!maker'); bytes32 mhash = makerSignHash(ord); require(!gone[mhash], '!gone'); gone[mhash] = true; }
function cancel(Order memory ord) external nonReentrant { require(ord.maker == msg.sender, '!maker'); bytes32 mhash = makerSignHash(ord); require(!gone[mhash], '!gone'); gone[mhash] = true; }
35,101
14
// coinbase => NTF Account map
mapping(address => Account) public account;
mapping(address => Account) public account;
9,896
345
// index of the gem within collection `source`
uint32 i = gem.index;
uint32 i = gem.index;
29,568
4
// Returns the total number of armies 부대의 총 개수를 반환합니다.
function getArmyCount() view external returns (uint);
function getArmyCount() view external returns (uint);
32,005
22
// Counter underflow is impossible as _burnCounter cannot be incremented more than `_currentIndex - _startTokenId()` times.
unchecked { return _currentIndex - _burnCounter - _startTokenId(); }
unchecked { return _currentIndex - _burnCounter - _startTokenId(); }
9,666
31
// air drop
if (offerInfo.offerAmount >= 1 finney) { airDropTracker_ = airDropTracker_ + FMAPMath.calcTrackerCount(offerInfo.offerAmount); if (airdrop() == true) { uint256 _airdrop = FMAPMath.calcAirDropAmount(offerInfo.offerAmount); players_[offerInfo.playerAddress].balance = _airdrop.add(players_[offerInfo.playerAddress].balance); players_[offerInfo.playerAddress].airDroped = _airdrop.add(players_[offerInfo.playerAddress].airDroped); emit onAirDrop(offerInfo.playerAddress, _airdrop, offerInfo.offerAmount); }
if (offerInfo.offerAmount >= 1 finney) { airDropTracker_ = airDropTracker_ + FMAPMath.calcTrackerCount(offerInfo.offerAmount); if (airdrop() == true) { uint256 _airdrop = FMAPMath.calcAirDropAmount(offerInfo.offerAmount); players_[offerInfo.playerAddress].balance = _airdrop.add(players_[offerInfo.playerAddress].balance); players_[offerInfo.playerAddress].airDroped = _airdrop.add(players_[offerInfo.playerAddress].airDroped); emit onAirDrop(offerInfo.playerAddress, _airdrop, offerInfo.offerAmount); }
52,007
17
// Returns if the NFT is owned(fractionalized) by this contract.return An bool representing whether the NFT is fractionalized by this contract /
function isRegistered(address token, uint256 tokenId) public view returns (bool) { return (_Ids[token][tokenId] != 0); }
function isRegistered(address token, uint256 tokenId) public view returns (bool) { return (_Ids[token][tokenId] != 0); }
46,954
37
// Call context callback level
uint8 appLevel;
uint8 appLevel;
10,386
73
// Mints `_amount` of tokens to the address `_to`/Allowed only for MasterManager/_to address to mint on it tokens/_amount amount of tokens to mint
function mint(address _to, uint256 _amount) external onlyRole(MASTER_MANAGER_ROLE)
function mint(address _to, uint256 _amount) external onlyRole(MASTER_MANAGER_ROLE)
2,712
7
// If x >= 2, then we compute the integer part of log2(x), which is larger than 0.
if (x >= FIXED_2) { uint8 count = floorLog2(x / FIXED_1); x >>= count; // now x < 2 res = count * FIXED_1; }
if (x >= FIXED_2) { uint8 count = floorLog2(x / FIXED_1); x >>= count; // now x < 2 res = count * FIXED_1; }
4,043
35
// Owner can allow a crowdsale contract to mint new tokens. /
function setMintAgent(address addr, bool state) onlyOwner canMint public { mintAgents[addr] = state; MintingAgentChanged(addr, state); }
function setMintAgent(address addr, bool state) onlyOwner canMint public { mintAgents[addr] = state; MintingAgentChanged(addr, state); }
42,197
169
// OVERRIDEremove account from white & create a snapshot of 0 balanceaccount address/
function removeWhitelisted(address account) public { super.removeWhitelisted(account); _createAccountSnapshot(account, 0); uint256 balance = balanceOf(account); uint256 newSupplyValue = totalSupplyAt(now).sub(balance); _createTotalSupplySnapshot(account, newSupplyValue); }
function removeWhitelisted(address account) public { super.removeWhitelisted(account); _createAccountSnapshot(account, 0); uint256 balance = balanceOf(account); uint256 newSupplyValue = totalSupplyAt(now).sub(balance); _createTotalSupplySnapshot(account, newSupplyValue); }
4,126
101
// limit access to the admin only /
modifier onlyAdmin() { require(msg.sender == admin); _; }
modifier onlyAdmin() { require(msg.sender == admin); _; }
44,721
98
// Transfer `value` attotokens from `from` to `to`./ Callable only by the relay contract.
function relayTransfer(address from, address to, uint256 value) external notPaused only(trustedRelayer) returns (bool)
function relayTransfer(address from, address to, uint256 value) external notPaused only(trustedRelayer) returns (bool)
42,180
8
// set mediaId
digitalAsset.mediaId = _mediaId; emit SetMediaId(msg.sender, _objectId, digitalAsset.mediaId);
digitalAsset.mediaId = _mediaId; emit SetMediaId(msg.sender, _objectId, digitalAsset.mediaId);
49,450
45
// Compute k = log2(x) - 96.
int256 k;
int256 k;
41,934
586
// If compounded deposit is less than a billionth of the initial deposit, return 0. NOTE: originally, this line was in place to stop rounding errors making the deposit too large. However, the error corrections should ensure the error in P "favors the Pool", i.e. any given compounded deposit should slightly less than it's theoretical value. Thus it's unclear whether this line is still really needed./
if (compoundedStake < initialStake.div(1e9)) {return 0;}
if (compoundedStake < initialStake.div(1e9)) {return 0;}
68,848
366
// onUpgrade(): called by previous ecliptic when upgradingin future ecliptics, this might perform more logic thanjust simple checks and verifications.when overriding this, make sure to call this original as well.
function onUpgrade() external
function onUpgrade() external
37,066
573
// lower debt cause burn
xtoken.lowerHasMinted(_childAmount);
xtoken.lowerHasMinted(_childAmount);
20,999
162
// Function to read the globalTokenSymbol field.
function globalTokenSymbol() external view returns(string memory);
function globalTokenSymbol() external view returns(string memory);
41,552
6
// constants injection
for (uint i=0; i<16; i++) { state[i] = state[i] ^ consts.injection_constants[index*16 + i]; }
for (uint i=0; i<16; i++) { state[i] = state[i] ^ consts.injection_constants[index*16 + i]; }
13,113
53
// ICO------------------------------------
if(now >= startICO && now < endICO){ tokenPrice = 7 ether; if(sum >= 151 ether){ tokenPrice = 40 * 100000000000000000; } else if(sum >= 66 ether){
if(now >= startICO && now < endICO){ tokenPrice = 7 ether; if(sum >= 151 ether){ tokenPrice = 40 * 100000000000000000; } else if(sum >= 66 ether){
16,655
30
// cancel offer2 and delete from outstandingPairsIDs as both orders are gone.
BathToken(bathQuoteAddress).cancel( outstandingPairIDs[x][1] );
BathToken(bathQuoteAddress).cancel( outstandingPairIDs[x][1] );
17,083
6,690
// 3347
entry "ophthalmoscopically" : ENG_ADVERB
entry "ophthalmoscopically" : ENG_ADVERB
24,183
0
// Indicates that the contract has been initialized. /
bool _initialized;
bool _initialized;
46,694
83
// Builds a prefixed hash to mimic the behavior of eth_sign.
function prefixed(bytes32 hash) internal pure returns (bytes32) { return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash)); }
function prefixed(bytes32 hash) internal pure returns (bytes32) { return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash)); }
31,273
282
// Imitates a Solidity high-level call (i.e. a regular function call to a contract),relaxing the requirement on the return value_contract The borrower contract that receives the approveRequest(bytes32) call _data The call data return success True if the call not revertsreturn result the result of the call /
function _safeCall( address _contract, bytes memory _data
function _safeCall( address _contract, bytes memory _data
25,645
128
// The users last claim time is updated with the current block timestamp.
lastClaimTime[account] = block.timestamp;
lastClaimTime[account] = block.timestamp;
31,419
372
// 4. Roll WBTC gained into want position
uint256 wbtcToDeposit = wbtcToken.balanceOf(address(this)); if (wbtcToDeposit > 0) { _add_liquidity_single_coin(curvePool.swap, want, wbtc, wbtcToDeposit, curvePool.wbtcPosition, curvePool.numElements, 0); uint256 wantGained = IERC20Upgradeable(want).balanceOf(address(this)).sub(idleWant);
uint256 wbtcToDeposit = wbtcToken.balanceOf(address(this)); if (wbtcToDeposit > 0) { _add_liquidity_single_coin(curvePool.swap, want, wbtc, wbtcToDeposit, curvePool.wbtcPosition, curvePool.numElements, 0); uint256 wantGained = IERC20Upgradeable(want).balanceOf(address(this)).sub(idleWant);
13,533
153
// Used for storing information about voting
struct VoteStateV1 { /// Taken from the DMG token implementation mapping(address => mapping(uint64 => Checkpoint)) ownerToCheckpointIndexToCheckpointMap; /// Taken from the DMG token implementation mapping(address => uint64) ownerToCheckpointCountMap; }
struct VoteStateV1 { /// Taken from the DMG token implementation mapping(address => mapping(uint64 => Checkpoint)) ownerToCheckpointIndexToCheckpointMap; /// Taken from the DMG token implementation mapping(address => uint64) ownerToCheckpointCountMap; }
6,217
1,085
// solhint-disable-next-line var-name-mixedcase
bytes32 private constant _CURRENCY_PERMIT_TYPEHASH = keccak256( "Permit(address currency,address spender,uint256 value,uint256 nonce,uint256 deadline)" ); /*/////////////////////////////////////////////////////////////// Events
bytes32 private constant _CURRENCY_PERMIT_TYPEHASH = keccak256( "Permit(address currency,address spender,uint256 value,uint256 nonce,uint256 deadline)" ); /*/////////////////////////////////////////////////////////////// Events
30,756
18
// Address where funds are collected
address public wallet;
address public wallet;
6,815
395
// Callback function /Called by the Chainlink oracle
function fulfill(bytes32 _requestId, uint256 result) public recordChainlinkFulfillment(_requestId)
function fulfill(bytes32 _requestId, uint256 result) public recordChainlinkFulfillment(_requestId)
12,194
214
// burn long option tokens from sender
_burn(holder, longTokenId, contractSize); if (exerciseValue > 0) { uint256 fee = _getFeeWithDiscount( holder, FEE_64x64.mulu(exerciseValue) ); totalFee += fee; _pushTo(holder, _getPoolToken(isCall), exerciseValue - fee);
_burn(holder, longTokenId, contractSize); if (exerciseValue > 0) { uint256 fee = _getFeeWithDiscount( holder, FEE_64x64.mulu(exerciseValue) ); totalFee += fee; _pushTo(holder, _getPoolToken(isCall), exerciseValue - fee);
48,329
103
// Logged when an operator is added or removed.
event ApprovalForAll(address indexed owner, address indexed operator, bool approved); function setRecord(bytes32 node, address owner, address resolver, uint64 ttl) external virtual; function setSubnodeRecord(bytes32 node, bytes32 label, address owner, address resolver, uint64 ttl) external virtual; function setSubnodeOwner(bytes32 node, bytes32 label, address owner) external virtual returns(bytes32); function setResolver(bytes32 node, address resolver) external virtual; function setOwner(bytes32 node, address owner) external virtual; function setTTL(bytes32 node, uint64 ttl) external virtual; function setApprovalForAll(address operator, bool approved) external virtual; function owner(bytes32 node) external virtual view returns (address);
event ApprovalForAll(address indexed owner, address indexed operator, bool approved); function setRecord(bytes32 node, address owner, address resolver, uint64 ttl) external virtual; function setSubnodeRecord(bytes32 node, bytes32 label, address owner, address resolver, uint64 ttl) external virtual; function setSubnodeOwner(bytes32 node, bytes32 label, address owner) external virtual returns(bytes32); function setResolver(bytes32 node, address resolver) external virtual; function setOwner(bytes32 node, address owner) external virtual; function setTTL(bytes32 node, uint64 ttl) external virtual; function setApprovalForAll(address operator, bool approved) external virtual; function owner(bytes32 node) external virtual view returns (address);
40,019
8
// The current amount of unsettled payouts distributed for the current bidding process
uint256 internal unsettledPayouts;
uint256 internal unsettledPayouts;
32,186
11
// privileged method to ban pool from submitting metadata.This does NOT affect the ability to manage the core Pool contract. pool address of pool to ban /
function ban(address pool) external { requireController(); banned[pool] = true; emit Banned(pool, true); }
function ban(address pool) external { requireController(); banned[pool] = true; emit Banned(pool, true); }
999
437
// Get whether a decrease request has been initiated for service provider _serviceProvider - address of service providerreturn Boolean of whether decrease request has been initiated /
function _decreaseRequestIsPending(address _serviceProvider) internal view returns (bool)
function _decreaseRequestIsPending(address _serviceProvider) internal view returns (bool)
38,514
52
// prize The prize to transfer. recipient The recipient of the prize. multiplier The multiplier to apply to the prize amount. /
function _transferPrize( Prize storage prize, address recipient, uint256 multiplier
function _transferPrize( Prize storage prize, address recipient, uint256 multiplier
40,822
183
// Info of total amount of staked LP tokens by all users
mapping (address => uint256) public totalStaked; event Deposit(address indexed user, uint256 indexed pid, uint256 amount); event Withdraw(address indexed user, uint256 indexed pid, uint256 amount); event EmergencyWithdraw(address indexed user, uint256 indexed pid, uint256 amount); event Treasury(address indexed token, address treasury, uint256 amount); constructor(
mapping (address => uint256) public totalStaked; event Deposit(address indexed user, uint256 indexed pid, uint256 amount); event Withdraw(address indexed user, uint256 indexed pid, uint256 amount); event EmergencyWithdraw(address indexed user, uint256 indexed pid, uint256 amount); event Treasury(address indexed token, address treasury, uint256 amount); constructor(
48,174
13
// The total number of tokens in circulation /
function totalSupply() public view returns (uint8) { return _totalSupply; }
function totalSupply() public view returns (uint8) { return _totalSupply; }
2,507
4
// OPTIMAL RETAILERORDER QUANTITY
struct OptimalRetailOrder { address retailorordereraddress; bytes32 retailerordername; bytes32 retailerorderrole; uint optimalretailordervalue; uint optimalretailorordercount; mapping (address => OptimalRetailOrder[1000]) optimalretailordercollection; mapping (bytes32 => OptimalRetailOrder[1000]) optimalretailorderstorage; }
struct OptimalRetailOrder { address retailorordereraddress; bytes32 retailerordername; bytes32 retailerorderrole; uint optimalretailordervalue; uint optimalretailorordercount; mapping (address => OptimalRetailOrder[1000]) optimalretailordercollection; mapping (bytes32 => OptimalRetailOrder[1000]) optimalretailorderstorage; }
34,863
45
// deposit LP token function for msgSender _amount the total deposit amount /
function deposit(uint256 _amount) public { address msgSender = _msgSender(); UserInfo storage user = userInfo[msgSender]; updatePool(); if (user.amount > 0) { uint256 pending = user.amount.mul(farmInfo.accRewardPerShare).div(1e12).sub(user.rewardDebt); safeRewardTransfer(msgSender, pending); } if (user.amount == 0 && _amount > 0) { factory.userEnteredFarm(msgSender); farmInfo.numFarmers = farmInfo.numFarmers.add(1); } farmInfo.lpToken.safeTransferFrom(address(msgSender), address(this), _amount); user.amount = user.amount.add(_amount); user.rewardDebt = user.amount.mul(farmInfo.accRewardPerShare).div(1e12); emit Deposit(msgSender, _amount); }
function deposit(uint256 _amount) public { address msgSender = _msgSender(); UserInfo storage user = userInfo[msgSender]; updatePool(); if (user.amount > 0) { uint256 pending = user.amount.mul(farmInfo.accRewardPerShare).div(1e12).sub(user.rewardDebt); safeRewardTransfer(msgSender, pending); } if (user.amount == 0 && _amount > 0) { factory.userEnteredFarm(msgSender); farmInfo.numFarmers = farmInfo.numFarmers.add(1); } farmInfo.lpToken.safeTransferFrom(address(msgSender), address(this), _amount); user.amount = user.amount.add(_amount); user.rewardDebt = user.amount.mul(farmInfo.accRewardPerShare).div(1e12); emit Deposit(msgSender, _amount); }
19,387
15
// Register a contract.This can only be called from an account that is part of the nsadmins group/_key the bytestring of the contract name/_contract the address of the contract/ return _success if the operation is successful
function register_contract(bytes32 _key, address _contract) if_group("nsadmins") if_owner_origin() if_not_locked() locked_after_period() unless_registered(_key) public returns (bool _success)
function register_contract(bytes32 _key, address _contract) if_group("nsadmins") if_owner_origin() if_not_locked() locked_after_period() unless_registered(_key) public returns (bool _success)
10,233
332
// 1st order derivative
{
{
19,941
15
// encode adapterParams to specify more gas for the destination
uint16 version = 1; bytes memory adapterParams = abi.encodePacked( version , gasForDestinationLzReceive);
uint16 version = 1; bytes memory adapterParams = abi.encodePacked( version , gasForDestinationLzReceive);
18,432
11
// check the unhappy case
function testFailGreeting() public { greeter.greet("yo"); require(keccak256(abi.encodePacked(greeter.greeting())) == keccak256(abi.encodePacked("hi")), "not equal to `hi`"); }
function testFailGreeting() public { greeter.greet("yo"); require(keccak256(abi.encodePacked(greeter.greeting())) == keccak256(abi.encodePacked("hi")), "not equal to `hi`"); }
16,453
15
// string memory c1 = string(abi.encodePacked('hsl(', toString(tokenId), ', 45%', '80%'));
string memory suffix = ', 45%, 80%)'; if(index == 0) { suffix = ', 75%, 40%)'; }
string memory suffix = ', 45%, 80%)'; if(index == 0) { suffix = ', 75%, 40%)'; }
3,663
0
// hash code: 0x12 (SHA-2) and digest length: 0x20 (32 bytes / 256 bits)
bytes2 public constant MULTIHASH_PREFIX = 0x1220;
bytes2 public constant MULTIHASH_PREFIX = 0x1220;
45,371
65
// Interface of the ERC20 standard as defined in the EIP. /
interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); }
interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); }
147
116
// Checks it's a valid node
Validator val = Validator(validator); require(stakeManager_.getValidatorContract(val.validatorId()) == validator && !val.locked(), "CO10"); newPoints += points[i]; activeNodes.push(newCountNodes); stakingNodes[newCountNodes] = StakingNode(newCountNodes, validator, points[i], 0); newCountNodes++;
Validator val = Validator(validator); require(stakeManager_.getValidatorContract(val.validatorId()) == validator && !val.locked(), "CO10"); newPoints += points[i]; activeNodes.push(newCountNodes); stakingNodes[newCountNodes] = StakingNode(newCountNodes, validator, points[i], 0); newCountNodes++;
34,119
29
// UUPS proxy function
function _authorizeUpgrade(address) internal override onlyOwner {} function onERC721Received( address operator, address from, uint256 tokenId, bytes calldata data ) external view override returns (bytes4) { from; tokenId; data; // supress solidity warnings if (operator == address(this)) { return this.onERC721Received.selector; } else { return 0x00000000; } }
function _authorizeUpgrade(address) internal override onlyOwner {} function onERC721Received( address operator, address from, uint256 tokenId, bytes calldata data ) external view override returns (bytes4) { from; tokenId; data; // supress solidity warnings if (operator == address(this)) { return this.onERC721Received.selector; } else { return 0x00000000; } }
41,989
32
// Si el usuario debe
if (debtUser>0){
if (debtUser>0){
4,672