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
17
// external with ABIEncoderV2 Struct is not supported in solidity < 0.6.4
require(_isValidChainId(message.chainId), "INVALID_CHAIN_ID"); _checkSigner(message, signatureType, signature);
require(_isValidChainId(message.chainId), "INVALID_CHAIN_ID"); _checkSigner(message, signatureType, signature);
4,429
95
// Safely transfers the ownership of a given token ID to another address If the target address is a contract, it must implement `onERC721Received`, which is called upon a safe transfer, and return the magic value `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))`; otherwise, the transfer is reverted. Requires the msg sender to be the owner, approved, or operator_from current owner of the token_to address to receive the ownership of the given token ID_tokenId uint256 ID of the token to be transferred_data bytes data to send along with a safe transfer check/
function safeTransferFrom( address _from, address _to, uint256 _tokenId, bytes _data ) public canTransfer(_tokenId)
function safeTransferFrom( address _from, address _to, uint256 _tokenId, bytes _data ) public canTransfer(_tokenId)
2,823
846
// Returns array with owner addresses, which confirmed transaction./transactionId Transaction ID./ return _confirmations Returns array of owner addresses.
function getConfirmations(uint transactionId) public view returns (address[] memory _confirmations)
function getConfirmations(uint transactionId) public view returns (address[] memory _confirmations)
5,839
127
// can not be overridden by state variable due to type `Deciaml.decimal`
function getSettlementPrice() external view returns (Decimal.decimal memory); function getBaseAssetDeltaThisFundingPeriod() external view returns (SignedDecimal.signedDecimal memory); function getCumulativeNotional() external view returns (SignedDecimal.signedDecimal memory); function getMaxHoldingBaseAsset() external view returns (Decimal.decimal memory); function getOpenInterestNotionalCap() external view returns (Decimal.decimal memory);
function getSettlementPrice() external view returns (Decimal.decimal memory); function getBaseAssetDeltaThisFundingPeriod() external view returns (SignedDecimal.signedDecimal memory); function getCumulativeNotional() external view returns (SignedDecimal.signedDecimal memory); function getMaxHoldingBaseAsset() external view returns (Decimal.decimal memory); function getOpenInterestNotionalCap() external view returns (Decimal.decimal memory);
27,664
19
// Use along with {balanceOf} to enumerate all of ``owner``'s tokens. /
function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256 tokenId);
function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256 tokenId);
8,165
20
// Amount of decimals for display purposes
decimals = 0;
decimals = 0;
28,401
111
// withdraw function to unstake LP Tokens
function withdraw(uint amountToWithdraw) public noContractsAllowed { require(amountToWithdraw > 0, "Cannot withdraw 0 Tokens!"); require(depositedTokens[msg.sender] >= amountToWithdraw, "Invalid amount to withdraw"); require(now.sub(depositTime[msg.sender]) > cliffTime, "You recently deposited, please wait before withdrawing."); updateAccount(msg.sender); require(Token(trustedDepositTokenAddress).transfer(msg.sender, amountToWithdraw), "Could not transfer tokens."); depositedTokens[msg.sender] = depositedTokens[msg.sender].sub(amountToWithdraw); totalTokens = totalTokens.sub(amountToWithdraw); if (holders.contains(msg.sender) && depositedTokens[msg.sender] == 0) { holders.remove(msg.sender); } }
function withdraw(uint amountToWithdraw) public noContractsAllowed { require(amountToWithdraw > 0, "Cannot withdraw 0 Tokens!"); require(depositedTokens[msg.sender] >= amountToWithdraw, "Invalid amount to withdraw"); require(now.sub(depositTime[msg.sender]) > cliffTime, "You recently deposited, please wait before withdrawing."); updateAccount(msg.sender); require(Token(trustedDepositTokenAddress).transfer(msg.sender, amountToWithdraw), "Could not transfer tokens."); depositedTokens[msg.sender] = depositedTokens[msg.sender].sub(amountToWithdraw); totalTokens = totalTokens.sub(amountToWithdraw); if (holders.contains(msg.sender) && depositedTokens[msg.sender] == 0) { holders.remove(msg.sender); } }
37,583
26
// We verify if the order has arrived to its final destination
}else if(keccak256(abi.encodePacked(currentLocation))==keccak256(abi.encodePacked(orders[id].finalDestination))){
}else if(keccak256(abi.encodePacked(currentLocation))==keccak256(abi.encodePacked(orders[id].finalDestination))){
38,531
133
// bytes4(keccak256("ZeroCantBeAuthorizedError()"))
bytes internal constant ZERO_CANT_BE_AUTHORIZED_ERROR_BYTES = hex"57654fe4";
bytes internal constant ZERO_CANT_BE_AUTHORIZED_ERROR_BYTES = hex"57654fe4";
35,993
28
// Rejects the specified bid. _NFTid The Id of the NFTDetail _bidId The Id of the bid. /
function rejectBid(uint256 _NFTid, uint256 _bidId) external whenNotPaused nonReentrant { require(!Bids[_NFTid][_bidId].withdrawn, "Already withdrawn"); require(!Bids[_NFTid][_bidId].bidAccepted, "Bid Already Accepted"); require( NFTdetails[_NFTid].tokenIdOwner == msg.sender, "You can't Accept This Bid" ); Bids[_NFTid][_bidId].withdrawn = true; require( IERC20(Bids[_NFTid][_bidId].ERC20Address).transfer( Bids[_NFTid][_bidId].bidderAddress, Bids[_NFTid][_bidId].Amount ), "unable to transfer to bidder Address" ); emit BidRejected( _NFTid, _bidId, Bids[_NFTid][_bidId].bidderAddress, Bids[_NFTid][_bidId].Amount ); }
function rejectBid(uint256 _NFTid, uint256 _bidId) external whenNotPaused nonReentrant { require(!Bids[_NFTid][_bidId].withdrawn, "Already withdrawn"); require(!Bids[_NFTid][_bidId].bidAccepted, "Bid Already Accepted"); require( NFTdetails[_NFTid].tokenIdOwner == msg.sender, "You can't Accept This Bid" ); Bids[_NFTid][_bidId].withdrawn = true; require( IERC20(Bids[_NFTid][_bidId].ERC20Address).transfer( Bids[_NFTid][_bidId].bidderAddress, Bids[_NFTid][_bidId].Amount ), "unable to transfer to bidder Address" ); emit BidRejected( _NFTid, _bidId, Bids[_NFTid][_bidId].bidderAddress, Bids[_NFTid][_bidId].Amount ); }
32,349
13
// receive ETH
receive() external payable;
receive() external payable;
53,147
4
// total ether submitted before fees.
uint256 _submitted = 0; uint256 public tier = 0;
uint256 _submitted = 0; uint256 public tier = 0;
40,520
35
// Nethny [TIIK]
contract Hub is ERC721, Ownable{ using Counters for Counters.Counter; constructor() ERC721("Dublicate_RMRK","DRMRK"){} Counters.Counter private _tokenIdCounter; // Optional mapping for token URIs mapping(uint256 => string) private _tokenURIs; function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { require(_exists(tokenId), "ERC721URIStorage: URI query for nonexistent token"); string memory _tokenURI = _tokenURIs[tokenId]; string memory base = _baseURI(); // If there is no base URI, return the token URI. if (bytes(base).length == 0) { return _tokenURI; } // If both are set, concatenate the baseURI and tokenURI (via abi.encodePacked). if (bytes(_tokenURI).length > 0) { return string(abi.encodePacked(base, _tokenURI)); } return super.tokenURI(tokenId); } function _setTokenURI(uint256 tokenId, string memory _tokenURI) internal virtual { require(_exists(tokenId), "ERC721URIStorage: URI set of nonexistent token"); _tokenURIs[tokenId] = _tokenURI; } function _burn(uint256 tokenId) internal virtual override { super._burn(tokenId); if (bytes(_tokenURIs[tokenId]).length != 0) { delete _tokenURIs[tokenId]; } } //ERC721 //----------------- //Custom function Mint(address to) public onlyOwner returns (uint) { uint temp = _tokenIdCounter.current(); _safeMint(to, temp); _tokenIdCounter.increment(); return temp; } struct Order{ string UID; string Address; } //Events event createdRMRKOrder(address Client, string UID); event createdMOVROrder(string Client, string UID); event filledRMRKOrder(address Client, string UID); event filledMOVROrder(string Client, string UID); //Some variables mapping (string => uint) private _matching; mapping (address => mapping(string => bool)) private _ordersRMRK; mapping (string => bool)private _storageRMRK; mapping (address => uint)private _lostMoney; mapping (uint => string)private _storageMeta; //pending mapping (address => mapping(string => bool)) private _pendingOrderRMKR; Order[] private _ordersMOVR; uint private _serverPayment = 0; uint private _deployPayment = 0; address payable private _reciever = payable(0x43A2cCed6d1B7ba37173336AA794bAAB2cB1f830); address payable private _bank = payable(0xEc92783237998d58d3323880A5515A2a444Ed3E6); address Bridge = address(0); //Flags bool private _paymentsOn = false; //Functions function initialize(address MyAddress) onlyOwner public{ Bridge = MyAddress; } function myLostMoney()public view returns(uint){ return _lostMoney[msg.sender]; } function takeMoney()public { require(_lostMoney[msg.sender]>0, "You didn't lose any money!"); payable(msg.sender).transfer(_lostMoney[msg.sender]); } function _pay()private returns (bool result){ _reciever.transfer(_deployPayment); _bank.transfer(_serverPayment); if(msg.value > _deployPayment + _serverPayment){ _lostMoney[msg.sender] = msg.value - _deployPayment + _serverPayment; } return true; } function createRMRKOrder(address Client, string memory UID) public payable { require(Bridge != address(0), "Please initialize the contract!"); if(_paymentsOn){ require(msg.value >= _serverPayment + _deployPayment); _pay(); } require(bytes(UID).length != 0); require(Client != address(0)); //Check pending Order if(_pendingOrderRMKR[Client][UID]){ safeTransferFrom(Bridge, Client, _matching[UID]); }else{ _ordersRMRK[Client][UID] = true; } emit createdRMRKOrder(Client,UID); } function createMOVROrder(string memory Client, string memory UID)public payable{ require(Bridge != address(0), "Please initialize the contract!"); if(_paymentsOn){ require(msg.value >= _serverPayment + _deployPayment); _pay(); } require(bytes(UID).length != 0); require(bytes(Client).length != 0); require(msg.sender == ownerOf(_matching[UID])); require(_storageRMRK[UID]); safeTransferFrom(msg.sender, Bridge, _matching[UID]); _burn(_matching[UID]); Order memory order; order.UID = UID; order.Address = Client; _ordersMOVR.push(order); emit createdMOVROrder(Client,UID); } function fillRMRKOrder(address Client, string memory UID, string memory URI, string memory data) onlyOwner public{ require(Bridge != address(0), "Please initialize the contract!"); require(bytes(URI).length != 0); require(bytes(data).length != 0); require(Client != address(0), "Dont fill 0 address!"); if(_ordersRMRK[Client][UID]){ uint ID = Mint(Client); _matching[UID] = ID; _setTokenURI(ID,URI); _storageRMRK[UID] = true; _ordersRMRK[Client][UID] = false; _storageMeta[ID] = data; emit filledRMRKOrder(Client,UID); }else{ uint ID = Mint(Bridge); _matching[UID] = ID; _setTokenURI(ID,URI); _storageRMRK[UID] = true; _pendingOrderRMKR[Client][UID]=true; _storageMeta[ID] = data; emit filledRMRKOrder(Bridge,UID); } } function fillMOVROrders() onlyOwner public{ for (uint i =0;i <= _ordersMOVR.length; i = i + 1){ _storageRMRK[_ordersMOVR[i].UID] = false; } while(_ordersMOVR.length != 0){ _ordersMOVR.pop(); } } //Get Functions function getMeta(uint ID)public view returns (string memory){ return _storageMeta[ID]; } function getID(string memory UID)public view returns (uint){ return _matching[UID]; } function getServerPayments() public view returns (uint){ return _serverPayment; } function getDeployPayments() public view returns (uint){ return _deployPayment; } function getAddressReciever() public view returns (address){ return _reciever; } function getAddressBank() public view returns (address){ return _bank; } //Set Functions function addMOVROrders(string memory Client, string memory UID) onlyOwner public{ Order memory order; order.UID = UID; order.Address = Client; _ordersMOVR.push(order); } function changeServerPayments(uint New) onlyOwner public{ _serverPayment = New; } function changeDeployPayments(uint New) onlyOwner public{ _deployPayment = New; } function changeAddressReciever(address New) onlyOwner public{ _reciever = payable(New); } function changeAddressBank(address New) onlyOwner public{ _bank = payable(New); } function switchFee(bool New)onlyOwner public{ _paymentsOn = New; } }
contract Hub is ERC721, Ownable{ using Counters for Counters.Counter; constructor() ERC721("Dublicate_RMRK","DRMRK"){} Counters.Counter private _tokenIdCounter; // Optional mapping for token URIs mapping(uint256 => string) private _tokenURIs; function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { require(_exists(tokenId), "ERC721URIStorage: URI query for nonexistent token"); string memory _tokenURI = _tokenURIs[tokenId]; string memory base = _baseURI(); // If there is no base URI, return the token URI. if (bytes(base).length == 0) { return _tokenURI; } // If both are set, concatenate the baseURI and tokenURI (via abi.encodePacked). if (bytes(_tokenURI).length > 0) { return string(abi.encodePacked(base, _tokenURI)); } return super.tokenURI(tokenId); } function _setTokenURI(uint256 tokenId, string memory _tokenURI) internal virtual { require(_exists(tokenId), "ERC721URIStorage: URI set of nonexistent token"); _tokenURIs[tokenId] = _tokenURI; } function _burn(uint256 tokenId) internal virtual override { super._burn(tokenId); if (bytes(_tokenURIs[tokenId]).length != 0) { delete _tokenURIs[tokenId]; } } //ERC721 //----------------- //Custom function Mint(address to) public onlyOwner returns (uint) { uint temp = _tokenIdCounter.current(); _safeMint(to, temp); _tokenIdCounter.increment(); return temp; } struct Order{ string UID; string Address; } //Events event createdRMRKOrder(address Client, string UID); event createdMOVROrder(string Client, string UID); event filledRMRKOrder(address Client, string UID); event filledMOVROrder(string Client, string UID); //Some variables mapping (string => uint) private _matching; mapping (address => mapping(string => bool)) private _ordersRMRK; mapping (string => bool)private _storageRMRK; mapping (address => uint)private _lostMoney; mapping (uint => string)private _storageMeta; //pending mapping (address => mapping(string => bool)) private _pendingOrderRMKR; Order[] private _ordersMOVR; uint private _serverPayment = 0; uint private _deployPayment = 0; address payable private _reciever = payable(0x43A2cCed6d1B7ba37173336AA794bAAB2cB1f830); address payable private _bank = payable(0xEc92783237998d58d3323880A5515A2a444Ed3E6); address Bridge = address(0); //Flags bool private _paymentsOn = false; //Functions function initialize(address MyAddress) onlyOwner public{ Bridge = MyAddress; } function myLostMoney()public view returns(uint){ return _lostMoney[msg.sender]; } function takeMoney()public { require(_lostMoney[msg.sender]>0, "You didn't lose any money!"); payable(msg.sender).transfer(_lostMoney[msg.sender]); } function _pay()private returns (bool result){ _reciever.transfer(_deployPayment); _bank.transfer(_serverPayment); if(msg.value > _deployPayment + _serverPayment){ _lostMoney[msg.sender] = msg.value - _deployPayment + _serverPayment; } return true; } function createRMRKOrder(address Client, string memory UID) public payable { require(Bridge != address(0), "Please initialize the contract!"); if(_paymentsOn){ require(msg.value >= _serverPayment + _deployPayment); _pay(); } require(bytes(UID).length != 0); require(Client != address(0)); //Check pending Order if(_pendingOrderRMKR[Client][UID]){ safeTransferFrom(Bridge, Client, _matching[UID]); }else{ _ordersRMRK[Client][UID] = true; } emit createdRMRKOrder(Client,UID); } function createMOVROrder(string memory Client, string memory UID)public payable{ require(Bridge != address(0), "Please initialize the contract!"); if(_paymentsOn){ require(msg.value >= _serverPayment + _deployPayment); _pay(); } require(bytes(UID).length != 0); require(bytes(Client).length != 0); require(msg.sender == ownerOf(_matching[UID])); require(_storageRMRK[UID]); safeTransferFrom(msg.sender, Bridge, _matching[UID]); _burn(_matching[UID]); Order memory order; order.UID = UID; order.Address = Client; _ordersMOVR.push(order); emit createdMOVROrder(Client,UID); } function fillRMRKOrder(address Client, string memory UID, string memory URI, string memory data) onlyOwner public{ require(Bridge != address(0), "Please initialize the contract!"); require(bytes(URI).length != 0); require(bytes(data).length != 0); require(Client != address(0), "Dont fill 0 address!"); if(_ordersRMRK[Client][UID]){ uint ID = Mint(Client); _matching[UID] = ID; _setTokenURI(ID,URI); _storageRMRK[UID] = true; _ordersRMRK[Client][UID] = false; _storageMeta[ID] = data; emit filledRMRKOrder(Client,UID); }else{ uint ID = Mint(Bridge); _matching[UID] = ID; _setTokenURI(ID,URI); _storageRMRK[UID] = true; _pendingOrderRMKR[Client][UID]=true; _storageMeta[ID] = data; emit filledRMRKOrder(Bridge,UID); } } function fillMOVROrders() onlyOwner public{ for (uint i =0;i <= _ordersMOVR.length; i = i + 1){ _storageRMRK[_ordersMOVR[i].UID] = false; } while(_ordersMOVR.length != 0){ _ordersMOVR.pop(); } } //Get Functions function getMeta(uint ID)public view returns (string memory){ return _storageMeta[ID]; } function getID(string memory UID)public view returns (uint){ return _matching[UID]; } function getServerPayments() public view returns (uint){ return _serverPayment; } function getDeployPayments() public view returns (uint){ return _deployPayment; } function getAddressReciever() public view returns (address){ return _reciever; } function getAddressBank() public view returns (address){ return _bank; } //Set Functions function addMOVROrders(string memory Client, string memory UID) onlyOwner public{ Order memory order; order.UID = UID; order.Address = Client; _ordersMOVR.push(order); } function changeServerPayments(uint New) onlyOwner public{ _serverPayment = New; } function changeDeployPayments(uint New) onlyOwner public{ _deployPayment = New; } function changeAddressReciever(address New) onlyOwner public{ _reciever = payable(New); } function changeAddressBank(address New) onlyOwner public{ _bank = payable(New); } function switchFee(bool New)onlyOwner public{ _paymentsOn = New; } }
30,993
323
// Construct a new Configurable Rights Pool (wrapper around BPool) _initialTokens and _swapFee are only used for temporary storage between construction and create pool, and should not be used thereafter! _initialTokens is destroyed in createPool to prevent this, and _swapFee is kept in sync (defensively), but should never be used except in this constructor and createPool() factoryAddress - the BPoolFactory used to create the underlying pool poolParams - struct containing pool parameters rightsStruct - Set of permissions we are assigning to this smart pool /
constructor( address factoryAddress, PoolParams memory poolParams, RightsManager.Rights memory rightsStruct
constructor( address factoryAddress, PoolParams memory poolParams, RightsManager.Rights memory rightsStruct
16,218
340
// Automated market maker that lets users buy and sell options from it Creates a long token representing a call/put option and a short tokenrepresenting a covered call option. This contract is used for for both call and put options since they are inversesof each other. For example a ETH/USD call option with a strike of 100 isequivalent to a USD/ETH put option with a strike of 0.01. So for put optionswe use the reciprocals of the strike price and settlement price and alsomultiply the cost by the strike price so that underlying is in terms ofETH, not USD. In this
function initialize( address _baseToken, address _oracle, bool _isPutMarket, uint256 _strikePrice, uint256 _alpha, uint256 _expiryTime, address _longToken, address _shortToken
function initialize( address _baseToken, address _oracle, bool _isPutMarket, uint256 _strikePrice, uint256 _alpha, uint256 _expiryTime, address _longToken, address _shortToken
38,721
40
// Retrieves current maximum amount of tokens per one transfer for a particular token contract._token address of the token contract. return maximum amount on tokens that can be sent through the bridge in one transfer./
function maxPerTx(address _token) public view returns (uint256) { return uintStorage[keccak256(abi.encodePacked("maxPerTx", _token))]; }
function maxPerTx(address _token) public view returns (uint256) { return uintStorage[keccak256(abi.encodePacked("maxPerTx", _token))]; }
20,944
51
// Emitted when an offer is cancelled.
event CancelledOffer(address indexed offeror, uint256 indexed offerId);
event CancelledOffer(address indexed offeror, uint256 indexed offerId);
7,329
3
// The ROLL TOKEN!
RollToken public roll; address public devAddress; address public feeAddress;
RollToken public roll; address public devAddress; address public feeAddress;
4,721
25
// ADMIN//
function enableCollection( uint256 collectionId
function enableCollection( uint256 collectionId
11,536
54
// Deposit native tokens to bridge /
function depositNativeTokens() external payable { emit TokensDeposit(msg.sender, msg.value); }
function depositNativeTokens() external payable { emit TokensDeposit(msg.sender, msg.value); }
4,264
65
// -----------Private Varibales---------------/-----------Mapping---------------/-----------Arrays--------------/-----------enums---------------
enum Status {CREATED, ACTIVE} /*----------Modifier------------- -----------------------------------*/ modifier onlyOwner(){ require(msg.sender == owner,"only owner"); _; }
enum Status {CREATED, ACTIVE} /*----------Modifier------------- -----------------------------------*/ modifier onlyOwner(){ require(msg.sender == owner,"only owner"); _; }
64,827
4
// =================Transactions================Constructor
function Owner(address _ownerAddress, uint _idCustomer) { creatorAddress = msg.sender; ownerAddress = _ownerAddress; idCustomer = _idCustomer; isInitiated = true; }
function Owner(address _ownerAddress, uint _idCustomer) { creatorAddress = msg.sender; ownerAddress = _ownerAddress; idCustomer = _idCustomer; isInitiated = true; }
44,658
84
// Change the duration of the challenge period. _challengePeriodDuration The new duration of the challenge period. /
function changeChallengePeriodDuration(uint256 _challengePeriodDuration) external onlyGovernor { challengePeriodDuration = _challengePeriodDuration; }
function changeChallengePeriodDuration(uint256 _challengePeriodDuration) external onlyGovernor { challengePeriodDuration = _challengePeriodDuration; }
25,235
111
// get vote status._id data source id./
function isVoteOpen(uint256 _id) external view returns (bool) { return (votes[_id].deadline > 0) && (now <= votes[_id].deadline); }
function isVoteOpen(uint256 _id) external view returns (bool) { return (votes[_id].deadline > 0) && (now <= votes[_id].deadline); }
29,259
56
// buys
if(zeroBuyTaxmode){ if(tradingOpen && from == uniswapV2Pair) { currenttotalFee=0; }
if(zeroBuyTaxmode){ if(tradingOpen && from == uniswapV2Pair) { currenttotalFee=0; }
13,347
19
// Activate role
function giveRole(uint256 role, address actor) external onlyOwnerExec { _giveRole(role, actor); }
function giveRole(uint256 role, address actor) external onlyOwnerExec { _giveRole(role, actor); }
46,905
3
// Cancel all pending orders for a sender minNonce minimum user nonce /
function cancelAllOrdersForSender(uint256 minNonce) external { require(minNonce > userMinOrderNonce[msg.sender], "Cancel: Order nonce lower than current"); require(minNonce < userMinOrderNonce[msg.sender] + 500000, "Cancel: Cannot cancel more orders"); userMinOrderNonce[msg.sender] = minNonce; emit CancelAllOrders(msg.sender, minNonce); }
function cancelAllOrdersForSender(uint256 minNonce) external { require(minNonce > userMinOrderNonce[msg.sender], "Cancel: Order nonce lower than current"); require(minNonce < userMinOrderNonce[msg.sender] + 500000, "Cancel: Cannot cancel more orders"); userMinOrderNonce[msg.sender] = minNonce; emit CancelAllOrders(msg.sender, minNonce); }
15,491
22
// 打开锁定期自动释放开关/
function openAutoFree(address who) whenAdministrator(msg.sender) public { delete autoFreeLockBalance[who]; emit OpenAutoFree(msg.sender, who); }
function openAutoFree(address who) whenAdministrator(msg.sender) public { delete autoFreeLockBalance[who]; emit OpenAutoFree(msg.sender, who); }
30,997
123
// e.g. assume scale = fullScale z = 10e189e17 = 9e36 return 9e38 / 1e18 = 9e18
return (x * y) / scale;
return (x * y) / scale;
15,461
0
// msg represent the current message received by the contracts
msg.sender; // address of sender msg.value; // amount of ether provided to this contract in wei msg.data; // bytes, complete call data msg.gas; // remaining gas msg.sig; // return the first four bytes of the call data
msg.sender; // address of sender msg.value; // amount of ether provided to this contract in wei msg.data; // bytes, complete call data msg.gas; // remaining gas msg.sig; // return the first four bytes of the call data
45,451
14
// 清空使用者
function removeAllWorkers() external ensure_owner() returns(uint count) { count = 0; for (uint i; i < allWorkers.length ; i++) { address addr = allWorkers[i]; if(getWorker[addr].exists) { delete getWorker[addr]; count++; } } delete allWorkers; }
function removeAllWorkers() external ensure_owner() returns(uint count) { count = 0; for (uint i; i < allWorkers.length ; i++) { address addr = allWorkers[i]; if(getWorker[addr].exists) { delete getWorker[addr]; count++; } } delete allWorkers; }
3,833
48
// handling the pushing of local receipts_message message/
function pushReceipt(uint256 id, bytes memory _message) internal { push_receipt_counter = push_receipt_counter + 1; uint256 receipt_id = id + receipt_flag; Message memory message = Message(receipt_id, _message, block.number, true); batches[available_batch_id] = message; outbound[receipt_id] = available_batch_id; available_batch_id++; }
function pushReceipt(uint256 id, bytes memory _message) internal { push_receipt_counter = push_receipt_counter + 1; uint256 receipt_id = id + receipt_flag; Message memory message = Message(receipt_id, _message, block.number, true); batches[available_batch_id] = message; outbound[receipt_id] = available_batch_id; available_batch_id++; }
20,063
7
// Cash Faucet Faucet contract for Tesnet CASH (Dai) /
contract CashFaucet is ICashFaucet { IDaiVat public vat; IDaiJoin public daiJoin; IERC20 public col; IDaiJoin public colJoin; bytes32 public colIlk; IDaiFaucet public mcdFaucet; IERC20 public dai; constructor(IAugur _augur) public { vat = IDaiVat(_augur.lookup("DaiVat")); mcdFaucet = IDaiFaucet(_augur.lookup("MCDFaucet")); col = IERC20(_augur.lookup("MCDCol")); colJoin = IDaiJoin(_augur.lookup("MCDColJoin")); daiJoin = IDaiJoin(_augur.lookup("DaiJoin")); dai = IERC20(_augur.lookup("Cash")); colIlk = bytes32("REP-A"); col.approve(address(colJoin), 2**256 - 1); dai.approve(address(daiJoin), 2**256 - 1); col.approve(address(vat), 2**256 - 1); dai.approve(address(vat), 2**256 - 1); vat.hope(address(daiJoin)); } function faucet(uint256) public returns (bool) { // generate collateral by creating a proxy that will faucet for us. We do this because the MCD faucet only allows one use per address new CashFaucetProxy(mcdFaucet, col); // get balance of collateral uint256 balance = col.balanceOf(address(this)); // Deposit collateral colJoin.join(address(this), balance); // Open a CDP and issue max DAI (uint256 art, uint256 rate, uint256 spot, uint256 line, uint256 dust) = vat.ilks(colIlk); uint256 daiReceived = spot * balance / 10**27 - 10**18; vat.frob(colIlk, address(this), address(this),address(this), int256(balance), int256(daiReceived)); // Mint DAI for the sender daiJoin.exit(msg.sender, daiReceived); return true; } }
contract CashFaucet is ICashFaucet { IDaiVat public vat; IDaiJoin public daiJoin; IERC20 public col; IDaiJoin public colJoin; bytes32 public colIlk; IDaiFaucet public mcdFaucet; IERC20 public dai; constructor(IAugur _augur) public { vat = IDaiVat(_augur.lookup("DaiVat")); mcdFaucet = IDaiFaucet(_augur.lookup("MCDFaucet")); col = IERC20(_augur.lookup("MCDCol")); colJoin = IDaiJoin(_augur.lookup("MCDColJoin")); daiJoin = IDaiJoin(_augur.lookup("DaiJoin")); dai = IERC20(_augur.lookup("Cash")); colIlk = bytes32("REP-A"); col.approve(address(colJoin), 2**256 - 1); dai.approve(address(daiJoin), 2**256 - 1); col.approve(address(vat), 2**256 - 1); dai.approve(address(vat), 2**256 - 1); vat.hope(address(daiJoin)); } function faucet(uint256) public returns (bool) { // generate collateral by creating a proxy that will faucet for us. We do this because the MCD faucet only allows one use per address new CashFaucetProxy(mcdFaucet, col); // get balance of collateral uint256 balance = col.balanceOf(address(this)); // Deposit collateral colJoin.join(address(this), balance); // Open a CDP and issue max DAI (uint256 art, uint256 rate, uint256 spot, uint256 line, uint256 dust) = vat.ilks(colIlk); uint256 daiReceived = spot * balance / 10**27 - 10**18; vat.frob(colIlk, address(this), address(this),address(this), int256(balance), int256(daiReceived)); // Mint DAI for the sender daiJoin.exit(msg.sender, daiReceived); return true; } }
32,868
156
// used for giveaways
uint256 public amountForDevs = 144;
uint256 public amountForDevs = 144;
29,605
7
// solhint-disable-next-line avoid-low-level-calls /decode return value of execute:
(callSuccess, ret) = abi.decode(ret, (bool, bytes));
(callSuccess, ret) = abi.decode(ret, (bool, bytes));
7,331
260
// Removes every address from the list/self The Mapping struct that this function is attached to
function clearAll(Mapping storage self) internal { address currentAddress = self.addressMap[SENTINEL]; while (currentAddress != address(0) && currentAddress != SENTINEL) { address nextAddress = self.addressMap[currentAddress]; delete self.addressMap[currentAddress]; currentAddress = nextAddress; } self.addressMap[SENTINEL] = SENTINEL; self.count = 0; }
function clearAll(Mapping storage self) internal { address currentAddress = self.addressMap[SENTINEL]; while (currentAddress != address(0) && currentAddress != SENTINEL) { address nextAddress = self.addressMap[currentAddress]; delete self.addressMap[currentAddress]; currentAddress = nextAddress; } self.addressMap[SENTINEL] = SENTINEL; self.count = 0; }
13,664
4
// Standard math utilities missing in the Solidity language. /
library Math { /** * @dev Returns the largest of two numbers. */ function max(uint256 a, uint256 b) internal pure returns (uint256) { return a >= b ? a : b; } /** * @dev Returns the smallest of two numbers. */ function min(uint256 a, uint256 b) internal pure returns (uint256) { return a < b ? a : b; } /** * @dev Returns the average of two numbers. The result is rounded towards * zero. */ function average(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b) / 2 can overflow, so we distribute return (a / 2) + (b / 2) + ((a % 2 + b % 2) / 2); } }
library Math { /** * @dev Returns the largest of two numbers. */ function max(uint256 a, uint256 b) internal pure returns (uint256) { return a >= b ? a : b; } /** * @dev Returns the smallest of two numbers. */ function min(uint256 a, uint256 b) internal pure returns (uint256) { return a < b ? a : b; } /** * @dev Returns the average of two numbers. The result is rounded towards * zero. */ function average(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b) / 2 can overflow, so we distribute return (a / 2) + (b / 2) + ((a % 2 + b % 2) / 2); } }
1,007
49
// Total = 100% (1000)
uint256 public marketingPortionOfSwap = 500; // 50% uint256 public devPortionOfSwap = 200; // 20% uint256 public teamPortionOfSwap = 150; // 15% uint256 public lpPortionOfSwap = 150; // 15% IPancakeV2Router public router; address public pair; mapping (address => uint256) internal _reflectedBalances;
uint256 public marketingPortionOfSwap = 500; // 50% uint256 public devPortionOfSwap = 200; // 20% uint256 public teamPortionOfSwap = 150; // 15% uint256 public lpPortionOfSwap = 150; // 15% IPancakeV2Router public router; address public pair; mapping (address => uint256) internal _reflectedBalances;
34,737
91
// Calculate token distribution.
uint256 platformFee = calculatePlatformFee(_amount); uint256 idvFee = platformFee > 0 ? _amount.sub(platformFee) : _amount;
uint256 platformFee = calculatePlatformFee(_amount); uint256 idvFee = platformFee > 0 ? _amount.sub(platformFee) : _amount;
15,668
63
// Moves tokens `amount` from `sender` to `recipient`. This is internal function is equivalent to {transfer}, and can be used toe.g. implement automatic token fees, slashing mechanisms, etc. Emits a {Transfer} event. Requirements: - `sender` cannot be the zero address.- `recipient` cannot be the zero address.- `sender` must have a balance of at least `amount`. /
function _transfer(
function _transfer(
4,094
105
// Constructor function/
constructor (string memory name, string memory symbol) public { _name = name; _symbol = symbol; // register the supported interfaces to conform to ERC721 via ERC165 _registerInterface(_INTERFACE_ID_ERC721_METADATA); }
constructor (string memory name, string memory symbol) public { _name = name; _symbol = symbol; // register the supported interfaces to conform to ERC721 via ERC165 _registerInterface(_INTERFACE_ID_ERC721_METADATA); }
19,994
21
// 14: no partial fills, only offerer or zone can execute
ERC20_TO_ERC1155_FULL_RESTRICTED,
ERC20_TO_ERC1155_FULL_RESTRICTED,
30,178
4
// Apply the transition and record the resulting storage slots
if (transitionType == tn.TN_TYPE_DEPOSIT) { require(_infos.accountInfos.length == 1, ErrMsg.REQ_ONE_ACCT); dt.DepositTransition memory deposit = tn.decodePackedDepositTransition(_transition); updatedInfos.accountInfos[0] = transitionApplier1.applyDepositTransition(deposit, _infos.accountInfos[0]); outputs[0] = getAccountInfoHash(updatedInfos.accountInfos[0]); } else if (transitionType == tn.TN_TYPE_WITHDRAW) {
if (transitionType == tn.TN_TYPE_DEPOSIT) { require(_infos.accountInfos.length == 1, ErrMsg.REQ_ONE_ACCT); dt.DepositTransition memory deposit = tn.decodePackedDepositTransition(_transition); updatedInfos.accountInfos[0] = transitionApplier1.applyDepositTransition(deposit, _infos.accountInfos[0]); outputs[0] = getAccountInfoHash(updatedInfos.accountInfos[0]); } else if (transitionType == tn.TN_TYPE_WITHDRAW) {
53,797
7
// Delegates execution to an implementation contract.This is a low level function that doesn't return to its internal call site.It will return to the external caller whatever the implementation returns. implementation Address to delegate. /
function _delegate(address implementation) internal { assembly { // Copy msg.data. We take full control of memory in this inline assembly // block because it will not return to Solidity code. We overwrite the // Solidity scratch pad at memory position 0. calldatacopy(0, 0, calldatasize()) // Call the implementation. // out and outsize are 0 because we don't know the size yet. let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0) // Copy the returned data. returndatacopy(0, 0, returndatasize()) switch result // delegatecall returns 0 on error. case 0 { revert(0, returndatasize()) } default { return(0, returndatasize()) } } }
function _delegate(address implementation) internal { assembly { // Copy msg.data. We take full control of memory in this inline assembly // block because it will not return to Solidity code. We overwrite the // Solidity scratch pad at memory position 0. calldatacopy(0, 0, calldatasize()) // Call the implementation. // out and outsize are 0 because we don't know the size yet. let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0) // Copy the returned data. returndatacopy(0, 0, returndatasize()) switch result // delegatecall returns 0 on error. case 0 { revert(0, returndatasize()) } default { return(0, returndatasize()) } } }
4,808
140
// Calculate the remaining amount.
uint256 total = allocation.total; uint256 remainder = total.sub(allocation.claimed);
uint256 total = allocation.total; uint256 remainder = total.sub(allocation.claimed);
77,599
44
// See IMedia /
function finalize() external override onlyOwner
function finalize() external override onlyOwner
9,450
16
// Emits a {BatchMinted} eventCollateral token, nonce, token ids, batch size, and quantities are encoded,hashed and stored as the ERC1155CollateralWrapper token ID. token Collateral token address tokenIds List of token ids quantities List of quantities /
function mint( address token, uint256[] calldata tokenIds, uint256[] calldata quantities ) external nonReentrant returns (uint256) {
function mint( address token, uint256[] calldata tokenIds, uint256[] calldata quantities ) external nonReentrant returns (uint256) {
34,163
6
// The timestamp of the last sending of tokens to community vault/ return The timestamp truncated to 32 bits
function communityFeeLastTimestamp() external view returns (uint32);
function communityFeeLastTimestamp() external view returns (uint32);
23,017
1
// allow identification of user
UserIdentity ui;
UserIdentity ui;
15,437
11
// Remind people to commit before submitting the solution
require(commitment[msg.sender].timestamp != 0); bytes memory keyHash = getHash(_publicKey);
require(commitment[msg.sender].timestamp != 0); bytes memory keyHash = getHash(_publicKey);
26,568
84
// Calculates the expected returned swap amount/amount The given input amount of tokens/yieldShareIn Specifies whether to calculate the swap from TYS to TPS (if true) or from TPS to TYS/ return The expected returned amount of outToken
function getExpectedReturnGivenIn(uint256 amount, bool yieldShareIn) external view returns (uint256);
function getExpectedReturnGivenIn(uint256 amount, bool yieldShareIn) external view returns (uint256);
43,683
105
// e.g. 13814538111.399...e18 / 1e18 = 13814538111
return ceil.div(FULL_SCALE);
return ceil.div(FULL_SCALE);
25,445
6
// Returns true if a `leafs` can be proved to be a part of a Merkle treedefined by `root`. For this, `proofs` for each leaf must be provided, containingsibling hashes on the branch from the leaf to the root of the tree. Then'proofFlag' designates the nodes needed for the multi proof. /
function multiProofVerify( bytes32 root, bytes32[] memory leafs, bytes32[] memory proofs, bool[] memory proofFlag
function multiProofVerify( bytes32 root, bytes32[] memory leafs, bytes32[] memory proofs, bool[] memory proofFlag
2,964
796
// Each external function is dynamically assigned an action identifier as the hash of the disambiguator and the function selector. Disambiguation is necessary to avoid potential collisions in the function selectors of multiple contracts.
return keccak256(abi.encodePacked(_actionIdDisambiguator, selector));
return keccak256(abi.encodePacked(_actionIdDisambiguator, selector));
15,179
4
// Emitted when a new implementation upgrade is queued.
event UpgradeAnnounced(address newImplementation);
event UpgradeAnnounced(address newImplementation);
71,645
157
// Retrieves the period (index-1 based) for the specified cycle and period length. reverts if the specified cycle is zero. cycle The cycle within the period to retrieve. periodLengthInCycles_ Length of a period, in cycles.return The period (index-1 based) for the specified cycle and period length. /
function _getPeriod(uint16 cycle, uint16 periodLengthInCycles_) internal pure returns (uint16) { require(cycle != 0, "NftStaking: cycle cannot be zero"); return (cycle - 1) / periodLengthInCycles_ + 1; }
function _getPeriod(uint16 cycle, uint16 periodLengthInCycles_) internal pure returns (uint16) { require(cycle != 0, "NftStaking: cycle cannot be zero"); return (cycle - 1) / periodLengthInCycles_ + 1; }
68,137
77
// 超过每轮目标部分退款
if (result[0] > 0) { msg.sender.transfer(result[0]); }
if (result[0] > 0) { msg.sender.transfer(result[0]); }
8,266
320
// round 39
ark(i, q, 2781996465394730190470582631099299305677291329609718650018200531245670229393); sbox_partial(i, q); mix(i, q);
ark(i, q, 2781996465394730190470582631099299305677291329609718650018200531245670229393); sbox_partial(i, q); mix(i, q);
32,601
264
// Helper to add liquidity
function __uniswapV2Lend( address _recipient, address _tokenA, address _tokenB, uint256 _amountADesired, uint256 _amountBDesired, uint256 _amountAMin, uint256 _amountBMin
function __uniswapV2Lend( address _recipient, address _tokenA, address _tokenB, uint256 _amountADesired, uint256 _amountBDesired, uint256 _amountAMin, uint256 _amountBMin
83,855
117
// 5. postStakeOut (quasar->star nft; burn quasar)
if (campaignStakeConfigs[_cid].burnRequired) { _starNFT.burn(msg.sender, _nftID); } else {
if (campaignStakeConfigs[_cid].burnRequired) { _starNFT.burn(msg.sender, _nftID); } else {
52,692
20
// Returns the URI of the token with the given tokenId./tokenId Token Id of the NFT that you are getting the URI./ return Base64-encoded token metadata.
function tokenURI(uint256 tokenId) public view override returns (string memory) { Token memory token = tokens[tokenId]; return string( abi.encodePacked( 'data:application/json;base64,', Base64.encode( abi.encodePacked( _getTokenURIBeforeImage(token.name, token.description), Base64.encode( bytes( ISvgGenerator(svgGenerator).generateSvg( tokenId, token.minter, token.category, token.name, token.availabilityFrom, token.availabilityTo, token.duration, token.redeemed, token.forSale ) ) ), _getTokenURIAfterImage( token.category, token.minter, token.availabilityFrom, token.availabilityTo, token.duration, token.redeemed ) ) ) ) ); }
function tokenURI(uint256 tokenId) public view override returns (string memory) { Token memory token = tokens[tokenId]; return string( abi.encodePacked( 'data:application/json;base64,', Base64.encode( abi.encodePacked( _getTokenURIBeforeImage(token.name, token.description), Base64.encode( bytes( ISvgGenerator(svgGenerator).generateSvg( tokenId, token.minter, token.category, token.name, token.availabilityFrom, token.availabilityTo, token.duration, token.redeemed, token.forSale ) ) ), _getTokenURIAfterImage( token.category, token.minter, token.availabilityFrom, token.availabilityTo, token.duration, token.redeemed ) ) ) ) ); }
30,894
0
// import files from common directory
interface TokenInterface { function allowance(address, address) external view returns (uint); function balanceOf(address) external view returns (uint); function approve(address, uint) external; function transfer(address, uint) external returns (bool); function transferFrom(address, address, uint) external returns (bool); }
interface TokenInterface { function allowance(address, address) external view returns (uint); function balanceOf(address) external view returns (uint); function approve(address, uint) external; function transfer(address, uint) external returns (bool); function transferFrom(address, address, uint) external returns (bool); }
39,489
119
// Fill in index 0 to null requests
CSCPreSaleItem memory _Obj = CSCPreSaleItem(0, stringToBytes32("DummyAsset"), 0, 0, address(this), true); allPreSaleItems.push(_Obj);
CSCPreSaleItem memory _Obj = CSCPreSaleItem(0, stringToBytes32("DummyAsset"), 0, 0, address(this), true); allPreSaleItems.push(_Obj);
18,667
67
// Approve `spender` to transfer up to `amount` from `src`/This will overwrite the approval amount for `spender`/and is subject to issues noted [here](https:eips.ethereum.org/EIPS/eip-20approve)/spender The address of the account which may transfer tokens/amount The number of tokens that are approved/ return success Whether or not the approval succeeded
function approve(address spender, uint256 amount) external returns (bool success);
function approve(address spender, uint256 amount) external returns (bool success);
52,662
143
// Finalize the crowdsale and token minting, and transfer ownership ofthe token, can be called only by owner /
function finalization() internal { super.finalization(); // Multiplying tokens sold by 0,219512195122 // 18 / 82 = 0,219512195122 , which means that for every token sold in ICO // 0,219512195122 extra tokens will be issued. uint256 extraTokens = token.totalSupply().mul(219512195122).div(1000000000000); uint256 teamTokens = extraTokens.div(3); uint256 FSNASTokens = extraTokens.div(3).mul(2); // Mint toke time locks to team TokenTimelock firstBatch = new TokenTimelock(token, teamAddress, now.add(30 days)); token.mint(firstBatch, teamTokens.div(2)); TokenTimelock secondBatch = new TokenTimelock(token, teamAddress, now.add(1 years)); token.mint(secondBatch, teamTokens.div(2).div(3)); TokenTimelock thirdBatch = new TokenTimelock(token, teamAddress, now.add(2 years)); token.mint(thirdBatch, teamTokens.div(2).div(3)); TokenTimelock fourthBatch = new TokenTimelock(token, teamAddress, now.add(3 years)); token.mint(fourthBatch, teamTokens.div(2).div(3)); VestedTeamTokens(firstBatch, secondBatch, thirdBatch, fourthBatch); // Mint FSNAS tokens token.mint(FSNASAddress, FSNASTokens); // Finsih the minting token.finishMinting(); // Transfer ownership of token to company wallet token.transferOwnership(wallet); }
function finalization() internal { super.finalization(); // Multiplying tokens sold by 0,219512195122 // 18 / 82 = 0,219512195122 , which means that for every token sold in ICO // 0,219512195122 extra tokens will be issued. uint256 extraTokens = token.totalSupply().mul(219512195122).div(1000000000000); uint256 teamTokens = extraTokens.div(3); uint256 FSNASTokens = extraTokens.div(3).mul(2); // Mint toke time locks to team TokenTimelock firstBatch = new TokenTimelock(token, teamAddress, now.add(30 days)); token.mint(firstBatch, teamTokens.div(2)); TokenTimelock secondBatch = new TokenTimelock(token, teamAddress, now.add(1 years)); token.mint(secondBatch, teamTokens.div(2).div(3)); TokenTimelock thirdBatch = new TokenTimelock(token, teamAddress, now.add(2 years)); token.mint(thirdBatch, teamTokens.div(2).div(3)); TokenTimelock fourthBatch = new TokenTimelock(token, teamAddress, now.add(3 years)); token.mint(fourthBatch, teamTokens.div(2).div(3)); VestedTeamTokens(firstBatch, secondBatch, thirdBatch, fourthBatch); // Mint FSNAS tokens token.mint(FSNASAddress, FSNASTokens); // Finsih the minting token.finishMinting(); // Transfer ownership of token to company wallet token.transferOwnership(wallet); }
34,989
2
// Passenger mapping
mapping(address => Passenger) public insurancePassengers;
mapping(address => Passenger) public insurancePassengers;
30,119
19
// Require that the total pay at least the arbitration cost.
require(transaction.senderFee >= arbitrationCost, "The sender fee must cover arbitration costs."); transaction.lastInteraction = now;
require(transaction.senderFee >= arbitrationCost, "The sender fee must cover arbitration costs."); transaction.lastInteraction = now;
814
98
// Allowlist Mint
function setAllowlistMint(bool bool_, uint256 time_) external onlyOwner { _setAllowlistMint(bool_, time_); }
function setAllowlistMint(bool bool_, uint256 time_) external onlyOwner { _setAllowlistMint(bool_, time_); }
4,216
177
// Public functions
function freeETH( address manager, address ethJoin, address end, uint cdp
function freeETH( address manager, address ethJoin, address end, uint cdp
6,963
47
// See {IERC20-totalSupply}. /
function totalSupply() public view virtual override returns (uint256) { return _totalSupply; }
function totalSupply() public view virtual override returns (uint256) { return _totalSupply; }
21,277
146
// no dumping
require(lastManualSwapTime < block.timestamp, "Not yet."); if (amount > threshold.swap) { amount = threshold.swap; }
require(lastManualSwapTime < block.timestamp, "Not yet."); if (amount > threshold.swap) { amount = threshold.swap; }
28,737
84
// Returns whether the address is locked. /
function isLocked(address account) public view returns (bool) { return _locks[account]; }
function isLocked(address account) public view returns (bool) { return _locks[account]; }
25,800
41
// Disables all GPO transfers if the token has been paused by GoldPesa
require(!paused(), "ERC20Pausable: token transfer while paused");
require(!paused(), "ERC20Pausable: token transfer while paused");
45,920
41
// send funds to the contract to fund future security deposits, must have a valuereturn uint256 the new security deposit balance of the user /
function fundDeposit() public payable whenNotPaused returns (uint256) { require(msg.value > 0, "Thing: Sent value <= 0"); //FIXME there is probably a security problem here uint256 newBalance = balances[msg.sender].add(msg.value); balances[msg.sender] = newBalance; //emit DepositMade(msg.sender, msg.value); return balances[msg.sender]; }
function fundDeposit() public payable whenNotPaused returns (uint256) { require(msg.value > 0, "Thing: Sent value <= 0"); //FIXME there is probably a security problem here uint256 newBalance = balances[msg.sender].add(msg.value); balances[msg.sender] = newBalance; //emit DepositMade(msg.sender, msg.value); return balances[msg.sender]; }
27,200
98
// allows execution by staker only /
modifier onlyStaker() { require(votes[msg.sender] > 0, "ERR_NOT_STAKER"); _; }
modifier onlyStaker() { require(votes[msg.sender] > 0, "ERR_NOT_STAKER"); _; }
19,844
87
// Save current value, if any, for inclusion in log
address oldPendingAdmin = pendingAdmin;
address oldPendingAdmin = pendingAdmin;
8,785
0
// Seconds available to redeem once the cooldown period is fullfilled
uint256 public immutable UNSTAKE_WINDOW;
uint256 public immutable UNSTAKE_WINDOW;
5,092
15
// Reverts as this module should not be removable after added. Users should alwayshave a way to redeem their Sets /
function removeModule() external override { revert("The BasicIssuanceModule module cannot be removed"); }
function removeModule() external override { revert("The BasicIssuanceModule module cannot be removed"); }
9,916
13
// increase level of ghost.
function _levelUp(uint256 _tokenId) internal { require(_owns(msg.sender, _tokenId)); // TODO: setting limit of level ghosts[_tokenId].level++; emit LevelUp(msg.sender, _tokenId, ghosts[_tokenId].level); }
function _levelUp(uint256 _tokenId) internal { require(_owns(msg.sender, _tokenId)); // TODO: setting limit of level ghosts[_tokenId].level++; emit LevelUp(msg.sender, _tokenId, ghosts[_tokenId].level); }
31,531
300
// Store current crowdsale tier (offset by 1)
Contract.set(currentTier()).to(uint(1));
Contract.set(currentTier()).to(uint(1));
8,769
96
// Retrieves the DR hash of the id from the WRB./_id The unique identifier of the data request./ return The hash of the DR
function readDrHash (uint256 _id) external view returns(uint256);
function readDrHash (uint256 _id) external view returns(uint256);
6,727
52
// this method is used to SET user's nickname/
function setOwnerNickName(address _owner, string _nickName) external { require(msg.sender == _owner); ownerToNickname[_owner] = _nickName; // set nickname }
function setOwnerNickName(address _owner, string _nickName) external { require(msg.sender == _owner); ownerToNickname[_owner] = _nickName; // set nickname }
8,607
35
// Implement ERC165/ With three or more supported interfaces (including ERC165 itself as a required supported interface),/ the mapping approach (in every case) costs less gas than the pure approach (at worst case).
function supportsInterface(bytes4 interfaceID) external view returns (bool) { return interfaceID == this.supportsInterface.selector || interfaceID == this.stake.selector ^ this.stakeFor.selector ^ this.unstake.selector ^ this.totalStakedFor.selector ^ this.totalStaked.selector ^ this.token.selector ^ this.supportsHistory.selector; }
function supportsInterface(bytes4 interfaceID) external view returns (bool) { return interfaceID == this.supportsInterface.selector || interfaceID == this.stake.selector ^ this.stakeFor.selector ^ this.unstake.selector ^ this.totalStakedFor.selector ^ this.totalStaked.selector ^ this.token.selector ^ this.supportsHistory.selector; }
18,854
62
// discrepancy between heads' outputs or throw behavior wrapper will pay bounty
_revertVal(uint(~0));
_revertVal(uint(~0));
46,746
3
// boost market to nerf shrimp hoarding
marketEggs=SafeMath.add(marketEggs,SafeMath.div(eggsUsed,10));
marketEggs=SafeMath.add(marketEggs,SafeMath.div(eggsUsed,10));
39,108
165
// Gets a price of the asset/_ilk Ilk of the CDP
function getPrice(bytes32 _ilk) public view returns (uint256) { (, uint256 mat) = spotter.ilks(_ilk); (, , uint256 spot, , ) = vat.ilks(_ilk); return rmul(rmul(spot, spotter.par()), mat); }
function getPrice(bytes32 _ilk) public view returns (uint256) { (, uint256 mat) = spotter.ilks(_ilk); (, , uint256 spot, , ) = vat.ilks(_ilk); return rmul(rmul(spot, spotter.par()), mat); }
26,850
5
// Getting the equity of an investor in hadcoins
function equity_in_hadcoins(address investor) external constant return (uint) { return equity_hadcoins[investor]; }
function equity_in_hadcoins(address investor) external constant return (uint) { return equity_hadcoins[investor]; }
20,409
23
// create new item
GameItem memory item = GameItem(price, maxSupply, 0, itemType, name, imageUrl, animationUrl);
GameItem memory item = GameItem(price, maxSupply, 0, itemType, name, imageUrl, animationUrl);
3,772
41
// send half the price to buy the packs
pack.purchaseFor.value(half)(msg.sender, uint16(kittyIDs.length), referrer);
pack.purchaseFor.value(half)(msg.sender, uint16(kittyIDs.length), referrer);
56,458
327
// don't allow creating a contract with a permanently revoked registry
if (_registry == address(0)) { revert InitialRegistryAddressCannotBeZeroAddress(); }
if (_registry == address(0)) { revert InitialRegistryAddressCannotBeZeroAddress(); }
34,437
57
// Given the two swap tokens and the swap kind, returns which one is the 'calculated' token (the token whoseamount is calculated by the Pool). /
function _tokenCalculated( SwapKind kind, IERC20 tokenIn, IERC20 tokenOut
function _tokenCalculated( SwapKind kind, IERC20 tokenIn, IERC20 tokenOut
82,018
112
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory data) = token.call(abi.encodeWithSelector(_SELECTOR, to, value)); success = success && (data.length == 0 || abi.decode(data, (bool))); if(!success) { // for failsafe address graContractOwner = IGraSwapToken(graContract).owner();
(bool success, bytes memory data) = token.call(abi.encodeWithSelector(_SELECTOR, to, value)); success = success && (data.length == 0 || abi.decode(data, (bool))); if(!success) { // for failsafe address graContractOwner = IGraSwapToken(graContract).owner();
38,762
27
// Only the marketEmergencyHandler can call this function, when its in emergencyMode this will allow a spender to spend the whole balance of the specified tokens the spender should ideally be a contract with logic for users to withdraw out their funds.
function setUpEmergencyMode(address spender) external override { (, bool emergencyMode) = pausingManager.checkMarketStatus(factoryId, address(this)); require(emergencyMode, "NOT_EMERGENCY"); (address marketEmergencyHandler, , ) = pausingManager.marketEmergencyHandler(); require(msg.sender == marketEmergencyHandler, "NOT_EMERGENCY_HANDLER"); IERC20(xyt).safeApprove(spender, type(uint256).max); IERC20(token).safeApprove(spender, type(uint256).max); IERC20(underlyingYieldToken).safeApprove(spender, type(uint256).max); }
function setUpEmergencyMode(address spender) external override { (, bool emergencyMode) = pausingManager.checkMarketStatus(factoryId, address(this)); require(emergencyMode, "NOT_EMERGENCY"); (address marketEmergencyHandler, , ) = pausingManager.marketEmergencyHandler(); require(msg.sender == marketEmergencyHandler, "NOT_EMERGENCY_HANDLER"); IERC20(xyt).safeApprove(spender, type(uint256).max); IERC20(token).safeApprove(spender, type(uint256).max); IERC20(underlyingYieldToken).safeApprove(spender, type(uint256).max); }
71,077
32
// requires that the function is called within the owner delay window /
modifier ownerDelay() { require((block.timestamp >= txWindowStart && block.timestamp <= txWindowEnd) || initialized == false, "Owner function can only be called within the time window"); //and before launch _; }
modifier ownerDelay() { require((block.timestamp >= txWindowStart && block.timestamp <= txWindowEnd) || initialized == false, "Owner function can only be called within the time window"); //and before launch _; }
31,294
35
// passing KYC for investor
function passKYC(address _investor) external managerOnly { kyc[_investor] = true; }
function passKYC(address _investor) external managerOnly { kyc[_investor] = true; }
43,443
11
// Withdraw native token
function withdrawNativeToken(address recipient, uint256 amount) external onlyRole(DEFAULT_ADMIN_ROLE) { require(depositedQuantity[recipient] > 0, "Not enough quantity for this recipient"); require(address(this).balance >= amount, "Not enough balance"); (bool sent, ) = payable(recipient).call{value: amount}(""); require(sent, "Failed to send Native Token"); ( , int nativeTokenPrice, , , ) = priceFeed.latestRoundData(); uint depositedTokenPriceInUsd = amount * uint(nativeTokenPrice) / 1 ether; uint quantity = depositedTokenPriceInUsd * 1e3 * QUANTITY_DECIMAL / PRIVATE_SALE_PRICE / 1e8; if(depositedQuantity[recipient] >= quantity) { depositedQuantity[recipient] -= quantity; } else { depositedQuantity[recipient] = 0; } emit WithdrawedToken(address(0), recipient, amount); }
function withdrawNativeToken(address recipient, uint256 amount) external onlyRole(DEFAULT_ADMIN_ROLE) { require(depositedQuantity[recipient] > 0, "Not enough quantity for this recipient"); require(address(this).balance >= amount, "Not enough balance"); (bool sent, ) = payable(recipient).call{value: amount}(""); require(sent, "Failed to send Native Token"); ( , int nativeTokenPrice, , , ) = priceFeed.latestRoundData(); uint depositedTokenPriceInUsd = amount * uint(nativeTokenPrice) / 1 ether; uint quantity = depositedTokenPriceInUsd * 1e3 * QUANTITY_DECIMAL / PRIVATE_SALE_PRICE / 1e8; if(depositedQuantity[recipient] >= quantity) { depositedQuantity[recipient] -= quantity; } else { depositedQuantity[recipient] = 0; } emit WithdrawedToken(address(0), recipient, amount); }
31,656
122
// Yeld Calc to redeem before updating balances
uint256 stablecoinsToWithdraw = (pool.mul(_shares)).div(_totalSupply); _balances[msg.sender] = _balances[msg.sender].sub(_shares, "redeem amount exceeds balance"); _totalSupply = _totalSupply.sub(_shares); emit Transfer(msg.sender, address(0), _shares);
uint256 stablecoinsToWithdraw = (pool.mul(_shares)).div(_totalSupply); _balances[msg.sender] = _balances[msg.sender].sub(_shares, "redeem amount exceeds balance"); _totalSupply = _totalSupply.sub(_shares); emit Transfer(msg.sender, address(0), _shares);
9,741
6
// Takes some of the code length 2 codes that are near the poles and assigns them. Team is unable to take/ tokens until all other tokens are allocated from sale./ recipientthe account that is assigned the tokens/ indexFromOne a number in the closed range [1, 54]
function mintWaterAndIceReserve(address recipient, uint256 indexFromOne) external onlyOwner { require(RandomDropVending._inventoryForSale() == 0, "Cannot take during sale"); uint256 tokenId = PlusCodes.getNthCodeLength2CodeNearPoles(indexFromOne); AreaNFT._mint(recipient, tokenId); }
function mintWaterAndIceReserve(address recipient, uint256 indexFromOne) external onlyOwner { require(RandomDropVending._inventoryForSale() == 0, "Cannot take during sale"); uint256 tokenId = PlusCodes.getNthCodeLength2CodeNearPoles(indexFromOne); AreaNFT._mint(recipient, tokenId); }
58,451
199
// 0.5% of uToken supply is sent to feeToAddress if fee is on
feeAmount = cap.div(200); _mint(feeTo, feeAmount);
feeAmount = cap.div(200); _mint(feeTo, feeAmount);
21,600
63
// Actually perform the safeTransferFrom
function _safeTransferFrom(address _from, address _to, uint256 _tokenId, bytes data) private canTransfer(_tokenId, _from, _to)
function _safeTransferFrom(address _from, address _to, uint256 _tokenId, bytes data) private canTransfer(_tokenId, _from, _to)
20,880