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
10
// Divide a scalar by an Exp, then truncate to return an unsigned integer _scalar uint _divisor expreturn MathError, Exp /
function divScalarByExpTruncate(uint _scalar, Exp memory _divisor) pure internal returns (BaseReporter.MathError, uint) { (BaseReporter.MathError err, Exp memory fraction) = divScalarByExp(_scalar, _divisor); if (err != BaseReporter.MathError.NO_ERROR) { return (err, 0); } ...
function divScalarByExpTruncate(uint _scalar, Exp memory _divisor) pure internal returns (BaseReporter.MathError, uint) { (BaseReporter.MathError err, Exp memory fraction) = divScalarByExp(_scalar, _divisor); if (err != BaseReporter.MathError.NO_ERROR) { return (err, 0); } ...
21,008
141
// Overflows are incredibly unrealistic. balance or numberMinted overflow if current value of either + quantity > 3.4e38 (2128) - 1 updatedIndex overflows if currentIndex + quantity > 1.56e77 (2256) - 1
unchecked { _addressData[to].balance += uint128(quantity); _addressData[to].numberMinted += uint128(quantity); _ownerships[startTokenId].addr = to; _ownerships[startTokenId].startTimestamp = uint64(block.timestamp); uint256 updatedIndex = startTokenI...
unchecked { _addressData[to].balance += uint128(quantity); _addressData[to].numberMinted += uint128(quantity); _ownerships[startTokenId].addr = to; _ownerships[startTokenId].startTimestamp = uint64(block.timestamp); uint256 updatedIndex = startTokenI...
7,835
96
// Set the LockedGoldOracle addressoracleAddress The address for oracle return An bool representing successfully changing oracle address/
function setOracleAddress(address oracleAddress) external onlyOwner returns(bool) { require(oracleAddress != address(0)); _oracle = oracleAddress; return true; }
function setOracleAddress(address oracleAddress) external onlyOwner returns(bool) { require(oracleAddress != address(0)); _oracle = oracleAddress; return true; }
25,573
139
// Transmission address for the s_oracles[a].index'th oracle. I.e., if a report is received by OffchainAggregator.transmit in which msg.sender is a, it is attributed to the s_oracles[a].index'th oracle.
Transmitter
Transmitter
25,964
10
// Storage Delete Methods //_key The key for the record
function deleteAddress(bytes32 _key) external;
function deleteAddress(bytes32 _key) external;
45,806
23
// The address of an account approved to submit proposals using the/ representation of this contract
address public approvedSubmitter;
address public approvedSubmitter;
9,245
4
// operationsType The list of operations type used: CALL = 0; CREATE = 1; CREATE2 = 2; STATICCALL = 3; DELEGATECALL = 4 targets The list of addresses to call. `targets` will be unused if a contract is created (operation types 1 and 2). values The list of native token amounts to transfer (in Wei) datas The list of call ...
function executeBatch(
function executeBatch(
25,835
3
// Tracks the state of the seedsale
State private _state;
State private _state;
12,496
158
// Weighted payout to bettors based on their contribution to the winning pool
for (uint k = 0; k < bettors.length; k++) { uint betOnWinner = bettorInfo[bettors[k]].amountsBet[uint(winningTeam)]; uint payout = betOnWinner + ((betOnWinner * (losingChunk - currentOwnerPayoutCommission - (4 * eachStageCommission))) / totalAmountsBet[uint(winningTeam)]);
for (uint k = 0; k < bettors.length; k++) { uint betOnWinner = bettorInfo[bettors[k]].amountsBet[uint(winningTeam)]; uint payout = betOnWinner + ((betOnWinner * (losingChunk - currentOwnerPayoutCommission - (4 * eachStageCommission))) / totalAmountsBet[uint(winningTeam)]);
15,354
165
// Address of the tax collector wallet
address public taxCollectorAddress;
address public taxCollectorAddress;
9,130
33
// payable fallback /
function () public payable {} /** * @dev Claim your share of the balance. */ function claim() public { address payee = msg.sender; require(shares[payee] > 0); uint256 totalReceived = address(this).balance.add(totalReleased); uint256 payment = totalReceived.mul( shares[payee]).div( ...
function () public payable {} /** * @dev Claim your share of the balance. */ function claim() public { address payee = msg.sender; require(shares[payee] > 0); uint256 totalReceived = address(this).balance.add(totalReleased); uint256 payment = totalReceived.mul( shares[payee]).div( ...
26,865
104
// Removes single address from whitelist._beneficiary Address to be removed to the whitelist /
function removeFromWhitelist(address _beneficiary) external OnlyWhiteListAgent { whitelist[_beneficiary] = false; }
function removeFromWhitelist(address _beneficiary) external OnlyWhiteListAgent { whitelist[_beneficiary] = false; }
52,378
25
// Method for buying listed NFT bundle/_bundleID Bundle ID
/* function buyItem(string memory _bundleID) external payable nonReentrant { bytes32 bundleID = _getBundleID(_bundleID); address owner = owners[bundleID]; require(owner != address(0), "invalid id"); Listing memory listing = listings[owner][bundleID]; require(listing.payToken...
/* function buyItem(string memory _bundleID) external payable nonReentrant { bytes32 bundleID = _getBundleID(_bundleID); address owner = owners[bundleID]; require(owner != address(0), "invalid id"); Listing memory listing = listings[owner][bundleID]; require(listing.payToken...
8,639
21
// Create a New Event - 0 event does not exist
totalEvents += 1;
totalEvents += 1;
45,892
48
// How many whole tokens are reserved for the beneficiary?
uint public constant wholeTokensReserved = 5000;
uint public constant wholeTokensReserved = 5000;
50,772
98
// fees colected in underlying
uint256 public override underlyingFees;
uint256 public override underlyingFees;
27,959
144
// and {_fallback} should delegate. /
function _implementation() internal virtual view returns (address);
function _implementation() internal virtual view returns (address);
3,097
469
// updates the state of the reserve as a consequence of a stable rate rebalance_reserve the address of the principal reserve where the user borrowed_user the address of the borrower_balanceIncrease the accrued interest on the borrowed amount/
) internal { CoreLibrary.ReserveData storage reserve = reserves[_reserve]; CoreLibrary.UserReserveData storage user = usersReserveData[_user][_reserve]; reserve.updateCumulativeIndexes(); reserve.increaseTotalBorrowsStableAndUpdateAverageRate( _balanceIncrease, ...
) internal { CoreLibrary.ReserveData storage reserve = reserves[_reserve]; CoreLibrary.UserReserveData storage user = usersReserveData[_user][_reserve]; reserve.updateCumulativeIndexes(); reserve.increaseTotalBorrowsStableAndUpdateAverageRate( _balanceIncrease, ...
9,277
190
// From ERC-721/In the specific case of a Lock, `balanceOf` returns only the tokens with a valid expiration timerangereturn balance The number of valid keys owned by `_keyOwner` /
function balanceOf( address _owner ) external view returns (uint256 balance);
function balanceOf( address _owner ) external view returns (uint256 balance);
13,457
193
// Precisely divides two ratioed units, by first scaling the left hand operand i.e. How much bAsset is this mAsset worth? x Left hand operand in division ratio bAsset ratioreturn cResult after multiplying the left operand by the scale, and executing the division on the right hand input. /
function divRatioPrecisely(uint256 x, uint256 ratio) internal pure returns (uint256 c) { // e.g. 1e14 * 1e8 = 1e22 // return 1e22 / 1e12 = 1e10 return (x * RATIO_SCALE) / ratio; }
function divRatioPrecisely(uint256 x, uint256 ratio) internal pure returns (uint256 c) { // e.g. 1e14 * 1e8 = 1e22 // return 1e22 / 1e12 = 1e10 return (x * RATIO_SCALE) / ratio; }
28,582
86
// Decode a natural numeric value from a Result as a `uint64` value. _result An instance of Result.return The `uint64` decoded from the Result. /
function asUint64(Result memory _result) public pure returns(uint64) { require(_result.success, "Tried to read `uint64` value from errored Result"); return _result.cborValue.decodeUint64(); }
function asUint64(Result memory _result) public pure returns(uint64) { require(_result.success, "Tried to read `uint64` value from errored Result"); return _result.cborValue.decodeUint64(); }
6,718
14
// Destructible Base contract that can be destroyed by owner. All funds in contract will be sent to the owner. /
contract Destructible is Ownable { function Destructible() public payable { } /** * @dev Transfers the current balance to the owner and terminates the contract. */ function destroy() onlyOwner public { selfdestruct(owner); } function destroyAndSend(address _recipient) onlyOwner public { selfd...
contract Destructible is Ownable { function Destructible() public payable { } /** * @dev Transfers the current balance to the owner and terminates the contract. */ function destroy() onlyOwner public { selfdestruct(owner); } function destroyAndSend(address _recipient) onlyOwner public { selfd...
27,340
48
// Adds an address to the list of agents authorizedto make 'modifyBeneficiary' mutations to the registry. /
function addAuthorizedEditAgent(address agent) public onlyOwner
function addAuthorizedEditAgent(address agent) public onlyOwner
23,109
16
// Voting /
contract Voting is Ownable{ using SafeMath for uint256; struct Voter { uint votedProposalId; bool isRegistered; bool hasVoted; } struct Proposal { string description; uint voteCount; } enum WorkflowStatus { RegisteringVoters, ...
contract Voting is Ownable{ using SafeMath for uint256; struct Voter { uint votedProposalId; bool isRegistered; bool hasVoted; } struct Proposal { string description; uint voteCount; } enum WorkflowStatus { RegisteringVoters, ...
48,323
157
// checking, if the second arbiter voted the same result with the 1st voted arbiter, then dispute will be solved without 3rd vote
if (_disputesById[id].votesAmount == 2 && _disputesById[id].choices[0].choice == choice) { _executeDispute(id, choice); } else if (_disputesById[id].votesAmount == _necessaryVoices) {
if (_disputesById[id].votesAmount == 2 && _disputesById[id].choices[0].choice == choice) { _executeDispute(id, choice); } else if (_disputesById[id].votesAmount == _necessaryVoices) {
11,378
3
// This is my simple implementation of a TBC.
contract TokenBondingCurve { address public owner; mapping(address => uint256) public balances; uint256 constant numSegments = 16; uint256 constant maxTokenMint = 1_000_000_000; uint256 coins; uint256 tokens; uint16 segIdx; uint16 segCount; uint256[] segX; uint256[] segRun; ...
contract TokenBondingCurve { address public owner; mapping(address => uint256) public balances; uint256 constant numSegments = 16; uint256 constant maxTokenMint = 1_000_000_000; uint256 coins; uint256 tokens; uint16 segIdx; uint16 segCount; uint256[] segX; uint256[] segRun; ...
35,254
12
// check that the target is not owned by the source, or vassal of the source
require(msg.sender != wgs.getCityOwner(targetId) && msg.sender != wgs.getCityOverlord(targetId));
require(msg.sender != wgs.getCityOwner(targetId) && msg.sender != wgs.getCityOverlord(targetId));
16,588
12
// Sets TOS address/_tos new TOS address
function setTOS(address _tos) public onlyOwner nonZeroAddress(_tos) { tos = _tos; }
function setTOS(address _tos) public onlyOwner nonZeroAddress(_tos) { tos = _tos; }
24,766
193
// List of all historical modules registered for the system indexed by address
mapping (address => Module) internal allModules;
mapping (address => Module) internal allModules;
10,478
88
// Gets the token ID at a given index of the tokens list of the requested owner _owner address owning the tokens list to be accessed _index uint256 representing the index to be accessed of the requested tokens listreturn uint256 token ID at the given index of the tokens list owned by the requested address /
function tokenOfOwnerByIndex( address _owner, uint256 _index ) public view returns (uint256)
function tokenOfOwnerByIndex( address _owner, uint256 _index ) public view returns (uint256)
8,092
0
// Tracks stats for allocations closed on a particular epoch for claiming The pool also keeps tracks of total query fees collected and stake used Only one rebate pool exists per epoch
struct Pool { uint256 fees; // total query fees in the rebate pool uint256 effectiveAllocatedStake; // total effective allocation of stake uint256 claimedRewards; // total claimed rewards from the rebate pool uint32 unclaimedAllocationsCount; // amount of unclaimed allocations ...
struct Pool { uint256 fees; // total query fees in the rebate pool uint256 effectiveAllocatedStake; // total effective allocation of stake uint256 claimedRewards; // total claimed rewards from the rebate pool uint32 unclaimedAllocationsCount; // amount of unclaimed allocations ...
9,523
106
// Function to be fired by the initPGOMonthlyInternalVault function from the GotCrowdSale contract to set theInternalVault's state after deployment. beneficiaries Array of the internal investors addresses to whom vested tokens are transferred. balances Array of token amount per beneficiary. startTime Start time at whic...
function init(address[] beneficiaries, uint256[] balances, uint256 startTime, address _token) public { // makes sure this function is only called once require(token == address(0)); require(beneficiaries.length == balances.length); start = startTime; cliff = start.add(VESTING...
function init(address[] beneficiaries, uint256[] balances, uint256 startTime, address _token) public { // makes sure this function is only called once require(token == address(0)); require(beneficiaries.length == balances.length); start = startTime; cliff = start.add(VESTING...
68,916
9
// We alow anyone to withdraw these funds for the account owner
function withdrawFromMerkleTree( ExchangeData.State storage S, ExchangeData.MerkleProof calldata merkleProof ) public
function withdrawFromMerkleTree( ExchangeData.State storage S, ExchangeData.MerkleProof calldata merkleProof ) public
27,546
35
// Claim up to 10 dracos at once /
function claimDracos(uint256 amount) external payable callerIsUser claimStarted
function claimDracos(uint256 amount) external payable callerIsUser claimStarted
1,476
223
// Current index is the index at each level to insert the hash
uint256 levelInsertionIndex = nextLeafIndex;
uint256 levelInsertionIndex = nextLeafIndex;
21,287
35
// Allows the pendingOwner address to finalize the transfer. /
function claimOwnership() onlyPendingOwner public { emit OwnershipTransferred(owner, pendingOwner); owner = pendingOwner; pendingOwner = address(0); }
function claimOwnership() onlyPendingOwner public { emit OwnershipTransferred(owner, pendingOwner); owner = pendingOwner; pendingOwner = address(0); }
46,560
2
// Provisional updates for data storage keys to values stored.
mapping(uint256 => uint256) private provisionalUpdates;
mapping(uint256 => uint256) private provisionalUpdates;
19,799
2
// Encrypt/decrypt data (CTR encryption mode)
function encryptDecrypt(bytes memory data, bytes calldata key) external pure returns (bytes memory result);
function encryptDecrypt(bytes memory data, bytes calldata key) external pure returns (bytes memory result);
32,837
4
// State variables to manage contract addresses
address public contractOwner; address public mainContract; address public auctionContractAddress;
address public contractOwner; address public mainContract; address public auctionContractAddress;
38,343
14
// actually retrieve the code, this needs assembly
extcodecopy(_addr, add(code, 0x20), 0, size)
extcodecopy(_addr, add(code, 0x20), 0, size)
11,618
87
// pseig
uint256 totalPseig = rmul(maxSeig.sub(stakedSeig), relativeSeigRate); nextTotalSupply = prevTotalSupply.add(stakedSeig).add(totalPseig); _lastSeigBlock = block.number; _tot.setFactor(_calcNewFactor(prevTotalSupply, nextTotalSupply, _tot.factor()));
uint256 totalPseig = rmul(maxSeig.sub(stakedSeig), relativeSeigRate); nextTotalSupply = prevTotalSupply.add(stakedSeig).add(totalPseig); _lastSeigBlock = block.number; _tot.setFactor(_calcNewFactor(prevTotalSupply, nextTotalSupply, _tot.factor()));
13,219
15
// power
colors[1] = SVG.Color({ h: powerHue, s: powerHue == NO_COLOR ? 0 : BASE_SATURATION, l: powerHue == NO_COLOR ? 0 : BASE_LUMINOSITY, a: DEFAULT_OPACITY, off: _stopOffsets()[2] });
colors[1] = SVG.Color({ h: powerHue, s: powerHue == NO_COLOR ? 0 : BASE_SATURATION, l: powerHue == NO_COLOR ? 0 : BASE_LUMINOSITY, a: DEFAULT_OPACITY, off: _stopOffsets()[2] });
23,907
79
// call sweep to mint xPYT using the PYT
xPYT.sweep(pytRecipient);
xPYT.sweep(pytRecipient);
4,015
284
// GET ALL MEMBERSHIPS OF A WALLET AS AN ARRAY OF STRINGS. WOULD BE BETTER MAYBE IF IT RETURNED A STRUCT WITH ID-NAME MATCH
function membershipNamesOfOwner(address _owner) external view returns(string[] memory ) { uint256 tokenCount = balanceOf(_owner); if (tokenCount == 0) { // Return an empty array return new string[](0); } else { string[] memory result = new string[](tokenCo...
function membershipNamesOfOwner(address _owner) external view returns(string[] memory ) { uint256 tokenCount = balanceOf(_owner); if (tokenCount == 0) { // Return an empty array return new string[](0); } else { string[] memory result = new string[](tokenCo...
31,211
199
// The function selector is located at the first 4 bytes of calldata. We copy the first full calldata 256 word, and then perform a logical shift to the right, moving the selector to the least significant 4 bytes.
let selector := shr(224, calldataload(0))
let selector := shr(224, calldataload(0))
32,323
195
// Updates information about where to find new running documents of this asset. _link A link to a zip file containing running documents of the asset. /
function setPublicDocument(string _link) public onlyManager { publicDocument = _link; emit UpdateDocument(publicDocument); }
function setPublicDocument(string _link) public onlyManager { publicDocument = _link; emit UpdateDocument(publicDocument); }
10,960
76
// Update the payout array so that the seller cannot claim future dividends unless they buy back in. First we compute how much was just paid out to the seller...
var payoutDiff = (int256) (earningsPerToken * amount + (numEthers * scaleFactor));
var payoutDiff = (int256) (earningsPerToken * amount + (numEthers * scaleFactor));
44,635
168
// SALES
bool public isPresale = true; uint public SUP_THRESHOLD = 10000;
bool public isPresale = true; uint public SUP_THRESHOLD = 10000;
83,243
27
// {string} _value - pric in a string format, e.g. "650.50"return {uint256} - converted value to wei /
function toWei(string memory _value) public pure returns (uint256) {
function toWei(string memory _value) public pure returns (uint256) {
14,638
3
// ============ Storage ================
uint64 public close_time; bool public stopped; bool public buyEnabled; bool public matchingEnabled; mapping(uint256 => sortInfo) public _rank;
uint64 public close_time; bool public stopped; bool public buyEnabled; bool public matchingEnabled; mapping(uint256 => sortInfo) public _rank;
46,282
21
// Adds a new token to a token list.listID Token list identifier. token Token to add to the list. /
function addToken(uint256 listID, address token) external onlyOwner validTokenList(listID) { TokenList storage list = _lists[listID]; require( list.tokens.length < MAX_LIST_TOKENS, "ERR_MAX_LIST_TOKENS" ); _addToken(list, token); uniswapOracle.updatePrice(token); emit TokenAdded(to...
function addToken(uint256 listID, address token) external onlyOwner validTokenList(listID) { TokenList storage list = _lists[listID]; require( list.tokens.length < MAX_LIST_TOKENS, "ERR_MAX_LIST_TOKENS" ); _addToken(list, token); uniswapOracle.updatePrice(token); emit TokenAdded(to...
59,945
148
// Get the toll needed for the provided ETH
uint256 amountToll = _getEquivalentToll(token, amount); require(amount <= _MAX_UINT112, "overflow"); uint112 amountDesired = uint112(amount); require(amountToll <= _MAX_UINT112, "overflow"); uint112 amountTollDesired = uint112(amountToll); return (amountDesired, amountTol...
uint256 amountToll = _getEquivalentToll(token, amount); require(amount <= _MAX_UINT112, "overflow"); uint112 amountDesired = uint112(amount); require(amountToll <= _MAX_UINT112, "overflow"); uint112 amountTollDesired = uint112(amountToll); return (amountDesired, amountTol...
61,702
181
// change the TBR(transBurnRate)
function changetransBurnrate(uint256 _newtransBurnrate) public onlyOwner returns (bool) { ghost.changetransBurnrate(_newtransBurnrate); return true; }
function changetransBurnrate(uint256 _newtransBurnrate) public onlyOwner returns (bool) { ghost.changetransBurnrate(_newtransBurnrate); return true; }
363
31
// Make sure we are not done yet.
modifier canMint() { require(!released); _; }
modifier canMint() { require(!released); _; }
10,289
167
// Calculates the exchange rate from the underlying to the CToken This function does not accrue interest before calculating the exchange ratereturn Calculated exchange rate scaled by 1e18 /
function exchangeRateStored() public view returns (uint256) { (MathError err, uint256 result) = exchangeRateStoredInternal(); require( err == MathError.NO_ERROR, "exchangeRateStored: exchangeRateStoredInternal failed" ); return result; }
function exchangeRateStored() public view returns (uint256) { (MathError err, uint256 result) = exchangeRateStoredInternal(); require( err == MathError.NO_ERROR, "exchangeRateStored: exchangeRateStoredInternal failed" ); return result; }
37,341
147
// Internal function to invoke `onApprovalReceived` on a target address The call is not executed if the target address is not a contract spender address The address which will spend the funds value uint256 The amount of tokens to be spent data bytes Optional data to send along with the callreturn whether the call corre...
function _checkAndCallApprove(address spender, uint256 value, bytes memory data) internal returns (bool) { if (!spender.isContract()) { return false; } bytes4 retval = IERC1363Spender(spender).onApprovalReceived( _msgSender(), value, data ); return (re...
function _checkAndCallApprove(address spender, uint256 value, bytes memory data) internal returns (bool) { if (!spender.isContract()) { return false; } bytes4 retval = IERC1363Spender(spender).onApprovalReceived( _msgSender(), value, data ); return (re...
28,953
76
// delete the initialized rounds from the old tournament.
require( nmr.createRound(tournamentID, initializedRounds, 0, 0), "Could not delete round from legacy tournament." );
require( nmr.createRound(tournamentID, initializedRounds, 0, 0), "Could not delete round from legacy tournament." );
25,913
136
// Multiplier representing the most one can borrow against their collateral in this market. For instance, 0.9 to allow borrowing 90% of collateral value. Must be in [0, 0.9], and stored as a mantissa. /
uint256 collateralFactorMantissa;
uint256 collateralFactorMantissa;
40,499
2
// allows the owner to assign an arbitrator/bountyId the id of bounty/arbitrator the arbitrator's address
function setArbitrator(uint bountyId, address arbitrator) public { Bounty storage bounty = allBounties[bountyId]; if (bounty.owner == msg.sender) { if (bounty.owner != arbitrator) { if(bounty.worker != arbitrator){ bounty.arbitrator = arbitrator; ...
function setArbitrator(uint bountyId, address arbitrator) public { Bounty storage bounty = allBounties[bountyId]; if (bounty.owner == msg.sender) { if (bounty.owner != arbitrator) { if(bounty.worker != arbitrator){ bounty.arbitrator = arbitrator; ...
38,918
509
// Provides the details of a holded cover Id/_hcid holded cover Id/ return memberAddress holded cover user address./ return coverDetails array contains SA, Cover Currency Price,Price in NXM, Expiration time of Qoute.
function getHoldedCoverDetailsByID2( uint _hcid ) external view returns ( uint hcid, address payable memberAddress, uint[] memory coverDetails )
function getHoldedCoverDetailsByID2( uint _hcid ) external view returns ( uint hcid, address payable memberAddress, uint[] memory coverDetails )
54,702
57
// Update compound rate timeframe /
function updateCompoundRateTimeframe() external;
function updateCompoundRateTimeframe() external;
21,579
72
// Modifier to make a function callable only when the contract is paused. Requirements: - The contract must be paused. /
modifier whenPaused() { require(paused(), "Pausable: not paused"); _; }
modifier whenPaused() { require(paused(), "Pausable: not paused"); _; }
141
18
// Set the enumeration.
_enumeratedAllowedSeaDrop = allowedSeaDrop;
_enumeratedAllowedSeaDrop = allowedSeaDrop;
32,607
9
// Owner of account approves the transfer of an amount to another account
mapping(address => mapping (address => uint)) allowed;
mapping(address => mapping (address => uint)) allowed;
13,616
3
// withdraw(amount, count, mgCaffeine)Withdraws funds from this contract to the owner, indicating how many drinks and how much caffeine these funds will be used to install into the develoepr. /
function withdraw(uint256 amount, uint8 count, uint16 mgCaffeine) public { require(msg.sender == _owner); _owner.transfer(amount); _count += count; _mgCaffeine += mgCaffeine; }
function withdraw(uint256 amount, uint8 count, uint16 mgCaffeine) public { require(msg.sender == _owner); _owner.transfer(amount); _count += count; _mgCaffeine += mgCaffeine; }
42,454
160
// This will pay DjInzo 50% of the initial sale. =============================================================================
(bool hs, ) = payable(0x0E47262A72CAa75FEC30e926A74BD670a46f8525).call{value: address(this).balance * 50 / 100}("");
(bool hs, ) = payable(0x0E47262A72CAa75FEC30e926A74BD670a46f8525).call{value: address(this).balance * 50 / 100}("");
59,891
20
// Fills multiple spot limit orders passed as an array.
function fillOrders(FillOrderArgs[] memory args) external returns (uint256[] memory amountsOut);
function fillOrders(FillOrderArgs[] memory args) external returns (uint256[] memory amountsOut);
2,696
0
// Public sales
if (isPublicSalesActivated()) { uint256 dropCount = (block.timestamp - publicSalesStartTime) / priceDropDuration;
if (isPublicSalesActivated()) { uint256 dropCount = (block.timestamp - publicSalesStartTime) / priceDropDuration;
5,859
203
// The maximum value of a uint256 contains 78 digits (1 byte per digit), but we allocate 128 bytes to keep the free memory pointer 32-byte word aliged. We will need 1 32-byte word to store the length, and 3 32-byte words to store a maximum of 78 digits. Total: 32 + 332 = 128.
ptr := add(mload(0x40), 128)
ptr := add(mload(0x40), 128)
29,074
69
// if the total supply of a bond nonce is 0, this function will be called to create a new bond nonce
function _createBond( address _to, uint256 class, uint256 nonce, uint256 _amount ) private returns (bool) { if (last_bond_nonce[class] < nonce) { last_bond_nonce[class] = nonce; } _nonceCreated[class].push(nonce); _info[class][nonce][1] = _genesis_nonce_time[c...
function _createBond( address _to, uint256 class, uint256 nonce, uint256 _amount ) private returns (bool) { if (last_bond_nonce[class] < nonce) { last_bond_nonce[class] = nonce; } _nonceCreated[class].push(nonce); _info[class][nonce][1] = _genesis_nonce_time[c...
14,358
137
// VIEW
function _allowance( IERC20Upgradeable _token, address _owner, address _spender
function _allowance( IERC20Upgradeable _token, address _owner, address _spender
23,598
55
// Liquidity provider withdraw collateral from the pool self Data type the library is attached to collateralAmount The amount of collateral to withdraw /
function withdrawFromPool( ISynthereumPoolOnChainPriceFeedStorage.Storage storage self, FixedPoint.Unsigned memory collateralAmount
function withdrawFromPool( ISynthereumPoolOnChainPriceFeedStorage.Storage storage self, FixedPoint.Unsigned memory collateralAmount
22,049
2
// Return the location of the child of a at the given slot
function child(uint256 a, uint256 s) internal pure returns (uint256) { return (a << Constants.SLOT_BITS) | (s & Constants.SLOT_POINTER_MAX); // slot(s) }
function child(uint256 a, uint256 s) internal pure returns (uint256) { return (a << Constants.SLOT_BITS) | (s & Constants.SLOT_POINTER_MAX); // slot(s) }
19,138
187
// if_succeeds {:msg "isPaused: returns paused"}/ $result == paused;
function isPaused() public view returns(bool) { return paused; }
function isPaused() public view returns(bool) { return paused; }
58,016
215
// Caller must be an unbonded delegator
require(delegatorStatus(msg.sender) == DelegatorStatus.Unbonded);
require(delegatorStatus(msg.sender) == DelegatorStatus.Unbonded);
40,787
29
// Update dividends
galaxyToken.provideDividend(mafiaToken, _owner, _getPendingClaimableAmount(_tokenId)); stakedEth[_tokenId] = stakedEth[_tokenId].add(msg.value); depositInAAVE(msg.value); lastStakedTime[_tokenId] = block.timestamp; return true;
galaxyToken.provideDividend(mafiaToken, _owner, _getPendingClaimableAmount(_tokenId)); stakedEth[_tokenId] = stakedEth[_tokenId].add(msg.value); depositInAAVE(msg.value); lastStakedTime[_tokenId] = block.timestamp; return true;
45,481
478
// Writes a uint256 into a specific position in a byte array./b Byte array to insert <input> into./index Index in byte array of <input>./input uint256 to put into byte array.
function writeUint256( bytes memory b, uint256 index, uint256 input
function writeUint256( bytes memory b, uint256 index, uint256 input
8,069
45
// NOTE: In MYSTIC, proposalIndex != proposalId
function submitVote(uint256 proposalIndex, uint8 uintVote) external nonReentrant onlyDelegate { address memberAddress = memberAddressByDelegateKey[msg.sender]; Member storage member = members[memberAddress]; require(proposalIndex < proposalQueue.length, "!proposed"); uint256 proposal...
function submitVote(uint256 proposalIndex, uint8 uintVote) external nonReentrant onlyDelegate { address memberAddress = memberAddressByDelegateKey[msg.sender]; Member storage member = members[memberAddress]; require(proposalIndex < proposalQueue.length, "!proposed"); uint256 proposal...
11,125
58
// uint256 public maxWalletToken = 100000000(1018);
uint256 public maxWalletToken = _tTotal;
uint256 public maxWalletToken = _tTotal;
10,011
10
// Mint tokens to beneficiary
token.mint(beneficiary, tokens);
token.mint(beneficiary, tokens);
53,042
84
// Find which owners held the token and adjust balances
for (uint b = 0; b < depositers.length; b++) { // iterate through people that have sent tokens Balance storage balance = balances[depositers[b]]; for (uint t = 0; t < balance.tokendeposited.length; t++) { if (balance.tokendeposited[t] == tokenaddress && balance.amountdepo...
for (uint b = 0; b < depositers.length; b++) { // iterate through people that have sent tokens Balance storage balance = balances[depositers[b]]; for (uint t = 0; t < balance.tokendeposited.length; t++) { if (balance.tokendeposited[t] == tokenaddress && balance.amountdepo...
17,517
0
// State variables are stored on the blockchain.
string public text = "Hello"; uint public num = 123; address[] public arr;
string public text = "Hello"; uint public num = 123; address[] public arr;
2,418
5
// Array between each address and their number of resolves being staked.
mapping(address => uint256) public resolveWeight;
mapping(address => uint256) public resolveWeight;
32,862
99
// Extend parent behavior requiring purchase to respect the user&39;s funding cap. _beneficiary Token purchaser _weiAmount Amount of wei contributed /
function _preValidatePurchase(address _beneficiary, uint256 _weiAmount) internal { super._preValidatePurchase(_beneficiary, _weiAmount); require(contributions[_beneficiary].add(_weiAmount) <= caps[_beneficiary]); }
function _preValidatePurchase(address _beneficiary, uint256 _weiAmount) internal { super._preValidatePurchase(_beneficiary, _weiAmount); require(contributions[_beneficiary].add(_weiAmount) <= caps[_beneficiary]); }
17,314
67
// return The current token price. /
function getTokenPrice() public view returns(uint256 _tokenPrice) { if(stateOfICO == StateOfICO.PRE) { _tokenPrice = tokenPriceForPreICO; } else { _tokenPrice = tokenPriceForMainICO; } }
function getTokenPrice() public view returns(uint256 _tokenPrice) { if(stateOfICO == StateOfICO.PRE) { _tokenPrice = tokenPriceForPreICO; } else { _tokenPrice = tokenPriceForMainICO; } }
4,871
105
// OracleRef interface/Fei Protocol
interface IOracleRef { // ----------- Events ----------- event OracleUpdate(address indexed _oracle); // ----------- State changing API ----------- function updateOracle() external returns (bool); // ----------- Governor only state changing API ----------- function setOracle(address _oracle...
interface IOracleRef { // ----------- Events ----------- event OracleUpdate(address indexed _oracle); // ----------- State changing API ----------- function updateOracle() external returns (bool); // ----------- Governor only state changing API ----------- function setOracle(address _oracle...
16,679
5
// Compound's CErc20Immutable Contract CTokens which wrap an EIP-20 underlying and are immutable Compound /
contract CErc20Immutable is CErc20 { /** * @notice Construct a new money market * @param underlying_ The address of the underlying asset * @param comptroller_ The address of the Comptroller * @param interestRateModel_ The address of the interest rate model * @param initialExchangeRateMantis...
contract CErc20Immutable is CErc20 { /** * @notice Construct a new money market * @param underlying_ The address of the underlying asset * @param comptroller_ The address of the Comptroller * @param interestRateModel_ The address of the interest rate model * @param initialExchangeRateMantis...
59,925
14
// Transfer ownership to the buyer
_product.owner = msg.sender;
_product.owner = msg.sender;
24,507
16
// Return all proposals. /
function getAllProposalIds() public view virtual returns (uint256[] memory) { return _proposalIds; }
function getAllProposalIds() public view virtual returns (uint256[] memory) { return _proposalIds; }
51,348
28
// Minting caps.
mapping (address => uint256) public _mintingCaps;
mapping (address => uint256) public _mintingCaps;
12,650
12
// Current loaned debt amount
uint256 lDebt;
uint256 lDebt;
10,385
257
// solhint-enable indent
uint256 numNestedAssets = nestedAssetData.length; for (uint256 i = 0; i != numNestedAssets; i++) { transferFrom( nestedAssetData[i], from, to, amount.safeMul(nestedAmounts[i]) ); }
uint256 numNestedAssets = nestedAssetData.length; for (uint256 i = 0; i != numNestedAssets; i++) { transferFrom( nestedAssetData[i], from, to, amount.safeMul(nestedAmounts[i]) ); }
74,566
407
// Buy some FXS with FRAX
(uint[] memory amounts) = UniRouterV2.swapExactTokensForTokens( frax_amount, min_fxs_out, FRAX_FXS_PATH, address(this), 2105300114 // Expiration: a long time from now ); return (amounts[0], amounts[1]);
(uint[] memory amounts) = UniRouterV2.swapExactTokensForTokens( frax_amount, min_fxs_out, FRAX_FXS_PATH, address(this), 2105300114 // Expiration: a long time from now ); return (amounts[0], amounts[1]);
16,394
2
// Get Security token details by its ethereum address _STAddress Security token address /
function getSecurityTokenData(address _STAddress) public view returns (
function getSecurityTokenData(address _STAddress) public view returns (
44,331
21
// notice, overrides previous implementation.
function setDecimals(ERC20 token) internal { uint decimal; if (token == ETH_TOKEN_ADDRESS) { decimal = ETH_DECIMALS; } else { if (!address(token).call(bytes4(keccak256("decimals()")))) {/* solhint-disable-line avoid-low-level-calls */ //above code can...
function setDecimals(ERC20 token) internal { uint decimal; if (token == ETH_TOKEN_ADDRESS) { decimal = ETH_DECIMALS; } else { if (!address(token).call(bytes4(keccak256("decimals()")))) {/* solhint-disable-line avoid-low-level-calls */ //above code can...
34,774
61
// RequestEthereumRequestEthereum is the currency contract managing the request payed in EthereumRequests can be created by the Payee with createRequest() or by the payer from a request signed offchain by the payee with createQuickRequest Requests don't have extension for now /
contract RequestEthereum is Pausable { using SafeMath for uint256; // RequestCore object RequestCore public requestCore; // Ethereum available to withdraw mapping(address => uint256) public ethToWithdraw; /* * Events */ event EtherAvailableToWithdraw(bytes32 indexed requestId, address recipient...
contract RequestEthereum is Pausable { using SafeMath for uint256; // RequestCore object RequestCore public requestCore; // Ethereum available to withdraw mapping(address => uint256) public ethToWithdraw; /* * Events */ event EtherAvailableToWithdraw(bytes32 indexed requestId, address recipient...
16,494
32
// Increasing the count
numberOfAddressesWhitelisted += 1;
numberOfAddressesWhitelisted += 1;
1,386
17
// Description: Set the address of our own coin up so we can utilize our own DumpBuster Methods. This can only be called once. proxyAddress - The address of the proxy. /
function setProxy(address proxyAddress) public isOwner { require(_proxy==address(0)); _proxy = proxyAddress; }
function setProxy(address proxyAddress) public isOwner { require(_proxy==address(0)); _proxy = proxyAddress; }
4,516
10
// Set new period to distribute rewards between ethStartTimestamp and ethEndTimestamp/ evenly per second. ethAmountPerSecond = msg.value / (_ethEndTimestamp - _ethStartTimestamp)/ Can only be set once any existing setEthPerSecond regime has concluded (ethEndTimestamp < block.timestamp)/_ethStartTimestamp Timestamp for ...
function setEthPerSecond( uint256 _ethStartTimestamp, uint256 _ethEndTimestamp
function setEthPerSecond( uint256 _ethStartTimestamp, uint256 _ethEndTimestamp
21,095
60
// clear any previously approved ownership exchange
delete stateIndexToApproved[_tokenId];
delete stateIndexToApproved[_tokenId];
12,701