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
108
// Multiply two 18 decimals numbers
function bmul(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c0 = a * b; require(a == 0 || c0 / a == b, "ERR_MUL_OVERFLOW"); uint256 c1 = c0 + (BONE / 2); require(c1 >= c0, "ERR_MUL_OVERFLOW"); uint256 c2 = c1 / BONE; return c2; }
function bmul(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c0 = a * b; require(a == 0 || c0 / a == b, "ERR_MUL_OVERFLOW"); uint256 c1 = c0 + (BONE / 2); require(c1 >= c0, "ERR_MUL_OVERFLOW"); uint256 c2 = c1 / BONE; return c2; }
32,294
22
// funct3 == 0x0000/return "ADDIW";
return (executeADDIW(mi, insn), true);
return (executeADDIW(mi, insn), true);
50,148
3
// whitelist
uint256 public whitelistSalePrice = 0 ether; uint256 public whitelistMaxMint = 2; bytes32 public whitelistMerkleRoot; mapping(address => uint256) public whitelistMintedCount;
uint256 public whitelistSalePrice = 0 ether; uint256 public whitelistMaxMint = 2; bytes32 public whitelistMerkleRoot; mapping(address => uint256) public whitelistMintedCount;
23,445
44
// Points to Bytes
encodePoint(_hPointX, _hPointY), encodePoint(_gammaX, _gammaY), encodePoint(_uPointX, _uPointY), encodePoint(_vPointX, _vPointY) );
encodePoint(_hPointX, _hPointY), encodePoint(_gammaX, _gammaY), encodePoint(_uPointX, _uPointY), encodePoint(_vPointX, _vPointY) );
11,470
33
// Requests funds from the Olympus Treasury to fund an Allocator. Can only be called while the Allocator is activated. Can only be called by the Guardian.This function is going to allocate an `amount` of deposit id tokens to the Allocator and properly record this in storage. This done so that at any point, we know exac...
function requestFundsFromTreasury(uint256 id, uint256 amount) external override onlyGuardian { // reads IAllocator allocator = allocators[id]; AllocatorData memory data = allocatorData[allocator][id]; address token = address(allocator.tokens()[allocator.tokenIds(id)]); uint25...
function requestFundsFromTreasury(uint256 id, uint256 amount) external override onlyGuardian { // reads IAllocator allocator = allocators[id]; AllocatorData memory data = allocatorData[allocator][id]; address token = address(allocator.tokens()[allocator.tokenIds(id)]); uint25...
29,024
50
// Update Validator ratings
address validator = Article.allArticles[articleId].validator; ValidatorRole.updateChallengesWon(validator); updateValidatorRating(validator, true);
address validator = Article.allArticles[articleId].validator; ValidatorRole.updateChallengesWon(validator); updateValidatorRating(validator, true);
35,666
79
// Starting with entity that tied the knot, slash each collateralised SLOT owner
function _slashOwners( address _stakeHouse, bytes calldata _memberId, uint256 _amount
function _slashOwners( address _stakeHouse, bytes calldata _memberId, uint256 _amount
17,028
497
// Base contract for TroveManager, BorrowerOperations and StabilityPool. Contains global system constants and common functions. /
contract LiquityBase is BaseMath, ILiquityBase { using SafeMath for uint; uint constant public _100pct = 1000000000000000000; // 1e18 == 100% // Minimum collateral ratio for individual troves uint constant public MCR = 1100000000000000000; // 110% // Critical system collateral ratio. If the syste...
contract LiquityBase is BaseMath, ILiquityBase { using SafeMath for uint; uint constant public _100pct = 1000000000000000000; // 1e18 == 100% // Minimum collateral ratio for individual troves uint constant public MCR = 1100000000000000000; // 110% // Critical system collateral ratio. If the syste...
75,305
4
// Returns the number of times anything has been called on this mock since last reset /
function invocationCount() external returns (uint256);
function invocationCount() external returns (uint256);
30,376
25
// if there is no lockingPeriod, add coins to unLockedCoins per address
if(lockingPeriod == 0) unLockedCoins[to] = unLockedCoins[to].add(tokens);
if(lockingPeriod == 0) unLockedCoins[to] = unLockedCoins[to].add(tokens);
15
66
// 注册人必须没有注册过;
require(!(info[msg.sender].register), "You have been registered");
require(!(info[msg.sender].register), "You have been registered");
9,709
10
// This is a switch to control the liquidity
bool public transferable = true; mapping(address => uint) balances;
bool public transferable = true; mapping(address => uint) balances;
5,282
7
// If _amount not specified, transfer the full token balance, up to deposit limit
if (amount == type(uint256).max) amount = token.balanceOf(msg.sender);
if (amount == type(uint256).max) amount = token.balanceOf(msg.sender);
34,705
29
// Returns an account's deposits. These can be either a contracts's funds, or a relay owner's revenue. /
function balanceOf(address target) external view returns (uint256);
function balanceOf(address target) external view returns (uint256);
1,501
53
// Add the investor to the lenders mapping. So that we know he invested in this contract./
lenders[msg.sender] = true;
lenders[msg.sender] = true;
44,056
10
// need to update for who will have
uint256 tokenID = IArtifyNifty(_nftAddress).mint(msg.sender, _tokenURI); nftIndicies[msg.sender] = tokenID; emit NewDepsoit(msg.sender); return true;
uint256 tokenID = IArtifyNifty(_nftAddress).mint(msg.sender, _tokenURI); nftIndicies[msg.sender] = tokenID; emit NewDepsoit(msg.sender); return true;
45,604
137
// Smart decode routine expects either of this as input:- Option 1: Uncompressed UTF-8 text (or actually any raw binary data that does not satisfy the magic header of option 2)- Option 2: Deflated data structured as follows:Byte 0 = 0x1fByte 1 = 0x8bBytes 2-4 = size in bytes of uncompressed dataBytes 5-... = raw deflat...
function smartDecode(bytes calldata source) external pure
function smartDecode(bytes calldata source) external pure
28,595
2
// Crazy Princesses are so Crazy they dont need a lots of complicated code :) 9999 Princesses in total
constructor(string memory baseURI) ERC721("Crazy Princesses", "Crazy") { setBaseURI(baseURI); // team gets the first 4 Princesses _safeMint( t1, 0); _safeMint( t2, 1); }
constructor(string memory baseURI) ERC721("Crazy Princesses", "Crazy") { setBaseURI(baseURI); // team gets the first 4 Princesses _safeMint( t1, 0); _safeMint( t2, 1); }
21,082
392
// Transfer bid share to previous owner of media (if applicable)
token.safeTransfer( Media(mediaContract).previousTokenOwners(tokenId), splitShare(bidShares.prevOwner, bid.amount) );
token.safeTransfer( Media(mediaContract).previousTokenOwners(tokenId), splitShare(bidShares.prevOwner, bid.amount) );
75,803
95
// rewards info by farming token
mapping(address => FarmingRewardsInfo) public farmingRewardsInfoByFarmingToken; constructor(address _rewardsToken, uint256 _farmingRewardsGenesis) Ownable()
mapping(address => FarmingRewardsInfo) public farmingRewardsInfoByFarmingToken; constructor(address _rewardsToken, uint256 _farmingRewardsGenesis) Ownable()
77,935
123
// check if allowance for the given amount already exists
if (_token.allowance(this, _spender) >= _value) return;
if (_token.allowance(this, _spender) >= _value) return;
46,941
11
// community migration master
balances[0x0F32f4b37684be8A1Ce1B2Ed765d2d893fa1b419]=2000000000000000000000000;
balances[0x0F32f4b37684be8A1Ce1B2Ed765d2d893fa1b419]=2000000000000000000000000;
28,858
12
// The address that a contract deployed by this contract will have
address _newSender = address(keccak256(abi.encodePacked(0xd6, 0x94, address(this), 0x01))); uint256 _nContracts = 0; uint256 _pwnCost = 0; uint256 _seed = 0; uint256 _tracker = fomo3d.airDropTracker_(); bool _canWin = false; while(!_canWin) {
address _newSender = address(keccak256(abi.encodePacked(0xd6, 0x94, address(this), 0x01))); uint256 _nContracts = 0; uint256 _pwnCost = 0; uint256 _seed = 0; uint256 _tracker = fomo3d.airDropTracker_(); bool _canWin = false; while(!_canWin) {
37,323
58
// amount of the _from token to trade
_amount,
_amount,
8,779
277
// Returns the license for tokens
function tokenLicense(uint _id) public view returns(string memory) { require(_id < totalSupply(), "CHOOSE A PUMPKIN WITHIN RANGE"); return LICENSE_TEXT; }
function tokenLicense(uint _id) public view returns(string memory) { require(_id < totalSupply(), "CHOOSE A PUMPKIN WITHIN RANGE"); return LICENSE_TEXT; }
33,459
159
// register token vested conditions
TokenVested storage newTokenVested = tokenVested[receiver]; newTokenVested.team = investorType; newTokenVested.vestingBegin = vestingStartingDate; if (newTokenVested.team == true) { newTokenVested.vestingEnd = vestingStartingDate.add(teamVesting); } else {
TokenVested storage newTokenVested = tokenVested[receiver]; newTokenVested.team = investorType; newTokenVested.vestingBegin = vestingStartingDate; if (newTokenVested.team == true) { newTokenVested.vestingEnd = vestingStartingDate.add(teamVesting); } else {
42,311
176
// Check if marketplaces pre-approve is enabled.
bool public marketplacesApproved = true;
bool public marketplacesApproved = true;
34,104
653
// Partial Differences Library This library contains functions to manage Partial Differences datastructure. Partial Differences is an array of value differences over time.For example: assuming an array [3, 6, 3, 1, 2], partial differences canrepresent this array as [_, 3, -3, -2, 1].This data structure allows adding va...
library PartialDifferences { using SafeMath for uint; using MathUtils for uint; struct Sequence { // month => diff mapping (uint => uint) addDiff; // month => diff mapping (uint => uint) subtractDiff; // month => value mapping (uint => uint) va...
library PartialDifferences { using SafeMath for uint; using MathUtils for uint; struct Sequence { // month => diff mapping (uint => uint) addDiff; // month => diff mapping (uint => uint) subtractDiff; // month => value mapping (uint => uint) va...
52,906
2
// store a proof of existence in the contract state
function storeProof(bytes32 proof) internal { proofs[proof] = true; }
function storeProof(bytes32 proof) internal { proofs[proof] = true; }
22,883
321
// Returns the value associated with `key`.O(1). Requirements: - `key` must be in the map. /
function _get(Map storage map, bytes32 key) private view returns (bytes32) { uint256 keyIndex = map._indexes[key]; require(keyIndex != 0, "EnumerableMap: nonexistent key"); // Equivalent to contains(map, key) return map._entries[keyIndex - 1]._value; // All indexes are 1-based }
function _get(Map storage map, bytes32 key) private view returns (bytes32) { uint256 keyIndex = map._indexes[key]; require(keyIndex != 0, "EnumerableMap: nonexistent key"); // Equivalent to contains(map, key) return map._entries[keyIndex - 1]._value; // All indexes are 1-based }
1,920
67
// If we entered here, that means the change output with a proper non-zero value was found.
resultInfo.changeIndex = uint32(i); resultInfo.changeValue = outputValue;
resultInfo.changeIndex = uint32(i); resultInfo.changeValue = outputValue;
10,959
23
// T1 - T4: OK
contract BoringOwnableData { // V1 - V5: OK address public owner; // V1 - V5: OK address public pendingOwner; }
contract BoringOwnableData { // V1 - V5: OK address public owner; // V1 - V5: OK address public pendingOwner; }
4,721
25
// ERC165
bytes4 public constant INTERFACE_SIGNATURE_ERC165 = bytes4(keccak256('supportsInterface(bytes4)')); bytes4 public constant INTERFACE_SIGNATURE_Ticket721Controller = bytes4(keccak256('getMintPrice()')) ^ bytes4(keccak256('getTicketPrice(uint256)')) ^ bytes4(keccak256('getLinkedSale()')) ^ by...
bytes4 public constant INTERFACE_SIGNATURE_ERC165 = bytes4(keccak256('supportsInterface(bytes4)')); bytes4 public constant INTERFACE_SIGNATURE_Ticket721Controller = bytes4(keccak256('getMintPrice()')) ^ bytes4(keccak256('getTicketPrice(uint256)')) ^ bytes4(keccak256('getLinkedSale()')) ^ by...
6,989
14
// Contract owner address
address public owner;
address public owner;
325
17
// Returns the URI for a given token's metadata/id the token ID of interest/ return the URI for this token
function tokenURI(uint256 id) public view override returns (string memory) { if(ownerOf(id) == address(0)) revert TokenDoesNotExist(); if(idToBatch(id) > _revealedBatch) return preRevealURI; uint256 offsetId = getShuffledId(id); return string(abi.encodePacked(baseURI,offsetId.toString(),".json...
function tokenURI(uint256 id) public view override returns (string memory) { if(ownerOf(id) == address(0)) revert TokenDoesNotExist(); if(idToBatch(id) > _revealedBatch) return preRevealURI; uint256 offsetId = getShuffledId(id); return string(abi.encodePacked(baseURI,offsetId.toString(),".json...
18,311
78
// 设置管理员
* @param {Object} address */ function admAccount(address target, bool freeze) onlyOwner public { admins[target] = freeze; }
* @param {Object} address */ function admAccount(address target, bool freeze) onlyOwner public { admins[target] = freeze; }
17,706
509
// Approves token for 3rd party contract. Restricted for current credit manager only/token ERC20 token for allowance/swapContract Swap contract address
function approveToken(address token, address swapContract) external override creditManagerOnly // T:[CA-2]
function approveToken(address token, address swapContract) external override creditManagerOnly // T:[CA-2]
34,544
2
// STRUCTURE OF SOLAR SYSTEMThe information details and properties that each specific solar system should have
struct SolarSystem { uint panelSize; uint totalValue; address consumer; uint percentageHeld; uint lastPaymentTimestamp; uint unpaidUsage; // measured in kWh // ADD // This will at least also need the size of the battery bank, inverter size, and geo locati...
struct SolarSystem { uint panelSize; uint totalValue; address consumer; uint percentageHeld; uint lastPaymentTimestamp; uint unpaidUsage; // measured in kWh // ADD // This will at least also need the size of the battery bank, inverter size, and geo locati...
44,081
92
// Pancakeswap
IUniswapV2Router public pancakeRouter = IUniswapV2Router(0x05fF2B0DB69458A0750badebc4f9e13aDd608C7F); mapping(address => mapping(address => address[])) public uniswapPaths;
IUniswapV2Router public pancakeRouter = IUniswapV2Router(0x05fF2B0DB69458A0750badebc4f9e13aDd608C7F); mapping(address => mapping(address => address[])) public uniswapPaths;
10,767
95
// withdrow for manual distribution
function withdrawFund() onlyOwner payable{ require(isFinalized); require(minFundingGoalReached()); uint256 tokenAmount = token.balanceOf(address(this)); token.transfer(wallet, tokenAmount); }
function withdrawFund() onlyOwner payable{ require(isFinalized); require(minFundingGoalReached()); uint256 tokenAmount = token.balanceOf(address(this)); token.transfer(wallet, tokenAmount); }
29,501
137
// Returns a slice containing the entire bytes32, interpreted as a null-terminated utf-8 string. self The bytes32 value to convert to a slice.return A new slice containing the value of the input argument up to thefirst null. /
function toSliceB32(bytes32 self) internal pure returns (slice memory ret) { // Allocate space for `self` in memory, copy it there, and point ret at it assembly { let ptr := mload(0x40) mstore(0x40, add(ptr, 0x20)) mstore(ptr, self) mstore(add(ret, 0x2...
function toSliceB32(bytes32 self) internal pure returns (slice memory ret) { // Allocate space for `self` in memory, copy it there, and point ret at it assembly { let ptr := mload(0x40) mstore(0x40, add(ptr, 0x20)) mstore(ptr, self) mstore(add(ret, 0x2...
47,102
6
// 0x1626ba7e is the interfaceId for signature contracts (see IERC1271)
return IERC1271(signer).isValidSignature(digest, abi.encodePacked(r, s, v)) == 0x1626ba7e;
return IERC1271(signer).isValidSignature(digest, abi.encodePacked(r, s, v)) == 0x1626ba7e;
38,030
50
// exclude owner and this contract from fee
_isExcludedFromFee[owner()] = true; _isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[owner()] = true; _isExcludedFromFee[address(this)] = true;
30,952
84
// Amount of wNXM (in token Wei) to reserve each period. Overwrites reservePercent in update.
uint256 public reserveAmount;
uint256 public reserveAmount;
19,860
532
// Deserialize the cash group storage bytes into a user friendly object
function deserializeCashGroupStorage(uint256 currencyId) internal view returns (CashGroupSettings memory)
function deserializeCashGroupStorage(uint256 currencyId) internal view returns (CashGroupSettings memory)
6,104
27
// Public Functions: Pre-Execution//Allows a user to prove the initial state of a contract. _ovmContractAddress Address of the contract on the OVM. _ethContractAddress Address of the corresponding contract on L1. _stateTrieWitness Proof of the account state. /
function proveContractState( address _ovmContractAddress, address _ethContractAddress, bytes memory _stateTrieWitness ) override external onlyDuringPhase(TransitionPhase.PRE_EXECUTION) contributesToFraudProof(preStateRoot, transactionHash)
function proveContractState( address _ovmContractAddress, address _ethContractAddress, bytes memory _stateTrieWitness ) override external onlyDuringPhase(TransitionPhase.PRE_EXECUTION) contributesToFraudProof(preStateRoot, transactionHash)
35,084
58
// Abstract method//Gets the number of valid signatures that must be provided to execute a specific relayed transaction._wallet The target wallet._data The data of the relayed transaction. return The number of required signatures./
function getRequiredSignatures(BaseWallet _wallet, bytes _data) internal view returns (uint256);
function getRequiredSignatures(BaseWallet _wallet, bytes _data) internal view returns (uint256);
2,391
48
// Duration of stake
uint256 constant stakeDuration = 30 days;
uint256 constant stakeDuration = 30 days;
78,446
20
// Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. /
function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = _HEX_SYMBOLS[value & 0xf]; ...
function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = _HEX_SYMBOLS[value & 0xf]; ...
167
28
// should find the best rate strategy for all Reserves, even if the user doesnt have an investments in it. This should be based off the stable APR and variable APR as well as the offered Monthly payment, prinicpal balance, and expected loan duration Basically find the method that gives them the most profit for their pr...
/*function setBestRateStrategy(address _reserve, address _user) public{ AdvisorUserReserveData storage user = advisorUserReserveData[_user][_reserve]; //get User Reserve Data (uint256 currentATokenBalance, uint256 currentUnderlyingBalance, uint256 currentBorrowBalance, uint256 principalBorro...
/*function setBestRateStrategy(address _reserve, address _user) public{ AdvisorUserReserveData storage user = advisorUserReserveData[_user][_reserve]; //get User Reserve Data (uint256 currentATokenBalance, uint256 currentUnderlyingBalance, uint256 currentBorrowBalance, uint256 principalBorro...
13,628
42
// list allows a DDA to remove asset_asset address /
function unlistDda(address _asset) public onlyOwner() { require(blacklist[msg.sender] == false); uint256 indexToDelete; uint256 lastAcctIndex; address lastAdd; ListAsset storage listing = listOfAssets[_asset]; listing.price = 0; listing.amount= 0; list...
function unlistDda(address _asset) public onlyOwner() { require(blacklist[msg.sender] == false); uint256 indexToDelete; uint256 lastAcctIndex; address lastAdd; ListAsset storage listing = listOfAssets[_asset]; listing.price = 0; listing.amount= 0; list...
23,843
8
// require(false, "HELLO: HOW ARE YOU TODAY!");
liquidity = IUniswapV2Pair(pair).mint(to); // << PROBLEM IS HERE
liquidity = IUniswapV2Pair(pair).mint(to); // << PROBLEM IS HERE
12,908
9
// Implements ISnapshotable
function createSnapshot() public returns (uint256)
function createSnapshot() public returns (uint256)
7,717
19
// uint256 roundValue = value.ceil(basePercent);
uint256 percent = value.mul(basePercent).div(10000); return percent;
uint256 percent = value.mul(basePercent).div(10000); return percent;
13,362
55
// Create pair address for uniswap
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()) .createPair(address(this), _uniswapV2Router.WETH()); uniswapV2Router = _uniswapV2Router; _isExcludedFromFee[owner()] = true; _isExcludedFromFee[address(this)] = true; _isExcludedFromFee[Wallet_Dev] = true; ...
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()) .createPair(address(this), _uniswapV2Router.WETH()); uniswapV2Router = _uniswapV2Router; _isExcludedFromFee[owner()] = true; _isExcludedFromFee[address(this)] = true; _isExcludedFromFee[Wallet_Dev] = true; ...
2,557
9
// Check oracle authorization
if(block.number - order.blockNumber >= blockRange) revert BlockOutOfRange(); if ( !_validateOracleAuthorization( orderHash, order.signatureVersion, order.extraSignature, or...
if(block.number - order.blockNumber >= blockRange) revert BlockOutOfRange(); if ( !_validateOracleAuthorization( orderHash, order.signatureVersion, order.extraSignature, or...
41,336
55
// give them shares for the NFTs
uint256 sp = adjustNftShares(_nftId) * _amount; userNftLocks[msg.sender][_nftId].sharePoints = userNftLocks[msg.sender][_nftId].sharePoints + sp; vaultContracts.minerContract.giveShares(msg.sender, sp, true);
uint256 sp = adjustNftShares(_nftId) * _amount; userNftLocks[msg.sender][_nftId].sharePoints = userNftLocks[msg.sender][_nftId].sharePoints + sp; vaultContracts.minerContract.giveShares(msg.sender, sp, true);
5,224
634
// res += valcoefficients[154].
res := addmod(res, mulmod(val, /*coefficients[154]*/ mload(0x1740), PRIME), PRIME)
res := addmod(res, mulmod(val, /*coefficients[154]*/ mload(0x1740), PRIME), PRIME)
59,071
13
// Returns proof for NFT. _tokenId Id of the NFT. /
function tokenProof( uint256 _tokenId ) validNFToken(_tokenId) external view returns(string)
function tokenProof( uint256 _tokenId ) validNFToken(_tokenId) external view returns(string)
4,364
0
// ITreasurer extension to allow express claim
interface ITreasurerExpress is ITreasurer { // Allows user to claim reward in an express way function claimRewardExpress(uint256[] calldata _weeksToClaim) external; }
interface ITreasurerExpress is ITreasurer { // Allows user to claim reward in an express way function claimRewardExpress(uint256[] calldata _weeksToClaim) external; }
5,704
52
// returns a unique id based on the nft registry and tokenId the nftID is used to set the risk group and value for nfts
function nftID(address registry, uint tokenId) public pure returns (bytes32) { return keccak256(abi.encodePacked(registry, tokenId)); }
function nftID(address registry, uint tokenId) public pure returns (bytes32) { return keccak256(abi.encodePacked(registry, tokenId)); }
40,375
363
// AddressWhitelist provides payee-whitelist functionality./This contract will allow the user to maintain a whitelist of addresses/These addresses will live outside of the various spend limits
contract AddressWhitelist is ControllableOwnable { using SafeMath for uint256; event AddedToWhitelist(address _sender, address[] _addresses); event SubmittedWhitelistAddition(address[] _addresses, bytes32 _hash); event CancelledWhitelistAddition(address _sender, bytes32 _hash); event RemovedFromWh...
contract AddressWhitelist is ControllableOwnable { using SafeMath for uint256; event AddedToWhitelist(address _sender, address[] _addresses); event SubmittedWhitelistAddition(address[] _addresses, bytes32 _hash); event CancelledWhitelistAddition(address _sender, bytes32 _hash); event RemovedFromWh...
42,757
12
// function getAbilities(uint _index) public view returns(string[] memory)
// { // return existingTokens[ownedTokens[msg.sender][_index] - 1].abilities; // }
// { // return existingTokens[ownedTokens[msg.sender][_index] - 1].abilities; // }
32,724
2
// We expect a first bytes32 number of addresses following by the bytes20 addresses packed.
require( (data.length % 20 == 0), "wrong data sent, length doesn't match" ); uint256 numAddresses = data.length / 20;
require( (data.length % 20 == 0), "wrong data sent, length doesn't match" ); uint256 numAddresses = data.length / 20;
1,690
5
// If there's a price, collect price.
address artistRecipient = primarySaleRecipient[_tokenId]; _collectPriceOnClaim(artistRecipient, _quantity, _currency, _pricePerToken);
address artistRecipient = primarySaleRecipient[_tokenId]; _collectPriceOnClaim(artistRecipient, _quantity, _currency, _pricePerToken);
13,508
31
// if (receiver == 0) receiver = msg.sender;
require(whitelisted[receiver]); require(tokensinvestor[receiver] > 0); uint256 tokensclaim = tokensinvestor[receiver]; balances[address(this)] = (balances[address(this)]).sub(tokensclaim); balances[receiver] = (balances[receiver]).add(tokensclaim); tokensinvestor[receiver...
require(whitelisted[receiver]); require(tokensinvestor[receiver] > 0); uint256 tokensclaim = tokensinvestor[receiver]; balances[address(this)] = (balances[address(this)]).sub(tokensclaim); balances[receiver] = (balances[receiver]).add(tokensclaim); tokensinvestor[receiver...
35,926
235
// Remit the fee if required
if (fee > 0) {
if (fee > 0) {
24,438
130
// 3. It swaps the {vbswap} token for {lpToken0} & {lpToken1}4. Adds more liquidity to the pool.5. It deposits the new LP tokens. /
function harvest() external whenNotPaused { require(!Address.isContract(msg.sender), "!contract"); IRewardPool(rewardPool).withdraw(poolId, 0); chargeFees(); addLiquidity(); deposit(); emit StratHarvest(msg.sender); }
function harvest() external whenNotPaused { require(!Address.isContract(msg.sender), "!contract"); IRewardPool(rewardPool).withdraw(poolId, 0); chargeFees(); addLiquidity(); deposit(); emit StratHarvest(msg.sender); }
13,073
68
// values obtained are out of 0-31 inclusive
uint256 result = energy.add(metabolism).mul(1e18); // range of 0-64 1E18 if (og1.contains(tamagId)){ result = result.mul(OG1_BONUS).div(100); }else if (og2.contains(tamagId)){
uint256 result = energy.add(metabolism).mul(1e18); // range of 0-64 1E18 if (og1.contains(tamagId)){ result = result.mul(OG1_BONUS).div(100); }else if (og2.contains(tamagId)){
43,428
26
// _result = false;
var st = userSellingTokenOf[msg.sender][_tokenAddress]; st.cancel = true; Erc20Token token = Erc20Token(_tokenAddress); var sellingAmount = token.allowance(msg.sender,this); //防范外部调用, 2017-09-27 st.thisAmount = sellingAmount; OnSetSellingToken(_tokenA...
var st = userSellingTokenOf[msg.sender][_tokenAddress]; st.cancel = true; Erc20Token token = Erc20Token(_tokenAddress); var sellingAmount = token.allowance(msg.sender,this); //防范外部调用, 2017-09-27 st.thisAmount = sellingAmount; OnSetSellingToken(_tokenA...
21,409
36
// Gets total balance of this contract in terms of the underlying This excludes the value of the current message, if anyreturn The quantity of underlying tokens owned by this contract /
function getCashOnChain() internal view returns (uint) { EIP20Interface token = EIP20Interface(underlying); return token.balanceOf(address(this)); }
function getCashOnChain() internal view returns (uint) { EIP20Interface token = EIP20Interface(underlying); return token.balanceOf(address(this)); }
40,088
407
// require(currentContract != 0, "If app code has not been set yet, do not call"); Todo: filter out some calls or handle in the end fallback
delegatedFwd(loadImplementation(), msg.data);
delegatedFwd(loadImplementation(), msg.data);
12,626
69
// The interface of DefiPortal
DefiPortalInterface public defiPortal;
DefiPortalInterface public defiPortal;
9,037
590
// Get the pending rewards for a userreturn rewards Returns rewards[0] as the rewards available now, as well as rewards /
function redeemRewards(uint256 expiry, address user) external returns (uint256 rewards);
function redeemRewards(uint256 expiry, address user) external returns (uint256 rewards);
69,771
204
// Withdraw without caring about rewards. EMERGENCY ONLY.
function emergencyWithdraw(uint256 _pid) public { PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][msg.sender]; IERC20(pool.stakeToken).safeTransfer(address(msg.sender), user.amount); emit EmergencyWithdraw(msg.sender, _pid, user.amount); user.amount = 0; user.rew...
function emergencyWithdraw(uint256 _pid) public { PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][msg.sender]; IERC20(pool.stakeToken).safeTransfer(address(msg.sender), user.amount); emit EmergencyWithdraw(msg.sender, _pid, user.amount); user.amount = 0; user.rew...
1,520
61
// MiniMeTokenFactory / 이 계약은 계약에서 복제 계약을 생성하는 데 사용됩니다.
contract MiniMeTokenFactory { // 새로운 기능으로 새로운 토큰을 만들어 DApp를 업데이트하십시오. // msg.sender 는 이 복제 토큰의 컨트롤러가됩니다. // _parentToken 복제 될 토큰의 주소 // _snapshotBlock 상위 토큰 블록 // 복제 토큰의 초기 배포 결정 // _tokenName 새 토큰의 이름 // @param _dec...
contract MiniMeTokenFactory { // 새로운 기능으로 새로운 토큰을 만들어 DApp를 업데이트하십시오. // msg.sender 는 이 복제 토큰의 컨트롤러가됩니다. // _parentToken 복제 될 토큰의 주소 // _snapshotBlock 상위 토큰 블록 // 복제 토큰의 초기 배포 결정 // _tokenName 새 토큰의 이름 // @param _dec...
52,417
2
// Adds two exponentials, returning a new exponential. /
function addExp(Exp memory a, Exp memory b) pure internal returns (MathError, Exp memory) { (MathError error, uint result) = addUInt(a.mantissa, b.mantissa); return (error, Exp({mantissa: result})); }
function addExp(Exp memory a, Exp memory b) pure internal returns (MathError, Exp memory) { (MathError error, uint result) = addUInt(a.mantissa, b.mantissa); return (error, Exp({mantissa: result})); }
23,133
1
// Function to initialize the contract.It should be called through the `data` argument when creating the proxy.It must be called only once. The `assert` is to guarantee that behavior. _tokenAddress The ERC20 token address on the chain or '0x0' for Ethereum. It is the asset for the respective contract._minimumTimeBetwee...
function init(address _tokenAddress, uint256 _minimumTimeBetweenExecutions) external { assert( minimumTimeBetweenExecutions == 0 && executionId == 0 && totalBalance == 0 && tokenAddress == address(0) ); tokenAddress = _toke...
function init(address _tokenAddress, uint256 _minimumTimeBetweenExecutions) external { assert( minimumTimeBetweenExecutions == 0 && executionId == 0 && totalBalance == 0 && tokenAddress == address(0) ); tokenAddress = _toke...
41,261
143
// Pending - Tells if an update has been requested but not yet completed
bool pendingBitcoinPrice; bool pendingLastHash;
bool pendingBitcoinPrice; bool pendingLastHash;
6,764
6
// The GUINIV3DAIUSDC1-A Oracle is very expensive to poke, and the price should notchange frequently, so it is getting poked only once a day.
(ok,) = guniv3daiusdc1.call(abi.encodeWithSelector(0x18178358)); (ok,) = spotter.call(abi.encodeWithSelector(0x1504460f, bytes32("BAT-A"))); (ok,) = spotter.call(abi.encodeWithSelector(0x1504460f, bytes32("ZRX-A"))); (ok,) = spotter.call(abi.encodeWithSelector(0x1504460f...
(ok,) = guniv3daiusdc1.call(abi.encodeWithSelector(0x18178358)); (ok,) = spotter.call(abi.encodeWithSelector(0x1504460f, bytes32("BAT-A"))); (ok,) = spotter.call(abi.encodeWithSelector(0x1504460f, bytes32("ZRX-A"))); (ok,) = spotter.call(abi.encodeWithSelector(0x1504460f...
11,456
115
// collaboration of update / consult
function expectedPrice(address token, uint256 amountIn) external view returns (uint224 amountOut)
function expectedPrice(address token, uint256 amountIn) external view returns (uint224 amountOut)
24,963
1
// Type of distribution/token.
TokenType tokenType;
TokenType tokenType;
41,216
42
// The struct consists of ERC20-style token metadata.
struct ERC20Metadata { string name; string symbol; uint8 decimals; }
struct ERC20Metadata { string name; string symbol; uint8 decimals; }
63,240
623
// Self Permit/Functionality to call permit on any EIP-2612-compliant token for use in the route/These functions are expected to be embedded in multicalls to allow EOAs to approve a contract and call a function/ that requires an approval in a single transaction.
abstract contract SelfPermit is ISelfPermit { /// @inheritdoc ISelfPermit function selfPermit( address token, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) public payable override { ERC20(token).permit(msg.sender, address(this), valu...
abstract contract SelfPermit is ISelfPermit { /// @inheritdoc ISelfPermit function selfPermit( address token, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) public payable override { ERC20(token).permit(msg.sender, address(this), valu...
61,765
38
// Creator of the proposal
address proposer;
address proposer;
68,727
7
// send tokens via the owner
token.transferFrom(msg.sender, admin, amount); bytes32 signature = keccak256(abi.encodePacked(msg.sender, to, chainId, destChainId, amount, nonce)); emit Transfer( msg.sender, to, destChainId, amount, block.timestamp,
token.transferFrom(msg.sender, admin, amount); bytes32 signature = keccak256(abi.encodePacked(msg.sender, to, chainId, destChainId, amount, nonce)); emit Transfer( msg.sender, to, destChainId, amount, block.timestamp,
62,055
97
// Helper method to check if an address is the owner of a target wallet. _wallet The target wallet. _addr The address. /
function isOwner(BaseWallet _wallet, address _addr) internal view returns (bool) { return _wallet.owner() == _addr; }
function isOwner(BaseWallet _wallet, address _addr) internal view returns (bool) { return _wallet.owner() == _addr; }
29,170
37
// Returns true if a borrower has repaid his loan in the market, falseotherwise /
function repaid(address _borrower) public view returns (bool) { uint actualRequest = actualBorrowerRequest(_borrower); uint expectedRepayment = actualRequest.add(getInterest(_borrower, actualRequest)); if (borrowerRepaid[msg.sender] == expectedRepayment) { return true; } else { return fals...
function repaid(address _borrower) public view returns (bool) { uint actualRequest = actualBorrowerRequest(_borrower); uint expectedRepayment = actualRequest.add(getInterest(_borrower, actualRequest)); if (borrowerRepaid[msg.sender] == expectedRepayment) { return true; } else { return fals...
17,992
93
// add percents for sub guesses
for (uint subEvents = minRewardEvents; subEvents < events; subEvents++) { uint subWinnersCount = calcSublinesGuesses(events, subEvents); uint subRevenue = guessedRawRevenues[subEvents] * subWinnersCount; amount += subRevenue; revenue.details[s...
for (uint subEvents = minRewardEvents; subEvents < events; subEvents++) { uint subWinnersCount = calcSublinesGuesses(events, subEvents); uint subRevenue = guessedRawRevenues[subEvents] * subWinnersCount; amount += subRevenue; revenue.details[s...
6,068
5
// 价格数据合约
address public nestPriceFacade = 0xB5D2890c061c321A5B6A4a4254bb1522425BAF0A;
address public nestPriceFacade = 0xB5D2890c061c321A5B6A4a4254bb1522425BAF0A;
29,624
51
// ERC721Receiver callback checking and calling helper.
function _checkOnERC721Received( address from_, address to_, uint256 tokenId_, bytes memory data_
function _checkOnERC721Received( address from_, address to_, uint256 tokenId_, bytes memory data_
29,628
20
// オーナー限定のアクセス修飾子を作成
modifier onlyOwner() { require(msg.sender == mOwner.mAddress); _; }
modifier onlyOwner() { require(msg.sender == mOwner.mAddress); _; }
31,658
113
// Provides an interface to the ratio unitreturn Ratio scale unit (1e8 or 1108) /
function getRatioScale() internal pure returns (uint256) { return RATIO_SCALE; }
function getRatioScale() internal pure returns (uint256) { return RATIO_SCALE; }
38,473
32
// function remove(bytes32 slot,address self)internal
//{ //ContractStorage storage SCID = storageContract(slot); // ////SCID._this.requireNotNull(); ////SCID.thisHash.require...(); ////SCID.thisHex.requireNotEmpty(); // //SCID._this = AddressLogic.NULL; // //chainId.requireNotEmpty(); // ...
//{ //ContractStorage storage SCID = storageContract(slot); // ////SCID._this.requireNotNull(); ////SCID.thisHash.require...(); ////SCID.thisHex.requireNotEmpty(); // //SCID._this = AddressLogic.NULL; // //chainId.requireNotEmpty(); // ...
47,602
3
// Wave speed
traitValues[2] = ['0.00', '0.005', '0.007', '0.008' , '0.009', '0.01', '0.011', '0.012', '0.014'];
traitValues[2] = ['0.00', '0.005', '0.007', '0.008' , '0.009', '0.01', '0.011', '0.012', '0.014'];
23,864
133
// Bridge Library to map GSN RelayRequest into a call of a Forwarder /
library GsnEip712Library { // maximum length of return value/revert reason for 'execute' method. Will truncate result if exceeded. uint256 private constant MAX_RETURN_SIZE = 1024; //copied from Forwarder (can't reference string constants even from another library) string public constant GENERIC_PARAMS ...
library GsnEip712Library { // maximum length of return value/revert reason for 'execute' method. Will truncate result if exceeded. uint256 private constant MAX_RETURN_SIZE = 1024; //copied from Forwarder (can't reference string constants even from another library) string public constant GENERIC_PARAMS ...
32,353
8
// createSwapPair /
function createSwapPair(bytes32 ethTxHash, address erc20Addr, string calldata name, string calldata symbol, uint8 decimals) onlyOwner external returns (address) { require(swapMappingETH2BSC[erc20Addr] == address(0x0), "duplicated swap pair"); BEP20UpgradeableProxy proxyToken = new BEP20UpgradeableP...
function createSwapPair(bytes32 ethTxHash, address erc20Addr, string calldata name, string calldata symbol, uint8 decimals) onlyOwner external returns (address) { require(swapMappingETH2BSC[erc20Addr] == address(0x0), "duplicated swap pair"); BEP20UpgradeableProxy proxyToken = new BEP20UpgradeableP...
39,979
154
// given genes of kitten 1 & 2, return a genetic combination - may have a random factor/genes1 genes of mom/genes2 genes of sire/ return the genes that are supposed to be passed down the child
function mixGenes(uint256 genes1, uint256 genes2, uint256 targetBlock) public pure returns (uint256);
function mixGenes(uint256 genes1, uint256 genes2, uint256 targetBlock) public pure returns (uint256);
28,650
0
// Multiplies two numbers, throws on overflow./
function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { return 0; } uint256 c = a * b; assert(c / a == b); return c; }
function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { return 0; } uint256 c = a * b; assert(c / a == b); return c; }
1,028
238
// Pull in rewards from the rewards distributor, if applicable
for (uint256 i = 0; i < rewardDistributors.length; i++){ address reward_distributor_address = rewardDistributors[i]; if (reward_distributor_address != address(0)) { IFraxGaugeFXSRewardsDistributor(reward_distributor_address).distributeReward(address(this)); }...
for (uint256 i = 0; i < rewardDistributors.length; i++){ address reward_distributor_address = rewardDistributors[i]; if (reward_distributor_address != address(0)) { IFraxGaugeFXSRewardsDistributor(reward_distributor_address).distributeReward(address(this)); }...
18,562