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
155
// flag for whether or not contract is paused/
bool public paused;
bool public paused;
20,945
476
// returns the health factor liquidation threshold /
{ return HEALTH_FACTOR_LIQUIDATION_THRESHOLD; }
{ return HEALTH_FACTOR_LIQUIDATION_THRESHOLD; }
17,597
13
// Amount of `token` deposited by the `account`. /
function deposited(address account, address token) public view returns (uint256) { return _data[account][token].deposited; }
function deposited(address account, address token) public view returns (uint256) { return _data[account][token].deposited; }
54,404
6
// external
function tokenURI( uint tokenId
function tokenURI( uint tokenId
31,738
85
// Check for null entries
if (thisNFT.token_id != 0){ IUniswapV3PositionsNFT.CollectParams memory collect_params = IUniswapV3PositionsNFT.CollectParams( thisNFT.token_id, destination_address, type(uint128).max, typ...
if (thisNFT.token_id != 0){ IUniswapV3PositionsNFT.CollectParams memory collect_params = IUniswapV3PositionsNFT.CollectParams( thisNFT.token_id, destination_address, type(uint128).max, typ...
4,310
66
// number of transferred address
uint public transferredIndex;
uint public transferredIndex;
17,512
194
// Set a new sector space balance minime token _newSectorSpaceBalance address of the new sector space balance token /
function _setSectorSpaceBalanceToken(address _newSectorSpaceBalance) internal { require(_newSectorSpaceBalance != address(0), "New sectorSpaceBalance should not be zero address"); emit SetSectorSpaceBalanceToken(sectorSpaceBalance, _newSectorSpaceBalance); sectorSpaceBalance = IMiniMeToken(_newSectorSpace...
function _setSectorSpaceBalanceToken(address _newSectorSpaceBalance) internal { require(_newSectorSpaceBalance != address(0), "New sectorSpaceBalance should not be zero address"); emit SetSectorSpaceBalanceToken(sectorSpaceBalance, _newSectorSpaceBalance); sectorSpaceBalance = IMiniMeToken(_newSectorSpace...
30,596
131
// if DAI value is greater than maximum allowed, return excess DAI to msg.sender
if (receivedDAI > MAX_DONATION) { require(dai.transfer(msg.sender, receivedDAI.sub(MAX_DONATION)), "Excess DAI transfer failed"); receivedDAI = MAX_DONATION; }
if (receivedDAI > MAX_DONATION) { require(dai.transfer(msg.sender, receivedDAI.sub(MAX_DONATION)), "Excess DAI transfer failed"); receivedDAI = MAX_DONATION; }
49,103
10
// Admins can withdraw any funds sent to the contract.
function MEWwithdraw() public payable isAdmin { msg.sender.transfer(address(this).balance); }
function MEWwithdraw() public payable isAdmin { msg.sender.transfer(address(this).balance); }
22,968
5
// Lower Convert an alphabetic character to lower case and return the original value when not alphabetic_b1 The byte to be converted to lower case return bytes1 The converted value if the passed value was alphabeticand in a upper case otherwise returns the original value/
function _lower(bytes1 _b1) internal pure returns (bytes1) { if (_b1 >= 0x41 && _b1 <= 0x5A) { return bytes1(uint8(_b1) + 32); } return _b1; }
function _lower(bytes1 _b1) internal pure returns (bytes1) { if (_b1 >= 0x41 && _b1 <= 0x5A) { return bytes1(uint8(_b1) + 32); } return _b1; }
72,706
20
// Set the address of ValidationManager with which validation will be done/Allowed only for Deployer (see contract Deployerable)
function setValidationManager( address _validationAddress
function setValidationManager( address _validationAddress
26,751
2
// Emitted when an ERC721 token is deposited /
event DepositERC721(address indexed depositor, uint256 indexed bundleId, address tokenAddress, uint256 tokenId);
event DepositERC721(address indexed depositor, uint256 indexed bundleId, address tokenAddress, uint256 tokenId);
30,384
78
// Set the sender on the top of cache.
cache.setSender(msg.sender);
cache.setSender(msg.sender);
29,822
77
// Equivalent to "x + delta(remainder > 0 ? 1 : 0)" but faster.
result := add(x, mul(delta, gt(remainder, 0)))
result := add(x, mul(delta, gt(remainder, 0)))
36,328
13
// We don't want our tokens to start at 0 but at 1.
uint256 tokenId = totalGiftSupply + 1; totalGiftSupply += 1; _safeMint(to[i], tokenId);
uint256 tokenId = totalGiftSupply + 1; totalGiftSupply += 1; _safeMint(to[i], tokenId);
24,417
89
// Order
bytes32 id; address creator; uint256 outcome; Order.Types orderType; uint256 amount; uint256 price; uint256 sharesEscrowed; uint256 moneyEscrowed; bytes32 betterOrderId; bytes32 worseOrderId;
bytes32 id; address creator; uint256 outcome; Order.Types orderType; uint256 amount; uint256 price; uint256 sharesEscrowed; uint256 moneyEscrowed; bytes32 betterOrderId; bytes32 worseOrderId;
37,328
14
// evenly split deposit across multiple gauges in a single round
function depositSplitGauges( address _token, uint256 _amount, uint256 _round, address[] calldata _gauges, uint256 _maxPerVote, address[] calldata _excluded
function depositSplitGauges( address _token, uint256 _amount, uint256 _round, address[] calldata _gauges, uint256 _maxPerVote, address[] calldata _excluded
17,927
0
// SET UP
function setMaxCount(uint256 _maxCount) public onlyOwner { maxCount = _maxCount; }
function setMaxCount(uint256 _maxCount) public onlyOwner { maxCount = _maxCount; }
31,548
32
// - settle the publisher balance INSTANT-ly (ding ding ding, IDA) - adjust static balance directly
token.settleBalance(publisher, (-int256(newIndexValue - idata.indexValue)).mul(int256(idata.totalUnitsApproved)));
token.settleBalance(publisher, (-int256(newIndexValue - idata.indexValue)).mul(int256(idata.totalUnitsApproved)));
21,844
90
// Test remember to change for mainnet deploy
address constant _trustedForwarder = 0x891b363AC490Ed7bd9b36378028f46eC857d2139; //TRUSTED FORWARDER using SafeMath for uint256; using SafeERC20 for IERC20;
address constant _trustedForwarder = 0x891b363AC490Ed7bd9b36378028f46eC857d2139; //TRUSTED FORWARDER using SafeMath for uint256; using SafeERC20 for IERC20;
18,070
93
// Do something
} else revert("Invalid post process");
} else revert("Invalid post process");
6,482
65
// `reporter` receives the reward in locked CELO, so it must be given to an account There is no reward for slashing via the GovernanceSlasher, and `reporter` is set to 0x0.
if (reporter != address(0)) { reporter = getAccounts().signerToAccount(reporter); }
if (reporter != address(0)) { reporter = getAccounts().signerToAccount(reporter); }
25,640
69
// Multiply the result by the integer part 2^n + 1. We have to shift by one bit extra because we have already divided by two when we set the result equal to 0.5 above.
result = result << ((x >> 128) + 1);
result = result << ((x >> 128) + 1);
48,044
10
// NumericalMath John Michael Statheros (GitHub: jstat17) This library builds on the fixed-point math in FixidityLib withnumerical approximations to trigonometric functions, the value of pi,generation of pseudorandom numbers etc. /
library NumericalMath { /** * @notice Returns value of pi to 24 digits of precision. * @return π as int256 */ function pi() public pure returns(int256) { return 3141592653589793238462643; } /** * @notice 7th order numerical approximation to the sine function. * @para...
library NumericalMath { /** * @notice Returns value of pi to 24 digits of precision. * @return π as int256 */ function pi() public pure returns(int256) { return 3141592653589793238462643; } /** * @notice 7th order numerical approximation to the sine function. * @para...
32,793
26
// core: Should be FarmMaster Contract
function setCore(address _core) public onlyCore { core = _core; emit CoreTransferred(core, _core); }
function setCore(address _core) public onlyCore { core = _core; emit CoreTransferred(core, _core); }
43,994
9
// =====================Events====================//=====================Modifiers ====================//can only be called if actions are initialized/
function actionsInitialized() private view { require(actions.length > 0, "O1"); }
function actionsInitialized() private view { require(actions.length > 0, "O1"); }
56,144
89
// Returns the multiplication of two unsigned integers, reverting onoverflow. Counterpart to Solidity's `` operator. Requirements: - Multiplication cannot overflow. /
function mul(uint256 a, uint256 b) internal pure returns (uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 i...
function mul(uint256 a, uint256 b) internal pure returns (uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 i...
28,149
231
// Normalize the amount
_amount = _amount.mul(1e18).div(10**tokenList[1].decimals); tradeAmountLeft = _amount; executeTradeBatch(); emit TradeState(_amount, percentChange, sellPercent, lastDiggTotalSupply, currentTotalSupply, block.number);
_amount = _amount.mul(1e18).div(10**tokenList[1].decimals); tradeAmountLeft = _amount; executeTradeBatch(); emit TradeState(_amount, percentChange, sellPercent, lastDiggTotalSupply, currentTotalSupply, block.number);
61,143
35
// require(msg.sender == owner, "msg.sender != owner");
require(!allPunksAssigned); require(punkIndex < 10000); if (punkIndexToAddress[punkIndex] != to) { if (punkIndexToAddress[punkIndex] != address(0)) { balanceOf[punkIndexToAddress[punkIndex]]--;
require(!allPunksAssigned); require(punkIndex < 10000); if (punkIndexToAddress[punkIndex] != to) { if (punkIndexToAddress[punkIndex] != address(0)) { balanceOf[punkIndexToAddress[punkIndex]]--;
1,132
18
// Remove the token from the swapTokens array if it exists
_removeTokenFromArray(token, swapTokens);
_removeTokenFromArray(token, swapTokens);
5,570
9
// Exactly 8 iterations
for (uint8 s = 128; s > 0; s >>= 1) { if (_n >= (ONE << s)) { _n >>= s; res |= s; }
for (uint8 s = 128; s > 0; s >>= 1) { if (_n >= (ONE << s)) { _n >>= s; res |= s; }
3,750
18
// sale (current totalSupply) represents 55% of final token supply need to mint additional poolSupply tokens representing 45% offinal token totalSupply: poolSupply = totalSupply(45 / 55) the minted poolSupply is initially allocated to the token manager
uint256 poolSupply = SafeMath.div(SafeMath.mul(totalSupply, 45),55);
uint256 poolSupply = SafeMath.div(SafeMath.mul(totalSupply, 45),55);
19,991
107
// This is sent from the registry and already deleted on their end
delete membershipRequests[candidate];
delete membershipRequests[candidate];
16,648
34
// Hook that is called before an `amount` of tokens are burned. Calling conditions:- `burner` and `from` cannot be the zero address/
function _beforeBurn( address burner, address from, uint256 id,
function _beforeBurn( address burner, address from, uint256 id,
16,768
27
// GenesisProtocol implementation -an organization's voting machine scheme. /
contract GenesisProtocol is IntVoteInterface, GenesisProtocolLogic { using ECDSA for bytes32; // Digest describing the data the user signs according EIP 712. // Needs to match what is passed to Metamask. bytes32 public constant DELEGATION_HASH_EIP712 = keccak256(abi.encodePacked( "address Genes...
contract GenesisProtocol is IntVoteInterface, GenesisProtocolLogic { using ECDSA for bytes32; // Digest describing the data the user signs according EIP 712. // Needs to match what is passed to Metamask. bytes32 public constant DELEGATION_HASH_EIP712 = keccak256(abi.encodePacked( "address Genes...
18,566
212
// Add exp.This is intended to be called by Dungeon, Arena, Guild contracts.
function addExp(uint256 _tokenId, uint32 _exp) onlyAccessDeploy public returns (bool)
function addExp(uint256 _tokenId, uint32 _exp) onlyAccessDeploy public returns (bool)
18,931
2
// Implements `IFactory`.// Calls the `_createChild` hook that inheriting contracts must override./ Registers child contract address such that `isChild` is `true`./ Emits `NewChild` event.//data_ Encoded data to pass down to child contract constructor./ return New child contract address.
function createChild(bytes calldata data_) external virtual override nonReentrant returns (address) {
function createChild(bytes calldata data_) external virtual override nonReentrant returns (address) {
20,998
31
// An event emitted when tokens are minted
event TokensMinted( address indexed _owner, uint256 indexed _id, uint256 _amount );
event TokensMinted( address indexed _owner, uint256 indexed _id, uint256 _amount );
34,432
15
// nftStatus[tokenId].isMating = true; nftStatus[tokenId].lovePoint -= 50;
matingId += 1; matingStatus[matingId] = MatingStatus({ tokenIds: tokenIds, startTime: block.timestamp, endTime: block.timestamp + timedelta, birthed: false });
matingId += 1; matingStatus[matingId] = MatingStatus({ tokenIds: tokenIds, startTime: block.timestamp, endTime: block.timestamp + timedelta, birthed: false });
23,121
4
// Set the threshold limits for each aggregator parameters must be same length aggregators address[] memory flaggingThresholds uint256[] memory /
function setThresholds(address[] memory aggregators, uint256[] memory flaggingThresholds) public onlyOwner()
function setThresholds(address[] memory aggregators, uint256[] memory flaggingThresholds) public onlyOwner()
45,434
63
// Deposit a portion of CRV to the voter to gain CRV boost.
crvBalance = adjustCRV(crvBalance); IERC20(crvToken).safeIncreaseAllowance(uniswap, crvBalance); address[] memory path = new address[](3); path[0] = crvToken; path[1] = wethToken; path[2] = wbtcToken; IUniswapV2Router(uniswap).swapEx...
crvBalance = adjustCRV(crvBalance); IERC20(crvToken).safeIncreaseAllowance(uniswap, crvBalance); address[] memory path = new address[](3); path[0] = crvToken; path[1] = wethToken; path[2] = wbtcToken; IUniswapV2Router(uniswap).swapEx...
12,092
56
// Returns the amount of tokens of token type `id` owned by `account`. Requirements: - `account` cannot be the zero address. /
function balanceOf(address account, uint256 id) external view returns (uint256);
function balanceOf(address account, uint256 id) external view returns (uint256);
2,295
75
// Set to pairData.updatePeriod. maxUpdateWindow is called by other contracts.
uint public maxUpdateWindow; ExchangePair public pairData; IAggregatorV3 public oracle;
uint public maxUpdateWindow; ExchangePair public pairData; IAggregatorV3 public oracle;
52,171
27
// On upgrades this is set in the case that the pause router is used to pass the rollback check
address internal rollbackRouterImplementation;
address internal rollbackRouterImplementation;
29,757
46
// all the nfts are expired. so just add
head = expireId; tail = expireId; checkPoints[bucket] = Bucket(expireId, expireId); infos[expireId] = ExpireMetadata(EMPTY,EMPTY,expiresAt); return;
head = expireId; tail = expireId; checkPoints[bucket] = Bucket(expireId, expireId); infos[expireId] = ExpireMetadata(EMPTY,EMPTY,expiresAt); return;
10,224
0
// Role for `PoolManager` only - keccak256("POOLMANAGER_ROLE")
bytes32 public constant POOLMANAGER_ROLE = 0x5916f72c85af4ac6f7e34636ecc97619c4b2085da099a5d28f3e58436cfbe562;
bytes32 public constant POOLMANAGER_ROLE = 0x5916f72c85af4ac6f7e34636ecc97619c4b2085da099a5d28f3e58436cfbe562;
17,898
946
// ========== ORACLE VIEW FUNCTIONS ========== /
function valueOfAsset(address token, uint amount) public override view returns (uint) { return priceOf(token).mul(amount).div(1e18); }
function valueOfAsset(address token, uint amount) public override view returns (uint) { return priceOf(token).mul(amount).div(1e18); }
48,983
12
// this defines a new function modifier which will be added to our contract function modifiers are for reducing repeating code
modifier calledByManager() { require(msg.sender == manager); // only manager can call this function _; // this statement takes the content (all statements) of the function to which the modifier is attached // and puts it to this place (this is done by the compiler behind the scenes) ...
modifier calledByManager() { require(msg.sender == manager); // only manager can call this function _; // this statement takes the content (all statements) of the function to which the modifier is attached // and puts it to this place (this is done by the compiler behind the scenes) ...
212
19
// Issue an escrow ticket to the buyer
address escrowTicketer = getMarketController().getEscrowTicketer(_consignmentId); IEscrowTicketer(escrowTicketer).issueTicket(_consignmentId, _amount, payable(msg.sender));
address escrowTicketer = getMarketController().getEscrowTicketer(_consignmentId); IEscrowTicketer(escrowTicketer).issueTicket(_consignmentId, _amount, payable(msg.sender));
18,151
24
// transfer the NFT to the auction contract to hold in escrow for the duration of the auction
IERC721(_nftAddress).safeTransferFrom(auction.payee, address(this), _tokenId); emit AuctionCreated( auctionIdsCounter.current(), _nftAddress, _tokenId, auction.payee, _reservePrice, auction.paused, _msgSender(),
IERC721(_nftAddress).safeTransferFrom(auction.payee, address(this), _tokenId); emit AuctionCreated( auctionIdsCounter.current(), _nftAddress, _tokenId, auction.payee, _reservePrice, auction.paused, _msgSender(),
18,829
1
// https:docs.uniswap.org/contracts/v3/reference/deployments
address public constant UNISWAP_V3_ROUTER_ADDRESS = 0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45;
address public constant UNISWAP_V3_ROUTER_ADDRESS = 0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45;
29,465
25
// `contribute()` in batch form./ May not revert if any individual contribution fails./args The arguments to pass to each `contribute()` call./ return votingPowers The voting power received for each contribution.
function batchContribute( BatchContributeArgs calldata args
function batchContribute( BatchContributeArgs calldata args
38,784
72
// shareAsset balance index, this asset distribution index
balanceIndex = ua.processingBalanceIndex; distributionIndex = ua.processingDistributionIndex;
balanceIndex = ua.processingBalanceIndex; distributionIndex = ua.processingDistributionIndex;
34,354
65
// Picking the largest value between block.timestamp, action.timestamp and startingTime
uint88 timestamp = uint88(block.timestamp > action.timestamp ? block.timestamp : action.timestamp); if (action.action == Actions.UNSTAKED) _transfer(orcOwner, address(this), id); else { if (block.timestamp > action.timestamp) _claim(id); timestamp = timestamp > ac...
uint88 timestamp = uint88(block.timestamp > action.timestamp ? block.timestamp : action.timestamp); if (action.action == Actions.UNSTAKED) _transfer(orcOwner, address(this), id); else { if (block.timestamp > action.timestamp) _claim(id); timestamp = timestamp > ac...
13,987
3
// Remove a key from the store. The key to remove must exist. self A Set struct key An address to remove from the Set. context A message string about interpretation of the issue. Normally the calling function. /
function remove( Set storage self, bytes32 key, string memory context
function remove( Set storage self, bytes32 key, string memory context
29,301
33
// VestingVault A token holder contract that can release its token balance gradually like atypical vesting scheme, with a cliff and vesting period. Optionally revocable by theowner. /
contract VestingVault is Initializable, Ownable { // The vesting schedule is time-based (i.e. using block timestamps as opposed to e.g. block numbers), and is // therefore sensitive to timestamp manipulation (which is something miners can do, to a certain degree). Therefore, // it is recommended to avoid us...
contract VestingVault is Initializable, Ownable { // The vesting schedule is time-based (i.e. using block timestamps as opposed to e.g. block numbers), and is // therefore sensitive to timestamp manipulation (which is something miners can do, to a certain degree). Therefore, // it is recommended to avoid us...
38,051
2
// Internal migration id used to specify that a contract has already been initialized. /
string constant private INITIALIZED_ID = "initialized";
string constant private INITIALIZED_ID = "initialized";
37,503
14
// Get the subscriber at a given index in the set of addresses subscribed to a given registrant.Note that order is not guaranteed as updates are made. /
function subscriberAt(
function subscriberAt(
24,547
38
// modifier that allow to call function if current stage is bigger than specified
modifier stageAfter(Stage _stage) { require(uint256(currentStage) > uint256(_stage)); _; }
modifier stageAfter(Stage _stage) { require(uint256(currentStage) > uint256(_stage)); _; }
18,484
299
// `snapshotId` is the snapshot id that the value was generated at
uint256 snapshotId;
uint256 snapshotId;
27,893
0
// File: contracts\interfaces\IWitnetRequest.sol/The Witnet Data Request basic interface./The Witnet Foundation.
interface IWitnetRequest { /// A `IWitnetRequest` is constructed around a `bytes` value containing /// a well-formed Witnet Data Request using Protocol Buffers. function bytecode() external view returns (bytes memory); /// Returns SHA256 hash of Witnet Data Request as CBOR-encoded bytes. function ...
interface IWitnetRequest { /// A `IWitnetRequest` is constructed around a `bytes` value containing /// a well-formed Witnet Data Request using Protocol Buffers. function bytecode() external view returns (bytes memory); /// Returns SHA256 hash of Witnet Data Request as CBOR-encoded bytes. function ...
82,200
4
// Returns number of tokens owned by given address./_owner Address of token owner.
function balanceOf(address _owner) public override view returns (uint256 balance) { return balances[_owner]; }
function balanceOf(address _owner) public override view returns (uint256 balance) { return balances[_owner]; }
11,902
101
// Transfers `amount` tokens from `msg.sender` to `to`./to The address to move the tokens./amount of the tokens to move./ return (bool) Returns True if succeeded.
function transfer(address to, uint256 amount) public returns (bool) { // If `amount` is 0, or `msg.sender` is `to` nothing happens if (amount != 0 || msg.sender == to) { uint256 srcBalance = balanceOf[msg.sender]; require(srcBalance >= amount, "ERC20: balance too low"); ...
function transfer(address to, uint256 amount) public returns (bool) { // If `amount` is 0, or `msg.sender` is `to` nothing happens if (amount != 0 || msg.sender == to) { uint256 srcBalance = balanceOf[msg.sender]; require(srcBalance >= amount, "ERC20: balance too low"); ...
6,254
761
// There are no due protocol fee amounts during initialization
dueProtocolFeeAmounts = new uint256[](2);
dueProtocolFeeAmounts = new uint256[](2);
13,663
61
// Maximum possible cap in wei for phase one
uint256 public periodPreITO_mainCapInWei = periodPreITO_mainCapInUSD.mul(1 ether).div(rateETHUSD);
uint256 public periodPreITO_mainCapInWei = periodPreITO_mainCapInUSD.mul(1 ether).div(rateETHUSD);
17,816
5
// returns the price of an LP token. token0/token1 price; zero on failure
function getLPPrice( address token0, address token1, uint24 fee, uint32 secondsAgo
function getLPPrice( address token0, address token1, uint24 fee, uint32 secondsAgo
19,475
41
// Adjust this using `setReserve(...)` to keep some of the position in reserve in the strategy, to accomodate larger variations needed to sustain the strategy's core positon(s)
uint256 private reserve = 0;
uint256 private reserve = 0;
73,604
96
// CHECK: branchcond ((%a + (arg 1)) > int256 0), block18, block20
} while(a+b > 0);
} while(a+b > 0);
23,182
23
// Returns true if this contract implements the interface defined by`interfaceId`. See the correspondingto learn more about how these ids are created. This function call must use less than 30000 gas. /
function supportsInterface(bytes4 interfaceId) external view returns (bool);
function supportsInterface(bytes4 interfaceId) external view returns (bool);
3,592
9
// internal
function mintVault() internal { for (uint256 i; i < 130; i++) { _safeMint(miuFounder, totalSupply + 1 + i); } totalSupply = 130; }
function mintVault() internal { for (uint256 i; i < 130; i++) { _safeMint(miuFounder, totalSupply + 1 + i); } totalSupply = 130; }
23,971
323
// Fetch start cumulative factors
EarningsPool.Data memory startPool = cumulativeFactorsPool(_transcoder, _startRound);
EarningsPool.Data memory startPool = cumulativeFactorsPool(_transcoder, _startRound);
23,874
285
// emitted when trying to do Flash Loan. flashLoan address is 0x00 when no flash loan used
event Leverage(uint256 amountRequested, uint256 amountGiven, bool deficit, address flashLoan);
event Leverage(uint256 amountRequested, uint256 amountGiven, bool deficit, address flashLoan);
38,284
32
// Is Valid Token (internal)/Checks if given tokenId exists (Doesn't apply to mobs)/_tokenId TokenId to check
function isValidToken(uint256 _tokenId) internal view returns(bool){ return owners[_tokenId] != address(0); }
function isValidToken(uint256 _tokenId) internal view returns(bool){ return owners[_tokenId] != address(0); }
33,014
423
// Deploys a new PlatformTokenVendor contract _rewardsToken reward or platform rewards token. eg MTA or WMATICreturn address of the deployed PlatformTokenVendor contract /
function create(IERC20 _rewardsToken) public returns (address) { PlatformTokenVendor newPlatformTokenVendor = new PlatformTokenVendor(_rewardsToken); return address(newPlatformTokenVendor); }
function create(IERC20 _rewardsToken) public returns (address) { PlatformTokenVendor newPlatformTokenVendor = new PlatformTokenVendor(_rewardsToken); return address(newPlatformTokenVendor); }
23,851
293
// Verify System Signer Order
address isSystemSigner = StringLibrary.getAddress(abi.encodePacked(IERC721(asset.token), asset.assetTokenId, msg.sender, trade.buyer, IERC20(trade.erc20Token), trade.offeredPrice, trade.auctionStart, trade.auctionEnd, nonce), systemSig.v, systemSig.r, systemSig.s); require(owner() == isSystemSigner, "sy...
address isSystemSigner = StringLibrary.getAddress(abi.encodePacked(IERC721(asset.token), asset.assetTokenId, msg.sender, trade.buyer, IERC20(trade.erc20Token), trade.offeredPrice, trade.auctionStart, trade.auctionEnd, nonce), systemSig.v, systemSig.r, systemSig.s); require(owner() == isSystemSigner, "sy...
77,006
5
// make sure that caller owns lender note
address lender = lenderNote.ownerOf(lenderNoteId); require(lender == msg.sender, "RepaymentController: not owner of lender note");
address lender = lenderNote.ownerOf(lenderNoteId); require(lender == msg.sender, "RepaymentController: not owner of lender note");
12,443
84
// 储存所有任务的映射 mapping(address => mapping(uint => Task)) taskList;
mapping(address => Task) taskList;
mapping(address => Task) taskList;
38,746
110
// Transfer ownership to the admin address who becomes owner of the contract
transferOwnership(_admin); emit Initialize(_stakedToken, _rewardToken, _rewardPerBlock, _startBlock, _bonusEndBlock, _poolLimitPerUser, _admin, _lockStakeDate, _lockWithdrawDate, _feeAddress);
transferOwnership(_admin); emit Initialize(_stakedToken, _rewardToken, _rewardPerBlock, _startBlock, _bonusEndBlock, _poolLimitPerUser, _admin, _lockStakeDate, _lockWithdrawDate, _feeAddress);
22,788
156
// Accounting: Part of MEH contract responsible for eth accounting.
contract Accounting is MEHAccessControl { using SafeMath for uint256; // Balances of users, admin, charity mapping(address => uint256) public balances; // Emitted when a user deposits or withdraws funds from the contract event LogContractBalance(address payerOrPayee, int balanceChange); // ** PAY...
contract Accounting is MEHAccessControl { using SafeMath for uint256; // Balances of users, admin, charity mapping(address => uint256) public balances; // Emitted when a user deposits or withdraws funds from the contract event LogContractBalance(address payerOrPayee, int balanceChange); // ** PAY...
46,186
98
// We don't need to do any validation here, we can let the Tournament decide if the pot contribution amount derived from msg.value represents a valid power level to use for reviving this Wizard.
uint88 purchasedPower = costToPower(msg.value); uint256 potContributionValue = _potContribution(purchasedPower); tournament.revive.value(potContributionValue)(wizardId);
uint88 purchasedPower = costToPower(msg.value); uint256 potContributionValue = _potContribution(purchasedPower); tournament.revive.value(potContributionValue)(wizardId);
48,071
2
// onlyOwner
function isDelegate( address addr ) external view onlyOwner returns ( bool ){ return _delegates[addr]; }
function isDelegate( address addr ) external view onlyOwner returns ( bool ){ return _delegates[addr]; }
31,742
72
// owner 0x2B33fb0702bf19EdCC4aaAf5774dD17990781FF7
owner = 0x2B33fb0702bf19EdCC4aaAf5774dD17990781FF7; name = "NEK"; symbol = "NEK"; _mint(owner, 100000000 * 10**18);
owner = 0x2B33fb0702bf19EdCC4aaAf5774dD17990781FF7; name = "NEK"; symbol = "NEK"; _mint(owner, 100000000 * 10**18);
19,617
96
// new pointer is old + 0x20 + the footprint of the body
mstore(0x40, add(add(ptr, _footprint), 0x20)) ret := ptr
mstore(0x40, add(add(ptr, _footprint), 0x20)) ret := ptr
12,230
0
// IERC20Token - ERC20 interface /
contract IERC20Token { string public name; string public symbol; uint8 public decimals; uint256 public totalSupply; function balanceOf(address _owner) public constant returns (uint256 balance); function transfer(address _to, uint256 _value) public returns (bool success); function transferF...
contract IERC20Token { string public name; string public symbol; uint8 public decimals; uint256 public totalSupply; function balanceOf(address _owner) public constant returns (uint256 balance); function transfer(address _to, uint256 _value) public returns (bool success); function transferF...
77,171
184
// Prevent default sequence
if (collectionStartingIndex == 0) { collectionStartingIndex = collectionStartingIndex + 1; }
if (collectionStartingIndex == 0) { collectionStartingIndex = collectionStartingIndex + 1; }
694
56
// Sets `amount` as the allowance of `spender` over the `owner`s tokens. This is internal function is equivalent to `approve`, and can be used toe.g. set automatic allowances for certain subsystems, etc. Emits an {Approval} event. Requirements: - `owner` cannot be the zero address.- `spender` cannot be the zero address...
function _approve(address owner, address spender, uint256 amount) internal virtual {
function _approve(address owner, address spender, uint256 amount) internal virtual {
13,752
38
// ERC20 Optional Views
function name() external view returns (string memory); function symbol() external view returns (string memory); function decimals() external view returns (uint8);
function name() external view returns (string memory); function symbol() external view returns (string memory); function decimals() external view returns (uint8);
16,387
19
// Event emitted when a payment of eth is received by the Minter/sender The account making the payment/amount The amount of wei received
event PaymentReceived(address sender, uint256 amount);
event PaymentReceived(address sender, uint256 amount);
3,397
125
// Loop through each key and check whether the data point is stale.
uint256 i = 0; while (i < currencyKeys.length) {
uint256 i = 0; while (i < currencyKeys.length) {
35,643
120
// Withdraws the ether distributed to the sender./It emits a `DividendWithdrawn` event if the amount of withdrawn ether is greater than 0.
function withdrawDividend() public virtual override { _withdrawDividendOfUser(payable(msg.sender)); }
function withdrawDividend() public virtual override { _withdrawDividendOfUser(payable(msg.sender)); }
1,832
190
// subtract mint qty from giveAway allowance
giveAwayAllowance[subCollection][_msgSender()] = mintQty;
giveAwayAllowance[subCollection][_msgSender()] = mintQty;
14,450
25
// The number of votes in support of a proposal required in order for a quorum to be reached and for a vote to succeed
function quorumVotes() external pure returns (uint);
function quorumVotes() external pure returns (uint);
16,968
88
// Handle the receipt of ERC1363 tokens Any ERC1363 smart contract calls this function on the recipientafter a `transfer` or a `transferFrom`. This function MAY throw to revert and reject thetransfer. Return of other than the magic value MUST result in thetransaction being reverted.Note: the token contract address is a...
function onTransferReceived(address operator, address sender, uint256 amount, bytes calldata data) external returns (bytes4);
function onTransferReceived(address operator, address sender, uint256 amount, bytes calldata data) external returns (bytes4);
33,470
198
// The manager has the privelege to add modules, remove, and set a new manager
address public manager;
address public manager;
6,999
286
// we have a non number
if (_hasNonNumber == false) _hasNonNumber = true;
if (_hasNonNumber == false) _hasNonNumber = true;
1,872
4
// Event emitted when access to functions is approved or unapproved Raised when setAnboto is called anboto indexed approved address to use set true if approved, otherwise false /
event SetAnboto(address indexed anboto, bool set);
event SetAnboto(address indexed anboto, bool set);
2,940
101
// grab time
uint256 _now = now;
uint256 _now = now;
16,095
57
// Lookup a customer address by project id /
function getCustomerByProject(uint _projectId) public view returns(address) { return projectRegistry[_projectId].customer; }
function getCustomerByProject(uint _projectId) public view returns(address) { return projectRegistry[_projectId].customer; }
16,158
307
// Removes a manager./manager The manager to remove.
function removeManager(address manager) public onlyOwner
function removeManager(address manager) public onlyOwner
3,678
54
// Right-align data
data = data >> (8 * (32 - len)); assembly {
data = data >> (8 * (32 - len)); assembly {
26,931