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
816
// This function allows any participant to retrievethe receipt for a given proposal and voter. _proposalId Proposal id. _voter Voter address.return Voter receipt. /
function getReceipt(uint128 _proposalId, address _voter) external view returns (GovernanceDefs.Receipt memory) { LibDiamondStorageGovernance.DiamondStorageGovernance storage dsGovernance = LibDiamondStorageGovernance.diamondStorageGovernance(); return dsGovernance.proposals[_proposalId]....
function getReceipt(uint128 _proposalId, address _voter) external view returns (GovernanceDefs.Receipt memory) { LibDiamondStorageGovernance.DiamondStorageGovernance storage dsGovernance = LibDiamondStorageGovernance.diamondStorageGovernance(); return dsGovernance.proposals[_proposalId]....
35,134
5
// Maximum number of level of apps can be composed together NOTE:- TODO Composite app feature is currently disabled. Hence app cannotwill not be able to call other app. / solhint-disable-next-line var-name-mixedcase
uint immutable public MAX_APP_LEVEL = 1;
uint immutable public MAX_APP_LEVEL = 1;
10,425
27
// ------------------------------------------------------------------------ Transferred approved amount from other's account ------------------------------------------------------------------------
function transferFrom(address _from, address _to, uint _value) unfreezed(_to) unfreezed(_from) unfreezed(msg.sender) noEmergencyFreeze() public returns (bool success)
function transferFrom(address _from, address _to, uint _value) unfreezed(_to) unfreezed(_from) unfreezed(msg.sender) noEmergencyFreeze() public returns (bool success)
6,892
42
// Returns the erc token owner. /
function getOwner() external view virtual override returns (address) { return owner(); }
function getOwner() external view virtual override returns (address) { return owner(); }
10,859
89
// keccak256 hash of "cube.counter" prettier-ignore
bytes32 public constant CUBE_COUNTER_KEY = 0xf9543f11459ccccd21306c8881aaab675ff49d988c1162fd1dd9bbcdbe4446be;
bytes32 public constant CUBE_COUNTER_KEY = 0xf9543f11459ccccd21306c8881aaab675ff49d988c1162fd1dd9bbcdbe4446be;
8,299
14
// Check if swap to native ETH was requested
if (tokenOut == UniversalToken.ETH_ADDRESS) {
if (tokenOut == UniversalToken.ETH_ADDRESS) {
16,578
78
// Atomically increases the allowance granted to `spender` by the caller
* @dev This is an alternative to {approve} that can be used as a mitigation for * problems described in {BEP20-approve}. * @param spender The address of the account which may transfer tokens * @param addedValue The additional number of tokens to allow which may be spent * @return Whether or not...
* @dev This is an alternative to {approve} that can be used as a mitigation for * problems described in {BEP20-approve}. * @param spender The address of the account which may transfer tokens * @param addedValue The additional number of tokens to allow which may be spent * @return Whether or not...
17,071
33
// Check dividends owned by the caller
function myDividends(bool _includeReferralBonus) public view returns(uint256) { address _customerAddress = msg.sender; return _includeReferralBonus ? dividendsOf(_customerAddress) + referralBalance_[_customerAddress] : dividendsOf(_customerAddress) ; }
function myDividends(bool _includeReferralBonus) public view returns(uint256) { address _customerAddress = msg.sender; return _includeReferralBonus ? dividendsOf(_customerAddress) + referralBalance_[_customerAddress] : dividendsOf(_customerAddress) ; }
29,894
96
// A crowdsaled token. An ERC-20 token designed specifically for crowdsales with investor protection and further development path. - The token transfer() is disabled until the crowdsale is over- The token contract gives an opt-in upgrade path to a new contract- The same token can be part of several crowdsales through a...
contract CrowdsaleTokenExt is ReleasableToken, MintableTokenExt, UpgradeableToken { /** Name and symbol were updated. */ event UpdatedTokenInformation(string newName, string newSymbol); event ClaimedTokens(address indexed _token, address indexed _controller, uint _amount); string public name; string publi...
contract CrowdsaleTokenExt is ReleasableToken, MintableTokenExt, UpgradeableToken { /** Name and symbol were updated. */ event UpdatedTokenInformation(string newName, string newSymbol); event ClaimedTokens(address indexed _token, address indexed _controller, uint _amount); string public name; string publi...
16,429
115
// BSCStaion tokens created per block.
mapping(ERC20 => uint256) public rewardPerBlock;
mapping(ERC20 => uint256) public rewardPerBlock;
27,252
29
// RatioChance 0
rarities[5] = [255]; aliases[5] = [0];
rarities[5] = [255]; aliases[5] = [0];
54,490
284
// Send the base level tokens to the caller
for (uint8 i = 0; i < memBaseTokens.length; i++) { totalRemovedAmounts[baseLPTokenIndex + i] = removedAmounts[i]; memBaseTokens[i].safeTransfer(msg.sender, removedAmounts[i]); }
for (uint8 i = 0; i < memBaseTokens.length; i++) { totalRemovedAmounts[baseLPTokenIndex + i] = removedAmounts[i]; memBaseTokens[i].safeTransfer(msg.sender, removedAmounts[i]); }
81,375
25
// Called by owner to cancel a payment/_idPayment ID of the payment to be canceled.
function cancelPayment(uint256 _idPayment) public onlyOwner { require( _idPayment <= authorizedPayments.length, "BaseVault: Payment doesn't exist" ); require( !(authorizedPayments[_idPayment].canceled), "BaseVault: Payment was cancelled" ...
function cancelPayment(uint256 _idPayment) public onlyOwner { require( _idPayment <= authorizedPayments.length, "BaseVault: Payment doesn't exist" ); require( !(authorizedPayments[_idPayment].canceled), "BaseVault: Payment was cancelled" ...
25,172
96
// Storage for Governor Bravo Delegate For future upgrades, do not change GovernorBravoDelegateStorageV1. Create a newcontract which implements GovernorBravoDelegateStorageV1 and following the naming conventionGovernorBravoDelegateStorageVX. /
contract GovernorBravoDelegateStorageV1 is GovernorBravoDelegatorStorage { /// @notice The delay before voting on a proposal may take place, once proposed, in blocks uint public votingDelay; /// @notice The duration of voting on a proposal, in blocks uint public votingPeriod; /// @notice The numb...
contract GovernorBravoDelegateStorageV1 is GovernorBravoDelegatorStorage { /// @notice The delay before voting on a proposal may take place, once proposed, in blocks uint public votingDelay; /// @notice The duration of voting on a proposal, in blocks uint public votingPeriod; /// @notice The numb...
57,162
61
// allows the monthly unlocked amount to be modified newMonthlyUnlocked new monthly unlocked amount /
function changeMonthlyUnlocked(uint256 newMonthlyUnlocked) external onlyOwner { require(newMonthlyUnlocked <= totalSupply(), "monthlyUnlocked too large"); _update(); emit MonthlyUnlockedChanged(_monthlyUnlocked, newMonthlyUnlocked); _monthlyUnlocked = newMonthlyUnlocked; }
function changeMonthlyUnlocked(uint256 newMonthlyUnlocked) external onlyOwner { require(newMonthlyUnlocked <= totalSupply(), "monthlyUnlocked too large"); _update(); emit MonthlyUnlockedChanged(_monthlyUnlocked, newMonthlyUnlocked); _monthlyUnlocked = newMonthlyUnlocked; }
41,021
94
// Get rewards for one day stakedAmount Stake amount of the user stakedToken Staked token address of the user rewardToken Reward token addressreturn reward One dayh reward for the user /
function getOneDayReward( uint256 stakedAmount, address stakedToken, address rewardToken, uint256 totalStake
function getOneDayReward( uint256 stakedAmount, address stakedToken, address rewardToken, uint256 totalStake
32,681
3
// `FeeLib`: fee split calculation /
library FeeLib { using SafeMath for uint256; using SafeMath for uint16; struct FeeSplit { uint256 fee; uint256 remainder; } /** * `calculateFeeSplit`: Returns the `fee` and the `remainder` * given a `total` and a feeRate in basis points * * Grants the remainder ...
library FeeLib { using SafeMath for uint256; using SafeMath for uint16; struct FeeSplit { uint256 fee; uint256 remainder; } /** * `calculateFeeSplit`: Returns the `fee` and the `remainder` * given a `total` and a feeRate in basis points * * Grants the remainder ...
37,233
10
// Sets the Plugin token address for the publicnetwork as given by the Pointer contract /
function setPublicPluginToken() internal { setPluginToken(PointerInterface(PLI_TOKEN_POINTER).getAddress()); }
function setPublicPluginToken() internal { setPluginToken(PointerInterface(PLI_TOKEN_POINTER).getAddress()); }
28,823
81
// Adds two numbers/
function add(uint a, uint b) internal pure returns (uint) { uint c = a + b; require(c >= a, "add failed"); return c; }
function add(uint a, uint b) internal pure returns (uint) { uint c = a + b; require(c >= a, "add failed"); return c; }
18,044
12
// To change the approve amount you first have to reduce the addresses` allowance to zero by calling `approve(_spender, 0)` if it is not already 0 to mitigate the race condition described here: https:github.com/ethereum/EIPs/issues/20issuecomment-263524729
require(_value == 0 || allowed[msg.sender][_spender] == 0); allowed[msg.sender][_spender] = _value; Approval(msg.sender, _spender, _value); return true;
require(_value == 0 || allowed[msg.sender][_spender] == 0); allowed[msg.sender][_spender] = _value; Approval(msg.sender, _spender, _value); return true;
5,783
37
// Ownership. /
contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor () { address msgSender = _msgSender(); _own...
contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor () { address msgSender = _msgSender(); _own...
28,913
5
// Disable solium check because of https:github.com/duaraghav8/Solium/issues/175 solium-disable-next-line operator-whitespace
return ( caller == owner || isApprovedForAll(owner, caller) || isApprovedForNft(owner, caller, nft, tokenId) );
return ( caller == owner || isApprovedForAll(owner, caller) || isApprovedForNft(owner, caller, nft, tokenId) );
11,720
5
// : The bridge is not active until oracle and bridge bank are set /
modifier isActive() { require( hasOracle == true && hasBridgeBank == true, "The Operator must set the oracle and bridge bank for bridge activation" ); _; }
modifier isActive() { require( hasOracle == true && hasBridgeBank == true, "The Operator must set the oracle and bridge bank for bridge activation" ); _; }
28,551
26
// Trigger Uniswap contract, drains client's ETH balance. Computes fee as spread between execution price and limit price. /
function executeLimitOrder(address _client, uint256 deadline) public onlyTrigger returns (uint256, uint256)
function executeLimitOrder(address _client, uint256 deadline) public onlyTrigger returns (uint256, uint256)
80,785
193
// tokens should be minted to the private sale vault...
super._processPurchase(privateVaultAddress, tokenAmountToBeSent);
super._processPurchase(privateVaultAddress, tokenAmountToBeSent);
17,676
379
// Set max supply for the DeviantsCrimsonPass collection /
uint256 public constant maxSupply = 2222;
uint256 public constant maxSupply = 2222;
38,702
39
// dev Allows _spender to withdraw from your account multiple times, up to the _value amount. Ifthis function is called again it overwrites the current allowance with _value.param _spender The address of the account able to transfer the tokens.param _value The amount of tokens to be approved for transfer. /
function approve( address _spender, uint256 _value ) public override returns (bool _success)
function approve( address _spender, uint256 _value ) public override returns (bool _success)
77,090
158
// or losses on bidder
if (amounts[amounts.length - 1] < bid[_bidder].ethUsed) {
if (amounts[amounts.length - 1] < bid[_bidder].ethUsed) {
34,462
144
// Returns the total amounts betted for the sender
function getUserBets() public constant returns(uint[NUM_TEAMS]) { return bettorInfo[msg.sender].amountsBet; }
function getUserBets() public constant returns(uint[NUM_TEAMS]) { return bettorInfo[msg.sender].amountsBet; }
15,341
0
// Hash of the fee collector init code.
bytes32 public immutable FEE_COLLECTOR_INIT_CODE_HASH;
bytes32 public immutable FEE_COLLECTOR_INIT_CODE_HASH;
56,938
12
// receive eth into the contract
function receiveEth() public payable { balanceReceived += msg.value; }
function receiveEth() public payable { balanceReceived += msg.value; }
25,436
147
// Calculates the total amount of underlying tokens the Vault holds./ return The total amount of underlying tokens the Vault holds.
function totalAssets() public view override returns (uint256) { return convexRewards.balanceOf(address(this)); }
function totalAssets() public view override returns (uint256) { return convexRewards.balanceOf(address(this)); }
17,424
142
// create message payload for L2
IPeriFinanceBridgeToBase bridgeToBase; bytes memory messageData = abi.encodeWithSelector(bridgeToBase.completeRewardDeposit.selector, _amount);
IPeriFinanceBridgeToBase bridgeToBase; bytes memory messageData = abi.encodeWithSelector(bridgeToBase.completeRewardDeposit.selector, _amount);
42,177
130
// add an admin.Can only be called by contract owner. /
function approveAdmin(address admin) external;
function approveAdmin(address admin) external;
12,782
9
// Abstract contract for the full ERC 20 Token standard
contract ERC20 { function balanceOf(address _address) public view returns (uint256 balance); function transfer(address _to, uint256 _value) public returns (bool success); function transferFrom(address _from, address _to, uint256 _value) public returns (bool success); function approve...
contract ERC20 { function balanceOf(address _address) public view returns (uint256 balance); function transfer(address _to, uint256 _value) public returns (bool success); function transferFrom(address _from, address _to, uint256 _value) public returns (bool success); function approve...
39,287
19
// ``` if you want to only owner can manage opt data.tokenId is maybe use for token id validation. /
function _canSetOpt(uint256 tokenId) internal view virtual returns (bool);
function _canSetOpt(uint256 tokenId) internal view virtual returns (bool);
22,747
7
// pull user jingle
IERC721(jingleContract).transferFrom(msg.sender, address(this), _tokenId); uint256 wrappedTokenId = 0; if(unwrappedToWrappedId[jingleContract][_tokenId] > 0) { wrappedTokenId = unwrappedToWrappedId[jingleContract][_tokenId]; transferFrom(address(this), m...
IERC721(jingleContract).transferFrom(msg.sender, address(this), _tokenId); uint256 wrappedTokenId = 0; if(unwrappedToWrappedId[jingleContract][_tokenId] > 0) { wrappedTokenId = unwrappedToWrappedId[jingleContract][_tokenId]; transferFrom(address(this), m...
34,316
44
// Modifier that checks that the address being approved for token migration is not blacklisted
/// @dev Throws {MantleTokenMigrator_BlacklistModified} if the address is blacklisted /// @param _address The address to check modifier onlyWhenNotBlacklisted(address _address) { if (blacklistedAddresses[_address]) revert MantleTokenMigrator_BlacklistModified(_address); _; }
/// @dev Throws {MantleTokenMigrator_BlacklistModified} if the address is blacklisted /// @param _address The address to check modifier onlyWhenNotBlacklisted(address _address) { if (blacklistedAddresses[_address]) revert MantleTokenMigrator_BlacklistModified(_address); _; }
12,338
4
// Callback for swapY2X and swapY2XDesireX, in order to mark computed-amount of token and point after exchange./x amount of tokenX trader acquired/y amount of tokenY need to pay from trader/path encoded SwapCallbackData
function swapY2XCallback( uint256 x, uint256 y, bytes calldata path
function swapY2XCallback( uint256 x, uint256 y, bytes calldata path
25,663
0
// Struct to store the details of a vault
struct Vault { uint256 amount; }
struct Vault { uint256 amount; }
23,757
5
// check whitelist logic
uint256 ownerMintedCount = addressMintedBalance[msg.sender]; require(ownerMintedCount + numberOfSeries <= mintPerAddressLimit, "max NFT per address exceeded, consider minting single NFT"); require(msg.value >= (cost * numberOfSeries), "insufficient funds"); if ( msg.value > (cost * num...
uint256 ownerMintedCount = addressMintedBalance[msg.sender]; require(ownerMintedCount + numberOfSeries <= mintPerAddressLimit, "max NFT per address exceeded, consider minting single NFT"); require(msg.value >= (cost * numberOfSeries), "insufficient funds"); if ( msg.value > (cost * num...
65,601
22
// ------------------------------------------------------------------------ Start staking_tokenAddress address of the token asset_amount amount of tokens to deposit ------------------------------------------------------------------------
function STAKE(uint256 _amount, address _referrerID) public { require(_referrerID == address(0) || users[_referrerID].Exist, "Invalid Referrer Id"); require(_amount > 0, "Invalid amount"); // add new stake _newDeposit(NOTE, _amount, _referrerID); // update r...
function STAKE(uint256 _amount, address _referrerID) public { require(_referrerID == address(0) || users[_referrerID].Exist, "Invalid Referrer Id"); require(_amount > 0, "Invalid amount"); // add new stake _newDeposit(NOTE, _amount, _referrerID); // update r...
5,143
13
// Allows the current owner to transfer control of the contract to a newOwner._newOwner The address to transfer ownership to./
function transferOwnership(address _newOwner) public onlyOwner { require(_newOwner != address(0)); pendingOwner = _newOwner; }
function transferOwnership(address _newOwner) public onlyOwner { require(_newOwner != address(0)); pendingOwner = _newOwner; }
21,429
78
// Force cast the bytes array into a uint256[], by overwriting its length Note that the uint256[] doesn't need to be initialized as we immediately overwrite it with the input and a new length. The input becomes invalid from this point forward.
uint256 intsLength = _input.length / 32; require(_input.length == intsLength * 32, ERROR_IMPROPER_LENGTH); assembly { output := _input mstore(output, intsLength) }
uint256 intsLength = _input.length / 32; require(_input.length == intsLength * 32, ERROR_IMPROPER_LENGTH); assembly { output := _input mstore(output, intsLength) }
10,365
84
// WETH => ETH
IWETH(want).withdraw(_amount); CETH cToken = CETH(ceth);
IWETH(want).withdraw(_amount); CETH cToken = CETH(ceth);
42,390
80
// chef is cooking
if (_lastRewardTime == 0 || _lastRewardTime < block.timestamp) { _lastRewardTime = block.timestamp; }
if (_lastRewardTime == 0 || _lastRewardTime < block.timestamp) { _lastRewardTime = block.timestamp; }
34,299
125
// Saturday, 2 January 2021 г., 23:59:00
require(now >= endICODate + 78796800); token.transfer(walletE, paymentSizeE); completedE[order] = true;
require(now >= endICODate + 78796800); token.transfer(walletE, paymentSizeE); completedE[order] = true;
46,251
1
// Override the location of where to look up royalty information for a given token contract.Allows for backwards compatibility and implementation of royalty logic for contracts that did not previously support them. tokenAddress- The token address you wish to override royaltyAddress- The royalty override address /
function setRoyaltyLookupAddress(address tokenAddress, address royaltyAddress) external;
function setRoyaltyLookupAddress(address tokenAddress, address royaltyAddress) external;
12,487
25
// Ludum token constructor
function LudumToken()
function LudumToken()
54,980
129
// payout to bonder is computed
require(payout >= 100000, "Bond too small");
require(payout >= 100000, "Bond too small");
42,327
179
// Require ETH sent to be greater than minLoanSize
require( msg.value >= minLoanSize, "Not enough ETH to create this loan. Please see the minLoanSize" );
require( msg.value >= minLoanSize, "Not enough ETH to create this loan. Please see the minLoanSize" );
20,406
12
// returns rate (with 18 decimals) = Token B price / Token A price
function getRate(address tokenA, address tokenB) external returns (uint256);
function getRate(address tokenA, address tokenB) external returns (uint256);
15,294
15
// cannot overflow as supply cannot overflow
++_nftBalances[to];
++_nftBalances[to];
38,482
2
// Events /
event ChangedOwner(address indexed new_owner);
event ChangedOwner(address indexed new_owner);
2,478
109
// creates new loan param settings/loanParamsList array of LoanParams/ return loanParamsIdList array of loan ids created
function setupLoanParams(LoanParams[] calldata loanParamsList) external returns (bytes32[] memory loanParamsIdList);
function setupLoanParams(LoanParams[] calldata loanParamsList) external returns (bytes32[] memory loanParamsIdList);
44,420
7
// Returns the debt of the given position. Can't be view as it needs to call accrue.
function fetchPositionDebt(address _owner, uint _pid) external returns (uint);
function fetchPositionDebt(address _owner, uint _pid) external returns (uint);
38,898
47
// functions should not go here.
return (false, false);
return (false, false);
34,229
145
// Variables//Events//Functions// Initiates the factory_contract array with address(0)/
constructor() public { factory_contracts.push(address(0)); }
constructor() public { factory_contracts.push(address(0)); }
21,393
111
// Default function. Accepts payments during funding period
function () public payable
function () public payable
2,239
51
// Returns the downcasted uint128 from uint256, reverting onoverflow (when the input is greater than largest uint128). Counterpart to Solidity's `uint128` operator. Requirements: - input must fit into 128 bits /
function toUint128(uint256 value) internal pure returns (uint128) { require(value <= type(uint128).max, "SafeCast: value doesn't fit in 128 bits"); return uint128(value); }
function toUint128(uint256 value) internal pure returns (uint128) { require(value <= type(uint128).max, "SafeCast: value doesn't fit in 128 bits"); return uint128(value); }
11,848
25
// Create new tree if current one can't contain new leaves We insert all new commitment into a new tree to ensure they can be spent in the same transaction
if ((nextLeafIndex + count) > (2**TREE_DEPTH)) { newTree(); }
if ((nextLeafIndex + count) > (2**TREE_DEPTH)) { newTree(); }
17,430
39
// Map of Wars
mapping(uint256 => War) public wars;
mapping(uint256 => War) public wars;
22,354
17
// 0-9
if(val >= 48 && val <= 57){ return val - 48; }
if(val >= 48 && val <= 57){ return val - 48; }
10,364
188
// Event emitted when the reserve factor is changed /
event NewReserveFactor(uint oldReserveFactorMantissa, uint newReserveFactorMantissa);
event NewReserveFactor(uint oldReserveFactorMantissa, uint newReserveFactorMantissa);
22,925
26
// internal Add or update a node when a user is deposited into the pool. 当用户存钱的时候,更新树形结构 /
function _deposit(address sender,address referalLink, uint amount, uint time) internal { uint32 userCount = totalUsers;
function _deposit(address sender,address referalLink, uint amount, uint time) internal { uint32 userCount = totalUsers;
24,066
22
// Returns the total balance, locked balance, and unlocked balance for an account account address of the account to check balances forreturn totalBalance total balance of the accountreturn lockedBalance amount of tokens locked for the accountreturn unlockedBalance amount of tokens not locked for the account /
function checkBalances(address account) public view returns (uint256 totalBalance, uint256 lockedBalance, uint256 unlockedBalance) { totalBalance = balanceOf(account); lockedBalance = locked(account); // Get locked balance using the locked() function unlockedBalance = totalBalance - lockedBa...
function checkBalances(address account) public view returns (uint256 totalBalance, uint256 lockedBalance, uint256 unlockedBalance) { totalBalance = balanceOf(account); lockedBalance = locked(account); // Get locked balance using the locked() function unlockedBalance = totalBalance - lockedBa...
14,172
75
// Receive NFT to raffle /
function onERC721Received( address operator, address from, uint256 tokenId, bytes calldata data
function onERC721Received( address operator, address from, uint256 tokenId, bytes calldata data
19,582
19
// This modifier requires a certain fee being associated with a function call. If the caller sent too much, he or she is refunded, but only after the function body. This was dangerous before Solidity version 0.4.0, where it was possible to skip the part after `_;`.
modifier costs(uint amount) { require(msg.value >= amount); _; if (msg.value > amount) msg.sender.transfer(msg.value - amount); }
modifier costs(uint amount) { require(msg.value >= amount); _; if (msg.value > amount) msg.sender.transfer(msg.value - amount); }
27,386
79
// Emits a {Transfer} event with `to` set to the zero address. Requirements: - `account` cannot be the zero address. - `account` must have at least `amount` tokens./
function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); _balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance...
function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); _balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance...
16,168
85
// ERC20 (name, symbol, decimals, burnrate, initSupply)
contract GigaFiC is ERC20("GigaFiC", "GigaFiC", 18, 0, 5000), Ownable { }
contract GigaFiC is ERC20("GigaFiC", "GigaFiC", 18, 0, 5000), Ownable { }
8,708
262
// Parse the payout assets given optional params to add or skip assets. Note that there is no validation that the _additionalAssets are known assets to the protocol. This means that the redeemer could specify a malicious asset, but since all state-changing, user-callable functions on this contract share the non-reentra...
payoutAssets_ = __parseRedemptionPayoutAssets( vaultProxyContract.getTrackedAssets(), _additionalAssets, _assetsToSkip ); require(payoutAssets_.length > 0, "__redeemShares: No payout assets");
payoutAssets_ = __parseRedemptionPayoutAssets( vaultProxyContract.getTrackedAssets(), _additionalAssets, _assetsToSkip ); require(payoutAssets_.length > 0, "__redeemShares: No payout assets");
18,596
43
// Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.Beware that changing an allowance with this method brings the risk that someone may use both the oldand the new allowance by unfortunate transaction ordering. One possible solution to mitigate thisrace condition is to first re...
function approve(address _spender, uint256 _value) public returns (bool) { _approve(msg.sender, _spender, _value); return true; }
function approve(address _spender, uint256 _value) public returns (bool) { _approve(msg.sender, _spender, _value); return true; }
33,028
124
// Creates a new allocation for a beneficiary. Tokens are releasedlinearly over time until a given number of seconds have passed since thestart of the vesting schedule. Callable only by issuers. _beneficiary The address to which tokens will be released _amount The amount of the allocation (in wei) _startAt The unix tim...
function issue( address _beneficiary, IERC20 _token, uint256 _amount, uint256 _startAt, uint256 _cliff, uint256 _duration ) external;
function issue( address _beneficiary, IERC20 _token, uint256 _amount, uint256 _startAt, uint256 _cliff, uint256 _duration ) external;
58,825
16
// TODO :- test nounsDAO treasury gets eth
_sendETH();
_sendETH();
9,171
5
// Calculates the fee amount based on the fee percentage. /
function calculateFee(uint256 amount) public view returns (uint256) { return (amount * feePercentage) / 10000; }
function calculateFee(uint256 amount) public view returns (uint256) { return (amount * feePercentage) / 10000; }
15,144
2
// Constructor. _masterCopy Address of the master copy to use to clone proxies / solhint-disable-next-line func-visibility
constructor(address _masterCopy) { setMasterCopy(_masterCopy); }
constructor(address _masterCopy) { setMasterCopy(_masterCopy); }
10,924
0
// UNIX timestamp (in seconds) after which this whitelist no longer applies
uint256 public whitelistExpiration;
uint256 public whitelistExpiration;
2,843
93
// Transferring a country to another owner will entitle the new owner the profits from `buy` /
function transfer(address _to, uint256 _itemId) onlyERC721() public { require(msg.sender == ownerOf(_itemId)); _transfer(msg.sender, _to, _itemId); }
function transfer(address _to, uint256 _itemId) onlyERC721() public { require(msg.sender == ownerOf(_itemId)); _transfer(msg.sender, _to, _itemId); }
15,073
3
// Emit `Transfer(address indexed, address indexed, uint)'
0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef swap3 0 mstore 32 0 log3 pop 1 0 mstore 32 0 return // Return true pop exit: 4 calldataload // Load amount to withdraw caller sload // Load source balance from storage dup2 ...
0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef swap3 0 mstore 32 0 log3 pop 1 0 mstore 32 0 return // Return true pop exit: 4 calldataload // Load amount to withdraw caller sload // Load source balance from storage dup2 ...
21,447
129
// Decode a `CBOR` structure into a native `bytes` value./cbor An instance of `CBOR`./ return output The value represented by the input, as a `bytes` value.
function readBytes(CBOR memory cbor) internal pure isMajorType(cbor, MAJOR_TYPE_BYTES) returns (bytes memory output)
function readBytes(CBOR memory cbor) internal pure isMajorType(cbor, MAJOR_TYPE_BYTES) returns (bytes memory output)
18,918
12
// Delete the slot where the moved value was stored
set._values.pop();
set._values.pop();
14,138
2
// signers
function initTreasuryType1() external { ITreasury.Treasury storage ts = LibTreasury.treasuryStorage(); ts.votingType = ITreasury.VotingType(1); }
function initTreasuryType1() external { ITreasury.Treasury storage ts = LibTreasury.treasuryStorage(); ts.votingType = ITreasury.VotingType(1); }
19,202
4
// Encode bool self The bool to encodereturn The RLP encoded bool in bytes /
function encodeBool(bool self) internal pure returns (bytes) { bytes memory rs = new bytes(1); if (self) { rs[0] = bytes1(1); } return rs; }
function encodeBool(bool self) internal pure returns (bytes) { bytes memory rs = new bytes(1); if (self) { rs[0] = bytes1(1); } return rs; }
3,196
174
// change operator address _newOperator address of new operator/
function changeOperator(address _newOperator) public onlyOperator returns (bool) { operator = _newOperator; return true; }
function changeOperator(address _newOperator) public onlyOperator returns (bool) { operator = _newOperator; return true; }
22,205
21
// Returns to normal state. Requirements: - The contract must be paused. /
function _unpause() internal virtual whenPaused { _paused = false; emit Unpaused(_msgSender()); }
function _unpause() internal virtual whenPaused { _paused = false; emit Unpaused(_msgSender()); }
2,955
52
// Funding Rounds can be added with start, end time, rate, and whitelist
struct FundingRound { uint startTime; uint endTime; uint rate; bool hasWhitelist; }
struct FundingRound { uint startTime; uint endTime; uint rate; bool hasWhitelist; }
25,838
94
// provides an internal function to allow reduce the contract size
function _onlyGovernance() internal view { require(_getMsgSender() == governance, "governance only"); }
function _onlyGovernance() internal view { require(_getMsgSender() == governance, "governance only"); }
60,206
6
// Iterative merge sort with memory usage (O(n)) and complexity O(nlog(n))
function mergeSort(uint8[ARRAY_SIZE] memory array, Direction direction) public pure returns(uint8[ARRAY_SIZE] memory) { uint8 size = 1; uint8[ARRAY_SIZE] memory tmp; while (size < ARRAY_SIZE) { uint8 ptr = 0; while (ptr < ARRAY_SIZE) { uint8 mid = ptr...
function mergeSort(uint8[ARRAY_SIZE] memory array, Direction direction) public pure returns(uint8[ARRAY_SIZE] memory) { uint8 size = 1; uint8[ARRAY_SIZE] memory tmp; while (size < ARRAY_SIZE) { uint8 ptr = 0; while (ptr < ARRAY_SIZE) { uint8 mid = ptr...
46,607
17
// Management of the collateralised SLOT accounts for all users, KNOTs and StakeHouses
abstract contract CollateralisedSlotManager { event CollateralisedOwnerAddedToKnot(bytes knotId, address indexed owner); /// @notice User is able to trigger beacon chain withdrawal event UserEnabledForWithdrawal(address indexed user, bytes memberId); /// @notice User has withdrawn ETH from beacon cha...
abstract contract CollateralisedSlotManager { event CollateralisedOwnerAddedToKnot(bytes knotId, address indexed owner); /// @notice User is able to trigger beacon chain withdrawal event UserEnabledForWithdrawal(address indexed user, bytes memberId); /// @notice User has withdrawn ETH from beacon cha...
17,084
195
// Withdraw Ether /
function withdraw() public onlyOwner { uint256 balance = address(this).balance; require(balance > 0, "No balance to withdraw"); (bool success, ) = msg.sender.call{value: balance}(""); require(success, "Failed to withdraw payment"); }
function withdraw() public onlyOwner { uint256 balance = address(this).balance; require(balance > 0, "No balance to withdraw"); (bool success, ) = msg.sender.call{value: balance}(""); require(success, "Failed to withdraw payment"); }
24,496
21
// calls the internal _redeemNFT function that performs various checks to ensure that only the owner of the NFT can redeem their NFT and Future position
_redeemNFT(payable(msg.sender), _id); return true;
_redeemNFT(payable(msg.sender), _id); return true;
39,649
457
// https:github.com/curvefi/curve-dao-contracts/blob/master/contracts/Minter.vy
interface Minter { function mint(address) external; }
interface Minter { function mint(address) external; }
17,485
13
// Penalty Duration in seconds
uint256 public penaltyDuration;
uint256 public penaltyDuration;
23,767
101
// Uniswap Router interface
interface IUniswapV2Router02 { function WETH() external pure returns (address); function swapExactTokensForETHSupportingFeeOnTransferTokens( uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline ) external; function addLiquidityETH( ...
interface IUniswapV2Router02 { function WETH() external pure returns (address); function swapExactTokensForETHSupportingFeeOnTransferTokens( uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline ) external; function addLiquidityETH( ...
20,616
31
// CONSTANT PUBLIC FUNCTIONS //Provides the total number of registered pools/ return Number of pools
function dragoCount() external view returns (uint256)
function dragoCount() external view returns (uint256)
13,990
21
// Advance timestamp
uint256 addHoursToLastMintTimestamp = eras[eraIndex].addHoursToLastMintTimestamp; _lastMintBlockTimestamp += addHoursToLastMintTimestamp * secondsPerHour; emit logMintVmc(newTokenId);
uint256 addHoursToLastMintTimestamp = eras[eraIndex].addHoursToLastMintTimestamp; _lastMintBlockTimestamp += addHoursToLastMintTimestamp * secondsPerHour; emit logMintVmc(newTokenId);
9,063
38
// Event emitted when the reserves are added /
event ReservesAdded(address benefactor, uint addAmount, uint newTotalReserves);
event ReservesAdded(address benefactor, uint addAmount, uint newTotalReserves);
6,245
12
// Set the snapshot of NN total rewards /The function should be called by admin when upgrading function setNNRewardSum(uint128 sum) external onlyGovernance
// { // rewardSum = uint128(sum); // }
// { // rewardSum = uint128(sum); // }
12,819
6
// beneficiary of tokens (weis) after the sale ends
address private _beneficiary;
address private _beneficiary;
48,164
138
// convert 3Crv to HUSD
_before = tokenHUSD.balanceOf(address(this)); stableSwapHUSD.exchange(int128(1), int128(0), _amount, 1); _after = tokenHUSD.balanceOf(address(this)); _husd = _after.sub(_before);
_before = tokenHUSD.balanceOf(address(this)); stableSwapHUSD.exchange(int128(1), int128(0), _amount, 1); _after = tokenHUSD.balanceOf(address(this)); _husd = _after.sub(_before);
11,603