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
107
// Instantiate DebtLocker if it doesn't exist withing this factory
if (debtLocker == address(0)) { debtLocker = IDebtLockerFactory(dlFactory).newLocker(loan); debtLockers[loan][dlFactory] = debtLocker; }
if (debtLocker == address(0)) { debtLocker = IDebtLockerFactory(dlFactory).newLocker(loan); debtLockers[loan][dlFactory] = debtLocker; }
55,892
3
// TODO think about try catch in transfers
uint256 balanceBefore; if (_assetItem.asset.assetType == ETypes.AssetType.NATIVE) { balanceBefore = _to.balance; (bool success, ) = _to.call{ value: _assetItem.amount}("");
uint256 balanceBefore; if (_assetItem.asset.assetType == ETypes.AssetType.NATIVE) { balanceBefore = _to.balance; (bool success, ) = _to.call{ value: _assetItem.amount}("");
8,960
415
// Calls from the wallet to itself are deemed special (e.g. this is used for updating the wallet implementation) We also disallow calls to module functions directly (e.g. this is used for some special wallet <-> module interaction)
require(wallet != to && !Wallet(wallet).hasModule(to), "CALL_DISALLOWED");
require(wallet != to && !Wallet(wallet).hasModule(to), "CALL_DISALLOWED");
47,689
51
// before execute: register governance call in queue.
if (_executor() != address(this)) { for (uint256 i = 0; i < targets.length; ++i) { if (targets[i] == address(this)) { _governanceCall.pushBack(keccak256(calldatas[i])); }
if (_executor() != address(this)) { for (uint256 i = 0; i < targets.length; ++i) { if (targets[i] == address(this)) { _governanceCall.pushBack(keccak256(calldatas[i])); }
1,562
239
// get option cash value this assume that the underlying price is denominated in strike assetcash value = max(underlying price - strike price, 0) _strikePrice option strike price _underlyingPrice option underlying price _isPut option type, true for put and false for call option /
function _getCashValue( FPI.FixedPointInt memory _strikePrice, FPI.FixedPointInt memory _underlyingPrice, bool _isPut
function _getCashValue( FPI.FixedPointInt memory _strikePrice, FPI.FixedPointInt memory _underlyingPrice, bool _isPut
15,075
35
// Function to add a proposal that should be considered for execution/proposalId Id that should identify the proposal uniquely/txHashes EIP-712 hashes of the transactions that should be executed/The nonce used for the question by this function is always 0
function addProposal(string memory proposalId, bytes32[] memory txHashes) public { addProposalWithNonce(proposalId, txHashes, 0); }
function addProposal(string memory proposalId, bytes32[] memory txHashes) public { addProposalWithNonce(proposalId, txHashes, 0); }
23,679
187
// Returns how much unclaimed rewards an account has/account Address for which the request is made/ return How much a given account earned rewards
function earned(address account) external view returns (uint256);
function earned(address account) external view returns (uint256);
35,495
28
// Update the parameters of the interest rate model (only callable by owner, i.e. Timelock) baseRatePerYear The approximate target base APR, as a mantissa (scaled by 1e18) multiplierPerYear The rate of increase in interest rate wrt utilization (scaled by 1e18) jumpMultiplierPerYear The multiplierPerBlock after hitting ...
function updateJumpRateModel(uint baseRatePerYear, uint multiplierPerYear, uint jumpMultiplierPerYear, uint kink_) external { require(msg.sender == owner, "only the owner may call this function."); updateJumpRateModelInternal(baseRatePerYear, multiplierPerYear, jumpMultiplierPerYear, kink_); }
function updateJumpRateModel(uint baseRatePerYear, uint multiplierPerYear, uint jumpMultiplierPerYear, uint kink_) external { require(msg.sender == owner, "only the owner may call this function."); updateJumpRateModelInternal(baseRatePerYear, multiplierPerYear, jumpMultiplierPerYear, kink_); }
27,944
11
// 0.4 显示合约余额
function ShowContractMoney() view public returns(uint){ return contractAdr.balance; }
function ShowContractMoney() view public returns(uint){ return contractAdr.balance; }
6,908
1
// ГОРОДА и БОЛЕЕ МЕЛКИЕ ЕДИНИЦЫ
ToponimicAdj("московский") ToponimicAdj("парижский") ToponimicAdj("ленинградский") ToponimicAdj("петербургский") ToponimicAdj("балтийский") ToponimicAdj("киевский") ToponimicAdj("невский") ToponimicAdj("сибирский") ToponimicAdj("лондонский") ToponimicAdj("курский")
ToponimicAdj("московский") ToponimicAdj("парижский") ToponimicAdj("ленинградский") ToponimicAdj("петербургский") ToponimicAdj("балтийский") ToponimicAdj("киевский") ToponimicAdj("невский") ToponimicAdj("сибирский") ToponimicAdj("лондонский") ToponimicAdj("курский")
4,367
50
// Restore consideration data pointer at the consideration head ptr.
mstore(considerationHeadPtr, considerationDataPtr)
mstore(considerationHeadPtr, considerationDataPtr)
32,816
37
// clear the price so it is no longer for sale
delete packs[packId]; BuyPack(msg.sender, packId, msg.value);
delete packs[packId]; BuyPack(msg.sender, packId, msg.value);
24,447
55
// Getter for the PLATFORM_NAME future parameterreturn returns the platform of the future /
function PLATFORM_NAME() external view returns (uint256);
function PLATFORM_NAME() external view returns (uint256);
3,784
50
// Return change to msg.sender
msg.sender.transfer(change);
msg.sender.transfer(change);
47,096
4
// Destroy the contract and send all ether balance to owner. /
function kill() public onlyOwner { //Convert from `address` to `address payable` address payable payableOwner = address(uint160(owner())); selfdestruct(payableOwner); }
function kill() public onlyOwner { //Convert from `address` to `address payable` address payable payableOwner = address(uint160(owner())); selfdestruct(payableOwner); }
5,802
80
// beneficiary who is the recipient of tokens from the contributionethBalance ETH balance of the recipient of tokens from the contributionelpBalance ELP balance of the recipient of tokens from the contribution/
event Withdrawal(address indexed beneficiary, uint256 ethBalance, uint256 elpBalance);
event Withdrawal(address indexed beneficiary, uint256 ethBalance, uint256 elpBalance);
33,815
202
// setRitualSettingsallows us to change the ritual price, rate, and whether ritual is enabled or not /
function setRitualSettings(uint256 price, uint256 rate, bool available) public payable onlyOwner { ritualPrice = price; ritualRate = rate; templeAvailable = available; }
function setRitualSettings(uint256 price, uint256 rate, bool available) public payable onlyOwner { ritualPrice = price; ritualRate = rate; templeAvailable = available; }
43,804
19
// withdraw accumulated balance, called by payee./
function withdrawPayments() { address payee = msg.sender; uint256 payment = payments[payee]; require(payment != 0); require(this.balance >= payment); totalPayments = totalPayments.sub(payment); payments[payee] = 0; assert(payee.send(payment)); }
function withdrawPayments() { address payee = msg.sender; uint256 payment = payments[payee]; require(payment != 0); require(this.balance >= payment); totalPayments = totalPayments.sub(payment); payments[payee] = 0; assert(payee.send(payment)); }
1,099
276
// Process rebond using unbonding lock
processRebond(msg.sender, _unbondingLockId, _newPosPrev, _newPosNext);
processRebond(msg.sender, _unbondingLockId, _newPosPrev, _newPosNext);
23,704
18
// return Number of transactions, both enabled and disabled, in transactions list. /
function transactionsSize() external view returns (uint256) { return transactions.length; }
function transactionsSize() external view returns (uint256) { return transactions.length; }
8,554
295
// Transfer Seller
uint256 sellerSlash = offeredPrice.sub(creatorSlash).sub(sellerFeeToSlash); erc20TransferProxy.erc20safeTransferFrom(IERC20(trade.erc20Token), trade.buyer, msg.sender, sellerSlash);
uint256 sellerSlash = offeredPrice.sub(creatorSlash).sub(sellerFeeToSlash); erc20TransferProxy.erc20safeTransferFrom(IERC20(trade.erc20Token), trade.buyer, msg.sender, sellerSlash);
55,290
19
// Set token migration manager contract address prior to migrating You can't change migration manager when migration is in progress or has completed. /
function setMigrationManager(address _mgr) public onlyTokenManager { require((currentPhase != Phase.Migrated) && (currentPhase != Phase.Migrating)); migrationManager = _mgr; }
function setMigrationManager(address _mgr) public onlyTokenManager { require((currentPhase != Phase.Migrated) && (currentPhase != Phase.Migrating)); migrationManager = _mgr; }
54,895
40
// TO BUY ALREADY USED BLOCKS BID BIDDING
function Bid(uint block_id, bytes32 file_hash, uint chunk_id, string memory attachments, string memory tags) payable public { uint256 previous_price = Blocks[block_id].eth_value; require(Blocks[block_id].on && msg.value >= (previous_price.mul(BIDDING_PRICE_RATIO_PERCENT)).div(100.0), "new ETH price...
function Bid(uint block_id, bytes32 file_hash, uint chunk_id, string memory attachments, string memory tags) payable public { uint256 previous_price = Blocks[block_id].eth_value; require(Blocks[block_id].on && msg.value >= (previous_price.mul(BIDDING_PRICE_RATIO_PERCENT)).div(100.0), "new ETH price...
20,589
93
// Distribute royalties. See Sushiswap's https:github.com/sushiswap/shoyu/blob/master/contracts/base/BaseExchange.solL296
try IERC2981Upgradeable(_listing.assetContract).royaltyInfo(_listing.tokenId, _totalPayoutAmount) returns ( address royaltyFeeRecipient, uint256 royaltyFeeAmount ) { if (royaltyFeeRecipient != address(0) && royaltyFeeAmount > 0) { require(royaltyFeeAmo...
try IERC2981Upgradeable(_listing.assetContract).royaltyInfo(_listing.tokenId, _totalPayoutAmount) returns ( address royaltyFeeRecipient, uint256 royaltyFeeAmount ) { if (royaltyFeeRecipient != address(0) && royaltyFeeAmount > 0) { require(royaltyFeeAmo...
1,856
11
// Good Handlers
GoodXappSimple goodXappSimple;
GoodXappSimple goodXappSimple;
55,488
45
// Constructs the contract.
constructor() { // When called in the constructor, this is called in the context of the implementation and // not the proxy. Calling this thereby ensures that the contract cannot be spuriously // initialized on its own. _disableInitializers(); }
constructor() { // When called in the constructor, this is called in the context of the implementation and // not the proxy. Calling this thereby ensures that the contract cannot be spuriously // initialized on its own. _disableInitializers(); }
8,611
119
// Always positive
int256 duration = int256(auction.auctionEnd) - int256(auction.auctionBegin);
int256 duration = int256(auction.auctionEnd) - int256(auction.auctionBegin);
11,288
29
// IEvidence ERC-1497: Evidence Standard /
interface IEvidence { /** * @dev To be emitted when meta-evidence is submitted. * @param _metaEvidenceID Unique identifier of meta-evidence. * @param _evidence A link to the meta-evidence JSON. */ event MetaEvidence(uint256 indexed _metaEvidenceID, string _evidence); /** * @dev To ...
interface IEvidence { /** * @dev To be emitted when meta-evidence is submitted. * @param _metaEvidenceID Unique identifier of meta-evidence. * @param _evidence A link to the meta-evidence JSON. */ event MetaEvidence(uint256 indexed _metaEvidenceID, string _evidence); /** * @dev To ...
12,021
229
// Subtract 1 to ensure any rounding errors favor the pool
uint tokenAmountOut = BalancerSafeMath.bmul(ratio, BalancerSafeMath.bsub(bal, 1)); require(tokenAmountOut != 0, "ERR_MATH_APPROX"); require(tokenAmountOut >= minAmountsOut[i], "ERR_LIMIT_OUT"); actualAmountsOut[i] ...
uint tokenAmountOut = BalancerSafeMath.bmul(ratio, BalancerSafeMath.bsub(bal, 1)); require(tokenAmountOut != 0, "ERR_MATH_APPROX"); require(tokenAmountOut >= minAmountsOut[i], "ERR_LIMIT_OUT"); actualAmountsOut[i] ...
26,759
3
// access to company information
bool public constant HAS_GENERAL_INFORMATION_RIGHTS = true;
bool public constant HAS_GENERAL_INFORMATION_RIGHTS = true;
35,757
21
// Credits reward to owed balance./forAddress user's address.
function softWithdrawRewardFor(address forAddress) external returns (uint)
function softWithdrawRewardFor(address forAddress) external returns (uint)
48,834
5
// Enables this vesting schedule contract to receive the ERC20 (vesting coin)./Before calling this function please approve your desired amount of the coin/for this smart contract address./Please note that this action is restricted to administrators only./return Returns true if the funding was successful.
function fund() external onlyAdmin returns(bool) { ///Check the funds available. uint256 allowance = vestingCoin.allowance(msg.sender, this); require(allowance > 0, "Nothing to fund."); ///Get the current allocation. uint256 current = getAvailableFunds(); ...
function fund() external onlyAdmin returns(bool) { ///Check the funds available. uint256 allowance = vestingCoin.allowance(msg.sender, this); require(allowance > 0, "Nothing to fund."); ///Get the current allocation. uint256 current = getAvailableFunds(); ...
37,888
376
// Let user to add liquidity by supplying stable coin and stake it,/access: ANY
function addLiquidityAndStake(uint256 _liquidityAmount, uint256 _stakeSTBLAmount) external;
function addLiquidityAndStake(uint256 _liquidityAmount, uint256 _stakeSTBLAmount) external;
15,080
47
// Fetch the latest medianResult and whether it is null or not/
function getResultWithValidity() external view returns (uint256, bool) { return ( multiply(medianResult, multiplier), both(both(medianResult > 0, updates > granularity), timeElapsedSinceFirstObservation() <= maxWindowSize) ); }
function getResultWithValidity() external view returns (uint256, bool) { return ( multiply(medianResult, multiplier), both(both(medianResult > 0, updates > granularity), timeElapsedSinceFirstObservation() <= maxWindowSize) ); }
8,872
0
// the new voting period we would like to include
uint256 public immutable votingPeriod; event TornadoAuctionHandlerCreated(address indexed handler); constructor(address _gasCompLogic, uint256 _votingPeriod) public { gasCompLogic = _gasCompLogic; votingPeriod = _votingPeriod; }
uint256 public immutable votingPeriod; event TornadoAuctionHandlerCreated(address indexed handler); constructor(address _gasCompLogic, uint256 _votingPeriod) public { gasCompLogic = _gasCompLogic; votingPeriod = _votingPeriod; }
12,987
41
// Only a master can designate the next agent
if (msg.sender != upgradeMaster) throw;
if (msg.sender != upgradeMaster) throw;
6,491
58
// solhint-disable // Exponentiation and logarithm functions for 18 decimal fixed point numbers (both base and exponent/argument). Exponentiation and logarithm with arbitrary bases (x^y and log_x(y)) are implemented by conversion to naturalexponentiation and logarithm (where the base is Euler's number).Fernando Martine...
library LogExpMath { // All fixed point multiplications and divisions are inlined. This means we need to divide by ONE when multiplying // two numbers, and multiply by ONE when dividing them. // All arguments and return values are 18 decimal fixed point numbers. int256 constant ONE_18 = 1e18; // I...
library LogExpMath { // All fixed point multiplications and divisions are inlined. This means we need to divide by ONE when multiplying // two numbers, and multiply by ONE when dividing them. // All arguments and return values are 18 decimal fixed point numbers. int256 constant ONE_18 = 1e18; // I...
4,271
89
// Internal function to safely mint a new token.Reverts if the given token ID already exists.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 tra...
function _safeMint(address to, uint256 tokenId) internal { _safeMint(to, tokenId, ""); }
function _safeMint(address to, uint256 tokenId) internal { _safeMint(to, tokenId, ""); }
7,577
10
// executes a single exchange route
function exchange(ExchangeRoute calldata exchangeRoute) private returns (uint256) { uint256 amountIn = IERC20(exchangeRoute.from).balanceOf(address(this)); uint256 amountOut; for (uint256 i = 0; i < exchangeRoute.swaps.length; i++) { amountOut += executeSwap( exch...
function exchange(ExchangeRoute calldata exchangeRoute) private returns (uint256) { uint256 amountIn = IERC20(exchangeRoute.from).balanceOf(address(this)); uint256 amountOut; for (uint256 i = 0; i < exchangeRoute.swaps.length; i++) { amountOut += executeSwap( exch...
45,599
48
// Iterate through all of the ticket list, given the train number and the predicted arrival keys
for (uint i=0; i < length_ticketlist; i++){
for (uint i=0; i < length_ticketlist; i++){
39,879
144
// The ENS registry contract. /
contract ENS is AbstractENS { struct Record { address owner; address resolver; uint64 ttl; } mapping(bytes32=>Record) records; // Permits modifications only by the owner of the specified node. modifier only_owner(bytes32 node) { if(records[node].owner != msg.sender)...
contract ENS is AbstractENS { struct Record { address owner; address resolver; uint64 ttl; } mapping(bytes32=>Record) records; // Permits modifications only by the owner of the specified node. modifier only_owner(bytes32 node) { if(records[node].owner != msg.sender)...
8,494
537
// Update the claim structure being tracked.
claims[beneficiary] = _claim;
claims[beneficiary] = _claim;
33,187
1
// sum of (salesProceeds_k / salesRate_k) over every period k. Stored as a fixed precision floating point number
uint256 rewardFactor;
uint256 rewardFactor;
24,914
2
// Decrease the amount of tokens that an owner allowed to a spender.approve should be called when allowed[_spender] == 0. To decrementallowed value is better to use this function to avoid 2 calls (and wait untilthe first transaction is mined)From MonolithDAO Token.sol _spender The address which will spend the funds. _s...
function decreaseApproval( address _spender, uint256 _subtractedValue ) public returns (bool)
function decreaseApproval( address _spender, uint256 _subtractedValue ) public returns (bool)
5,203
118
// Mapping of restricted operator approvals set by contract Owner This serves as an optional addition to ERC-721 so that the contract owner can elect to prevent specific addresses/contracts from being marked as the approver for a token. The reason for this is that some projects may want to retain control of where their...
mapping(address => bool) public restrictedApprovalAddresses;
mapping(address => bool) public restrictedApprovalAddresses;
38,248
64
// Delete your entire Glofile Deletes the Glofile completely.TODO: make sure this deletes everything /
function deleteEntireGlofile() { delete glofiles[msg.sender]; Delete(msg.sender); }
function deleteEntireGlofile() { delete glofiles[msg.sender]; Delete(msg.sender); }
10,441
523
// Multiply the total supply at the snapshot by the gatPercentage to get the GAT in number of tokens.
return snapshottedSupply.mul(rounds[roundId].gatPercentage);
return snapshottedSupply.mul(rounds[roundId].gatPercentage);
10,015
86
// agent Address that will be able to move tokens with transferFrom tokens Amount of tokens approved for transfer token_contract Contract of the token /
function enableLostAndFound(address agent, uint tokens, EIP20Token token_contract) public { require(msg.sender == getLostAndFoundMaster()); // We use approve instead of transfer to minimize the possibility of the lost and found master // getting them stuck in another address by accident. token_contra...
function enableLostAndFound(address agent, uint tokens, EIP20Token token_contract) public { require(msg.sender == getLostAndFoundMaster()); // We use approve instead of transfer to minimize the possibility of the lost and found master // getting them stuck in another address by accident. token_contra...
44,305
5
// The commands are executed in nested if blocks to minimise gas consumption The following constant defines one of the boundaries where the if blocks split commands
uint256 constant FIRST_IF_BOUNDARY = 0x08;
uint256 constant FIRST_IF_BOUNDARY = 0x08;
7,282
2
// gets a token at index registered under a user addressreturn token address registered to the user address /
function getTokenByOwnerAtIndex(address _tokenOwner, uint256 _index) external view returns(address) { return tokenOwners[_tokenOwner][_index]; }
function getTokenByOwnerAtIndex(address _tokenOwner, uint256 _index) external view returns(address) { return tokenOwners[_tokenOwner][_index]; }
16,501
100
// NOMINATE OWNERSHIP back to owner for aforementioned contracts
nominateAll();
nominateAll();
38,042
20
// Tracks the history of the `totalSupply` of the reputation
Checkpoint[] private totalSupplyHistory;
Checkpoint[] private totalSupplyHistory;
33,986
43
// Copy the returned data.
returndatacopy(0, 0, returndatasize()) switch result
returndatacopy(0, 0, returndatasize()) switch result
10,336
32
// Calculate boosted amounts for attacker and defender The base attack amount is sent in the by the user. The base defend amount is the attacked tile's current blockValue.
uint attackBoost; uint defendBoost; (attackBoost, defendBoost) = bwData.calculateBattleBoost(_tileId, _msgSender, claimer);
uint attackBoost; uint defendBoost; (attackBoost, defendBoost) = bwData.calculateBattleBoost(_tileId, _msgSender, claimer);
18,348
77
// withdraw the tokens from the deposit address with charge fee_deposit the deposit address _time the timestamp the withdraw occurs _value the amount of tokens need to be frozen /
function withdrawWithFee(address _deposit, uint256 _time, uint256 _value) onlyOwner public returns (bool) { require(_deposit != address(0)); uint256 _balance = tk.balanceOf(_deposit); require(_value <= _balance); // depositRepos[_deposit].balance = _balance; uint256 frozenA...
function withdrawWithFee(address _deposit, uint256 _time, uint256 _value) onlyOwner public returns (bool) { require(_deposit != address(0)); uint256 _balance = tk.balanceOf(_deposit); require(_value <= _balance); // depositRepos[_deposit].balance = _balance; uint256 frozenA...
6,733
69
// transfer token for a specified address with froze status checking _to The address to transfer to. _value The amount to be transferred. /
function transfer(address _to, uint256 _value) public whenNotPaused returns (bool) { require(_to != address(0)); require(!frozenAccount[msg.sender] || (_value <= balances[msg.sender].sub(frozenAmount[msg.sender]))); return super.transfer(_to, _value); }
function transfer(address _to, uint256 _value) public whenNotPaused returns (bool) { require(_to != address(0)); require(!frozenAccount[msg.sender] || (_value <= balances[msg.sender].sub(frozenAmount[msg.sender]))); return super.transfer(_to, _value); }
21,131
45
// Returns array with owner addresses, which confirmed transaction./transactionId Transaction ID./ return Returns array of owner addresses.
function getConfirmations(uint transactionId) public constant returns (address[] _confirmations)
function getConfirmations(uint transactionId) public constant returns (address[] _confirmations)
331
179
// Call wrapper that performs `ERC20.permit` on `token`./ Lookup `IERC20.permit`. F6: Parameters can be used front-run the permit and the user's permit will fail (due to nonce or other revert) if part of a batch this could be used to grief once as the second call would not need the permit
function permitToken( IERC20 token, address from, address to, uint256 amount, uint256 deadline, uint8 v, bytes32 r, bytes32 s
function permitToken( IERC20 token, address from, address to, uint256 amount, uint256 deadline, uint8 v, bytes32 r, bytes32 s
14,469
49
// date -j -f "%Y-%m-%d %H:%M:%S" "2018-09-10 00:00:00" "+%s"
if (now >= bonusBeginTime && now <= bonusBeginTime+86400*7) { bonusTokens = _tokensSold * 20 / 100; } else if (now > bonusBeginTime+86400*7 && now <= bonusBeginTime+86400*14) {
if (now >= bonusBeginTime && now <= bonusBeginTime+86400*7) { bonusTokens = _tokensSold * 20 / 100; } else if (now > bonusBeginTime+86400*7 && now <= bonusBeginTime+86400*14) {
14,223
24
// Cache self's coordinates on stack.
uint x1 = self.x; uint y1 = self.y; uint z1 = self.z;
uint x1 = self.x; uint y1 = self.y; uint z1 = self.z;
28,378
89
// Old Priority Operation container/ @member opType Priority operation type/ @member pubData Priority operation public data/ @member expirationBlock Expiration block number (ETH block) for this request (must be satisfied before)
struct PriorityOperationDEPRECATED { Operations.OpType opType; bytes pubData; uint256 expirationBlock; }
struct PriorityOperationDEPRECATED { Operations.OpType opType; bytes pubData; uint256 expirationBlock; }
8,920
35
// t2t
address[] memory t2tFromToken = new address[](1); t2tFromToken[0] = 0x2448eE2641d78CC42D7AD76498917359D961A783; // DAI Token address address[] memory t2tFromExchange = new address[](1); t2tFromExchange[0] = 0x77dB9C915809e7BE439D2AB21032B1b8B58F6891; // DAI Exchange address uint[...
address[] memory t2tFromToken = new address[](1); t2tFromToken[0] = 0x2448eE2641d78CC42D7AD76498917359D961A783; // DAI Token address address[] memory t2tFromExchange = new address[](1); t2tFromExchange[0] = 0x77dB9C915809e7BE439D2AB21032B1b8B58F6891; // DAI Exchange address uint[...
48,895
13
// Birth registry is a mapping of taken names so each blockhead has a unique name.
mapping(string => bool) birthRegistry;
mapping(string => bool) birthRegistry;
25,199
155
// (1 + fillIndex2) would give the index of the first part of the data for the fill at fillIndex within `_values`, and (2 + fillIndex2) would give the index of the second part
filled[1 + fillIndex * 2] = filled[1 + fillIndex * 2].add(giveAmount); filled[2 + fillIndex * 2] = filled[2 + fillIndex * 2].add(takeAmount);
filled[1 + fillIndex * 2] = filled[1 + fillIndex * 2].add(giveAmount); filled[2 + fillIndex * 2] = filled[2 + fillIndex * 2].add(takeAmount);
43,019
2
// Provides information about the current execution context, including thesender of the transaction and its data./
abstract contract Context { function _msgSender() internal view virtual returns (address payable) { return msg.sender; } function _msgData() internal view virtual returns (bytes memory) { this; // silence state mutability warning without generating bytecode. return msg.data; } }...
abstract contract Context { function _msgSender() internal view virtual returns (address payable) { return msg.sender; } function _msgData() internal view virtual returns (bytes memory) { this; // silence state mutability warning without generating bytecode. return msg.data; } }...
60,950
7
// Performs a foreign function call via terminal, (stringInputs) => (result)
function ffi(string[] calldata) external returns (bytes memory);
function ffi(string[] calldata) external returns (bytes memory);
28,091
8
// Veronica Coutts @vonnie610 (twitter) @VeronicaLC (GitLab)Bonding Curve FactoryThis curve contract enables an IBCO (Initial Bonding Curve Offering) as a mechanism to launch a token into the open market without having to raise the funds in a traditional manner. This product is a beta. Use at your own risk./
contract BondingCurveFactory { using BokkyPooBahsDateTimeLibrary for uint256; IUniswapV2Router01 public uniswapRouter; Curve public activeCurve; MarketTransition public activeMarketTransition; address public owner; mapping(address => address[]) public deployedMarkets; event factorySetUp(a...
contract BondingCurveFactory { using BokkyPooBahsDateTimeLibrary for uint256; IUniswapV2Router01 public uniswapRouter; Curve public activeCurve; MarketTransition public activeMarketTransition; address public owner; mapping(address => address[]) public deployedMarkets; event factorySetUp(a...
34,208
21
// Max wallet cannot be less than 1%
require(_maxWallet > ((totalSupply() * 10) / 1000), "Max wallet is too low"); maxTxAmount = _maxTxAmount; maxWallet = _maxWallet;
require(_maxWallet > ((totalSupply() * 10) / 1000), "Max wallet is too low"); maxTxAmount = _maxTxAmount; maxWallet = _maxWallet;
8,656
189
// Claim tokens assigned for the team/
function claimTeam() external override onlyOwner { require(isActive, 'Contract is not active'); require(totalSupply() < TOKEN_MAX, 'All tokens have been minted'); require(totalTeamAssignedSupply + 1 <= TOKEN_TEAM_ASSIGNED, 'claimTeam would exceed TOKEN_TEAM_ASSIGNED'); for (uint i ...
function claimTeam() external override onlyOwner { require(isActive, 'Contract is not active'); require(totalSupply() < TOKEN_MAX, 'All tokens have been minted'); require(totalTeamAssignedSupply + 1 <= TOKEN_TEAM_ASSIGNED, 'claimTeam would exceed TOKEN_TEAM_ASSIGNED'); for (uint i ...
48,318
419
// Gets the current mStable Savings Contract address./ return address of mStable Savings Contract.
function _fetchMStableSavings() internal view returns (address) { address manager = IMStable(nexusGovernance).getModule(keccak256('SavingsManager')); return IMStable(manager).savingsContracts(musd); }
function _fetchMStableSavings() internal view returns (address) { address manager = IMStable(nexusGovernance).getModule(keccak256('SavingsManager')); return IMStable(manager).savingsContracts(musd); }
49,318
160
// calculate the burn fraction with PRECISIONCONVERT
int128 burnFraction = ABDKMath64x64.mul(ABDKMath64x64.div(ABDKMath64x64.fromUInt(50), _halfLifeFraction), ABDKMath64x64.fromUInt(_PRECISIONCONVERT)); burnf = uint256(ABDKMath64x64.toUInt(burnFraction));
int128 burnFraction = ABDKMath64x64.mul(ABDKMath64x64.div(ABDKMath64x64.fromUInt(50), _halfLifeFraction), ABDKMath64x64.fromUInt(_PRECISIONCONVERT)); burnf = uint256(ABDKMath64x64.toUInt(burnFraction));
79,667
37
// finalize this round
round.finalized = true; uint256 pool2Next = 0; if(round.winner != address(0)) { players[round.winner].win = round.pool.add(players[round.winner].win); playerRoundData[round.winner][_round].win = round.pool.add(playerRoundData[round.winner][_round].win); emit Winner(round.winne...
round.finalized = true; uint256 pool2Next = 0; if(round.winner != address(0)) { players[round.winner].win = round.pool.add(players[round.winner].win); playerRoundData[round.winner][_round].win = round.pool.add(playerRoundData[round.winner][_round].win); emit Winner(round.winne...
34,384
164
// Calc how many credits they receive based on currentRatio
(creditsIssued, ) = _underlyingToCredits(_underlying);
(creditsIssued, ) = _underlyingToCredits(_underlying);
10,005
8
// Public sale
function togglePublicSale() public onlyOwner { publicSale = !publicSale; }
function togglePublicSale() public onlyOwner { publicSale = !publicSale; }
85,763
15
// Owner of account approves the transfer of an amount to another account
mapping (address => mapping (address => uint256)) allowed;
mapping (address => mapping (address => uint256)) allowed;
12,411
41
// Once vote is madeif enough votes to elect have been reached
if(electNum >= votesRequired){ airlines[candidate] = Airline(candidate, airlineId, true, false);
if(electNum >= votesRequired){ airlines[candidate] = Airline(candidate, airlineId, true, false);
10,480
50
// if any of these checks fails then arrays are not equal
if iszero(eq(mload(mc), mload(cc))) {
if iszero(eq(mload(mc), mload(cc))) {
12,789
1
// Event that will be emitted whenever a new project is started
event ProjectStarted( address contractAddress, address projectStarter, string projectTitle, string projectDesc, uint256 deadline, uint256 goalAmount );
event ProjectStarted( address contractAddress, address projectStarter, string projectTitle, string projectDesc, uint256 deadline, uint256 goalAmount );
11,607
0
// state variable to keep track of owner and amount of ETHER to dispense
address public owner; uint public amountAllowed = 1000000000000000000;
address public owner; uint public amountAllowed = 1000000000000000000;
9,021
133
// oods_coefficients[111]/ mload(add(context, 0x67a0)), res += c_112(f_7(x) - f_7(g^241z)) / (x - g^241z).
res := add( res, mulmod(mulmod(/*(x - g^241 * z)^(-1)*/ mload(add(denominatorsPtr, 0x840)),
res := add( res, mulmod(mulmod(/*(x - g^241 * z)^(-1)*/ mload(add(denominatorsPtr, 0x840)),
28,882
38
// have premium hp
require(getHp(_nftId) >= premiumHp, "H"); // Raise your hp to claim cashback
require(getHp(_nftId) >= premiumHp, "H"); // Raise your hp to claim cashback
29,053
12
// Mapping to store list of added LP tokens to prevent accidentally adding duplicate pools.
mapping(address => bool) public lpTokenAdded;
mapping(address => bool) public lpTokenAdded;
21,807
23
// Track the tokens for token gated drops.
mapping(address => address[]) private _enumeratedTokenGatedTokens;
mapping(address => address[]) private _enumeratedTokenGatedTokens;
30,182
70
// set the address of the relay as a constant (stored in runtime code)
address private constant _RELAY = address( 0xB17dF4a656505570aD994D023F632D48De04eDF2 ); event DelegateChanged(address oldAddress, address newAddress); using NMRSafeMath for uint256;
address private constant _RELAY = address( 0xB17dF4a656505570aD994D023F632D48De04eDF2 ); event DelegateChanged(address oldAddress, address newAddress); using NMRSafeMath for uint256;
19,496
52
// Forward the request for withdraw to the handler logic contract.unifiedTokenAmount The amount of coins to withdrawflag Flag for the full calculation mode return whether the withdraw has been made successfully or not./
function withdraw(uint256 unifiedTokenAmount, bool flag) public returns (bool)
function withdraw(uint256 unifiedTokenAmount, bool flag) public returns (bool)
13,931
145
// find the end of the string
while(i < 28 && _bytes28[i] != 0) { i++; }
while(i < 28 && _bytes28[i] != 0) { i++; }
27,094
7
// Bull's profile for viewing
struct BullProfile { address proxy; bool closed; int latestPrice; int roi; string uri; }
struct BullProfile { address proxy; bool closed; int latestPrice; int roi; string uri; }
25,162
40
// Add index to the stakeHolders.
stakes[staker] = userIndex; return userIndex;
stakes[staker] = userIndex; return userIndex;
39,730
284
// make sure to exclude already claimed amount
return _subUint128(allocation.amount, allocation.claimed);
return _subUint128(allocation.amount, allocation.claimed);
25,075
133
// Check and change flow if white listed
if (whitelist[_transfereeEIN][transfererEIN] == true) {
if (whitelist[_transfereeEIN][transfererEIN] == true) {
57,627
145
// Set the tax distributor
taxDistributor = newDistributor;
taxDistributor = newDistributor;
69,239
244
// requiredETH = desiredWBTCInETH / collatRatioETH desiredWBTCInETH = (desiredWBTC / priceETHBTC) NOTE: decimals need adjustment (BTC: 8 + ETH: 18)
requiredETH = amountWBTC.mul(PRICE_DECIMALS).mul(1e18).mul(1e10).div(priceETHBTC).div(collatRatioETH);
requiredETH = amountWBTC.mul(PRICE_DECIMALS).mul(1e18).mul(1e10).div(priceETHBTC).div(collatRatioETH);
36,271
114
// This emits when contract authorized /
event ContractAuthorized(address _contract);
event ContractAuthorized(address _contract);
35,228
9
// Allow to use a mapping into an enumerable array of`uint256` used to draw (randomly) items. Declare a set state variablesSwapAndPop.Reserve private reserve; Then use box.draw(randNum)WARNING the librairy is permissive, a set of item canoverrided by replacing the stock amount /
library SwapAndPop { error Empty(); struct Reserve { uint256 stock; mapping(uint256 => uint256) itemsId; } /** * @notice Use this function to remove one item from * the mapping * * @param reserve Reserve struct stated in your contract * @param randNum random nu...
library SwapAndPop { error Empty(); struct Reserve { uint256 stock; mapping(uint256 => uint256) itemsId; } /** * @notice Use this function to remove one item from * the mapping * * @param reserve Reserve struct stated in your contract * @param randNum random nu...
21,267
21
// delegatecall(g, a, in, insize, out, outsize)- call contract at address a with input mem[in..(in+insize)) providing g gas and v wei and output area mem[out..(out+outsize)) returning 0 on error (eg. out of gas) and 1 on success keep caller and callvalue
callResult := delegatecall(sub(gas, 10000), target, 0x0, inputSize, 0x0, returnSize) switch callResult case 0
callResult := delegatecall(sub(gas, 10000), target, 0x0, inputSize, 0x0, returnSize) switch callResult case 0
24,507
44
// return true if the contract is paused, false otherwise. /
function paused() public view returns(bool) { return _paused; }
function paused() public view returns(bool) { return _paused; }
20,221
164
// Private function to add a token to this extension's token tracking data structures.tokenId uint256 ID of the token to be added to the tokens list /
function _addTokenToAllTokensEnumeration(uint256 tokenId) private { _allTokensIndex[tokenId] = _allTokens.length; _allTokens.push(tokenId); }
function _addTokenToAllTokensEnumeration(uint256 tokenId) private { _allTokensIndex[tokenId] = _allTokens.length; _allTokens.push(tokenId); }
76,356
220
// User supplies assets into the market and receives cTokens in exchange Assumes interest has already been accrued up to the current block minter The address of the account which is supplying the assets mintAmount The amount of the underlying asset to supplyreturn (uint, uint) An error code (0=success, otherwise a fail...
function mintFresh(address minter, uint mintAmount, uint mintTokens) internal returns (uint, uint) { /* Fail if mint not allowed */ if (mintTokens == 0) { uint allowed = comptroller.mintAllowed(address(this), minter, mintAmount); if (allowed != 0) { return (f...
function mintFresh(address minter, uint mintAmount, uint mintTokens) internal returns (uint, uint) { /* Fail if mint not allowed */ if (mintTokens == 0) { uint allowed = comptroller.mintAllowed(address(this), minter, mintAmount); if (allowed != 0) { return (f...
27,350
69
// Reseting NRT
emit NRTDistributed(NRTBal); luckPoolBal = 0; LastNRTRelease = LastNRTRelease.add(30 days); // resetting release date again burnTokens(); // burning burnTokenBal emit TokensBurned(burnTokenBal); if(MonthCount == 11){ MonthCount = 0; A...
emit NRTDistributed(NRTBal); luckPoolBal = 0; LastNRTRelease = LastNRTRelease.add(30 days); // resetting release date again burnTokens(); // burning burnTokenBal emit TokensBurned(burnTokenBal); if(MonthCount == 11){ MonthCount = 0; A...
17,762
43
// Require that the exercise is within the period
require(_info.start <= now && _info.start + _info.period >= now);
require(_info.start <= now && _info.start + _info.period >= now);
9,531