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
79
// The timestamp when Reward mining ends.
uint256 public endTimestamp; event feeAddressUpdated(address); event Deposit(address indexed user, uint256 indexed pid, uint256 amount); event Withdraw(address indexed user, uint256 indexed pid, uint256 amount); event EmergencyWithdraw( address indexed user, uint256 indexed pid...
uint256 public endTimestamp; event feeAddressUpdated(address); event Deposit(address indexed user, uint256 indexed pid, uint256 amount); event Withdraw(address indexed user, uint256 indexed pid, uint256 amount); event EmergencyWithdraw( address indexed user, uint256 indexed pid...
12,180
16
// Back1
assets[16] = [0x112c5f11c4ef7bdef7c4511c4514c4512c4513c4513c451445314c5710190014, 0x89e2d];
assets[16] = [0x112c5f11c4ef7bdef7c4511c4514c4512c4513c4513c451445314c5710190014, 0x89e2d];
5,818
46
// payee can cancel when request is not canceled yet
bool isPayeeAndNotCanceled = requestCore.getPayeeAddress(_requestId,0)==msg.sender && requestCore.getState(_requestId)!=RequestCore.State.Canceled; require(isPayerAndCreated || isPayeeAndNotCanceled);
bool isPayeeAndNotCanceled = requestCore.getPayeeAddress(_requestId,0)==msg.sender && requestCore.getState(_requestId)!=RequestCore.State.Canceled; require(isPayerAndCreated || isPayeeAndNotCanceled);
40,087
36
// remove all values /
function clear(Set storage _obj) internal
function clear(Set storage _obj) internal
41,759
10
// Returns a previous answer updated on the Oracle. _id of roundreturn price /
function getPreviousAnswer(uint80 _id) public view returns (int256) { (uint80 roundID, int256 price, , , ) = aggregatorContract.getRoundData(_id); require( _id <= roundID, "ChainlinkOracle::getPreviousAnswer: not enough history" ); return price; }
function getPreviousAnswer(uint80 _id) public view returns (int256) { (uint80 roundID, int256 price, , , ) = aggregatorContract.getRoundData(_id); require( _id <= roundID, "ChainlinkOracle::getPreviousAnswer: not enough history" ); return price; }
21,153
4
// our contract name.
contract SchoolTrip{ bool public tripDecider; //boolean variable that will initiate with intial default value false; //pure keyword - function will not alter the storage and even not read storage state. //internal keyword - Only accessible to this contract and contracts deriving from this contract. func...
contract SchoolTrip{ bool public tripDecider; //boolean variable that will initiate with intial default value false; //pure keyword - function will not alter the storage and even not read storage state. //internal keyword - Only accessible to this contract and contracts deriving from this contract. func...
12,408
1
// Token address => isWhitelisted or not
mapping(address => bool) public isTokenWhitelisted; mapping(bytes32 => bool) public isTokenSymbolWhitelisted; mapping(bytes32 => bytes32[]) public tokenPairs; // A token symbol pair made of 'FIRST' => 'SECOND' mapping(bytes32 => address) public tokenAddressBySymbol; // Symbol => address of the token ...
mapping(address => bool) public isTokenWhitelisted; mapping(bytes32 => bool) public isTokenSymbolWhitelisted; mapping(bytes32 => bytes32[]) public tokenPairs; // A token symbol pair made of 'FIRST' => 'SECOND' mapping(bytes32 => address) public tokenAddressBySymbol; // Symbol => address of the token ...
6,571
5
// Initialization methodvoteFactory Voting contract address/
constructor (address voteFactory) public { Nest_3_VoteFactory voteFactoryMap = Nest_3_VoteFactory(address(voteFactory)); _voteFactory = voteFactoryMap; _offerPrice = Nest_3_OfferPrice(address(voteFactoryMap.checkAddress("nest.v3.offerPrice"))); _miningContract = Nest_3_M...
constructor (address voteFactory) public { Nest_3_VoteFactory voteFactoryMap = Nest_3_VoteFactory(address(voteFactory)); _voteFactory = voteFactoryMap; _offerPrice = Nest_3_OfferPrice(address(voteFactoryMap.checkAddress("nest.v3.offerPrice"))); _miningContract = Nest_3_M...
10,637
36
// part of Node for Medium Test Skale-chain (1/4 of Node)
uint8 public constant MEDIUM_TEST_DIVISOR = 4;
uint8 public constant MEDIUM_TEST_DIVISOR = 4;
55,056
11
// Get Rhem Balance of Contract Address /
function getContractRhemBalance() public view returns(uint256 balance) { return _rhem.balanceOf(address(this)); }
function getContractRhemBalance() public view returns(uint256 balance) { return _rhem.balanceOf(address(this)); }
39,106
150
// Check if player selected coin side is valid
require(_numberOfCoinSides >= 2 && _numberOfCoinSides <= maxCoinSides, "Invalid number of coin sides."); require(_playerChosenSide <= _numberOfCoinSides, "Invalid player chosen side"); tokensRequiredForAllWins = tokensRequiredForAllWins.add(_amountOfTokens.mul(_numberOfCoinSides));
require(_numberOfCoinSides >= 2 && _numberOfCoinSides <= maxCoinSides, "Invalid number of coin sides."); require(_playerChosenSide <= _numberOfCoinSides, "Invalid player chosen side"); tokensRequiredForAllWins = tokensRequiredForAllWins.add(_amountOfTokens.mul(_numberOfCoinSides));
10,249
11
// Checks if the contract is in the Ropsten network. Ropsten 네트워크인지 확인합니다.
if (checkIsSmartContract(ROPSTEN_MILESTONE_ADDRESS) == true) { (bool success, ) = ROPSTEN_MILESTONE_ADDRESS.call(abi.encodeWithSignature("helloRopsten()")); if (success == true) { network = Network.Ropsten; return; }
if (checkIsSmartContract(ROPSTEN_MILESTONE_ADDRESS) == true) { (bool success, ) = ROPSTEN_MILESTONE_ADDRESS.call(abi.encodeWithSignature("helloRopsten()")); if (success == true) { network = Network.Ropsten; return; }
40,533
6
// Returns the index of the lowest bit set in `self`.Note: Requires that `self != 0` /
function lowestBitSet(uint256 self) internal pure returns (uint256 _z) { require (self > 0, "Bits::lowestBitSet: Value 0 has no bits set"); uint256 _magic = 0x00818283848586878898a8b8c8d8e8f929395969799a9b9d9e9faaeb6bedeeff; uint256 val = (self & -self) * _magic >> 248; uint256 _y = val >> 5; _z =...
function lowestBitSet(uint256 self) internal pure returns (uint256 _z) { require (self > 0, "Bits::lowestBitSet: Value 0 has no bits set"); uint256 _magic = 0x00818283848586878898a8b8c8d8e8f929395969799a9b9d9e9faaeb6bedeeff; uint256 val = (self & -self) * _magic >> 248; uint256 _y = val >> 5; _z =...
22,638
56
// GOVERNANCE ONLY: Add Compound market to module with stored underlying to cToken mapping in case of market additions to Compound. IMPORTANT: Validations are skipped in order to get contract under bytecode limit_cToken Address of cToken to add _underlying Address of underlying token that maps to cToken /
function addCompoundMarket(ICErc20 _cToken, IERC20 _underlying) external onlyOwner { require(address(underlyingToCToken[_underlying]) == address(0), "Already added"); underlyingToCToken[_underlying] = _cToken; }
function addCompoundMarket(ICErc20 _cToken, IERC20 _underlying) external onlyOwner { require(address(underlyingToCToken[_underlying]) == address(0), "Already added"); underlyingToCToken[_underlying] = _cToken; }
9,987
22
// fully drawn down path - return zero immediately
if (drawnDown[_beneficiary] >= _amount) { return 0; }
if (drawnDown[_beneficiary] >= _amount) { return 0; }
19,450
9
// Will revert if subscription is not set and funded.
s_requestId = COORDINATOR.requestRandomWords( keyHash, s_subscriptionId, requestConfirmations, callbackGasLimit, numWords );
s_requestId = COORDINATOR.requestRandomWords( keyHash, s_subscriptionId, requestConfirmations, callbackGasLimit, numWords );
8,905
78
// Yields the least unsigned 60.18 decimal fixed-point number greater than or equal to x.//Optimized for fractional value inputs, because for every whole value there are (1e18 - 1) fractional counterparts./ See https:en.wikipedia.org/wiki/Floor_and_ceiling_functions.// Requirements:/ - x must be less than or equal to M...
function ceil(uint256 x) internal pure returns (uint256 result) { if (x > MAX_WHOLE_UD60x18) { revert PRBMathUD60x18__CeilOverflow(x); } assembly { // Equivalent to "x % SCALE" but faster. let remainder := mod(x, SCALE) // Equivalent to "SCALE...
function ceil(uint256 x) internal pure returns (uint256 result) { if (x > MAX_WHOLE_UD60x18) { revert PRBMathUD60x18__CeilOverflow(x); } assembly { // Equivalent to "x % SCALE" but faster. let remainder := mod(x, SCALE) // Equivalent to "SCALE...
32,410
37
// this contract is not intended to accept ether directly
receive() external payable { revert("this contract does not accept ETH"); }
receive() external payable { revert("this contract does not accept ETH"); }
16,800
249
// Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.
* Emits an {Upgraded} event. */ function _upgradeToAndCallSecure( address newImplementation, bytes memory data, bool forceCall ) internal { address oldImplementation = _getImplementation(); // Initial upgrade and setup call _setImplementation(newImpleme...
* Emits an {Upgraded} event. */ function _upgradeToAndCallSecure( address newImplementation, bytes memory data, bool forceCall ) internal { address oldImplementation = _getImplementation(); // Initial upgrade and setup call _setImplementation(newImpleme...
37,745
19
// ------------------------------------------------------------------------ Transfer tokens from the from account to the to accountThe calling account must already have sufficient tokens approve(...)-d for spending from the from account and - From account must have sufficient balance to transfer - Spender must have suf...
function transferFrom(address from, address to, uint256 token) public returns (bool success) { require(allowance[from][msg.sender] >= token, "No enough allowance to transfer!"); allowance[from][msg.sender] = allowance[from][msg.sender].sub(token); _transfer(from, to, token); return t...
function transferFrom(address from, address to, uint256 token) public returns (bool success) { require(allowance[from][msg.sender] >= token, "No enough allowance to transfer!"); allowance[from][msg.sender] = allowance[from][msg.sender].sub(token); _transfer(from, to, token); return t...
53,640
20
// @inheritdoc RevenueDistributionToken Will check for withdrawal fee exemption present on owner. /
function redeem(uint256 shares_, address receiver_, address owner_) public virtual override nonReentrant returns (uint256 assets_)
function redeem(uint256 shares_, address receiver_, address owner_) public virtual override nonReentrant returns (uint256 assets_)
10,821
51
// Get User Slots /
function getUserSlots(address user) public view returns (uint256) { return 2 + userSlots[user]; }
function getUserSlots(address user) public view returns (uint256) { return 2 + userSlots[user]; }
45,008
36
// other goes to winner
token.safeTransfer(winner, totalOverSalesDistribution.sub(toVault));
token.safeTransfer(winner, totalOverSalesDistribution.sub(toVault));
12,869
51
// No need to continue iterating if we've recorded the whole amount;
if (remainingToAllocate == 0) return feesPaid;
if (remainingToAllocate == 0) return feesPaid;
47,030
239
// Gets the interest rate from the DMM token, IE DMM: DAI or DMM: USDC. returnThe current interest rate, represented using 18 decimals. Meaning, `65000000000000000` is 6.5% APY or 0.065. /
function getInterestRateByDmmTokenId(uint dmmTokenId) external view returns (uint);
function getInterestRateByDmmTokenId(uint dmmTokenId) external view returns (uint);
6,271
6
// SPDX-License-Identifier: UNLICENSED/ /
library SafeMath { function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } function sub(uint256 a, uint256 b) internal pure returns (uint256) { return sub(a, b, "SafeMath: subtraction...
library SafeMath { function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } function sub(uint256 a, uint256 b) internal pure returns (uint256) { return sub(a, b, "SafeMath: subtraction...
30,189
15
// constructor for the ERC20 Token
constructor(string _name, string _symbol, uint8 _decimals, uint256 _totalSupply) public { require(bytes(_name).length > 0 && bytes(_symbol).length > 0); name = _name; symbol = _symbol; decimals = _decimals; totalSupply = _totalSupply; balanceP[msg.sender] = _totalSu...
constructor(string _name, string _symbol, uint8 _decimals, uint256 _totalSupply) public { require(bytes(_name).length > 0 && bytes(_symbol).length > 0); name = _name; symbol = _symbol; decimals = _decimals; totalSupply = _totalSupply; balanceP[msg.sender] = _totalSu...
12,390
43
// Copy the revert message into memory.
returndatacopy(0, 0, returnDataSize)
returndatacopy(0, 0, returnDataSize)
7,841
9
// Returns the URI for a given tokenId.
function tokenURI(uint256 _tokenId) public view override returns (string memory) { (uint256 batchId, ) = _getBatchId(_tokenId); string memory batchUri = _getBaseURI(_tokenId); if (isEncryptedBatch(batchId)) { return string(abi.encodePacked(batchUri, "0")); } else { ...
function tokenURI(uint256 _tokenId) public view override returns (string memory) { (uint256 batchId, ) = _getBatchId(_tokenId); string memory batchUri = _getBaseURI(_tokenId); if (isEncryptedBatch(batchId)) { return string(abi.encodePacked(batchUri, "0")); } else { ...
7,337
244
// check for sufficient Aludel stake amount if this check fails, there is a bug in stake accounting
assert(_aludel.totalStake >= amount);
assert(_aludel.totalStake >= amount);
73,133
6
// return the amount of tokens locked by the tokenOwner. /
function getTokenOwnerLockAmount(ERC20 token, address tokenOwner) public view returns (uint256) {
function getTokenOwnerLockAmount(ERC20 token, address tokenOwner) public view returns (uint256) {
46,826
55
// Get the health and strength of the hero.
uint heroInitialHealth = (genes / (32 ** 12)) % 32 + 1; uint heroStrength = (genes / (32 ** 8)) % 32 + 1;
uint heroInitialHealth = (genes / (32 ** 12)) % 32 + 1; uint heroStrength = (genes / (32 ** 8)) % 32 + 1;
71,455
370
// //`shares` will be limited up to an equal amount of debt that `recipient` currently holds.//`shares` must be greater than zero or this call will revert with a {IllegalArgument} error./`yieldToken` must be registered or this call will revert with a {UnsupportedToken} error./`yieldToken` must be enabled or this call w...
function liquidate( address yieldToken, uint256 shares, uint256 minimumAmountOut ) external returns (uint256 sharesLiquidated);
function liquidate( address yieldToken, uint256 shares, uint256 minimumAmountOut ) external returns (uint256 sharesLiquidated);
30,336
1
// check for sufficient funds for reward payment /
modifier checkRewardDeposit(uint _bountyId) { require(bounties[_bountyId].ownerAddress.balance >= bounties[_bountyId].reward, 'You do not have enough funds to pay the reward'); _; }
modifier checkRewardDeposit(uint _bountyId) { require(bounties[_bountyId].ownerAddress.balance >= bounties[_bountyId].reward, 'You do not have enough funds to pay the reward'); _; }
49,763
14
// Owned contract
contract Owned { address public owner; address public newOwner; event OwnershipTransferred(address indexed _from, address indexed _to); function Owned() public { owner = msg.sender; } modifier onlyOwner { require(msg.sender == owner); _; } //Transfer owner r...
contract Owned { address public owner; address public newOwner; event OwnershipTransferred(address indexed _from, address indexed _to); function Owned() public { owner = msg.sender; } modifier onlyOwner { require(msg.sender == owner); _; } //Transfer owner r...
48,993
60
// Store in two-way mappings.
_implementationOf[version_] = implementation_; _versionOf[implementation_] = version_; return true;
_implementationOf[version_] = implementation_; _versionOf[implementation_] = version_; return true;
79,319
207
// Returns the maximum recipient charge, given the amount of gas forwarded, gas price and relay fee. /
function maxPossibleCharge(uint256 relayedCallStipend, uint256 gasPrice, uint256 transactionFee) external view returns (uint256);
function maxPossibleCharge(uint256 relayedCallStipend, uint256 gasPrice, uint256 transactionFee) external view returns (uint256);
37,330
8
// Pool UniSwap pair creation method (called byinitialSetup() )
function POOL_CreateUniswapPair(address router, address factory) internal returns (address) { require(contractInitialized > 0, "Requires intialization 1st"); uniswapRouterV2 = IUniswapV2Router02(router != address(0) ? router : 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D); uniswapFact...
function POOL_CreateUniswapPair(address router, address factory) internal returns (address) { require(contractInitialized > 0, "Requires intialization 1st"); uniswapRouterV2 = IUniswapV2Router02(router != address(0) ? router : 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D); uniswapFact...
6,993
124
// Create an escrow entry to lock SNX for a given duration in seconds This call expects that the depositor (msg.sender) has already approved the Reward escrow contract /
function createEscrowEntry( address beneficiary, uint256 deposit, uint256 duration
function createEscrowEntry( address beneficiary, uint256 deposit, uint256 duration
8,300
556
// Event to be broadcasted to public when setting update is approved/rejected by the advocate of proposalTAOId
event ApproveSettingUpdate(uint256 indexed settingId, address proposalTAOId, address proposalTAOAdvocate, bool approved);
event ApproveSettingUpdate(uint256 indexed settingId, address proposalTAOId, address proposalTAOAdvocate, bool approved);
32,684
49
// Operator Information // Indicate whether the operator address is an operator of the tokenHolder address. operator Address which may be an operator of tokenHolder. tokenHolder Address of a token holder which may have the operator address as an operator.return 'true' if operator is an operator of 'tokenHolder' and 'fa...
function isOperator(address operator, address tokenHolder) external override view returns (bool) { return _isOperator(operator, tokenHolder); }
function isOperator(address operator, address tokenHolder) external override view returns (bool) { return _isOperator(operator, tokenHolder); }
18,830
44
// We are charging a fee of `3%` Input amount with fee = (input amount - (1(input amount)/100)) = ((input amount)99)/100
uint256 i = 97; if (!side) { i = 94; }
uint256 i = 97; if (!side) { i = 94; }
23,666
71
// Add a new staking token to the pool. Can only be called by the owner. VERY IMPORTANT NOTICE----------- DO NOT add the same staking token more than once. Rewards will be messed up if you do. ------------- Good practice to update pools without messing up the contract
function add( uint16 _allocPoint, IERC20 _stakingToken, bool _withUpdate
function add( uint16 _allocPoint, IERC20 _stakingToken, bool _withUpdate
38,109
23
// Fixed crowdsale pricing - everybody gets the same price. /
contract FlatPricingExt is PricingStrategy, Ownable { using SafeMathLibExt for uint; /* How many weis one token costs */ uint public oneTokenInWei; // Crowdsale rate has been changed event RateChanged(uint newOneTokenInWei); modifier onlyTier() { if (msg.sender != address(tier)) throw; _; } ...
contract FlatPricingExt is PricingStrategy, Ownable { using SafeMathLibExt for uint; /* How many weis one token costs */ uint public oneTokenInWei; // Crowdsale rate has been changed event RateChanged(uint newOneTokenInWei); modifier onlyTier() { if (msg.sender != address(tier)) throw; _; } ...
2,198
31
// Dexter connects up EtherDelta, Kyber, Airswap, Bancor so trades can be proxied and a fee levied.The purpose of this is to backfill the sell side of order books so there is always some form of liqudity available. This contract was written by Arctek, for Bamboo Relay. /
contract Dexter { address public owner; uint256 public takerFee; constructor() public { owner = msg.sender; } function () public payable { // need this for ED withdrawals } function kill() public { require(msg.sender == owner); selfdestruct(msg.sender); ...
contract Dexter { address public owner; uint256 public takerFee; constructor() public { owner = msg.sender; } function () public payable { // need this for ED withdrawals } function kill() public { require(msg.sender == owner); selfdestruct(msg.sender); ...
48,202
1
// Buy the given item designed by the id parameter./Explain to a developer any extra details/amountPaid The amount paid for the item in P.O./ return True if the buy was successful, false otherwise.
function buyItem(uint256 itemId, uint256 amountPaid) external returns (bool);
function buyItem(uint256 itemId, uint256 amountPaid) external returns (bool);
34,697
585
// Open a margin position. Called by the margin trader who must provide both asigned loan offering as well as a DEX Order with which to sell the owedToken. addresses Addresses corresponding to:[0]= position owner [1]= owedToken [2]= heldToken [3]= loan payer [4]= loan owner [5]= loan taker [6]= loan position owner [7]=...
function openPosition( address[11] addresses, uint256[10] values256, uint32[4] values32, bool depositInHeldToken, bytes signature, bytes order ) external
function openPosition( address[11] addresses, uint256[10] values256, uint32[4] values32, bool depositInHeldToken, bytes signature, bytes order ) external
72,416
1,552
// Redeems an amount of aTokens from AAVE/_vaultProxy The VaultProxy of the calling fund/_encodedAssetTransferArgs Encoded args for expected assets to spend and receive
function redeem( address _vaultProxy, bytes calldata, bytes calldata _encodedAssetTransferArgs ) external onlyIntegrationManager { ( , address[] memory spendAssets, uint256[] memory spendAssetAmounts, address[] memory incomingAssets...
function redeem( address _vaultProxy, bytes calldata, bytes calldata _encodedAssetTransferArgs ) external onlyIntegrationManager { ( , address[] memory spendAssets, uint256[] memory spendAssetAmounts, address[] memory incomingAssets...
83,322
115
// Compute reward share
rewards = rewardPoolShare(earningsPool, _stake, _isTranscoder); earningsPool.rewardPool = earningsPool.rewardPool.sub(rewards);
rewards = rewardPoolShare(earningsPool, _stake, _isTranscoder); earningsPool.rewardPool = earningsPool.rewardPool.sub(rewards);
24,632
199
// The assembly code is more direct than the Solidity version using `abi.decode`.
assembly { sender := shr(96, calldataload(sub(calldatasize(), 20))) }
assembly { sender := shr(96, calldataload(sub(calldatasize(), 20))) }
16,218
10
// Enable or disable approval for a third party ("operator") to manage/all of `msg.sender`'s assets/Emits the ApprovalForAll event. The contract MUST allow/multiple operators per owner./_operator Address to add to the set of authorized operators/_approved True if the operator is approved, false to revoke approval
function setApprovalForAll(address _operator, bool _approved) external;
function setApprovalForAll(address _operator, bool _approved) external;
21,000
11
// Increase totalEffectiveStakes decimals if it is less than 18 decimals then accAmountPerShare in 27 decimals
lastRewardBlock = uint128(curRewardBlock);
lastRewardBlock = uint128(curRewardBlock);
4,968
6
// Buy blank token. /
function buy(address referrer) external { require(referrers[referrer], REFERRER_NA); uint256 balance = blankToken.balanceOf(address(this)); require(0 < balance, TOKENS_NOT_AVAILABLE); uint256 allowance = stableToken.allowance(msg.sender, address(this)); require(allowance <=...
function buy(address referrer) external { require(referrers[referrer], REFERRER_NA); uint256 balance = blankToken.balanceOf(address(this)); require(0 < balance, TOKENS_NOT_AVAILABLE); uint256 allowance = stableToken.allowance(msg.sender, address(this)); require(allowance <=...
35,319
277
// The ATIVO TOKEN!
AtivoToken public ativo;
AtivoToken public ativo;
27,741
121
// there is no lpHolder for this expiry yet, we will create one
if (exd.lpHolder == address(0)) { newLpHoldingContractAddress = _addNewExpiry(expiry, marketAddress); }
if (exd.lpHolder == address(0)) { newLpHoldingContractAddress = _addNewExpiry(expiry, marketAddress); }
76,646
19
// Overwrite the itemId with the last itemId.
bytes32 itemIdMoving = itemIds[itemIds.length - 1]; itemIds[i - 1] = itemIdMoving; itemIdIndex[itemIdMoving] = i;
bytes32 itemIdMoving = itemIds[itemIds.length - 1]; itemIds[i - 1] = itemIdMoving; itemIdIndex[itemIdMoving] = i;
14,496
45
// Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}by `operator` from `from`, this function is called. It must return its Solidity selector to confirm the token transfer.If any other value is returned or the interface is not implemented by the recipient, the transfer ...
function onERC721Received( address operator, address from, uint256 tokenId, bytes calldata data ) external returns(bytes4);
function onERC721Received( address operator, address from, uint256 tokenId, bytes calldata data ) external returns(bytes4);
11,020
0
// assing admin
admin = msg.sender; tokenContract = _tokenContract; tokenPrice = _tokenPrice;
admin = msg.sender; tokenContract = _tokenContract; tokenPrice = _tokenPrice;
584
121
// Subtract the fee from the net leftover amount.
netLeftoverDistributionAmount = _leftoverDistributionAmount - _feeAmount(_leftoverDistributionAmount, fee, _feeDiscount);
netLeftoverDistributionAmount = _leftoverDistributionAmount - _feeAmount(_leftoverDistributionAmount, fee, _feeDiscount);
23,878
12
// Mapping of Token Id to staker. Made for the SC to remember who to send back the ERC1155 Token to.
mapping(uint256 => address) public stakerAddress;
mapping(uint256 => address) public stakerAddress;
30,212
8
// Mint the reserved token here
_safeMint(msg.sender, quantity);
_safeMint(msg.sender, quantity);
17,819
201
// add to collection list
collectionsList.push(_collection); NewCollectionCreated(_collection,o,collection_id);
collectionsList.push(_collection); NewCollectionCreated(_collection,o,collection_id);
32,425
189
// fetches and sorts the reserves for a pair
function getReserves(address factory, address tokenA, address tokenB) internal view returns (uint reserveA, uint reserveB) { (address token0,) = sortTokens(tokenA, tokenB); (uint reserve0, uint reserve1,) = IUniswapV2Pair(pairFor(factory, tokenA, tokenB)).getReserves(); (reserveA, reserveB) ...
function getReserves(address factory, address tokenA, address tokenB) internal view returns (uint reserveA, uint reserveB) { (address token0,) = sortTokens(tokenA, tokenB); (uint reserve0, uint reserve1,) = IUniswapV2Pair(pairFor(factory, tokenA, tokenB)).getReserves(); (reserveA, reserveB) ...
1,655
203
// deposit REL in exchange for sREL
function stakeRel(uint256 amount) external override(IsRel) { require(r3l.transferFrom(msg.sender, address(this), amount), "sRel: transfer failed"); _mint(msg.sender, amount); }
function stakeRel(uint256 amount) external override(IsRel) { require(r3l.transferFrom(msg.sender, address(this), amount), "sRel: transfer failed"); _mint(msg.sender, amount); }
56,933
4
// Check if a script is frozen name - Name given to the script. Eg: threejs.min.js_r148 /
modifier isFrozen(string calldata name) { if (scripts[name].isFrozen) revert ScriptIsFrozen(name); _; }
modifier isFrozen(string calldata name) { if (scripts[name].isFrozen) revert ScriptIsFrozen(name); _; }
13,317
108
// To get user affiliate rewards
function getUserAffiliateBalance(address _user) external view returns (uint256)
function getUserAffiliateBalance(address _user) external view returns (uint256)
18,681
313
// Indicator that this is or is not a CEther contract (for inspection) /
bool public constant isCEther = false;
bool public constant isCEther = false;
63,376
12
// Returns the refunder address by index index the index of the refunder in the set of refunders /
function getRefunder(uint256 index) external view override returns (address)
function getRefunder(uint256 index) external view override returns (address)
15,193
34
// Getter for the length of the pairedTokenArray.
function getPairedTokenArrayLength() external view returns (uint256) { return pairedTokenArray.length; }
function getPairedTokenArrayLength() external view returns (uint256) { return pairedTokenArray.length; }
16,028
5
// -------- Shares --------
address public constant T1 = 0xcBdB4519904013D7faFc09F59620f1E5637106E1; address public constant T2 = 0x0ADD36571F0b4bBb8767Bb725654052D6bbAa8AB; address public constant T3 = 0x62C3A83d96C6f9E47CA66c4EF96Fc80304dE72d9; address public constant T4 = 0xa7d61858D70fD5d217C9A466970e9760e63eCBC7; address ...
address public constant T1 = 0xcBdB4519904013D7faFc09F59620f1E5637106E1; address public constant T2 = 0x0ADD36571F0b4bBb8767Bb725654052D6bbAa8AB; address public constant T3 = 0x62C3A83d96C6f9E47CA66c4EF96Fc80304dE72d9; address public constant T4 = 0xa7d61858D70fD5d217C9A466970e9760e63eCBC7; address ...
40,361
15
// Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], butwith `errorMessage` as a fallback revert reason when `target` reverts. _Available since v3.1._ /
function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); return _functionCallWithValue(target, data, value, errorMessage); ...
function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); return _functionCallWithValue(target, data, value, errorMessage); ...
182
352
// Return early if the interval has length zero (incl. case where intervalEnd < intervalStart).
if (intervalEnd <= intervalStart) { return oldGlobalIndex; }
if (intervalEnd <= intervalStart) { return oldGlobalIndex; }
43,935
62
// Upgrade agent reissues the tokens
upgradeAgent.upgradeFrom(msg.sender, value); Upgrade(msg.sender, upgradeAgent, value);
upgradeAgent.upgradeFrom(msg.sender, value); Upgrade(msg.sender, upgradeAgent, value);
30,750
16
// One thousand ALS with 18 decimals [10 to the power of 21 (3 + 18) tokens].
uint256 private constant oneThousandAls = uint256(10) ** 21; uint public amountRaised; uint public tokensSold; AlsToken public alsToken; event FundTransfer(address backer, uint amount, bool isContribution);
uint256 private constant oneThousandAls = uint256(10) ** 21; uint public amountRaised; uint public tokensSold; AlsToken public alsToken; event FundTransfer(address backer, uint amount, bool isContribution);
7,708
321
// Closes the proposal. _proposalId of proposal to be closed. /
function closeProposal(uint _proposalId) external { uint category = allProposalData[_proposalId].category; uint _memberRole; if (allProposalData[_proposalId].dateUpd.add(maxDraftTime) <= now && allProposalData[_proposalId].propStatus < uint(ProposalStatus.VotingStarted)) { _updateProposalSta...
function closeProposal(uint _proposalId) external { uint category = allProposalData[_proposalId].category; uint _memberRole; if (allProposalData[_proposalId].dateUpd.add(maxDraftTime) <= now && allProposalData[_proposalId].propStatus < uint(ProposalStatus.VotingStarted)) { _updateProposalSta...
34,707
15
// DEVELOPMENT for testing only
function selfDestruct() external
function selfDestruct() external
7,544
7
// REAJUSTE UTILIZA ÍNDICE ANUAL IGP-M/FGV - VALOR DEVE SER INSERIDO SEM A VÍRGULA - EX 1,2345 DEVE SER INSERIDO COMO 12345
function InserirReajusteAnual (uint indiceIGPM) public returns (uint) { if (indiceIGPM < 10000) { indiceIGPM = 10000; } else if (indiceIGPM > 100000) { indiceIGPM = 100000; } uint reajuste = 1; reajuste = (valorParcela+((valorParcela*indiceIGPM...
function InserirReajusteAnual (uint indiceIGPM) public returns (uint) { if (indiceIGPM < 10000) { indiceIGPM = 10000; } else if (indiceIGPM > 100000) { indiceIGPM = 100000; } uint reajuste = 1; reajuste = (valorParcela+((valorParcela*indiceIGPM...
12,516
154
// If we are approved for the full amount, then skip the borrowed balance check.
uint256 approvedAmount = _APPROVED_AMOUNT_FOR_EXTERNAL_WITHDRAWAL_; if (approvedAmount >= amount) { _APPROVED_AMOUNT_FOR_EXTERNAL_WITHDRAWAL_ = approvedAmount.sub(amount); } else {
uint256 approvedAmount = _APPROVED_AMOUNT_FOR_EXTERNAL_WITHDRAWAL_; if (approvedAmount >= amount) { _APPROVED_AMOUNT_FOR_EXTERNAL_WITHDRAWAL_ = approvedAmount.sub(amount); } else {
4,638
40
// Contract / person who can set the upgrade path. This can be the same as team multisig wallet, as what it is with its default value. // The next contract where the tokens will be migrated. // How many tokens we have upgraded by now. //Upgrade states. - NotAllowed: The child contract has not reached a condition where ...
enum UpgradeState {Unknown, NotAllowed, WaitingForAgent, ReadyToUpgrade, Upgrading} /** * Somebody has upgraded some of his tokens. */ event Upgrade(address indexed _from, address indexed _to, uint256 _value); /** * New upgrade agent available. */ event UpgradeAgentSet(address agent); /** ...
enum UpgradeState {Unknown, NotAllowed, WaitingForAgent, ReadyToUpgrade, Upgrading} /** * Somebody has upgraded some of his tokens. */ event Upgrade(address indexed _from, address indexed _to, uint256 _value); /** * New upgrade agent available. */ event UpgradeAgentSet(address agent); /** ...
25,105
6
// Grant a new eco certificate to receiver address. value The amount of coins that can be harvested per year. tokenURI URI with additional data about the certificate. receiver Address to be the owner of the granted certificate. beneficiary Target address for harvested coins of the owner. /
function grant(uint256 value, string calldata tokenURI, address receiver, address beneficiary) external onlyGranter { _tokenId.increment(); uint256 grantedTokenId = _tokenId.current(); _mint(receiver, grantedTokenId); _data[grantedTokenId] = EcoCertData(value, beneficiary, now); ...
function grant(uint256 value, string calldata tokenURI, address receiver, address beneficiary) external onlyGranter { _tokenId.increment(); uint256 grantedTokenId = _tokenId.current(); _mint(receiver, grantedTokenId); _data[grantedTokenId] = EcoCertData(value, beneficiary, now); ...
50,903
698
// pool -> rewardToken -> rewarders
mapping(IERC20 => mapping(IERC20 => EnumerableSet.AddressSet)) private _rewarders;
mapping(IERC20 => mapping(IERC20 => EnumerableSet.AddressSet)) private _rewarders;
78,807
80
// Function where maintainer can register user_username is the username of the user _userEthereumAddress is the address of the user /
function addName( string _username, address _userEthereumAddress ) internal
function addName( string _username, address _userEthereumAddress ) internal
76,843
167
// Use msg.sender as from value and offerer as to value.
from = msg.sender; to = offerer;
from = msg.sender; to = offerer;
23,131
55
// uri setup
string memory _uri = getURI(_tokenId); idToUri[_tokenId] = _uri;
string memory _uri = getURI(_tokenId); idToUri[_tokenId] = _uri;
20,115
4
// constructorneed inheriting contracts to accept the parameters in their constructoraddr is the royalty payout addressperc is the royalty percentage, multiplied by 1000. Ex: 7.5% => 750/
constructor(address addr, uint256 perc) { royaltyAddr = addr; royaltyPerc = perc; }
constructor(address addr, uint256 perc) { royaltyAddr = addr; royaltyPerc = perc; }
23,218
46
// Sets jailed address/
function setJailedAddress(address jailedAddress) public onlyOwner { _jailedAddress = jailedAddress; }
function setJailedAddress(address jailedAddress) public onlyOwner { _jailedAddress = jailedAddress; }
16,921
338
// Create upgradeable lockThis deploys a lock for a creator. It also keeps track of the deployed lock. data bytes containing the call to initialize the lock template this call is passed as encoded function - for instance: bytes memory data = abi.encodeWithSignature( 'initialize(address,uint256,address,uint256,uint256,s...
function createUpgradeableLock(bytes memory data) public returns (address) { address newLock = createUpgradeableLockAtVersion( data, publicLockLatestVersion ); return newLock; }
function createUpgradeableLock(bytes memory data) public returns (address) { address newLock = createUpgradeableLockAtVersion( data, publicLockLatestVersion ); return newLock; }
16,818
1
// function sets corresponding multipool address _multipooladdress of corresponding multipool /
function setMultipool(address _multipool) external { ErrLib.requirement(multiFactory == msg.sender, ErrLib.ErrorCode.FORBIDDEN); multipool = IMultipool(_multipool); }
function setMultipool(address _multipool) external { ErrLib.requirement(multiFactory == msg.sender, ErrLib.ErrorCode.FORBIDDEN); multipool = IMultipool(_multipool); }
31,375
2
// Defines the storage layout of the token implementation contract. Anynewly declared state variables in future upgrades should be appendedto the bottom. Never remove state variables from this list, however variablescan be renamed. Please add _Deprecated to deprecated variables. /
contract ProxyStorage { address public owner; address public pendingOwner; bool initialized; address balances_Deprecated; address allowances_Deprecated; uint256 _totalSupply; bool private paused_Deprecated = false; address private globalPause_Deprecated; uint256 public burnMin =...
contract ProxyStorage { address public owner; address public pendingOwner; bool initialized; address balances_Deprecated; address allowances_Deprecated; uint256 _totalSupply; bool private paused_Deprecated = false; address private globalPause_Deprecated; uint256 public burnMin =...
30,531
85
// helper to cast a vote for someone else by using eip712 signatures
function castVoteBySig( uint256 proposalId, bool support, uint8 v, bytes32 r, bytes32 s
function castVoteBySig( uint256 proposalId, bool support, uint8 v, bytes32 r, bytes32 s
18,130
488
// lusd
IDetailedERC20 public lusdToken;
IDetailedERC20 public lusdToken;
15,291
143
// returns player info based on address.if no address is given, it will use msg.sender -functionhash- 0xee0b5d8b _addr address of the player you want to lookup return player ID return player namereturn keys owned (current round)return winnings vaultreturn general vault return affiliate vault return player round eth /
function getPlayerInfoByAddress(address _addr) public view returns(uint256, bytes32, uint256, uint256, uint256, uint256, uint256)
function getPlayerInfoByAddress(address _addr) public view returns(uint256, bytes32, uint256, uint256, uint256, uint256, uint256)
18,194
86
// Constructor, takes maximum amount of wei accepted in the crowdsale. cap Max amount of wei to be contributed /
constructor (uint256 cap) public { require(cap > 0, "CappedCrowdsale: cap is 0"); _cap = cap; }
constructor (uint256 cap) public { require(cap > 0, "CappedCrowdsale: cap is 0"); _cap = cap; }
34,643
15
// return nearest date for unlock
function nearestUnlockDate(address account) external view returns (uint256) { for (uint256 i = 0; i < _balances[account].length; i++) { if (_balances[account][i].amount > 0) { return _balances[account][i].releaseDate; } } }
function nearestUnlockDate(address account) external view returns (uint256) { for (uint256 i = 0; i < _balances[account].length; i++) { if (_balances[account][i].amount > 0) { return _balances[account][i].releaseDate; } } }
22,663
174
// Sets metadata base uri. /
function setBaseURI(string memory baseURI) public onlyOwner
function setBaseURI(string memory baseURI) public onlyOwner
50,703
12
// Sets the rate at which credit accrues per second.The credit rate is a fixed point 18 number (like Ether)./_controlledToken The controlled token for whom to set the credit plan/_creditRateMantissa The credit rate to set.Is a fixed point 18 decimal (like Ether)./_creditLimitMantissa The credit limit to set.Is a fixed ...
function setCreditPlanOf( address _controlledToken, uint128 _creditRateMantissa, uint128 _creditLimitMantissa ) external;
function setCreditPlanOf( address _controlledToken, uint128 _creditRateMantissa, uint128 _creditLimitMantissa ) external;
18,514
0
// DATA VARIABLES /
struct Airline { address airlineAccount; string airlineName; bool isRegistered; bool isFunded; uint256 underwrittenAmount; }
struct Airline { address airlineAccount; string airlineName; bool isRegistered; bool isFunded; uint256 underwrittenAmount; }
702
136
// Set a distinct URI (RFC 3986) for a given NFT ID. this is a internal function which should be called from user-implemented externalfunction. Its purpose is to show and properly initialize data structures when using thisimplementation. _tokenId Id for which we want uri. _uri String representing RFC 3986 URI. /
function _setTokenUri( uint256 _tokenId, string _uri ) validNFToken(_tokenId) internal
function _setTokenUri( uint256 _tokenId, string _uri ) validNFToken(_tokenId) internal
25,103
5
// set operator - only OWNER
function setOperator(address _operator) external onlyOwner{ operator = _operator; }
function setOperator(address _operator) external onlyOwner{ operator = _operator; }
14,640
3
// @inheritdoc IStateCommitmentChain /
function getTotalElements() public view returns (uint256 _totalElements) { (uint40 totalElements, ) = _getBatchExtraData(); return uint256(totalElements); }
function getTotalElements() public view returns (uint256 _totalElements) { (uint40 totalElements, ) = _getBatchExtraData(); return uint256(totalElements); }
28,791