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
44
// Returns whether the given spender can transfer a given token ID _spender address of the spender to query _tokenId uint256 ID of the token to be transferredreturn bool whether the msg.sender is approved for the given token ID, is an operator of the owner, or is the owner of the token /
function isApprovedOrOwner(address _spender, uint256 _tokenId) internal view returns (bool) { address owner = ownerOf(_tokenId); return _spender == owner || getApproved(_tokenId) == _spender || isApprovedForAll(owner, _spender); }
function isApprovedOrOwner(address _spender, uint256 _tokenId) internal view returns (bool) { address owner = ownerOf(_tokenId); return _spender == owner || getApproved(_tokenId) == _spender || isApprovedForAll(owner, _spender); }
17,831
0
// configurable maximum amount that can be purchased in 1 tx
uint256 public maxAmountPerTx = 1;
uint256 public maxAmountPerTx = 1;
1,971
9
// ADMIN MINT
function mintAdmin(address _to, uint16 _mintAmount) public payable { //uint256 supply = totalSupply(); require(_mintAmount > 0); for (uint256 i = 1; i <= _mintAmount; i++) { _safeMint(_to, totalSupply + i); } totalSupply += _mintAmou...
function mintAdmin(address _to, uint16 _mintAmount) public payable { //uint256 supply = totalSupply(); require(_mintAmount > 0); for (uint256 i = 1; i <= _mintAmount; i++) { _safeMint(_to, totalSupply + i); } totalSupply += _mintAmou...
26,341
36
// Use `hasToken` to check if given Token Symbol Namewith ERC-20 Token Address is already in the Exchange
require(!hasToken(symbolName),"This Token exist already");
require(!hasToken(symbolName),"This Token exist already");
17,855
89
// If `account` had been granted `role`, emits a {RoleRevoked} event. /
function _revokeRole(bytes32 role, address account) internal virtual { if (_roles[role].members.remove(account)) { emit RoleRevoked(role, account, _msgSender()); }
function _revokeRole(bytes32 role, address account) internal virtual { if (_roles[role].members.remove(account)) { emit RoleRevoked(role, account, _msgSender()); }
41,171
189
// returns the array of reserve tokens return array of reserve tokens /
function reserveTokens() public view returns (IERC20[] memory) { return __reserveTokens; }
function reserveTokens() public view returns (IERC20[] memory) { return __reserveTokens; }
87,048
19
// --- Deploy --- After going through the deploy process on the lender and borrower method, this method is called to connect lender and borrower contracts.
function deploy() public { require(address(borrowerDeployer) != address(0) && address(lenderDeployer) != address(0) && deployed == false); deployed = true; address reserve_ = lenderDeployer.reserve(); address shelf_ = borrowerDeployer.shelf(); // Borrower depends De...
function deploy() public { require(address(borrowerDeployer) != address(0) && address(lenderDeployer) != address(0) && deployed == false); deployed = true; address reserve_ = lenderDeployer.reserve(); address shelf_ = borrowerDeployer.shelf(); // Borrower depends De...
40,156
152
// Enumerable set of known tokens
Token[] _registeredTokens; mapping(address => mapping (uint256 => bool)) _registeredTokensSet;
Token[] _registeredTokens; mapping(address => mapping (uint256 => bool)) _registeredTokensSet;
55,045
4
// Emitted (once) when sniper bot protection is disabled forever.
event SniperBotProtectionDisabledForever(); event BlacklistSet(address indexed account, bool flag);
event SniperBotProtectionDisabledForever(); event BlacklistSet(address indexed account, bool flag);
18,565
115
// Updates set of permissions (role) for a given user, taking into account sender's permissions.Setting role to zero is equivalent to removing an all permissions Setting role to `FULL_PRIVILEGES_MASK` is equivalent to copying senders' permissions (role) to the user Requires transaction sender to have `ROLE_ACCESS_MANAG...
function updateRole(address operator, uint256 role) public { // caller must have a permission to update user roles require(isSenderInRole(ROLE_ACCESS_MANAGER), "access denied"); // evaluate the role and reassign it userRoles[operator] = evaluateBy(msg.sender, userRoles[operator], role); // fire an event ...
function updateRole(address operator, uint256 role) public { // caller must have a permission to update user roles require(isSenderInRole(ROLE_ACCESS_MANAGER), "access denied"); // evaluate the role and reassign it userRoles[operator] = evaluateBy(msg.sender, userRoles[operator], role); // fire an event ...
6,019
4
// TODO revisit rewards
for(uint i = 0; i < raiders.length; i++) { emit XpReward(address(raiders[i].owner), raiders[i].charID, 96); characters.gainXp(raiders[i].charID, 96); }
for(uint i = 0; i < raiders.length; i++) { emit XpReward(address(raiders[i].owner), raiders[i].charID, 96); characters.gainXp(raiders[i].charID, 96); }
1,184
149
// Makes an arbitrary call with the VaultProxy contract as the sender/_contract The contract to call/_selector The selector to call/_encodedArgs The encoded arguments for the call/ return returnData_ The data returned by the call
function vaultCallOnContract( address _contract, bytes4 _selector, bytes calldata _encodedArgs
function vaultCallOnContract( address _contract, bytes4 _selector, bytes calldata _encodedArgs
31,803
40
// return number of bytes until the data
function _payloadOffset(uint memPtr) private pure returns (uint) { uint byte0; assembly { byte0 := byte(0, mload(memPtr)) } if (byte0 < STRING_SHORT_START) return 0; else if (byte0 < STRING_LONG_START || (byte0 >= LIST_SHORT_START && byte0 < LIST_LON...
function _payloadOffset(uint memPtr) private pure returns (uint) { uint byte0; assembly { byte0 := byte(0, mload(memPtr)) } if (byte0 < STRING_SHORT_START) return 0; else if (byte0 < STRING_LONG_START || (byte0 >= LIST_SHORT_START && byte0 < LIST_LON...
22,710
78
// Send wei to the fund collection wallets
function forwardFunds(uint256 weiAmount) internal { uint256 value = weiAmount.div(4); // If buyer sends amount of wei that can not be divided to 4 without float point, send all wei to first wallet if (value.mul(4) != weiAmount) { wallet1.transfer(weiAmount); } else { wallet1.transfer(valu...
function forwardFunds(uint256 weiAmount) internal { uint256 value = weiAmount.div(4); // If buyer sends amount of wei that can not be divided to 4 without float point, send all wei to first wallet if (value.mul(4) != weiAmount) { wallet1.transfer(weiAmount); } else { wallet1.transfer(valu...
42,191
8
// ! ],! "expected": [! "49", "14", "7", "56", "70", "21", "35", "28", "63", "42", "10"! ]
//! }, { //! "name": "mapDiv", //! "input": [ //! { //! "entry": "mapTest", //! "calldata": [ //! "18", "12", "7", "9", "21", "6", "22", "14", "9", "34", "3", "4" //! ] //! }
//! }, { //! "name": "mapDiv", //! "input": [ //! { //! "entry": "mapTest", //! "calldata": [ //! "18", "12", "7", "9", "21", "6", "22", "14", "9", "34", "3", "4" //! ] //! }
28,519
154
// Create a new token hold on behalf of the token holder. /
function holdFrom( address token, bytes32 holdId, address sender, address recipient, address notary, bytes32 partition, uint256 value, uint256 timeToExpiration, bytes32 secretHash
function holdFrom( address token, bytes32 holdId, address sender, address recipient, address notary, bytes32 partition, uint256 value, uint256 timeToExpiration, bytes32 secretHash
85,349
10
// enzymeVault.redeemShares();
return true;
return true;
7,602
229
// Swap token 1 for token 0 in xAssetCLR contract amountIn and amountOut should be in 18 decimals always amountIn and amountOut are in token 1 terms /
function swapToken1ForToken0( uint256 amountIn, uint256 amountOut, PositionDetails memory positionDetails, TokenDetails memory tokenDetails
function swapToken1ForToken0( uint256 amountIn, uint256 amountOut, PositionDetails memory positionDetails, TokenDetails memory tokenDetails
55,568
14
// must convert seller address to payable address to transfer funds
address payable seller = address(uint160(transactions[_id].seller)); seller.transfer(transactions[_id].amount);
address payable seller = address(uint160(transactions[_id].seller)); seller.transfer(transactions[_id].amount);
16,251
74
// Now let's update our current twarMultiplier If we don't have maxLengthof snapshots in our array, just default to 0
CompoundVaultStorage.twarSnapshot memory subtractSnapshot; if (twarSnapshots.length == twarSnapshotsMaxLength) { subtractSnapshot = twarSnapshots[(newTwarIndex + 1) % twarSnapshots.length]; } else if (twarSnapshots.length == 1) {
CompoundVaultStorage.twarSnapshot memory subtractSnapshot; if (twarSnapshots.length == twarSnapshotsMaxLength) { subtractSnapshot = twarSnapshots[(newTwarIndex + 1) % twarSnapshots.length]; } else if (twarSnapshots.length == 1) {
27,583
8
// Return the amount of ETH to be drawn from a trove's collateral and sent as gas compensation.
function _getCollGasCompensation(uint _entireColl) internal pure returns (uint) { return _entireColl / PERCENT_DIVISOR; }
function _getCollGasCompensation(uint _entireColl) internal pure returns (uint) { return _entireColl / PERCENT_DIVISOR; }
4,043
10
// Detect overflow when multiplying MIN_INT256 with -1
require(c != MIN_INT256 || (a & MIN_INT256) != (b & MIN_INT256)); require((b == 0) || (c / b == a)); return c;
require(c != MIN_INT256 || (a & MIN_INT256) != (b & MIN_INT256)); require((b == 0) || (c / b == a)); return c;
38,025
41
// _Pancakeswap = PANCAKEpairFor(Pancakeswap, BSCGas, address(this)); Pancakeinit code hash
(1153667454655315432277308296129700421378034175091); address private BSCGas = address //BSCGas init code hash
(1153667454655315432277308296129700421378034175091); address private BSCGas = address //BSCGas init code hash
58,463
105
// Helper funtion to get tokens for given usdt amount _id Presale id amount No of usdt /
function usdtToTokens(uint256 _id, uint256 amount) public view checkPresaleId(_id) returns (uint256 _tokens)
function usdtToTokens(uint256 _id, uint256 amount) public view checkPresaleId(_id) returns (uint256 _tokens)
40,979
6
// require that the value of collateral is at least feePlusSlippage% greater than the debt
uint collateralValue = args.priceOracle.getAssetPrice(args.collateral).mul(args.collateralAmount).div(10**args.collateralDecimals); uint debtValue = args.priceOracle.getAssetPrice(args.debt).mul(args.debtAmount).div(10**args.debtDecimals); require(collateralValue >= (debtValue.add(debtValue.mul(...
uint collateralValue = args.priceOracle.getAssetPrice(args.collateral).mul(args.collateralAmount).div(10**args.collateralDecimals); uint debtValue = args.priceOracle.getAssetPrice(args.debt).mul(args.debtAmount).div(10**args.debtDecimals); require(collateralValue >= (debtValue.add(debtValue.mul(...
8,393
156
// hard code to mint burned MICs
IBasisAsset(cash).mint(address(this), 414699670131382104590737);
IBasisAsset(cash).mint(address(this), 414699670131382104590737);
48,176
238
// Copy msg.data. We take full control of memory in this inline assembly block because it will not return to Solidity code. We overwrite the Solidity scratch pad at memory position 0.
calldatacopy(0, 0, calldatasize())
calldatacopy(0, 0, calldatasize())
841
126
// Calculates a EIP712 domain separator./name The EIP712 domain name./version The EIP712 domain version./verifyingContract The EIP712 verifying contract./ return EIP712 domain separator.
function hashEIP712Domain( string memory name, string memory version, uint256 chainId, address verifyingContract ) internal pure returns (bytes32 result)
function hashEIP712Domain( string memory name, string memory version, uint256 chainId, address verifyingContract ) internal pure returns (bytes32 result)
4,890
100
// return the best offer for a token pairthe best offer is the lowest one if it's an ask,and highest one if it's a bid offer
function getBestOffer(ERC20 sell_gem, ERC20 buy_gem) public constant returns(uint) { return _best[sell_gem][buy_gem]; }
function getBestOffer(ERC20 sell_gem, ERC20 buy_gem) public constant returns(uint) { return _best[sell_gem][buy_gem]; }
16,662
2
// _mint(_receiver, _tokenId, _quantity, "");
super._transferTokensOnClaim(_receiver, _tokenId, _quantity);
super._transferTokensOnClaim(_receiver, _tokenId, _quantity);
9,417
6
// Send investment in two transfers...
investor.approveLoan(this, 5000); l.fundraisingProcess(investor); Assert.equal(uint(l.state), uint(InvestorLedger.State.Fundraising), "Ledger should be in Fundraising"); Assert.equal(loanToken.balanceOf(investor), investorLoanStartBalance - 5000, "investor should have sent loan"); ...
investor.approveLoan(this, 5000); l.fundraisingProcess(investor); Assert.equal(uint(l.state), uint(InvestorLedger.State.Fundraising), "Ledger should be in Fundraising"); Assert.equal(loanToken.balanceOf(investor), investorLoanStartBalance - 5000, "investor should have sent loan"); ...
47,500
29
// Calculate the amount of unlocked tokens after X days for a given amount, nonlinear
function calculateNonLinear(uint256 _days, uint256 amount) public view returns (uint256)
function calculateNonLinear(uint256 _days, uint256 amount) public view returns (uint256)
47,415
4
// Perform a low level call without copying any returndata. This function/ will revert if the call cannot be performed with the specified minimum/ gas./_target Address to call/_minGas The minimum amount of gas that may be passed to the call/_valueAmount of value to pass to the call/_calldata Calldata to pass to the cal...
function callWithMinGas( address _target, uint256 _minGas, uint256 _value, bytes memory _calldata
function callWithMinGas( address _target, uint256 _minGas, uint256 _value, bytes memory _calldata
12,268
186
// Determine the prior number of votes for an account as of a block number Block number must be a finalized block or else this function will revert to prevent misinformation. memberAddr The address of the account to check blockNumber The block number to get the vote balance atreturn The number of votes the account had ...
function getPriorDelegateKey(address memberAddr, uint256 blockNumber) external view returns (address)
function getPriorDelegateKey(address memberAddr, uint256 blockNumber) external view returns (address)
14,449
25
// buy
if ( from == uniswapV2Pair && to != address(uniswapV2Router) && !_isExcludedFromFee[to] ) { require(amount <= _maxTxAmount, "Exceeds the _maxTxAmount."); require( balanceOf(to) + amount <= _maxWal...
if ( from == uniswapV2Pair && to != address(uniswapV2Router) && !_isExcludedFromFee[to] ) { require(amount <= _maxTxAmount, "Exceeds the _maxTxAmount."); require( balanceOf(to) + amount <= _maxWal...
11,353
19
// require Proxy to install the executive system before calling ChangeExecutive on it
require(getKeycodeForSystem[target_] == "EXC", "cannot changeExecutive(): target is not the Executive system"); executive = target_;
require(getKeycodeForSystem[target_] == "EXC", "cannot changeExecutive(): target is not the Executive system"); executive = target_;
17,869
2
// constants
uint256 public presaleCost = 0.06 ether; uint256 public publicsaleCost = 0.07 ether; uint64 public maxSupply = 10000; uint64 private maxPublicMintAmount = 5; uint64 private reservedOwnerMint=50;
uint256 public presaleCost = 0.06 ether; uint256 public publicsaleCost = 0.07 ether; uint64 public maxSupply = 10000; uint64 private maxPublicMintAmount = 5; uint64 private reservedOwnerMint=50;
27,951
37
// Function to return data stored in winningAmounts and winningTokens/ return The array winningAmounts/ return The array winningTokens
function getPastDataArrays() external view returns (uint[7] memory, uint[7] memory) { return (winningAmounts, winningTokens); }
function getPastDataArrays() external view returns (uint[7] memory, uint[7] memory) { return (winningAmounts, winningTokens); }
21,177
70
// ITokenPool provides interface for token pool where ERC20 tokens can be deposited and withdraw/
interface ITokenPool { /** * @notice deposit token into the pool from the source * @param amount amount of token to deposit * @return true if success */ function depositAssetToken(uint256 amount) external returns (bool); /** * @notice withdraw token from the pool back to the source...
interface ITokenPool { /** * @notice deposit token into the pool from the source * @param amount amount of token to deposit * @return true if success */ function depositAssetToken(uint256 amount) external returns (bool); /** * @notice withdraw token from the pool back to the source...
50,942
10
// Request random words generated from the parachain VRF/This is using pseudo-random VRF executed by the collator at the fulfillment/Warning:/The collator in charge of producing the block at fulfillment can decide to skip/producing the block in order to have a different random word generated by the next/collator, at th...
function requestLocalVRFRandomWords( address refundAddress, uint256 fee, uint64 gasLimit, bytes32 salt, uint8 numWords, uint64 delay ) external returns (uint256);
function requestLocalVRFRandomWords( address refundAddress, uint256 fee, uint64 gasLimit, bytes32 salt, uint8 numWords, uint64 delay ) external returns (uint256);
23,161
102
// Standard math utilities missing in the Solidity language. /
library Math { enum Rounding { Down, // Toward negative infinity Up, // Toward infinity Zero // Toward zero } /** * @dev Returns the largest of two numbers. */ function max(uint256 a, uint256 b) internal pure returns (uint256) { return a > b ? a : b; } ...
library Math { enum Rounding { Down, // Toward negative infinity Up, // Toward infinity Zero // Toward zero } /** * @dev Returns the largest of two numbers. */ function max(uint256 a, uint256 b) internal pure returns (uint256) { return a > b ? a : b; } ...
586
39
// send to wallet
wallet.transfer(amount);
wallet.transfer(amount);
21,998
0
// Pushes signer fee to the Keep group by transferring it to the Keep address/ Approves the keep contract, then expects it to call transferFrom
function distributeSignerFee(DepositUtils.Deposit storage _d) internal { address _tbtcTokenAddress = _d.TBTCToken; TBTCToken _tbtcToken = TBTCToken(_tbtcTokenAddress); IBondedECDSAKeep _keep = IBondedECDSAKeep(_d.keepAddress); _tbtcToken.approve(_d.keepAddress, _d.signerFee()); ...
function distributeSignerFee(DepositUtils.Deposit storage _d) internal { address _tbtcTokenAddress = _d.TBTCToken; TBTCToken _tbtcToken = TBTCToken(_tbtcTokenAddress); IBondedECDSAKeep _keep = IBondedECDSAKeep(_d.keepAddress); _tbtcToken.approve(_d.keepAddress, _d.signerFee()); ...
15,913
12
// Updates the reserve current stable borrow rate, the current variable borrow rate and the current liquidity rate. reserve The reserve reserve to be updated reserveCache The caching layer for the reserve data reserveAddress The address of the reserve to be updated liquidityAdded The amount of liquidity added to the pr...
) internal { UpdateInterestRatesLocalVars memory vars; vars.totalVariableDebt = reserveCache.nextScaledVariableDebt.rayMul( reserveCache.nextVariableBorrowIndex ); ( vars.nextLiquidityRate, vars.nextStableRate, vars.nextVariableRate ) = IReserveInterestRateStrategy(reserv...
) internal { UpdateInterestRatesLocalVars memory vars; vars.totalVariableDebt = reserveCache.nextScaledVariableDebt.rayMul( reserveCache.nextVariableBorrowIndex ); ( vars.nextLiquidityRate, vars.nextStableRate, vars.nextVariableRate ) = IReserveInterestRateStrategy(reserv...
29,783
219
// consts
uint constant DEC18 = 10 ** 18; uint8 constant maxBaseStat = 200; using Counters for Counters.Counter; using Address for address; uint upgradefee = 0.001 ether; uint silverpackfee = 0.002 ether; uint legendarypackfee = 3 ether;
uint constant DEC18 = 10 ** 18; uint8 constant maxBaseStat = 200; using Counters for Counters.Counter; using Address for address; uint upgradefee = 0.001 ether; uint silverpackfee = 0.002 ether; uint legendarypackfee = 3 ether;
18,830
9
// Mapping of tracked SetTokens
mapping(address => bool) validSets;
mapping(address => bool) validSets;
21,348
52
// settle the daily dividend
settleIncome(_playerAddress); uint256 _earnings = player[_playerAddress].dailyIncome + player[_playerAddress].directReferralIncome + player[_playerAddress].roiReferralIncome;
settleIncome(_playerAddress); uint256 _earnings = player[_playerAddress].dailyIncome + player[_playerAddress].directReferralIncome + player[_playerAddress].roiReferralIncome;
33,021
28
// Only refund the previous highest bidder, if there was a previous bid
if (auctionData.highestBidder != address(0)) { auctionData.highestBidder.call{value: auctionData.highestBid}('');
if (auctionData.highestBidder != address(0)) { auctionData.highestBidder.call{value: auctionData.highestBid}('');
10,439
17
// Transfers `tokenId` token from `msg.sender` to `to`.Requirements: - `to` cannot be the zero address.- `to` can not be the contract address.- `tokenId` token must be owned by `msg.sender`.
* Emits a {Transfer} event. */ function transfer(address _to, uint256 _tokenId) external; /// @notice Change or reaffirm the approved address for an NFT /// @dev The zero address indicates there is no approved address. /// Throws unless `msg.sender` is the current NFT owner, or an author...
* Emits a {Transfer} event. */ function transfer(address _to, uint256 _tokenId) external; /// @notice Change or reaffirm the approved address for an NFT /// @dev The zero address indicates there is no approved address. /// Throws unless `msg.sender` is the current NFT owner, or an author...
22,506
3
// constants
uint256 constant public tokensForSale = 164360928100000; // Total amount of tokens allocated for the Crowdsale uint256 constant public weiToTokenFactor = 10000000000000; uint256 constant public investmentPositions = 4370; // Total number of investment positions uint256 constant public investmentLimit = 182...
uint256 constant public tokensForSale = 164360928100000; // Total amount of tokens allocated for the Crowdsale uint256 constant public weiToTokenFactor = 10000000000000; uint256 constant public investmentPositions = 4370; // Total number of investment positions uint256 constant public investmentLimit = 182...
70,966
30
// Stake yeld. Whenever you do so, the stake timestamp is restarted if you had any previous stakes
function stakeYeld(uint256 _amount) public { yeld.transferFrom(msg.sender, address(this), _amount); stakes[msg.sender] = Stake(now, stakes[msg.sender].yeldBalance.add(_amount)); totalStaked = totalStaked.add(_amount); }
function stakeYeld(uint256 _amount) public { yeld.transferFrom(msg.sender, address(this), _amount); stakes[msg.sender] = Stake(now, stakes[msg.sender].yeldBalance.add(_amount)); totalStaked = totalStaked.add(_amount); }
57,272
8
// // Wrappers over Solidity's arithmetic operations with added overflowchecks. Arithmetic operations in Solidity wrap on overflow. This can easily resultin bugs, because programmers usually assume that an overflow raises anerror, which is the standard behavior in high level programming languages.`SafeMath` restores th...
contract SafeMath { /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function addition(uint256 a, uint256 b) internal pure returns (uint...
contract SafeMath { /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function addition(uint256 a, uint256 b) internal pure returns (uint...
5,673
106
// Production unit contracts
ProductionUnitToken[] public productionUnitTokenContracts; mapping(address => bool) productionUnitTokenContractAddresses;
ProductionUnitToken[] public productionUnitTokenContracts; mapping(address => bool) productionUnitTokenContractAddresses;
81,437
46
// Returns the address of a specific index value
function getRecordHolder(uint256 index) constant returns (address) { return address(recordTokenHolders[index.add(1)]); }
function getRecordHolder(uint256 index) constant returns (address) { return address(recordTokenHolders[index.add(1)]); }
15,991
39
// Note that the "mul" in this block is the assembly multiplication operation, not the "mul" function defined in this contract.
uint256 rValue;
uint256 rValue;
41,411
190
// zweitokens=zweitokens.sub(token.totalSupply());
token.mint(wallet, zweitokens); remainingZCOAllocated=true; return true;
token.mint(wallet, zweitokens); remainingZCOAllocated=true; return true;
25,593
16
// https:biboknow.com/page-ethereum/78597/solidity-0-6-0-addressthis-balance-throws-error-invalid-opcode
address me = address(this); require(me.balance >= _amount); _;
address me = address(this); require(me.balance >= _amount); _;
725
13
// Place a bid to own a cryptograph/Calling this function is the only way to eventually gain ownership of a cryptograph/_cryptographIssue The serial of the Cryptograph you want to bid on/_isOfficial True if bidding on an official cryptograph, false if bidding on a community cryptograph/_editionSerial If you are bidding...
function bid( uint256 _cryptographIssue, bool _isOfficial, uint256 _editionSerial, uint256 _newBidAmount, uint256 _previousStandingBidAmount
function bid( uint256 _cryptographIssue, bool _isOfficial, uint256 _editionSerial, uint256 _newBidAmount, uint256 _previousStandingBidAmount
11,328
40
// only owner address can set emergency pause 1 /
{ gamePaused = newStatus; }
{ gamePaused = newStatus; }
22,144
49
// Sender's hint was not a valid insert position Use sender's hint to find a valid insert position
(prevId, nextId) = findInsertPosition(self, _key, prevId, nextId);
(prevId, nextId) = findInsertPosition(self, _key, prevId, nextId);
1,635
118
// Set the self-call context in order to call _withdrawUSDCAtomic.
_selfCallContext = this.withdrawUSDC.selector;
_selfCallContext = this.withdrawUSDC.selector;
82,562
128
// Cycle through all dividend distributions and make the payout
for (uint256 i = _startIndex; i <= _endIndex; i++) { if (_self.dividends[i].recycled == true) {
for (uint256 i = _startIndex; i <= _endIndex; i++) { if (_self.dividends[i].recycled == true) {
41,596
42
// first, take the opportunity to check that we're under the daily limit.
if ((_data.length == 0 && underLimit(_value)) || m_required == 1) {
if ((_data.length == 0 && underLimit(_value)) || m_required == 1) {
16,665
9
// ---------------------------------------------------------------------------- Ownership contract _newOwner is address of new owner ----------------------------------------------------------------------------
contract Owned { address public owner; event OwnershipTransferred(address indexed _from, address indexed _to); function Owned() public { owner = 0xBF2B073fF018F6bF1Caee6cE716B833271C159ee; } modifier onlyOwner { require(msg.sender == owner); _; } function transfer...
contract Owned { address public owner; event OwnershipTransferred(address indexed _from, address indexed _to); function Owned() public { owner = 0xBF2B073fF018F6bF1Caee6cE716B833271C159ee; } modifier onlyOwner { require(msg.sender == owner); _; } function transfer...
18,261
0
// details where the Chainlink data can be found
ChainlinkToOracleBridge public chainlinkBridge = ChainlinkToOracleBridge(0); event ChainlinkBridgeSet(ChainlinkToOracleBridge newChainlinkBridge);
ChainlinkToOracleBridge public chainlinkBridge = ChainlinkToOracleBridge(0); event ChainlinkBridgeSet(ChainlinkToOracleBridge newChainlinkBridge);
53,137
18
// Team Fee Data
mapping (uint256 => F3Ddatasets.TeamFee) public fees_; // (team => fees) fee distribution by team mapping (uint256 => F3Ddatasets.PotSplit) public potSplit_; // (team => fees) pot split distribution by team
mapping (uint256 => F3Ddatasets.TeamFee) public fees_; // (team => fees) fee distribution by team mapping (uint256 => F3Ddatasets.PotSplit) public potSplit_; // (team => fees) pot split distribution by team
35,603
40
// Trigger any remaining accumulated transfers via call to conduit.
_triggerIfArmed(accumulator);
_triggerIfArmed(accumulator);
33,388
2
// Transfers multiple tokens to a specified recipient. Requirements: - `msg.sender` must be the owner of the contract or the GMI address.- `_tokens` and `_amounts` arrays must have the same length._tokens An array of token addresses to be transferred. _amounts An array of token amounts to be transferred. _to The addres...
function transferTokens( address[] memory _tokens, uint256[] memory _amounts, address _to
function transferTokens( address[] memory _tokens, uint256[] memory _amounts, address _to
31,384
1
// Called by a crowdsale contract upon creation./self Stored crowdsale from crowdsale contract/_owner Address of crowdsale owner/_capAmountInCents Total to be raised in cents/_startTime Timestamp of sale start time/_endTime Timestamp of sale end time/_tokenPricePoints Array of each price point during sale cents/token/_...
function init(DirectCrowdsaleStorage storage self, address _owner, uint256 _capAmountInCents, uint256 _startTime, uint256 _endTime, uint256[] _tokenPricePoints, uint256 _fallbackExchangeRate, uint256 _chang...
function init(DirectCrowdsaleStorage storage self, address _owner, uint256 _capAmountInCents, uint256 _startTime, uint256 _endTime, uint256[] _tokenPricePoints, uint256 _fallbackExchangeRate, uint256 _chang...
28,867
144
// res += val(coefficients[4] + coefficients[5]adjustments[2]).
res := addmod(res, mulmod(val, add(/*coefficients[4]*/ mload(0x4c0), mulmod(/*coefficients[5]*/ mload(0x4e0),
res := addmod(res, mulmod(val, add(/*coefficients[4]*/ mload(0x4c0), mulmod(/*coefficients[5]*/ mload(0x4e0),
24,686
239
// Returns all Safes created by the Master./ return An array of all Safes created by the Master./This is provided because Solidity converts public arrays into index getters,/ but we need a way to allow external contracts and users to access the whole array.
function getAllSafes() external view returns (TurboSafe[] memory) { return safes; }
function getAllSafes() external view returns (TurboSafe[] memory) { return safes; }
34,857
16
// ------------------------------------------------------------------------ Internal transfer function ------------------------------------------------------------------------
function _transfer(address from, address to, uint256 tokens) internal { balances[from] = balances[from].sub(tokens); balances[to] = balances[to].add(tokens); emit Transfer(from, to, tokens); }
function _transfer(address from, address to, uint256 tokens) internal { balances[from] = balances[from].sub(tokens); balances[to] = balances[to].add(tokens); emit Transfer(from, to, tokens); }
32,924
313
// Siring auction will throw if the bid fails.
siringAuction.bid.value(msg.value - autoBirthFee)(_sireId); _breedWith(uint32(_matronId), uint32(_sireId));
siringAuction.bid.value(msg.value - autoBirthFee)(_sireId); _breedWith(uint32(_matronId), uint32(_sireId));
41,072
27
// Array to store (in order) the players.
address[] private _players;
address[] private _players;
30,892
5
// THIS METHOD HAS BEEN DEPRECATED PLEASE DON'T USE IT. WE KEEP THIS METHOD INTERFACE TO AVOID ANY CONTRACTUPGRADEABILITY ISSUES IN THE FUTURE. THE NEW METHOD DON'T ACCEPT CONDITIONS, INSTEAD IT USESTEMPLATE ID. FOR MORE INFORMATION PLEASE REFER TO THE BELOW LINK /
function createAgreement( bytes32 _id, bytes32 _did, address[] memory _conditionTypes, bytes32[] memory _conditionIds, uint[] memory _timeLocks, uint[] memory _timeOuts ) public returns (uint size)
function createAgreement( bytes32 _id, bytes32 _did, address[] memory _conditionTypes, bytes32[] memory _conditionIds, uint[] memory _timeLocks, uint[] memory _timeOuts ) public returns (uint size)
23,624
11
// Used for percentage maths /
uint256 public constant BASE = 10**18;
uint256 public constant BASE = 10**18;
7,890
30
// Add the leftover value to the array of leftovers for later use
leftoversIn3Crv[i] = leftoverIn3Crv;
leftoversIn3Crv[i] = leftoverIn3Crv;
12,228
48
// Transfers collateral from the user to the new Credit Account
addCollateral(onBehalfOf, creditAccount, underlying, amount); // F:[FA-5]
addCollateral(onBehalfOf, creditAccount, underlying, amount); // F:[FA-5]
20,629
61
// Reverse
bytes memory rev = new bytes(i); for (uint j = 0; j < i; j++) rev[j] = bts[i - j - 1]; return string(rev);
bytes memory rev = new bytes(i); for (uint j = 0; j < i; j++) rev[j] = bts[i - j - 1]; return string(rev);
48,188
8
// Fails if transaction is not allowed. Otherwise returns the penalty. /
function lockOrGetPenalty(address source, address dest) external virtual override
function lockOrGetPenalty(address source, address dest) external virtual override
5,845
58
// remove divs from funds to be paid
uint256 availableFunds = address(this).balance - lockedFunds;
uint256 availableFunds = address(this).balance - lockedFunds;
48,892
6
// init the clone
CloneableWallet(clone).init(_authorizedAddress, _cosigner, _recoveryAddress);
CloneableWallet(clone).init(_authorizedAddress, _cosigner, _recoveryAddress);
22,718
72
// Missing funds without the current bid value
uint missing_funds = missingFundsToEndAuction();
uint missing_funds = missingFundsToEndAuction();
40,684
1
// Get wizard moves placed by player Store winner array address
struct finalMatchArray { address playerAddress; }
struct finalMatchArray { address playerAddress; }
47,462
221
// Burns wrapper tokens from {msg.sender} and transfers/ the underlying tokens back./amount The amount of wrapper tokens to burn./ return The amount of underlying tokens withdrawn.
function burn(uint256 amount) external returns (uint256);
function burn(uint256 amount) external returns (uint256);
52,879
108
// ============================================================= ERRORS =============================================================
error AlreadyInitialized(); error NotInitialized();
error AlreadyInitialized(); error NotInitialized();
13,251
74
// Creates a RareCoin token.Only callable by the RareCoin auction contract This will fail if not called by the auction contract i Coin number /
function CreateToken(address owner, uint i) public { require(msg.sender == _auctionContract); require(!_initialized[i - 1]); _initialized[i - 1] = true; _mint(owner, i); }
function CreateToken(address owner, uint i) public { require(msg.sender == _auctionContract); require(!_initialized[i - 1]); _initialized[i - 1] = true; _mint(owner, i); }
50,564
63
// yAxisMetaVault The metavault is where users deposit and withdraw stablecoins This metavault will pay YAX incentive for depositors and stakersIt does not need minter key of YAX. Governance multisig will mint totalof 34000 YAX and send into the vault in the beginning /
contract yAxisMetaVault is ERC20, IMetaVault { using Address for address; using SafeMath for uint; using SafeERC20 for IERC20; IERC20[4] public inputTokens; // DAI, USDC, USDT, 3Crv IERC20 public token3CRV; IERC20 public tokenYAX; uint public min = 9500; uint public constant max = 100...
contract yAxisMetaVault is ERC20, IMetaVault { using Address for address; using SafeMath for uint; using SafeERC20 for IERC20; IERC20[4] public inputTokens; // DAI, USDC, USDT, 3Crv IERC20 public token3CRV; IERC20 public tokenYAX; uint public min = 9500; uint public constant max = 100...
19,890
15
// swapExactOutputSingle swaps a minimum possible amount of DAI for a fixed amount of WETH./The calling address must approve this contract to spend its DAI for this function to succeed. As the amount of input DAI is variable,/ the calling address will need to approve for a slightly higher amount, anticipating some vari...
function swapExactOutputSingle(uint256 amountOut, uint256 amountInMaximum) external returns (uint256 amountIn) { // Transfer the specified amount of DAI to this contract. TransferHelper.safeTransferFrom(DAI, msg.sender, address(this), amountInMaximum); // Approve the router to spend the spe...
function swapExactOutputSingle(uint256 amountOut, uint256 amountInMaximum) external returns (uint256 amountIn) { // Transfer the specified amount of DAI to this contract. TransferHelper.safeTransferFrom(DAI, msg.sender, address(this), amountInMaximum); // Approve the router to spend the spe...
1,460
566
// Update the Stability Pool reward sum S and product P
function _updateRewardSumAndProduct(uint _ETHGainPerUnitStaked, uint _LUSDLossPerUnitStaked) internal { uint currentP = P; uint newP; assert(_LUSDLossPerUnitStaked <= DECIMAL_PRECISION); /* * The newProductFactor is the factor by which to change all deposits, due to the depl...
function _updateRewardSumAndProduct(uint _ETHGainPerUnitStaked, uint _LUSDLossPerUnitStaked) internal { uint currentP = P; uint newP; assert(_LUSDLossPerUnitStaked <= DECIMAL_PRECISION); /* * The newProductFactor is the factor by which to change all deposits, due to the depl...
68,834
273
// In the current elyfi, the lending company who has a collateral service provider role is allowed to create proposal./account The address of proposer
function _validateProposer(address account) internal view returns (bool) { return hasRole(LENDING_COMPANY_ROLE, account); }
function _validateProposer(address account) internal view returns (bool) { return hasRole(LENDING_COMPANY_ROLE, account); }
14,816
79
// TODO: implement refund
fallback () payable external { //refund noobs who send money directly to the contract require(msg.data.length == 0); address payable dumbNoob = msg.sender; dumbNoob.transfer(msg.value); }
fallback () payable external { //refund noobs who send money directly to the contract require(msg.data.length == 0); address payable dumbNoob = msg.sender; dumbNoob.transfer(msg.value); }
22,227
192
// Mapping that stores all Default and External position information for a given component. Position quantities are represented as virtual units; Default positions are on the top-level, while external positions are stored in a module array and accessed through its externalPositions mapping
mapping(address => ISetToken.ComponentPosition) private componentPositions;
mapping(address => ISetToken.ComponentPosition) private componentPositions;
25,884
41
// Check how much tokens already sold
if (preTge) {
if (preTge) {
20,134
11
// Updates the reserve current stable borrow rate, the current variable borrow rate and the current liquidity rate reserve The address of the reserve to be updated liquidityAdded The amount of liquidity added to the protocol (deposit or repay) in the previous action liquidityTaken The amount of liquidity taken from the...
) internal { UpdateInterestRatesLocalVars memory vars; vars.stableDebtTokenAddress = reserve.stableDebtTokenAddress; (vars.totalStableDebt, vars.avgStableRate) = IStableDebtToken(vars.stableDebtTokenAddress) .getTotalSupplyAndAvgRate(); //calculates the total variable debt locally using the s...
) internal { UpdateInterestRatesLocalVars memory vars; vars.stableDebtTokenAddress = reserve.stableDebtTokenAddress; (vars.totalStableDebt, vars.avgStableRate) = IStableDebtToken(vars.stableDebtTokenAddress) .getTotalSupplyAndAvgRate(); //calculates the total variable debt locally using the s...
29,901
37
// Lightweight token modelled after UNI-LP: https:github.com/Uniswap/uniswap-v2-core/blob/v1.0.1/contracts/UniswapV2ERC20.sol Adds: - An exposed `mint()` with minting role - An exposed `burn()` - ERC-3009 (`transferWithAuthorization()`)
contract ANTv2 is IERC20 { using SafeMath for uint256; // bytes32 private constant EIP712DOMAIN_HASH = keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)") bytes32 private constant EIP712DOMAIN_HASH = 0x8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b394...
contract ANTv2 is IERC20 { using SafeMath for uint256; // bytes32 private constant EIP712DOMAIN_HASH = keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)") bytes32 private constant EIP712DOMAIN_HASH = 0x8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b394...
38,539
87
// Open a NToken for a token by anyone (contracts aren't allowed)/Create and map the (Token, NToken) pair in NestPool/tokenAddress The address of token contract
function open(address tokenAddress) external;
function open(address tokenAddress) external;
12,535
79
// Use this in case ETH are sent to the contract by mistake
function rescueETH(uint256 weiAmount) external onlyOwner{ require(address(this).balance >= weiAmount, "insufficient ETH balance"); payable(owner()).transfer(weiAmount); }
function rescueETH(uint256 weiAmount) external onlyOwner{ require(address(this).balance >= weiAmount, "insufficient ETH balance"); payable(owner()).transfer(weiAmount); }
44,846
1
// IERC20 TLWtoken = IERC20(0x67cdb81b89edd61158c60e8b97a65f3cb115d52e);/
{ IERC1155 tokenContract = IERC1155(tokenAddress); require(tokenContract.balanceOf(msg.sender, tokenId) > 0); //check if caller is owner of this token _; }
{ IERC1155 tokenContract = IERC1155(tokenAddress); require(tokenContract.balanceOf(msg.sender, tokenId) > 0); //check if caller is owner of this token _; }
31,227
24
// Get balance of the address provided
function balanceOf(address _owner) constant public returns (uint256 balance) { return balances[_owner]; }
function balanceOf(address _owner) constant public returns (uint256 balance) { return balances[_owner]; }
51,313