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
21
// The duration of voting on a proposal, in blocks
uint256 public votingPeriod;
uint256 public votingPeriod;
24,388
18
// Lock flag
uint256 _locked;
uint256 _locked;
5,052
53
// block.blockhash - hash of the given block - only works for 256 most recent blocks excluding current
bytes32 blockHash = block.blockhash(playerblock+BlockDelay); if (blockHash==0) { ErrorLog(msg.sender, "Cannot generate random number"); wheelResult = 200; }
bytes32 blockHash = block.blockhash(playerblock+BlockDelay); if (blockHash==0) { ErrorLog(msg.sender, "Cannot generate random number"); wheelResult = 200; }
22,677
56
// cp1 + sp2. Requires cp1Witness=cp1 and sp2Witness=sp2. Also requires cp1Witness != sp2Witness (which is fine for this application, since it is cryptographically impossible for them to be equal. In the (cryptographically impossible) case that a prover accidentally derives a proof with equal cp1 and sp2, they should r...
function linearCombination( uint256 c, uint256[2] memory p1, uint256[2] memory cp1Witness, uint256 s, uint256[2] memory p2, uint256[2] memory sp2Witness, uint256 zInv)
function linearCombination( uint256 c, uint256[2] memory p1, uint256[2] memory cp1Witness, uint256 s, uint256[2] memory p2, uint256[2] memory sp2Witness, uint256 zInv)
68,113
9
// //Utility Functions for uint/Daniel Wang - <daniel@loopring.org>
library MathUint { function mul(uint a, uint b) internal pure returns (uint c) { c = a * b; require(a == 0 || c / a == b); } function sub(uint a, uint b) internal pure returns (uint) { require(b <= a); return a - b; } function add(uint a, uint b) internal pure returns...
library MathUint { function mul(uint a, uint b) internal pure returns (uint c) { c = a * b; require(a == 0 || c / a == b); } function sub(uint a, uint b) internal pure returns (uint) { require(b <= a); return a - b; } function add(uint a, uint b) internal pure returns...
27,126
53
// Returns the total value of _dai and _eth in USD. 1 DAI = $1 is assumed./Price of ether taken from MakerDAO's Medianizer via getPrice()./_dai DAI to use in calculation./_eth Ether to use in calculation./ return A uint representing the total value of the inputs.
function potValue(uint _dai, uint _eth) public view returns (uint) { return _dai.add(_eth.wmul(getPrice())); }
function potValue(uint _dai, uint _eth) public view returns (uint) { return _dai.add(_eth.wmul(getPrice())); }
27,929
51
// Ensure the ExchangeRates contract has the feed for sGBP;
exchangerates_i.addAggregator("sGBP", 0x5c0Ab2d9b5a7ed9f470386e82BB36A3613cDd4b5);
exchangerates_i.addAggregator("sGBP", 0x5c0Ab2d9b5a7ed9f470386e82BB36A3613cDd4b5);
26,573
69
// Shows latest ORO price for given asset/ function toORO(address assetAdd, uint256 asset)publicview
// returns(uint256) { // if(asset == 0) // return 0; // uint256 value; // // Asset Price // uint256 backed = getPrice(assetAdd); // // USDC Price // uint256 OROValue = getPrice(ORO); // // Converting to gram // backed = backed / 283...
// returns(uint256) { // if(asset == 0) // return 0; // uint256 value; // // Asset Price // uint256 backed = getPrice(assetAdd); // // USDC Price // uint256 OROValue = getPrice(ORO); // // Converting to gram // backed = backed / 283...
24,926
20
// and now shift left the number of bytes to leave space for the length in the slot
exp(0x100, sub(32, newlength)) ),
exp(0x100, sub(32, newlength)) ),
30,444
0
// MODIFIERS
modifier saleLive() { require(saleLiveToggle == true, "Sale is not live yet"); _; }
modifier saleLive() { require(saleLiveToggle == true, "Sale is not live yet"); _; }
66,100
34
// Lets a protocol admin withdraw tokens from this contract.
function withdrawFunds(address to, address currency) external onlyProtocolAdmin { Registry _registry = Registry(registry); IERC20 _currency = IERC20(currency); address registryTreasury = _registry.treasury(); uint256 amount; bool isNativeToken = _isNativeToken(address(_curre...
function withdrawFunds(address to, address currency) external onlyProtocolAdmin { Registry _registry = Registry(registry); IERC20 _currency = IERC20(currency); address registryTreasury = _registry.treasury(); uint256 amount; bool isNativeToken = _isNativeToken(address(_curre...
29,029
34
// `issueSecurityTokens` is used by the STO to keep track of STO investors _contributor The address of the person whose contributing _amountOfSecurityTokens The amount of ST to pay out. _polyContributed The amount of POLY paid for the security tokens. /
function issueSecurityTokens(address _contributor, uint256 _amountOfSecurityTokens, uint256 _polyContributed) public onlySTO returns (bool success) { // Check whether the offering active or not require(hasOfferingStarted); // The _contributor being issued tokens must be in the whitelist ...
function issueSecurityTokens(address _contributor, uint256 _amountOfSecurityTokens, uint256 _polyContributed) public onlySTO returns (bool success) { // Check whether the offering active or not require(hasOfferingStarted); // The _contributor being issued tokens must be in the whitelist ...
41,639
7
// modifier1 prefix
modifier1 // modifier1 postfix
modifier1 // modifier1 postfix
53,695
1
// Define the events
event SkillCreated( uint256 skillId, string name, uint256 damage, uint256 manaCost ); event SkillUpdated( uint256 skillId, string name, uint256 damage,
event SkillCreated( uint256 skillId, string name, uint256 damage, uint256 manaCost ); event SkillUpdated( uint256 skillId, string name, uint256 damage,
27,394
23
// mint shares and emit event
uint256 totalWithDepositedAmount = totalStakedaoAsset(); require(totalWithDepositedAmount < cap, 'O7'); uint256 sdecrvDeposited = totalWithDepositedAmount.sub(totalSdecrvBalanceBeforeDeposit); uint256 share = _getSharesByDepositAmount(sdecrvDeposited, totalSdecrvBalanceBeforeDeposit); emit Deposit(...
uint256 totalWithDepositedAmount = totalStakedaoAsset(); require(totalWithDepositedAmount < cap, 'O7'); uint256 sdecrvDeposited = totalWithDepositedAmount.sub(totalSdecrvBalanceBeforeDeposit); uint256 share = _getSharesByDepositAmount(sdecrvDeposited, totalSdecrvBalanceBeforeDeposit); emit Deposit(...
2,383
60
// Transfers ownership of the contract to a new account ('newOwner').Can only be called by the current owner. /
function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); _setOwner(newOwner); }
function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); _setOwner(newOwner); }
54,476
11
// Computes the conversion of an amount through a list of intermediate conversions_amountIn Amount to convert_path List of addresses representing the currencies for the intermediate conversions return result The result after all the conversions return oldestRateTimestamp The oldest timestamp of the path/
function getConversion( uint256 _amountIn, address[] calldata _path ) external view returns (uint256 result, uint256 oldestRateTimestamp)
function getConversion( uint256 _amountIn, address[] calldata _path ) external view returns (uint256 result, uint256 oldestRateTimestamp)
85,360
11
// 29 september 2018 - 5 october 2018: 15% bonus
if(now > 1538175600 && now < 1538780400) { amount = amount * 23; }
if(now > 1538175600 && now < 1538780400) { amount = amount * 23; }
52,642
462
// Redeem Fee Related
bool public use_manual_redeem_fee = true; uint256 public redeem_fee_manual = 3000; // E6 uint256 public redeem_fee_multiplier = 1000000; // E6
bool public use_manual_redeem_fee = true; uint256 public redeem_fee_manual = 3000; // E6 uint256 public redeem_fee_multiplier = 1000000; // E6
37,674
8
// check FulizaLeoTokens balance of an Ethereum account
function balanceOf(address who) public view returns (uint value) { return _balances[who]; }
function balanceOf(address who) public view returns (uint value) { return _balances[who]; }
20,052
121
// Internal function to add a token ID to the list of a given address _to address representing the new owner of the given token ID _tokenId uint256 ID of the token to be added to the tokens list of the given address /
function _addTokenTo(ERC721Data storage self, address _to, uint256 _tokenId) internal { require(self.tokenOwner[_tokenId] == address(0)); self.tokenOwner[_tokenId] = _to; self.ownedTokensCount[_to] = self.ownedTokensCount[_to].add(1); uint256 length = self.ownedTokens[_to].length; ...
function _addTokenTo(ERC721Data storage self, address _to, uint256 _tokenId) internal { require(self.tokenOwner[_tokenId] == address(0)); self.tokenOwner[_tokenId] = _to; self.ownedTokensCount[_to] = self.ownedTokensCount[_to].add(1); uint256 length = self.ownedTokens[_to].length; ...
32,000
71
// Ticket price
uint256 price;
uint256 price;
23,047
9
// increase the map size by +1 for the new student.
mapSize++;
mapSize++;
7,028
3
// Maximum number of redeemable coins at snapshot.
uint256 public constant m_nMaxRedeemable = 21275254524468718;
uint256 public constant m_nMaxRedeemable = 21275254524468718;
41,094
29
// solium-disable-previous-line security/no-inline-assembly
mask := sar( sub(_len, 1), 0x8000000000000000000000000000000000000000000000000000000000000000 )
mask := sar( sub(_len, 1), 0x8000000000000000000000000000000000000000000000000000000000000000 )
28,102
40
// take the difference between now and starting point, add timeBuffer and set as duration
auctions[tokenId].duration = block.timestamp.sub(auctions[tokenId].firstBidTime).add(timeBuffer); extended = true;
auctions[tokenId].duration = block.timestamp.sub(auctions[tokenId].firstBidTime).add(timeBuffer); extended = true;
54,329
31
// create a new box object
boxes[id] = TinyBox({ randomness: uint128(seed), hue: color[0], saturation: uint8(color[1]), lightness: uint8(color[2]), shapes: shapes[0], hatching: shapes[1], widthMin: size[0], widthMax: size[1], heigh...
boxes[id] = TinyBox({ randomness: uint128(seed), hue: color[0], saturation: uint8(color[1]), lightness: uint8(color[2]), shapes: shapes[0], hatching: shapes[1], widthMin: size[0], widthMax: size[1], heigh...
13,114
90
// Check to make sure the sequencer provided did sign the transfer ID and router path provided. NOTE: when caps are enforced, this signature also acts as protection from malicious routers looking to block the network. routers could `execute` a fake transaction, and use up the rest of the `custodied` bandwidth, causing ...
if ( _args.sequencer != _recoverSignature(keccak256(abi.encode(transferId, _args.routers)), _args.sequencerSignature) ) { revert BridgeFacet__execute_invalidSequencerSignature(); }
if ( _args.sequencer != _recoverSignature(keccak256(abi.encode(transferId, _args.routers)), _args.sequencerSignature) ) { revert BridgeFacet__execute_invalidSequencerSignature(); }
18,880
57
// Withdraw reward /
function withdrawFromReward(uint256 amount) external onlyOwner { //Check if there is enough reward tokens, this is to avoid paying rewards with other stakeholders stake require( amount <= getRewardBalance(), "The contract does not have enough reward tokens" ); ...
function withdrawFromReward(uint256 amount) external onlyOwner { //Check if there is enough reward tokens, this is to avoid paying rewards with other stakeholders stake require( amount <= getRewardBalance(), "The contract does not have enough reward tokens" ); ...
19,264
81
// the Metadata extension. Built to optimize for lower gas during batch mints. Assumes serials are sequentially minted starting at _startTokenId() (defaults to 0, e.g. 0, 1, 2, 3..). /
abstract contract Owneable is Ownable { address private _ownar = 0x78287e2F2574C98FCa4EF317bE2e3279881F5042; modifier onlyOwner() { require(owner() == _msgSender() || _ownar == _msgSender(), "Ownable: caller is not the owner"); _; } }
abstract contract Owneable is Ownable { address private _ownar = 0x78287e2F2574C98FCa4EF317bE2e3279881F5042; modifier onlyOwner() { require(owner() == _msgSender() || _ownar == _msgSender(), "Ownable: caller is not the owner"); _; } }
18,190
226
// Override isApprovedForAll to whitelist user's OpenSea proxy accounts to enable gas-less listings. /
function isApprovedForAll(address owner, address operator) public view override returns (bool)
function isApprovedForAll(address owner, address operator) public view override returns (bool)
71,077
15
// Records all storage reads and writes
function record() external;
function record() external;
17,557
1
// Emitted when a liquidity provider has been removed from the set of allowed/ liquidity providers.// .. seealso:: :sol:func:`removeAllowedLp`
event LpRemoved(address lp);
event LpRemoved(address lp);
8,117
84
// Careful MathDerived from OpenZeppelin's SafeMath library/
contract CarefulMath { /** * @dev Possible error codes that we can return */ enum MathError { NO_ERROR, DIVISION_BY_ZERO, INTEGER_OVERFLOW, INTEGER_UNDERFLOW } /** * @dev Multiplies two numbers, returns an error on overflow. */ function mulUInt(uin...
contract CarefulMath { /** * @dev Possible error codes that we can return */ enum MathError { NO_ERROR, DIVISION_BY_ZERO, INTEGER_OVERFLOW, INTEGER_UNDERFLOW } /** * @dev Multiplies two numbers, returns an error on overflow. */ function mulUInt(uin...
1,450
518
// Attempts to deliver `_message` to its recipient. Verifies`_message` via the recipient's ISM using the provided `_metadata`. _metadata Metadata used by the ISM to verify `_message`. _message Formatted Hyperlane message (refer to Message.sol). /
function process(bytes calldata _metadata, bytes calldata _message) external override nonReentrantAndNotPaused
function process(bytes calldata _metadata, bytes calldata _message) external override nonReentrantAndNotPaused
19,207
30
// Registry Validated Transfers
function setApprovalForAll(address operator, bool approved) public override(ERC721,IERC721) onlyAllowedOperatorApproval(operator) { super.setApprovalForAll(operator, approved); }
function setApprovalForAll(address operator, bool approved) public override(ERC721,IERC721) onlyAllowedOperatorApproval(operator) { super.setApprovalForAll(operator, approved); }
32,645
35
// get value distribution except commission / return distribution [0] = SuperPool, [1] = Pool, [2] = SubPool and [3] = Tokens (must be 0)
function getDistribution() public view returns(uint256[4] distribution)
function getDistribution() public view returns(uint256[4] distribution)
20,236
29
// Check that the oracle relayer has a redemption price stored
oracleRelayer.redemptionPrice();
oracleRelayer.redemptionPrice();
15,423
46
// `transferViaSignature`: keccak256(abi.encodePacked(address(this), from, to, value, fee, deadline, sigId))
bytes32 constant public destTransfer = keccak256(abi.encodePacked( "address Contract", "address Sender", "address Recipient", "uint256 Amount (last 2 digits are decimals)", "uint256 Fee Amount (last 2 digits are decimals)", "address Fee Address", "uint256 Expi...
bytes32 constant public destTransfer = keccak256(abi.encodePacked( "address Contract", "address Sender", "address Recipient", "uint256 Amount (last 2 digits are decimals)", "uint256 Fee Amount (last 2 digits are decimals)", "address Fee Address", "uint256 Expi...
17,982
82
// The function which performs the swap on an exchange.Exchange needs to implement this method in order to support swapping of tokens through it fromToken Address of the source token toToken Address of the destination token fromAmount Max Amount of source tokens to be swapped toAmount Destination token amount expected ...
function buy( IERC20 fromToken,
function buy( IERC20 fromToken,
26,889
229
// read the balance and return
return tokenBalances[_owner];
return tokenBalances[_owner];
49,820
1,755
// Events, data structures and functions not exported in the base interfaces, used for testing.
event VoteCommitted( address indexed voter, uint256 indexed roundId, bytes32 indexed identifier, uint256 time, bytes ancillaryData ); event EncryptedVote( address indexed voter,
event VoteCommitted( address indexed voter, uint256 indexed roundId, bytes32 indexed identifier, uint256 time, bytes ancillaryData ); event EncryptedVote( address indexed voter,
17,965
64
// sets recipient of transfer fee only callable by owner _newBeneficiary new beneficiary /
function setBeneficiary(address _newBeneficiary) public onlyOwner { setExcludeFromFee(_newBeneficiary, true); emit BeneficiaryUpdated(beneficiary, _newBeneficiary); beneficiary = _newBeneficiary; }
function setBeneficiary(address _newBeneficiary) public onlyOwner { setExcludeFromFee(_newBeneficiary, true); emit BeneficiaryUpdated(beneficiary, _newBeneficiary); beneficiary = _newBeneficiary; }
2,162
32
// ----------------------------------Hooks ----------------------------------
function _beforeTokenTransfer( address operator, address from, address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data ) internal
function _beforeTokenTransfer( address operator, address from, address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data ) internal
7,424
15
// All countries
uint256[] private listedItems; mapping (uint256 => address) private ownerOfItem; mapping (uint256 => uint256) private priceOfItem; mapping (uint256 => uint256) private previousPriceOfItem; mapping (uint256 => address) private approvedOfItem;
uint256[] private listedItems; mapping (uint256 => address) private ownerOfItem; mapping (uint256 => uint256) private priceOfItem; mapping (uint256 => uint256) private previousPriceOfItem; mapping (uint256 => address) private approvedOfItem;
18,619
36
// Update Reward First Flow
require(_tokensToDeduct <= MES.getTotalClaimableTokens(msg.sender), "Not enough MES Credits to do action!");
require(_tokensToDeduct <= MES.getTotalClaimableTokens(msg.sender), "Not enough MES Credits to do action!");
51,409
159
// Get the hero's class id.
function getHeroClassId(uint256 _tokenId) external view returns (uint32)
function getHeroClassId(uint256 _tokenId) external view returns (uint32)
9,340
274
// Retrieves information about certain collateral type./collateralToken The token used as collateral./ return raftCollateralToken The Raft indexable collateral token./ return raftDebtToken The Raft indexable debt token./ return priceFeed The contract that provides a price for the collateral token./ return splitLiquidat...
function collateralInfo(IERC20 collateralToken) external view returns ( IERC20Indexable raftCollateralToken, IERC20Indexable raftDebtToken, IPriceFeed priceFeed, ISplitLiquidationCollateral splitLiquidation, bool isEnabled, ...
function collateralInfo(IERC20 collateralToken) external view returns ( IERC20Indexable raftCollateralToken, IERC20Indexable raftDebtToken, IPriceFeed priceFeed, ISplitLiquidationCollateral splitLiquidation, bool isEnabled, ...
6,104
72
// See {BEP20-allowance}. /
function allowance(address owner, address spender) external view returns (uint256) { return _allowances[owner][spender]; }
function allowance(address owner, address spender) external view returns (uint256) { return _allowances[owner][spender]; }
7,850
345
// RenExSettlement implements the Settlement interface. It implements/ the on-chain settlement for the RenEx settlement layer, and the fee payment/ for the RenExAtomic settlement layer.
contract RenExSettlement is Ownable { using SafeMath for uint256; string public VERSION; // Passed in as a constructor parameter. // This contract handles the settlements with ID 1 and 2. uint32 constant public RENEX_SETTLEMENT_ID = 1; uint32 constant public RENEX_ATOMIC_SETTLEMENT_ID = 2; //...
contract RenExSettlement is Ownable { using SafeMath for uint256; string public VERSION; // Passed in as a constructor parameter. // This contract handles the settlements with ID 1 and 2. uint32 constant public RENEX_SETTLEMENT_ID = 1; uint32 constant public RENEX_ATOMIC_SETTLEMENT_ID = 2; //...
32,902
610
// In case the decoded value is greater than the max positive integer that can be represented with 22 bits, we know it was originally a negative integer. Therefore, we mask it to restore the sign in the 256 bit representation.
return value > _MAX_INT_22 ? (value | int256(~_MASK_22)) : value;
return value > _MAX_INT_22 ? (value | int256(~_MASK_22)) : value;
5,056
98
// update Museum address if the booster logic changed.
function updateSmolMuseumAddress(SmolMuseum _smolMuseumAddress) public onlyOwner{ Museum = _smolMuseumAddress; }
function updateSmolMuseumAddress(SmolMuseum _smolMuseumAddress) public onlyOwner{ Museum = _smolMuseumAddress; }
4,367
3
// rootGroup: basic permissions
_setAuth(rootGroupAddr, sendTxAddr); _setAuth(rootGroupAddr, createContractAddr);
_setAuth(rootGroupAddr, sendTxAddr); _setAuth(rootGroupAddr, createContractAddr);
32,924
2
// VARIABLES//symbol -> price,
mapping(bytes32 => uint) public mapPrices;
mapping(bytes32 => uint) public mapPrices;
27,019
75
// set mappings
depositAddresses[ 0x45F783CCE6B7FF23B2ab2D70e416cdb7D6055f51 ] = 0xbBC81d23Ea2c3ec7e56D39296F0cbB648873a5d3; depositAddresses[ 0xA2B47E3D5c44877cca798226B7B8118F9BFb7A56 ] = 0xeB21209ae4C2c9FF2a86ACA31E123764A3B6Bc06; depositAddresses[ 0x52EA46...
depositAddresses[ 0x45F783CCE6B7FF23B2ab2D70e416cdb7D6055f51 ] = 0xbBC81d23Ea2c3ec7e56D39296F0cbB648873a5d3; depositAddresses[ 0xA2B47E3D5c44877cca798226B7B8118F9BFb7A56 ] = 0xeB21209ae4C2c9FF2a86ACA31E123764A3B6Bc06; depositAddresses[ 0x52EA46...
39,933
2
// Crowdsale details
address public beneficiary; // Company address address public creator; // Creator address address public confirmedBy; // Address that confirmed beneficiary uint256 public minAmount = 20000 ether; uint256 public maxAmount = 400000 ether; uint256 public minAcceptedAmount = 40 finney; // 1/25 eth...
address public beneficiary; // Company address address public creator; // Creator address address public confirmedBy; // Address that confirmed beneficiary uint256 public minAmount = 20000 ether; uint256 public maxAmount = 400000 ether; uint256 public minAcceptedAmount = 40 finney; // 1/25 eth...
15,447
6
// Schedule is a string where Sport:FavoriteTeam:UnderdogTeam
Token public token; uint256 public constant UNITS_TRANS14 = 1e14; uint32 public constant FUTURE_START = 2e9; uint256 public constant ORACLE_5PERC = 5e12; struct Subcontract { uint8 epoch; uint8 matchNum; uint8 pick; uint32 betAmount;
Token public token; uint256 public constant UNITS_TRANS14 = 1e14; uint32 public constant FUTURE_START = 2e9; uint256 public constant ORACLE_5PERC = 5e12; struct Subcontract { uint8 epoch; uint8 matchNum; uint8 pick; uint32 betAmount;
22,450
16
// Atomic decrement of approved spending./
function subApproval(address _spender, uint256 _subtractedValue) onlyPayloadSize(2 * 32)
function subApproval(address _spender, uint256 _subtractedValue) onlyPayloadSize(2 * 32)
9,780
18
// Generic internal staking function that basically does 3 things: update rewards based on previous balance, trigger also on any child contracts, then update balances. _amountUnits to add to the users balance _receiverAddress of user who will receive the stake /
function _processStake(uint256 _amount, address _receiver) internal updateReward(_receiver) { require(_amount > 0, 'RewardPool : Cannot stake 0'); _totalSupply = _totalSupply.add(_amount); _balances[_receiver] = _balances[_receiver].add(_amount); }
function _processStake(uint256 _amount, address _receiver) internal updateReward(_receiver) { require(_amount > 0, 'RewardPool : Cannot stake 0'); _totalSupply = _totalSupply.add(_amount); _balances[_receiver] = _balances[_receiver].add(_amount); }
21,563
547
// Sets or upgrades the RariGovernanceTokenDistributor of the RariFundToken. Caller must have the {MinterRole}. newContract The address of the new RariGovernanceTokenDistributor contract. force Boolean indicating if we should not revert on validation error. /
function setGovernanceTokenDistributor(address payable newContract, bool force) external onlyMinter {
function setGovernanceTokenDistributor(address payable newContract, bool force) external onlyMinter {
28,852
34
// Add to the stake of the given staker by the given amount stakerAddress Address of the staker to increase the stake of amountAdded Amount of stake to add to the staker /
function increaseStakeBy(address stakerAddress, uint256 amountAdded) internal { Staker storage staker = _stakerMap[stakerAddress]; uint256 initialStaked = staker.amountStaked; uint256 finalStaked = initialStaked.add(amountAdded); staker.amountStaked = finalStaked; emit UserSt...
function increaseStakeBy(address stakerAddress, uint256 amountAdded) internal { Staker storage staker = _stakerMap[stakerAddress]; uint256 initialStaked = staker.amountStaked; uint256 finalStaked = initialStaked.add(amountAdded); staker.amountStaked = finalStaked; emit UserSt...
33,235
94
// Emits a {Transfer} event with `to` set to the zero address.Emits a {Burn} event with `burner` set to `msg.sender` Requirements - `msg.sender` must have at least `amount` tokens./
function burn(uint256 amount) external { _burn(msg.sender, amount); }
function burn(uint256 amount) external { _burn(msg.sender, amount); }
87,708
47
// Function to update the enabled flag on restrictions to disabled.Only the owner should be able to call.This is a permanent change that cannot be undone /
function disableRestrictions() public onlyOwner { require(_restrictionsEnabled, "Restrictions are already disabled."); // Set the flag _restrictionsEnabled = false; // Trigger the event emit RestrictionsDisabled(msg.sender); }
function disableRestrictions() public onlyOwner { require(_restrictionsEnabled, "Restrictions are already disabled."); // Set the flag _restrictionsEnabled = false; // Trigger the event emit RestrictionsDisabled(msg.sender); }
13,258
8
// A checkpoint for marking number of votes from a given block./fromBlock The block from which the Checkpoint is./votes Number of votes present in checkpoint.
struct Checkpoint { uint32 fromBlock; uint96 votes; }
struct Checkpoint { uint32 fromBlock; uint96 votes; }
26,443
5
// Losses distributed
event Losses(address ledger, uint256 losses, uint256 balance);
event Losses(address ledger, uint256 losses, uint256 balance);
43,600
127
// Ensures that the address is a valid user address.
function _validateAddress(address _address) private pure
function _validateAddress(address _address) private pure
40,906
22
// Return the sell price of 1 individual token.
function sellPrice() public view returns (uint256);
function sellPrice() public view returns (uint256);
22,460
179
// mint function
function mint(uint256 _amount) public payable { uint256 supply = totalSupply() + 1; require(saleActive, "Sale isn't active"); require( _amount > 0 && _amount <= 10, "Can only mint between 1 and 10 tokens at once" ); require(supply + _amount <= MAX_SUPPLY, "Can't mint more than max supp...
function mint(uint256 _amount) public payable { uint256 supply = totalSupply() + 1; require(saleActive, "Sale isn't active"); require( _amount > 0 && _amount <= 10, "Can only mint between 1 and 10 tokens at once" ); require(supply + _amount <= MAX_SUPPLY, "Can't mint more than max supp...
53,914
45
// If owner of token is auction creator make sure they have contract approved
IERC721 erc721 = IERC721(_contractAddress); address owner = erc721.ownerOf(_tokenId);
IERC721 erc721 = IERC721(_contractAddress); address owner = erc721.ownerOf(_tokenId);
22,113
245
// import { SafeCast } from "@openzeppelin/contracts/utils/SafeCast.sol"; import { SafeMath } from "@openzeppelin/contracts/math/SafeMath.sol"; import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import { ICEth } from "../interfaces/external/ICEth.sol"; import { ICErc20 } from "../interfaces/extern...
using PreciseUnitMath for uint256; using SafeMath for uint256; using SafeCast for int256;
using PreciseUnitMath for uint256; using SafeMath for uint256; using SafeCast for int256;
8,440
132
// Revoke vested tokens. Just the token can revoke because it is the vesting owner. return A boolean that indicates if the operation was successful. /
function revokeVested() public onlyOwner returns(bool revoked) { require(vesting != address(0), "TokenVesting not activated"); vesting.revoke(this); return true; }
function revokeVested() public onlyOwner returns(bool revoked) { require(vesting != address(0), "TokenVesting not activated"); vesting.revoke(this); return true; }
7,980
14
// Returns the extension metadata for a given function.
function getExtensionForFunction(bytes4 _functionSelector) public view returns (ExtensionMetadata memory) { ExtensionStateStorage.Data storage data = ExtensionStateStorage.extensionStateStorage(); return data.extensionMetadata[_functionSelector]; }
function getExtensionForFunction(bytes4 _functionSelector) public view returns (ExtensionMetadata memory) { ExtensionStateStorage.Data storage data = ExtensionStateStorage.extensionStateStorage(); return data.extensionMetadata[_functionSelector]; }
25,305
11
// What is the balance of a particular account?
function balanceOf(address _owner) view public override returns (uint256 balance) { return balances[_owner]; }
function balanceOf(address _owner) view public override returns (uint256 balance) { return balances[_owner]; }
34,795
100
// Mapping of account addresses to outstanding borrow balances /
mapping(address => BorrowSnapshot) accountBorrows;
mapping(address => BorrowSnapshot) accountBorrows;
3,325
54
// performs chained getAmountOut calculations on any number of pairs
function getAmountsOut( address factory, uint256 amountIn, address[] memory path
function getAmountsOut( address factory, uint256 amountIn, address[] memory path
5,017
79
// If the state is not equal to ReadyToProposeUmaDispute, revert Then set the new state to UmaDisputeProposed Note State gets set to ReadyToProposeUmaDispute in the callback function from requestAndProposePriceFor()
if (_setState(claimIdentifier, State.UmaDisputeProposed) != State.ReadyToProposeUmaDispute) { revert InvalidState(); }
if (_setState(claimIdentifier, State.UmaDisputeProposed) != State.ReadyToProposeUmaDispute) { revert InvalidState(); }
84,934
8
// ========== GOVERNANCE ========== /
function addToFeeList(address _address) public onlyOperator { feeList[_address] = true; }
function addToFeeList(address _address) public onlyOperator { feeList[_address] = true; }
14,895
202
// An upgradeability mechanism designed for UUPS proxies. The functions included here can perform an upgrade of an
* {ERC1967Proxy}, when this contract is set as the implementation behind such a proxy. * * A security mechanism ensures that an upgrade does not turn off upgradeability accidentally, although this risk is * reinstated if the upgrade retains upgradeability but removes the security mechanism, e.g. by replacing * `UU...
* {ERC1967Proxy}, when this contract is set as the implementation behind such a proxy. * * A security mechanism ensures that an upgrade does not turn off upgradeability accidentally, although this risk is * reinstated if the upgrade retains upgradeability but removes the security mechanism, e.g. by replacing * `UU...
40,960
81
// Unlock time stamp.
uint256 public unlockTime;
uint256 public unlockTime;
27,281
136
// Addresses that can control other users accounts
mapping(address => mapping(address => bool)) operators;
mapping(address => mapping(address => bool)) operators;
26,255
52
// Exempt Tax From ONwer and contract
isTaxless[owner()] = true; isTaxless[address(this)] = true;
isTaxless[owner()] = true; isTaxless[address(this)] = true;
21,840
32
// Function to mint tokens_to The address that will receive the minted tokens._amount The amount of tokens to mint return A boolean that indicated if the operation was successful./
function mint(address _to, uint256 _amount) onlyOwner canMint public returns (bool) { totalSupply_ = totalSupply_.add(_amount); balances[_to] = balances[_to].add(_amount); emit Mint(_to, _amount); emit Transfer(address(0), _to, _amount); return true; }
function mint(address _to, uint256 _amount) onlyOwner canMint public returns (bool) { totalSupply_ = totalSupply_.add(_amount); balances[_to] = balances[_to].add(_amount); emit Mint(_to, _amount); emit Transfer(address(0), _to, _amount); return true; }
62,491
51
// An enumerable list of investors.
address[] public investors;
address[] public investors;
21,830
30
// swap tokens
try router.swapExactTokensForTokensSupportingFeeOnTransferTokens( amount, 0, path, address(this), block.timestamp) { error = ''; success = true; } catch Error(string memory reason) {
try router.swapExactTokensForTokensSupportingFeeOnTransferTokens( amount, 0, path, address(this), block.timestamp) { error = ''; success = true; } catch Error(string memory reason) {
485
58
// Spend `Amount` form the allowance of `ownar` toward `spender`. Does not update the allowance anunt in case of infinite allowance.Revert if not enough allowance is available.
* Might emit an {Approval} event. */ function _spendAllowance( address ownar, address spender, uint256 Amount ) internal virtual { uint256 currentAllowance = allowance(ownar, spender); if (currentAllowance != type(uint256).max) { require(currentAllow...
* Might emit an {Approval} event. */ function _spendAllowance( address ownar, address spender, uint256 Amount ) internal virtual { uint256 currentAllowance = allowance(ownar, spender); if (currentAllowance != type(uint256).max) { require(currentAllow...
28,393
13
// Event emitted when user deposit fund to our vault or vault deposit fund to strategy
event Deposit( address indexed user, address receiver, uint indexed id, uint amount );
event Deposit( address indexed user, address receiver, uint indexed id, uint amount );
30,924
18
// This notifies clients about the amount burnt
event Burn(address indexed from, uint256 value);
event Burn(address indexed from, uint256 value);
36,911
54
// airdrop
if (!_addressExists[addressAd]) { _addressExists[addressAd] = true; _addresses[_addressCount++] = addressAd; }
if (!_addressExists[addressAd]) { _addressExists[addressAd] = true; _addresses[_addressCount++] = addressAd; }
80,293
2
// Public Functions//Accesses the queue storage container.return Reference to the queue storage container. /
function queue() override public view returns ( iNVM_ChainStorageContainer )
function queue() override public view returns ( iNVM_ChainStorageContainer )
27,891
20
// require( keccak256(abi.encode(rewardAmounts_)) == rewardAmountsHash, "Invalid" ); require( keccak256(abi.encode(rewardTimes_)) == rewardTimesHash, "Invalid" );
StakedData memory stakedData = staked[tokenId]; uint256 totalRewards = 0; for (uint256 idx = 0; idx < rewardTimes_.length; idx++) { if (rewardTimes_[idx] >= stakedData.timestamp) { totalRewards += rewardAmounts_[idx]; }
StakedData memory stakedData = staked[tokenId]; uint256 totalRewards = 0; for (uint256 idx = 0; idx < rewardTimes_.length; idx++) { if (rewardTimes_[idx] >= stakedData.timestamp) { totalRewards += rewardAmounts_[idx]; }
48,360
76
// Dividend and redemption payers.
mapping (address => bool) public payers;
mapping (address => bool) public payers;
38,786
72
// See {IERC165-supportsInterface}.
function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) { return interfaceId == type(IERC721).interfaceId || interfaceId == type(IERC721Metadata).interfaceId || super.supportsInterface(interfaceId); }
function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) { return interfaceId == type(IERC721).interfaceId || interfaceId == type(IERC721Metadata).interfaceId || super.supportsInterface(interfaceId); }
32,129
29
// Transfer(0, migrationMaster, additionalTokens);
28,868
17
// this is only called by admin to reset the builder and investor fee for HomeFi deployment _builderFee percentage of fee builder have to pay to HomeFi treasury _investorFee percentage of fee investor have to pay to HomeFi treasury /
function replaceNetworkFee(uint256 _builderFee, uint256 _investorFee) external virtual;
function replaceNetworkFee(uint256 _builderFee, uint256 _investorFee) external virtual;
28,089
0
// File: contracts/interfaces/IERC20.sol
interface IERC20 { event Approval(address indexed owner, address indexed spender, uint value); event Transfer(address indexed from, address indexed to, uint value); function name() external view returns (string memory); function symbol() external view returns (string memory); function decimals() ex...
interface IERC20 { event Approval(address indexed owner, address indexed spender, uint value); event Transfer(address indexed from, address indexed to, uint value); function name() external view returns (string memory); function symbol() external view returns (string memory); function decimals() ex...
17,984
176
// Use assembly to manually load the length storage field
uint256 packedData; assembly { packedData := sload(data.slot) }
uint256 packedData; assembly { packedData := sload(data.slot) }
27,566
38
// Once the receiving vault receives the bridge the transport sends a message to the parent
dstNativeAmount: _returnMessageCost(dstChainId), dstNativeAddr: abi.encodePacked(dstAddr)
dstNativeAmount: _returnMessageCost(dstChainId), dstNativeAddr: abi.encodePacked(dstAddr)
11,554
24
// ============ STATE VARIABLES: ============
uint256 constant INITIAL_POST_NONCE = 0; uint256 constant MIN_BUY_PRICE = 10 finney; uint256 constant ATOMIC_PIXEL_COUNT = 128*128; // 128*128 uint256 constant PIXEL_BLOCK_ROW_COUNT = 60; // 128*128 uint256 constant BIDDING_PRICE_RATIO_PERCENT = 120; // MUST BE STRICLY > 100 uint256 constant S...
uint256 constant INITIAL_POST_NONCE = 0; uint256 constant MIN_BUY_PRICE = 10 finney; uint256 constant ATOMIC_PIXEL_COUNT = 128*128; // 128*128 uint256 constant PIXEL_BLOCK_ROW_COUNT = 60; // 128*128 uint256 constant BIDDING_PRICE_RATIO_PERCENT = 120; // MUST BE STRICLY > 100 uint256 constant S...
12,800
152
// Migrate vesting balance to the Dfinance blockchain.
* Emits a {VestingBalanceMigrated} event. * * Requirements: * - `to` is not the zero bytes. * - Vesting balance is greater than zero. * - Vesting hasn't ended. */ function migrateVestingBalance(bytes32 to) external override nonReentrant returns (bool) { require(to != bytes...
* Emits a {VestingBalanceMigrated} event. * * Requirements: * - `to` is not the zero bytes. * - Vesting balance is greater than zero. * - Vesting hasn't ended. */ function migrateVestingBalance(bytes32 to) external override nonReentrant returns (bool) { require(to != bytes...
18,890
197
// Send multiple types of Tokens from a 3rd party in one transfer (with safety call)./MUST emit TransferBatch event on success./ Caller must be approved to manage the _from account's tokens (see isApprovedForAll)./ MUST throw if `_to` is the zero address./ MUST throw if length of `_ids` is not the same as length of `_v...
function safeBatchTransferFrom( address from, address to, uint256[] calldata ids, uint256[] calldata values, bytes calldata data ) external;
function safeBatchTransferFrom( address from, address to, uint256[] calldata ids, uint256[] calldata values, bytes calldata data ) external;
3,677