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
66
// Aux function to return the external code size /
function _extCodeSize(address target_) internal view returns (uint256 size) { assembly { size := extcodesize(target_) } return size; }
function _extCodeSize(address target_) internal view returns (uint256 size) { assembly { size := extcodesize(target_) } return size; }
27,725
60
// Liquifies tokens to counter. /
function sell(uint256 amountOfTokens) onlyTokenHolders() public
function sell(uint256 amountOfTokens) onlyTokenHolders() public
74,289
16
// Remove given address from provided address list. Use it to remove keeper from keepers list and to remove address from feeWhitelist _listToUpdate address of AddressList contract. _addressToRemove address which we want to remove from AddressList. /
function removeFromList(address _listToUpdate, address _addressToRemove) external onlyKeeper { require(IAddressList(_listToUpdate).remove(_addressToRemove), Errors.REMOVE_FROM_LIST_FAILED); }
function removeFromList(address _listToUpdate, address _addressToRemove) external onlyKeeper { require(IAddressList(_listToUpdate).remove(_addressToRemove), Errors.REMOVE_FROM_LIST_FAILED); }
3,647
257
// Pause sale if active, make active if paused/
function flipMintState() external onlyOwner { mintIsActive = !mintIsActive; }
function flipMintState() external onlyOwner { mintIsActive = !mintIsActive; }
11,297
10
// ERC223 - ensure if we get told to transfer to a contract address it must support tokenFallback method and approve the transfer.
if (isContract(_to)) { iReceiver receiver = iReceiver(_to); receiver.tokenFallback(_from, _value, _data); }
if (isContract(_to)) { iReceiver receiver = iReceiver(_to); receiver.tokenFallback(_from, _value, _data); }
47,460
24
// staking. /
function withdrawRest() external onlyOwner { uint256 zcrBal = rewardsToken.balanceOf(address(this)); require(rewardsToken.transfer(msg.sender, zcrBal), "The transfer failed"); }
function withdrawRest() external onlyOwner { uint256 zcrBal = rewardsToken.balanceOf(address(this)); require(rewardsToken.transfer(msg.sender, zcrBal), "The transfer failed"); }
31,747
3,864
// 1933
entry "unbrokered" : ENG_ADJECTIVE
entry "unbrokered" : ENG_ADJECTIVE
18,545
59
// Change safeguard status on or off When safeguard is true, then all the non-owner functions will stop working. When safeguard is false, then all the functions will resume working back again!/
function changeSafeguardStatus() onlyOwner external{ if (safeguard == false){ safeguard = true; } else{ safeguard = false; } }
function changeSafeguardStatus() onlyOwner external{ if (safeguard == false){ safeguard = true; } else{ safeguard = false; } }
45,228
20
// Only manager is able to call this function Sets the percentage of the year stability fee for a particular collateral asset The address of the main collateral token newValue The stability fee percentage (3 decimals) /
function setStabilityFee(address asset, uint newValue) public onlyManager { stabilityFee[asset] = newValue; }
function setStabilityFee(address asset, uint newValue) public onlyManager { stabilityFee[asset] = newValue; }
3,295
32
// Atomic ERC20 Swap nonce uint256 Unique and should be sequential expiry uint256 Expiry in seconds since 1 January 1970 signerWallet address Wallet of the signer signerToken address ERC20 token transferred from the signer signerAmount uint256 Amount transferred from the signer senderToken address ERC20 token transferr...
function swap( uint256 nonce, uint256 expiry, address signerWallet, address signerToken, uint256 signerAmount, address senderToken, uint256 senderAmount, uint8 v, bytes32 r,
function swap( uint256 nonce, uint256 expiry, address signerWallet, address signerToken, uint256 signerAmount, address senderToken, uint256 senderAmount, uint8 v, bytes32 r,
88,016
5
// returns daily limit
function quota() public view returns (uint256) { return _quotaPerDay; }
function quota() public view returns (uint256) { return _quotaPerDay; }
16,986
35
// convert the swusd to want, we want the entire balance
swusdToWant(uint256(~0));
swusdToWant(uint256(~0));
29,608
154
// validate order's parameters are OK.
function validateOrder(Order order) private view
function validateOrder(Order order) private view
27,206
53
// Get fee collectorsreturn FeeCollector Array of fee collectors /
function getFeeCollectors() public view onlyOwner returns(FeeCollector[] memory) { FeeCollector[] memory feeCollectorArray = new FeeCollector[](_feeCollectors.length); for (uint256 i = 0; i < _feeCollectors.length; i++) { FeeCollector storage feeCollector = _feeCollectors[i]; feeCollectorArray[i]...
function getFeeCollectors() public view onlyOwner returns(FeeCollector[] memory) { FeeCollector[] memory feeCollectorArray = new FeeCollector[](_feeCollectors.length); for (uint256 i = 0; i < _feeCollectors.length; i++) { FeeCollector storage feeCollector = _feeCollectors[i]; feeCollectorArray[i]...
757
26
// Revokes the vesting schedule for given identifier.vestingScheduleId the vesting schedule identifier/
function revoke(bytes32 vestingScheduleId) public
function revoke(bytes32 vestingScheduleId) public
26,312
88
// ============ Cancel Auction ============
function cancelAuction(uint256 auctionId) external nonReentrant auctionExists(auctionId)
function cancelAuction(uint256 auctionId) external nonReentrant auctionExists(auctionId)
7,148
5
// TODO: Make sure this actually does correct and enough calculations Taxes the receiver (well, actually sends LESS tokens to the receiver) with Tokenomics 1.0 on the bought token, both from the sold token and the bought token. Returns the taxed amount.
function handleToks1Buy( address buyToken, uint value, address sellToken, address factory
function handleToks1Buy( address buyToken, uint value, address sellToken, address factory
38,568
194
// We limit the relay fees to prevent the user spending all their funds on fees.
require(relayerFeePct < 0.5e18, "invalid relayer fee");
require(relayerFeePct < 0.5e18, "invalid relayer fee");
66,893
35
// update number of pending validators
pendingValidators = pendingValidators.add(1);
pendingValidators = pendingValidators.add(1);
72,676
1
// set the owner and make the owner a raffleCreator
owner = msg.sender; raffleCreators[msg.sender].isRaffleCreator = true; developer = _developer; rngesusContract = _rngesusContract;
owner = msg.sender; raffleCreators[msg.sender].isRaffleCreator = true; developer = _developer; rngesusContract = _rngesusContract;
28,079
56
// Redeem tokens. These tokens are withdrawn from the owner address if the balance must be enough to cover the redeem or the call will fail._amount Number of tokens to be issued
function redeem(uint amount) onlyOwner { if (_totalSupply < amount) throw; if (balances[owner] < amount) throw; _totalSupply -= amount; balances[owner] -= amount; Redeem(amount); }
function redeem(uint amount) onlyOwner { if (_totalSupply < amount) throw; if (balances[owner] < amount) throw; _totalSupply -= amount; balances[owner] -= amount; Redeem(amount); }
48,327
28
// Destroys `amount` tokens from `account`, reducing thetotal supply. Emits a `Transfer` event with `to` set to the zero address. Requirements - `account` cannot be the zero address.- `account` must have at least `amount` tokens. /
function _burn(address account, uint256 value) internal { require(account != address(0), "ERC20: burn from the zero address"); _balances[account] = _balances[account].sub(value); _totalSupply = _totalSupply.sub(value); emit Transfer(account, address(0), value); }
function _burn(address account, uint256 value) internal { require(account != address(0), "ERC20: burn from the zero address"); _balances[account] = _balances[account].sub(value); _totalSupply = _totalSupply.sub(value); emit Transfer(account, address(0), value); }
16,555
75
// check if returned value is one or nothing
return returnValue == 1;
return returnValue == 1;
13,676
89
// Using the total_withdraw (monotonically increasing) in the signed message ensures that we do not allow replay attack to happen, by using the same withdraw proof twice. Next two lines enforce the monotonicity of total_withdraw and check for an underflow: (we use <= because current_withdraw == total_withdraw for the f...
current_withdraw = withdraw_data.total_withdraw - participant_state.withdrawn_amount; require(current_withdraw <= withdraw_data.total_withdraw, "TN/withdraw: underflow");
current_withdraw = withdraw_data.total_withdraw - participant_state.withdrawn_amount; require(current_withdraw <= withdraw_data.total_withdraw, "TN/withdraw: underflow");
23,619
237
// DOGE Eye
dogeAssets['E']['A'].ratio = 80; dogeAssets['E']['A'].assets.push('DJ glasses'); dogeAssets['E']['A'].assets.push('Tiny sunglasses'); dogeAssets['E']['A'].assets.push('Sunglasses'); dogeAssets['E']['A'].assets.push('Goggles'); dogeAssets['E']['A'].assets.push('Wink'); dogeAssets['E']['A'].assets.push('Lad...
dogeAssets['E']['A'].ratio = 80; dogeAssets['E']['A'].assets.push('DJ glasses'); dogeAssets['E']['A'].assets.push('Tiny sunglasses'); dogeAssets['E']['A'].assets.push('Sunglasses'); dogeAssets['E']['A'].assets.push('Goggles'); dogeAssets['E']['A'].assets.push('Wink'); dogeAssets['E']['A'].assets.push('Lad...
28,551
12
// Compute percentage representation of a fraction _fracNum Numerator of fraction represeting the percentage _fracDenom Denominator of fraction represeting the percentage /
function percPoints(uint256 _fracNum, uint256 _fracDenom) internal pure returns (uint256) { return _fracNum.mul(PERC_DIVISOR).div(_fracDenom); }
function percPoints(uint256 _fracNum, uint256 _fracDenom) internal pure returns (uint256) { return _fracNum.mul(PERC_DIVISOR).div(_fracDenom); }
11,522
211
// Start counting tokens from /
_tokenIdCounter._value = RESERVED_TOTAL;
_tokenIdCounter._value = RESERVED_TOTAL;
81,829
5
// Number of decimals needed to get to 18
uint256 private immutable missing_decimals;
uint256 private immutable missing_decimals;
51,171
83
// Checks if a given address currently has transferApproval for a particular Asset./_tokenId asset UniqueId
function approvedFor(uint256 _tokenId) public view onlyGrantedContracts returns (address) { return assetIndexToApproved[_tokenId]; }
function approvedFor(uint256 _tokenId) public view onlyGrantedContracts returns (address) { return assetIndexToApproved[_tokenId]; }
43,472
43
// Command for owner to end crowdsale /
function endCrowdsale(bool success) public grantOwner notEnded { state = CrowdsaleState.Ended; crowdsaleEndedSuccessfully = success; uint balance = address(this).balance; if (success && balance > 0) { uint amount = balance.sub(suspendedPayments); owner.trans...
function endCrowdsale(bool success) public grantOwner notEnded { state = CrowdsaleState.Ended; crowdsaleEndedSuccessfully = success; uint balance = address(this).balance; if (success && balance > 0) { uint amount = balance.sub(suspendedPayments); owner.trans...
13,097
15
// Nftaddress => fee, 5 - 5%
mapping(address => uint8) public secondaryListingFeePercentage;
mapping(address => uint8) public secondaryListingFeePercentage;
20,165
191
// Tracks the amount and release time of locked tokens for an address
struct LockupItem { uint256 amount; uint256 releaseTime; }
struct LockupItem { uint256 amount; uint256 releaseTime; }
29,785
402
// IncreasePositionDelegator dYdX Interface that smart contracts must implement in order to own position on behalf of otheraccounts NOTE: Any contract implementing this interface should also use OnlyMargin to control accessto these functions /
interface IncreasePositionDelegator { // ============ Public Interface functions ============ /** * Function a contract must implement in order to allow additional value to be added onto * an owned position. Margin will call this on the owner of a position during increasePosition() * * NOT...
interface IncreasePositionDelegator { // ============ Public Interface functions ============ /** * Function a contract must implement in order to allow additional value to be added onto * an owned position. Margin will call this on the owner of a position during increasePosition() * * NOT...
24,588
16
// TCO2s exempted from redeem fees
mapping(address => bool) public redeemFeeExemptedTCO2s;
mapping(address => bool) public redeemFeeExemptedTCO2s;
23,082
1
// solium-disable-next-line /
contract IdentityApp is CounterfactualApp { function computeOutcome(bytes memory encodedState) public pure returns (bytes memory) { return encodedState; } }
contract IdentityApp is CounterfactualApp { function computeOutcome(bytes memory encodedState) public pure returns (bytes memory) { return encodedState; } }
43,873
11
// Liquidity generation logic/ Steps - All tokens tat will ever exist go to this contract/ This contract accepts ETH as payable/ ETH is mapped to people/ When liquidity generationevent is over veryone can call / the mint LP function which will put all the ETH and tokens inside the uniswap contract/ without any involvem...
string public liquidityGenerationParticipationAgreement = "I'm not a resident of the United States \n I understand that this contract is provided with no warranty of any kind. \n I agree to not hold the contract creators, CORE team members or anyone associated with this event liable for any damage monetary and ot...
string public liquidityGenerationParticipationAgreement = "I'm not a resident of the United States \n I understand that this contract is provided with no warranty of any kind. \n I agree to not hold the contract creators, CORE team members or anyone associated with this event liable for any damage monetary and ot...
30,094
8
// set vault index by mod operator
uint256 indx = uint256(msg.sender) % vaults.length; RefundVault vault = vaults[indx]; vault.deposit.value(msg.value)(msg.sender);
uint256 indx = uint256(msg.sender) % vaults.length; RefundVault vault = vaults[indx]; vault.deposit.value(msg.value)(msg.sender);
14,401
1
// Inherit from IBrokers
function swap( TradeInfo calldata tradeInfo, bytes memory makerSignature, bool makerContra, bytes memory takerSignature, bool takerContra ) external override {
function swap( TradeInfo calldata tradeInfo, bytes memory makerSignature, bool makerContra, bytes memory takerSignature, bool takerContra ) external override {
16,891
59
// sequence id (minimum resolution price bucket / 256) => price update sequence
mapping(uint256 => uint256) priceUpdateSequences;
mapping(uint256 => uint256) priceUpdateSequences;
6,902
1,049
// Forwards a batch commit to Voting. commits struct to encapsulate an `identifier`, `time`, `hash` and optional `encryptedVote`. /
function batchCommit(VotingAncillaryInterface.CommitmentAncillary[] calldata commits) external onlyRoleHolder(uint256(Roles.Voter))
function batchCommit(VotingAncillaryInterface.CommitmentAncillary[] calldata commits) external onlyRoleHolder(uint256(Roles.Voter))
10,288
2
// Get the price to mint tokens/totalSupplyThe existing number of curve tokens/amount The number of curve tokens to mint
function calcMintPrice( uint256 totalSupply, uint256 reserveBalance, uint256 amount
function calcMintPrice( uint256 totalSupply, uint256 reserveBalance, uint256 amount
18,506
159
// Withdraw without caring about rewards. EMERGENCY ONLY. !Caution this will remove all your pending rewards!
function emergencyWithdraw(uint256 _pid) public { PoolInfo storage pool = poolInfo[_pid]; require(pool.withdrawable, "Withdrawing from this pool is disabled"); UserInfo storage user = userInfo[_pid][msg.sender]; pool.token.safeTransfer(address(msg.sender), user.amount); emit ...
function emergencyWithdraw(uint256 _pid) public { PoolInfo storage pool = poolInfo[_pid]; require(pool.withdrawable, "Withdrawing from this pool is disabled"); UserInfo storage user = userInfo[_pid][msg.sender]; pool.token.safeTransfer(address(msg.sender), user.amount); emit ...
38,065
78
// Array of all NFT IDs. /
uint256[] internal tokens;
uint256[] internal tokens;
11,732
75
// withdraw WETH from strategy if _isFlashDeposit is true, keeps wSqueeth in contract, otherwise sends to user _crabAmount amount of strategy token to burn _wSqueethAmount amount of wSqueeth to burn _isFlashWithdraw flag if called by flashWithdrawreturn ETH amount to withdraw /
function _withdraw( address _from, uint256 _crabAmount, uint256 _wSqueethAmount, bool _isFlashWithdraw
function _withdraw( address _from, uint256 _crabAmount, uint256 _wSqueethAmount, bool _isFlashWithdraw
24,025
15
// function transferFrom(address _from, address _to, uint256 _tokenId) external payable;
cryptoKittyContract.transferFrom(this, winningAddress, kittyDna);
cryptoKittyContract.transferFrom(this, winningAddress, kittyDna);
45,452
5
// In the case of Avax Rewards, swap wavax for cly
if(_wavax > 0){ IERC20(wavax).safeApprove(joeRouter, 0); IERC20(wavax).safeApprove(joeRouter, _wavax.div(2)); _swapTraderJoe(wavax, cly, _wavax.div(2)); }
if(_wavax > 0){ IERC20(wavax).safeApprove(joeRouter, 0); IERC20(wavax).safeApprove(joeRouter, _wavax.div(2)); _swapTraderJoe(wavax, cly, _wavax.div(2)); }
27,062
29
// if there are no commissions, or if there are but the seller is not the commission receiver (gallery), set seller amount. If the seller is not the gallery it will not get paid commission on primary sale even if it was set.
sellerAmount = ( _price - marketplaceFeeAmount );
sellerAmount = ( _price - marketplaceFeeAmount );
65,850
5
// Makes sure the fields in the proposal are setted as they should by default
listingInfo.owner = owner; listingInfo.status = TokenStatus.LISTED; listingInfo.valid = true; listingInfo.official = false; if (listingInfo.feeReceiver == address(0)) { listingInfo.feeReceiver = msg.sender; }
listingInfo.owner = owner; listingInfo.status = TokenStatus.LISTED; listingInfo.valid = true; listingInfo.official = false; if (listingInfo.feeReceiver == address(0)) { listingInfo.feeReceiver = msg.sender; }
16,190
53
// xxx
function getLockBalance(address account, uint8 decimals) internal view returns (uint256) { uint256 tempLock = 0; if (account == advance_mining) { if (now < unlock_time_0910) { tempLock = 735000000 * 10 ** uint256(decimals); } else if (now >= unlock_time_0910 &...
function getLockBalance(address account, uint8 decimals) internal view returns (uint256) { uint256 tempLock = 0; if (account == advance_mining) { if (now < unlock_time_0910) { tempLock = 735000000 * 10 ** uint256(decimals); } else if (now >= unlock_time_0910 &...
43,593
209
// Allows the creator to correct mistakes until the first token from an edition is sold
function updateURIIfNoSaleMade(uint256 _editionId, string calldata _newURI) external;
function updateURIIfNoSaleMade(uint256 _editionId, string calldata _newURI) external;
42,579
67
// Allows the safe transfer of ETH _to account to transfer ETH _value amount of ETH /
function safeTransferETH(address _to, uint256 _value) internal { (bool success, ) = _to.call{value: _value}(new bytes(0)); require(success, "IVaultHandler::safeTransferETH: ETH transfer failed"); }
function safeTransferETH(address _to, uint256 _value) internal { (bool success, ) = _to.call{value: _value}(new bytes(0)); require(success, "IVaultHandler::safeTransferETH: ETH transfer failed"); }
11,182
211
// See {IERC721Enumerable-tokenByIndex}. /
function tokenByIndex(uint256 index) public view override returns (uint256) { (uint256 tokenId, ) = _tokenOwners.at(index); return tokenId; }
function tokenByIndex(uint256 index) public view override returns (uint256) { (uint256 tokenId, ) = _tokenOwners.at(index); return tokenId; }
210
44
// price updates are grouped into hourly buckets
uint256 bucket = timestamp / (1 hours);
uint256 bucket = timestamp / (1 hours);
16,200
261
// /
uint256 public override count = 0;
uint256 public override count = 0;
81,407
23
// Swap USDC for AYIELD Tokens
function buyback(uint256 tokenAmount) private { // generate the AYIELD pair path of token -> USDC address[] memory path = new address[](2); path[0] = address(USDC); path[1] = address(AYIELD); // Give Pangolin Router Allowance to Spend Tokens USDC.approve(address(pang...
function buyback(uint256 tokenAmount) private { // generate the AYIELD pair path of token -> USDC address[] memory path = new address[](2); path[0] = address(USDC); path[1] = address(AYIELD); // Give Pangolin Router Allowance to Spend Tokens USDC.approve(address(pang...
4,801
5
// Total native currency ever supplied to this stream
function streamTotalSupply() external view returns (uint256);
function streamTotalSupply() external view returns (uint256);
8,617
33
// Detects whether "maRio" in any small/caps combination is the first substring within the input parameter. Tolerates initial spaces e.g. "Mario" or " mario" or "mArio" fullName The returned oraclize name string to search for the given first name.Note as of this writing it looks like this: "Nicos Anastasiades"return Tr...
function getIsMarioPrez(string memory fullName) public pure returns (bool) { bytes memory fullNameBytes = bytes(fullName); bytes memory soughtAfterCaps = bytes("MARIO"); bytes memory soughtAfterSmall = bytes("mario"); uint8 fni = 0; uint8 spaces = 0; bytes1 space = b...
function getIsMarioPrez(string memory fullName) public pure returns (bool) { bytes memory fullNameBytes = bytes(fullName); bytes memory soughtAfterCaps = bytes("MARIO"); bytes memory soughtAfterSmall = bytes("mario"); uint8 fni = 0; uint8 spaces = 0; bytes1 space = b...
2,591
24
// Reserve tokens /
function reserveTokens(uint256 qty) public onlyOwner { uint tokenId; uint256 creation = block.timestamp; for (uint i = 1; i <= qty; i++) { tokenId = totalSupply().add(1); if (tokenId <= MAX_TOKENS) { _safeMint(msg.sender, tokenId); _co...
function reserveTokens(uint256 qty) public onlyOwner { uint tokenId; uint256 creation = block.timestamp; for (uint i = 1; i <= qty; i++) { tokenId = totalSupply().add(1); if (tokenId <= MAX_TOKENS) { _safeMint(msg.sender, tokenId); _co...
33,020
59
// Whether a previous call of SwapAndLiquify process is still in process.
bool private _inSwapAndLiquify; bool private _autoSwapAndLiquifyEnabled; bool private _autoBurnEnabled; bool private _rewardEnabled; bool private _enableTradeFee; bool private _tradeFeeEnabled;
bool private _inSwapAndLiquify; bool private _autoSwapAndLiquifyEnabled; bool private _autoBurnEnabled; bool private _rewardEnabled; bool private _enableTradeFee; bool private _tradeFeeEnabled;
27,217
52
// poolShares = totalSupply(deltaWeight / totalWeight)
poolShares = BalancerSafeMath.bmul(totalSupply, BalancerSafeMath.bdiv(deltaWeight, totalWeight));
poolShares = BalancerSafeMath.bmul(totalSupply, BalancerSafeMath.bdiv(deltaWeight, totalWeight));
79,725
199
// Modifiers
modifier onlyHuman() { require(!address(msg.sender).isContract() && tx.origin == msg.sender, "Only for human."); _; }
modifier onlyHuman() { require(!address(msg.sender).isContract() && tx.origin == msg.sender, "Only for human."); _; }
12,462
17
// make sure this constructor name matches contract name above
function AuraToken() public{ decimals = 18; // Amount of decimals for display purposes totalSupply = 50000000 * 10 ** uint256(decimals); // Update total supply releasedSupply = 0; availableSupply = 0; name = "AuraToken"; // Set the name for display pur...
function AuraToken() public{ decimals = 18; // Amount of decimals for display purposes totalSupply = 50000000 * 10 ** uint256(decimals); // Update total supply releasedSupply = 0; availableSupply = 0; name = "AuraToken"; // Set the name for display pur...
10,092
17
// Performs a single swap for both exactIn and exactOut/ For exactIn, `amount` is `amountIn`. For exactOut, `amount` is `-amountOut`
function _swap(int256 amount, address recipient, bytes calldata path, address payer, bool isExactIn) private returns (int256 amount0Delta, int256 amount1Delta, bool zeroForOne)
function _swap(int256 amount, address recipient, bytes calldata path, address payer, bool isExactIn) private returns (int256 amount0Delta, int256 amount1Delta, bool zeroForOne)
16,723
1
// emit when owner add rewards to this contract
event Injected(address indexed operator, uint256 mainnetAmount, address[] erc20Contracts, uint256[] erc20Amounts); IERC1155Minter public immutable godGadget; IDG20 public immutable ag;
event Injected(address indexed operator, uint256 mainnetAmount, address[] erc20Contracts, uint256[] erc20Amounts); IERC1155Minter public immutable godGadget; IDG20 public immutable ag;
44,372
261
// pause/unpause entire protocol, including mint/redeem/borrow/seize/transfer Admin function, only owner and pauseGuardian can call this _paused whether to pause or unpause /
function _setProtocolPaused(bool _paused) external override checkPauser(_paused)
function _setProtocolPaused(bool _paused) external override checkPauser(_paused)
61,009
76
// Triggered when service address is replaced/
event ReplaceService(address oldService, address newService);
event ReplaceService(address oldService, address newService);
29,570
8
// print values in traces /assert (_balances[msg.sender] == VeriSol.Old(_balances[msg.sender] - amount));assert (_balances[recipient]== VeriSol.Old(_balances[recipient] + amount));
return true;
return true;
1,278
18
// Transfer the balance from owner&39;s account to another account
function transfer(address _to, uint256 _amount)public returns (bool ok) { require( _to != 0x0); require(balances[msg.sender] >= _amount && _amount >= 0); balances[msg.sender] = (balances[msg.sender]).sub(_amount); balances[_to] = (balances[_to]).add(_amount); emit Transfer(m...
function transfer(address _to, uint256 _amount)public returns (bool ok) { require( _to != 0x0); require(balances[msg.sender] >= _amount && _amount >= 0); balances[msg.sender] = (balances[msg.sender]).sub(_amount); balances[_to] = (balances[_to]).add(_amount); emit Transfer(m...
15,891
43
// Customer Section //
mapping(address => address[]) ProductsAtCustomer; event BatchReceived( address indexed BatchId ); function productBatchReceived( address bid
mapping(address => address[]) ProductsAtCustomer; event BatchReceived( address indexed BatchId ); function productBatchReceived( address bid
45,244
59
// `freeze? Prevent | Allow` `target` from sending & receiving tokenstarget Address to be frozenfreeze either to freeze it or not/
function _freezeAccount(address target, bool freeze) internal { frozenAccount[target] = freeze; emit FrozenFunds(target, freeze); }
function _freezeAccount(address target, bool freeze) internal { frozenAccount[target] = freeze; emit FrozenFunds(target, freeze); }
36,105
24
// Call a pre-approved external function. This allows to extend the functionality of the contract, without the need of a complete re-deployment. target Address of smart contract to call. functionHash Function hash of the external contract function to call. payload Entire payload to include in the external call. Keep in...
function delegateApproved (address target, bytes4 functionHash, bytes calldata payload) public payable { require(_approvedFunctions[target][functionHash], "CXIP: not approved delegate call"); (bool success, bytes memory data) = target.delegatecall(abi.encodePacked(functionHash, payload)); re...
function delegateApproved (address target, bytes4 functionHash, bytes calldata payload) public payable { require(_approvedFunctions[target][functionHash], "CXIP: not approved delegate call"); (bool success, bytes memory data) = target.delegatecall(abi.encodePacked(functionHash, payload)); re...
28,310
4
// address private usdtContract = 0x3B00Ef435fA4FcFF5C209a37d1f3dcff37c705aD;address private daiContract = 0xc7AD46e0b8a400Bb3C915120d284AafbA8fc4735;
address private curvePoolContract = 0xbEbc44782C7dB0a1A60Cb6fe97d0b483032FF1C7; address private owner; int128 private curveUsdtIndex = 2; int128 private curveDaiIndex = 0;
address private curvePoolContract = 0xbEbc44782C7dB0a1A60Cb6fe97d0b483032FF1C7; address private owner; int128 private curveUsdtIndex = 2; int128 private curveDaiIndex = 0;
16,076
202
// Update withdrawal period considered amount
_withdrawalPeriodIncreaseConsideredByTimestamp( pendingWithdrawal.timestamp, pendingWithdrawal.amount );
_withdrawalPeriodIncreaseConsideredByTimestamp( pendingWithdrawal.timestamp, pendingWithdrawal.amount );
68,273
3
// External function to get teller priority. tellerId Teller Id /
function tellerPriority(address tellerId) external view returns (uint256);
function tellerPriority(address tellerId) external view returns (uint256);
69,060
31
// Register the border
borders[baseParcelKey][borderKey] = Border( borderKey, msg.sender, parcels[0].x, parcels[0].y, parcels[1].x, parcels[1].y, parcels[2].x, parcels[2].y, _beneficiary,
borders[baseParcelKey][borderKey] = Border( borderKey, msg.sender, parcels[0].x, parcels[0].y, parcels[1].x, parcels[1].y, parcels[2].x, parcels[2].y, _beneficiary,
16,973
16
// release ID => [tokenId]
mapping(uint256 => uint256[]) public lotteryInfo;
mapping(uint256 => uint256[]) public lotteryInfo;
56,257
43
// Add prev result to the mult of days of 100 air prod
results[i] = firstResults.add(((prevProd.add(daysPassed)).sub(100)).mul(100));
results[i] = firstResults.add(((prevProd.add(daysPassed)).sub(100)).mul(100));
7,687
77
// Just refill
function () public payable {} // Withdraw balance by owner function withdrawBalance(uint256 summ) external onlyOwner { owner.transfer(summ); }
function () public payable {} // Withdraw balance by owner function withdrawBalance(uint256 summ) external onlyOwner { owner.transfer(summ); }
52,615
46
// SET TASK TOKEN FEE
fee = _fee;
fee = _fee;
35,694
22
// lpToken: _lp,
allocPoint: 1000, lastRewardBlock: startBlock, accAppPerShare: 0
allocPoint: 1000, lastRewardBlock: startBlock, accAppPerShare: 0
12,493
7
// minter of the vault/ return address of minter
function minter() external view override returns (address) { return _vaultInfo.minter; }
function minter() external view override returns (address) { return _vaultInfo.minter; }
37,626
0
// ERC1538 Transparent Contract Standard/Required interface/Note: the ERC-165 identifier for this interface is 0x61455567
interface IERC1538 { /// @dev This emits when one or a set of functions are updated in a transparent contract. /// The message string should give a short description of the change and why /// the change was made. event CommitMessage(string message); /// @dev This emits for each function that is ...
interface IERC1538 { /// @dev This emits when one or a set of functions are updated in a transparent contract. /// The message string should give a short description of the change and why /// the change was made. event CommitMessage(string message); /// @dev This emits for each function that is ...
0
56
// Updates the state of a market to account for the last n number of epochs./We have to check market not deprecated to avoid changing state once deprecated
function updateSystemStateSpecific(uint256 specificNumberOfEpochsToUpdate) external checkMarketNotDeprecated
function updateSystemStateSpecific(uint256 specificNumberOfEpochsToUpdate) external checkMarketNotDeprecated
21,658
195
// TODO: code review
contract StrategyCompLev is StrategyERC20_V3 { // Uniswap // address private constant UNISWAP = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D; address private constant WETH = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2; // Compound // address private constant COMPTROLLER = 0x3d9819210A31b4961b30EF54bE2...
contract StrategyCompLev is StrategyERC20_V3 { // Uniswap // address private constant UNISWAP = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D; address private constant WETH = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2; // Compound // address private constant COMPTROLLER = 0x3d9819210A31b4961b30EF54bE2...
23,007
208
// set the limit of ETH in cents, oraclize data greater than this is not accepted/_price Price in US cents
function setETHPriceUpperBound(uint _price) external onlymanyowners(keccak256(msg.data))
function setETHPriceUpperBound(uint _price) external onlymanyowners(keccak256(msg.data))
40,267
17
// Add a new leaderboard. Board hash will be created by name and creator/a funding is required to create a new leaderboard/boardId The randomly generated boardId from the chainlink VRF/name The name of the leaderboard/boardDescription A subtitle for the leaderboard/ return The hash of the newly created leaderboard
function addNewBoard(uint256 boardId, bytes32 name, string memory boardDescription) public returns(bool){ numBoards++; // add a new board and mark it as active boards[boardId] = Board(name, boardDescription, 0, msg.sender, 1); return true; }
function addNewBoard(uint256 boardId, bytes32 name, string memory boardDescription) public returns(bool){ numBoards++; // add a new board and mark it as active boards[boardId] = Board(name, boardDescription, 0, msg.sender, 1); return true; }
28,495
3
// filledSubtrees and roots could be bytes32[size], but using mappings makes it cheaper because it removes index range check on every interaction
mapping(uint256 => bytes32) public filledSubtrees; mapping(uint256 => bytes32) public roots; uint32 public constant ROOT_HISTORY_SIZE = 30; uint32 public currentRootIndex = 0; uint32 public nextIndex = 0;
mapping(uint256 => bytes32) public filledSubtrees; mapping(uint256 => bytes32) public roots; uint32 public constant ROOT_HISTORY_SIZE = 30; uint32 public currentRootIndex = 0; uint32 public nextIndex = 0;
19,248
19
// Aprove the passed address to spend the specified amount of tokens on behalf of msg.sender. _spender The address which will spend the funds. _value The amount of tokens to be spent. /
function approve(address _spender, uint256 _value) returns (bool) { // To change the approve amount you first have to reduce the addresses` // allowance to zero by calling `approve(_spender, 0)` if it is not // already 0 to mitigate the race condition described here: // https://github.com/ethereum...
function approve(address _spender, uint256 _value) returns (bool) { // To change the approve amount you first have to reduce the addresses` // allowance to zero by calling `approve(_spender, 0)` if it is not // already 0 to mitigate the race condition described here: // https://github.com/ethereum...
11,308
51
// Last timestamp when the median was updated
uint256 public lastUpdateTime; // [unix timestamp]
uint256 public lastUpdateTime; // [unix timestamp]
25,024
3
// Note oLIT 0x627fee87d0D9D2c55098A06ac805Db8F98B158Aa
interface IOLit { /** * @notice Exercises options tokens to purchase the underlying tokens. * @dev The options tokens are not burnt but sent to address(0) to avoid messing up the * inflation schedule. * The oracle may revert if it cannot give a secure result. * @param amount The amount of o...
interface IOLit { /** * @notice Exercises options tokens to purchase the underlying tokens. * @dev The options tokens are not burnt but sent to address(0) to avoid messing up the * inflation schedule. * The oracle may revert if it cannot give a secure result. * @param amount The amount of o...
28,613
123
// 20% to Funding event
_mint(fundAddress, reward.div(totalWeight).mul(rateFund));
_mint(fundAddress, reward.div(totalWeight).mul(rateFund));
28,320
320
// Finalize the pricePerShare at the end of the round
uint256 currentRound = vaultState.round; roundPricePerShare[currentRound] = newPricePerShare;
uint256 currentRound = vaultState.round; roundPricePerShare[currentRound] = newPricePerShare;
25,109
83
// Withdraw from the buffer
function withdraw(uint _amount) external nonReentrant { _withdraw(msg.sender, _amount); _safeTransfer(underlying, msg.sender, _amount); }
function withdraw(uint _amount) external nonReentrant { _withdraw(msg.sender, _amount); _safeTransfer(underlying, msg.sender, _amount); }
38,869
32
// when sell
else if ( automatedMarketMakerPairs[to] && !_isExcludedMaxTransactionAmount[from] ) { require( amount <= maxTransactionAmount, "Sell transfer amount exceeds the maxTransactionAmoun...
else if ( automatedMarketMakerPairs[to] && !_isExcludedMaxTransactionAmount[from] ) { require( amount <= maxTransactionAmount, "Sell transfer amount exceeds the maxTransactionAmoun...
3,315
31
// Mintable token Simple ERC20 Token example, with mintable token creation /
contract MintableToken is StandardToken, Ownable { event Mint(address indexed to, uint256 amount); /** * @dev Function to mint tokens * @param _to The address that will receive the minted tokens. * @param _amount The amount of tokens to mint. * @return A bool...
contract MintableToken is StandardToken, Ownable { event Mint(address indexed to, uint256 amount); /** * @dev Function to mint tokens * @param _to The address that will receive the minted tokens. * @param _amount The amount of tokens to mint. * @return A bool...
17,621
19
// A token holder contract that can release its token balance gradually like atypical vesting scheme, with a vesting period and vesting count. Optionally revocable by theowner. /
contract TokenVesting is Ownable { // The vesting schedule is time-based (i.e. using block timestamps as opposed to e.g. block numbers), and is // therefore sensitive to timestamp manipulation (which is something miners can do, to a certain degree). Therefore, // it is recommended to avoid using short time ...
contract TokenVesting is Ownable { // The vesting schedule is time-based (i.e. using block timestamps as opposed to e.g. block numbers), and is // therefore sensitive to timestamp manipulation (which is something miners can do, to a certain degree). Therefore, // it is recommended to avoid using short time ...
74,424
1
// Data needed to commit new block/blockNumber Number of the committed block/timestamp Unix timestamp denoting the start of the block execution/indexRepeatedStorageChanges The serial number of the shortcut index that's used as a unique identifier for storage keys that were used twice or more/newStateRoot The state root...
struct CommitBlockInfo { uint64 blockNumber; uint64 timestamp; uint64 indexRepeatedStorageChanges; bytes32 newStateRoot; uint256 numberOfLayer1Txs; bytes32 l2LogsTreeRoot; bytes32 priorityOperationsHash; bytes initialStorageChanges; bytes repea...
struct CommitBlockInfo { uint64 blockNumber; uint64 timestamp; uint64 indexRepeatedStorageChanges; bytes32 newStateRoot; uint256 numberOfLayer1Txs; bytes32 l2LogsTreeRoot; bytes32 priorityOperationsHash; bytes initialStorageChanges; bytes repea...
5,176
5
// uint amt = msg.value;emit log(type(msg.value));
emit log(msg.value); camp.donators.push(payable(msg.sender)); camp.donation.push(msg.value);
emit log(msg.value); camp.donators.push(payable(msg.sender)); camp.donation.push(msg.value);
24,296
232
// check if token name exists
mapping(string => bool) public tokenNameExists;
mapping(string => bool) public tokenNameExists;
40,044
2
// Emitted during finish minting /
event MintFinished();
event MintFinished();
10,584