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
402
// The Vault only requires the token list to be ordered for the Two Token Pools specialization. However, to make the developer experience consistent, we are requiring this condition for all the native pools. Also, since these Pools will register tokens only once, we can ensure the Pool tokens will follow the same order...
InputHelpers.ensureArrayIsSorted(tokens); _setSwapFeePercentage(swapFeePercentage); bytes32 poolId = vault.registerPool(specialization); vault.registerTokens(poolId, tokens, assetManagers);
InputHelpers.ensureArrayIsSorted(tokens); _setSwapFeePercentage(swapFeePercentage); bytes32 poolId = vault.registerPool(specialization); vault.registerTokens(poolId, tokens, assetManagers);
5,734
11
// 0-b. Pay out to Treasury
uint256 treasuryReward = newSupply.mul(Constants.getTreasuryRatio()).div(100); mintToTreasury(treasuryReward);
uint256 treasuryReward = newSupply.mul(Constants.getTreasuryRatio()).div(100); mintToTreasury(treasuryReward);
5,915
19
// Sanity check the pool we're delegating to exists.
_assertStakingPoolExists(poolId); _withdrawAndSyncDelegatorRewards( poolId, staker );
_assertStakingPoolExists(poolId); _withdrawAndSyncDelegatorRewards( poolId, staker );
24,884
553
// Reads the uint136 at `mPtr` in memory.
function readUint136( MemoryPointer mPtr
function readUint136( MemoryPointer mPtr
19,855
40
// --------------------------------------------
function depositInterest(uint256 _amount) external; // V1 & V2 function depositSavings(uint256 _amount) external returns (uint256 creditsIssued); // V1 & V2 function depositSavings(uint256 _amount, address _beneficiary) external returns (uint256 creditsIssued); // V2 function redeemC...
function depositInterest(uint256 _amount) external; // V1 & V2 function depositSavings(uint256 _amount) external returns (uint256 creditsIssued); // V1 & V2 function depositSavings(uint256 _amount, address _beneficiary) external returns (uint256 creditsIssued); // V2 function redeemC...
29,603
205
// _transfer, _mint and _burn are the only functions where the balances are modified, so it is there that the snapshots are updated. Note that the update happens _before_ the balance change, with the pre-modified value. The same is true for the total supply and _mint and _burn.
function _transfer( address from, address to, uint256 value
function _transfer( address from, address to, uint256 value
16,442
7
// Integer division of two signed integers truncating the quotient, reverts on division by zero./
function div(int256 a, int256 b) internal pure returns (int256) { require(b != 0); // Solidity only automatically asserts when dividing by 0 require(!(b == -1 && a == INT256_MIN)); // This is the only case of overflow int256 c = a / b; return c; }
function div(int256 a, int256 b) internal pure returns (int256) { require(b != 0); // Solidity only automatically asserts when dividing by 0 require(!(b == -1 && a == INT256_MIN)); // This is the only case of overflow int256 c = a / b; return c; }
1,415
30
// Calculate the total fees accrued/We consider fees any amount of underlying that is not accounted for in the epoch balance & queues
function feesAccrued() public view returns (uint256) { return poolToken.balanceOf(address(this)) - epochBalance() - underlyingInQueues(); }
function feesAccrued() public view returns (uint256) { return poolToken.balanceOf(address(this)) - epochBalance() - underlyingInQueues(); }
10,765
8
// Throws if the sender not is Master Address from InstaIndex or owner/
modifier isOwner { require(_msgSender() == IndexInterface(instaIndex).master() || owner() == _msgSender(), "caller is not the owner or master"); _; }
modifier isOwner { require(_msgSender() == IndexInterface(instaIndex).master() || owner() == _msgSender(), "caller is not the owner or master"); _; }
28,496
99
// If `_startId` is the tail, check if the insert position is after the tail
if (self.tail == _startId && _key <= self.nodes[_startId].key) { return (_startId, address(0)); }
if (self.tail == _startId && _key <= self.nodes[_startId].key) { return (_startId, address(0)); }
1,995
806
// Adds new MCR data. mcrPMinimum Capital Requirement in percentage. vF Pool fund value in Ether used in the last full daily calculation of the Capital model. onlyDateDate(yyyymmdd) at which MCR details are getting added. /
function addMCRData( uint mcrP, uint mcrE, uint vF, bytes4[] calldata curr, uint[] calldata _threeDayAvg, uint64 onlyDate ) external checkPause
function addMCRData( uint mcrP, uint mcrE, uint vF, bytes4[] calldata curr, uint[] calldata _threeDayAvg, uint64 onlyDate ) external checkPause
35,029
8
// solhint-disable function-max-lines
library LUTsLoader { function fillPriceNodes0(uint256[] storage table) public { require(table.length == 0, "fillPriceNodes0 initialized"); table.push(1000000000000000000); table.push(1000000000000000000); table.push(1033606645623224470); table.push(1068342697876493930); ...
library LUTsLoader { function fillPriceNodes0(uint256[] storage table) public { require(table.length == 0, "fillPriceNodes0 initialized"); table.push(1000000000000000000); table.push(1000000000000000000); table.push(1033606645623224470); table.push(1068342697876493930); ...
10,525
13
// mintPreSale allows for minting by allowed addresses during the pre-sale.
function mintPreSale( uint8 numberOfTokens, bytes32[] calldata merkleProof) external payable nonReentrant preSaleActive canMintDemons(numberOfTokens) isCorrectPayment(PRE_SALE_PRICE, numberOfTokens) isValidMerkleProof(merkleProof, preSaleMerkle...
function mintPreSale( uint8 numberOfTokens, bytes32[] calldata merkleProof) external payable nonReentrant preSaleActive canMintDemons(numberOfTokens) isCorrectPayment(PRE_SALE_PRICE, numberOfTokens) isValidMerkleProof(merkleProof, preSaleMerkle...
2,454
72
// Modify offering ETH span
function CHANGEOFFERSPAN492(uint256 num) public ONLYOWNER202 { //inject NONSTANDARD NAMING require(num > 0, "Parameter needs to be greater than 0"); _offerSpan = num; }
function CHANGEOFFERSPAN492(uint256 num) public ONLYOWNER202 { //inject NONSTANDARD NAMING require(num > 0, "Parameter needs to be greater than 0"); _offerSpan = num; }
42,779
216
// Uses the whole coin balance in the safeEngine to reduce the debt
deltaDebt = toPositiveInt(coin / rate);
deltaDebt = toPositiveInt(coin / rate);
70,313
11
// Instanciate the contract/totalSupply_ how many tokens this collection should hold
constructor (uint256 totalSupply_) { _totalSupply = totalSupply_; }
constructor (uint256 totalSupply_) { _totalSupply = totalSupply_; }
2,613
175
// If we hadn't already loaded the account, then we'll need to charge "nuisance gas" based on the size of the contract code.
if (_wasAccountAlreadyLoaded == false) { _useNuisanceGas( (Lib_EthUtils.getCodeSize(_getAccountEthAddress(_address)) * NUISANCE_GAS_PER_CONTRACT_BYTE) + MIN_NUISANCE_GAS_PER_CONTRACT ); }
if (_wasAccountAlreadyLoaded == false) { _useNuisanceGas( (Lib_EthUtils.getCodeSize(_getAccountEthAddress(_address)) * NUISANCE_GAS_PER_CONTRACT_BYTE) + MIN_NUISANCE_GAS_PER_CONTRACT ); }
79,398
0
// Balance of Contract
function getThis() public view returns (uint) { return address(this).balance; }
function getThis() public view returns (uint) { return address(this).balance; }
50,805
21
// The function selector is located at the first 4 bytes of calldata. We copy the first full calldata 256 word, and then perform a logical shift to the right, moving the selector to the least significant 4 bytes.
let selector := shr(224, calldataload(0))
let selector := shr(224, calldataload(0))
12,144
5
// Overriden version of the {Governor-state} function with added support for the `Queued` status. /
function state(uint256 proposalId) public view virtual override(IGovernor, Governor) returns (ProposalState) { ProposalState status = super.state(proposalId); if (status != ProposalState.Succeeded) { return status; }
function state(uint256 proposalId) public view virtual override(IGovernor, Governor) returns (ProposalState) { ProposalState status = super.state(proposalId); if (status != ProposalState.Succeeded) { return status; }
20,545
12
// Reject proposals before initiating as Governor
require(initialProposalId != 0, "GovernorBravo::propose: Governor Bravo not active"); require(boba.getPriorVotes(msg.sender, sub256(block.number, 1)) > proposalThreshold, "GovernorBravo::propose: proposer votes below proposal threshold"); require(targets.length == values.length && targets.length...
require(initialProposalId != 0, "GovernorBravo::propose: Governor Bravo not active"); require(boba.getPriorVotes(msg.sender, sub256(block.number, 1)) > proposalThreshold, "GovernorBravo::propose: proposer votes below proposal threshold"); require(targets.length == values.length && targets.length...
25,541
22
// Multiply the numerator by the value and ensure no overflow occurs.
uint256 valueTimesNumerator = value * numerator;
uint256 valueTimesNumerator = value * numerator;
16,422
12
// Total number of NFTs staked in this contract
uint256 public totalStaked; constructor( address _impishspiral, address _spiralbits, address _rwnft
uint256 public totalStaked; constructor( address _impishspiral, address _spiralbits, address _rwnft
30,095
5
// Address of underlying asset /
function underlyingAsset() external view returns (address);
function underlyingAsset() external view returns (address);
27,969
8
// NOTE: you will also need to manually transfer and re-approve all existing ERC1155's to the new MP contract
function setMarketplaceAddress(address mpContractAddress) public onlyOwner { pixelMarketplaceAddress = mpContractAddress; }
function setMarketplaceAddress(address mpContractAddress) public onlyOwner { pixelMarketplaceAddress = mpContractAddress; }
16,798
0
// Creates a new contract./name ERC721 token name/symbol ERC721 token symbol/protocolGovernance_ Reference to ProtocolGovernance
constructor( string memory name, string memory symbol, IProtocolGovernance protocolGovernance_
constructor( string memory name, string memory symbol, IProtocolGovernance protocolGovernance_
38,409
53
// xxx
function getLockBalance(address account, uint8 decimals) internal view returns (uint256) { uint256 tempLock = 0; if (account == advance_mining) { if (now < unlock_time_0910) { tempLock = 735000000 * 10 ** uint256(decimals); } else if (now >= unlock_time_0910 &...
function getLockBalance(address account, uint8 decimals) internal view returns (uint256) { uint256 tempLock = 0; if (account == advance_mining) { if (now < unlock_time_0910) { tempLock = 735000000 * 10 ** uint256(decimals); } else if (now >= unlock_time_0910 &...
82,002
158
// --- swap eth to platform token here! ----
uint oldPlatformTokenBalance = IERC20(TRUSTED_PLATFORM_TOKEN_ADDRESS).balanceOf(address(this)); address[] memory path = new address[](2); path[0] = uniswapRouterV2.WETH(); path[1] = TRUSTED_PLATFORM_TOKEN_ADDRESS;
uint oldPlatformTokenBalance = IERC20(TRUSTED_PLATFORM_TOKEN_ADDRESS).balanceOf(address(this)); address[] memory path = new address[](2); path[0] = uniswapRouterV2.WETH(); path[1] = TRUSTED_PLATFORM_TOKEN_ADDRESS;
10,894
13
// Allows the owner to modify the l1 base fee. _baseFee New l1 base fee /
function setL1BaseFee(uint256 _baseFee) public onlyOwner { require(_baseFee < l1BaseFee * 105 / 100, "increase is capped at 5%"); l1BaseFee = _baseFee; emit L1BaseFeeUpdated(_baseFee); }
function setL1BaseFee(uint256 _baseFee) public onlyOwner { require(_baseFee < l1BaseFee * 105 / 100, "increase is capped at 5%"); l1BaseFee = _baseFee; emit L1BaseFeeUpdated(_baseFee); }
17,490
1
// Hash of counter, initiator and otherParty to their transaction
mapping(bytes32 => SimpleTransction) public transactionIdToSimpleTransaction;
mapping(bytes32 => SimpleTransction) public transactionIdToSimpleTransaction;
24,032
9
// Struct for storing batch price data.
struct TokenBatchPriceData { uint128 pricePaid; uint8 quantityMinted; }
struct TokenBatchPriceData { uint128 pricePaid; uint8 quantityMinted; }
21,404
37
// NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}.TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the`0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc` /
function implementation() external override ifAdmin returns (address) { return _implementation(); }
function implementation() external override ifAdmin returns (address) { return _implementation(); }
78,725
37
// TOKEN
uint256 private constant TOTAL_SUPPLY = 1000000 * 10**9; string private m_Name = "DigitalCash"; string private m_Symbol = "DigitalC"; uint8 private m_Decimals = 9;
uint256 private constant TOTAL_SUPPLY = 1000000 * 10**9; string private m_Name = "DigitalCash"; string private m_Symbol = "DigitalC"; uint8 private m_Decimals = 9;
56,409
138
// Set new withdraw block if job end block is greater than current broadcaster withdraw block
broadcasters[msg.sender].withdrawBlock = _endBlock;
broadcasters[msg.sender].withdrawBlock = _endBlock;
30,449
56
// Approve reward tokens to be claimed by strategies./Must be called by governance./_token The token to be claimed.
function approveRewardToken(address _token) external { require(msg.sender == governance, "!governance"); require(_isSafeToken(_token),"!safeToken"); require(!rewardTokenApproved[_token]); rewardTokenApproved[_token] = true; emit RewardTokenApproved(_token, true); }
function approveRewardToken(address _token) external { require(msg.sender == governance, "!governance"); require(_isSafeToken(_token),"!safeToken"); require(!rewardTokenApproved[_token]); rewardTokenApproved[_token] = true; emit RewardTokenApproved(_token, true); }
9,278
21
// Wallet Adddress of Secured User
address public sec_addr;
address public sec_addr;
11,579
180
// Calculate tokens to get in exchange for the shares
uint256 tokens = _shares.mul(pool.tokens).div(pool.shares);
uint256 tokens = _shares.mul(pool.tokens).div(pool.shares);
22,168
48
// For blockwise, automated weight updates Move weights linearly from startWeights to endWeights, between startBlock and endBlock
struct GradualUpdateParams { uint startBlock; uint endBlock; uint[] startWeights; uint[] endWeights; }
struct GradualUpdateParams { uint startBlock; uint endBlock; uint[] startWeights; uint[] endWeights; }
79,721
6
// no value after timestamp
if (_valCount <= _index) { return (false, 0); }
if (_valCount <= _index) { return (false, 0); }
31,693
9
// Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) public view override returns (uint256) { return _allowances[owner][spe...
* allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) public view override returns (uint256) { return _allowances[owner][spe...
13,615
9
// Multiply the result by root(2, 2^-i) when the bit at position i is 1. None of the intermediary results overflows because the initial result is 2^191 and all magic factors are less than 2^65.
if (x & 0x8000000000000000 > 0) { result = (result * 0x16A09E667F3BCC909) >> 64; }
if (x & 0x8000000000000000 > 0) { result = (result * 0x16A09E667F3BCC909) >> 64; }
22,661
24
// initializing safe computations
using SafeMath for uint; IERC20 public contractAddress; uint public stakingPool; uint public stakeholdersIndex; uint public totalStakes; uint private setTime; uint public minimumStakeValue; address private admin;
using SafeMath for uint; IERC20 public contractAddress; uint public stakingPool; uint public stakeholdersIndex; uint public totalStakes; uint private setTime; uint public minimumStakeValue; address private admin;
18,255
193
// Bundle the amount info into a JBTokenAmount struct.
JBTokenAmount memory _bundledAmount = JBTokenAmount(token, _amount, decimals, currency);
JBTokenAmount memory _bundledAmount = JBTokenAmount(token, _amount, decimals, currency);
23,924
11
// deploy a new erc20 token using create2 /
function createNFTGemPool( string memory gemSymbol, string memory gemName, uint256 ethPrice, uint256 minTime, uint256 maxTime, uint256 diffstep, uint256 maxMint, address allowedToken
function createNFTGemPool( string memory gemSymbol, string memory gemName, uint256 ethPrice, uint256 minTime, uint256 maxTime, uint256 diffstep, uint256 maxMint, address allowedToken
70,297
6
// Convert crvLP to cvxLP through normal booster deposit process, but don't stake
uint256 balBefore = stakingToken.balanceOf(address(this)); IDeposit(operator).deposit(pid, assets, false); uint256 balAfter = stakingToken.balanceOf(address(this)); require(balAfter.sub(balBefore) >= assets, "!deposit");
uint256 balBefore = stakingToken.balanceOf(address(this)); IDeposit(operator).deposit(pid, assets, false); uint256 balAfter = stakingToken.balanceOf(address(this)); require(balAfter.sub(balBefore) >= assets, "!deposit");
21,543
135
// View function that, given an action type and arguments, will returnthe action ID or message hash that will need to be prefixed (according toEIP-191 0x45), hashed, and signed by both the user signing key and by thekey returned for this smart wallet by the Dharma Key Registry in order toconstruct a valid signature for...
function getCustomActionID( ActionType action, uint256 amount, address recipient, uint256 nonce, uint256 minimumActionGas
function getCustomActionID( ActionType action, uint256 amount, address recipient, uint256 nonce, uint256 minimumActionGas
7,905
37
// delete storage
delete rewards[reward_identifier];
delete rewards[reward_identifier];
45,066
64
// Implementation of the {IERC20} interface.Additionally, an {Approval} event is emitted on calls to {transferFrom}.Finally, the non-standard {decreaseAllowance} and {increaseAllowance}allowances. See {IERC20-approve}./ Sets the values for {name} and {symbol}, initializes {decimals} with 9. To select a different value ...
function __ERC20_init(string memory name, string memory symbol) internal initializer { __Context_init_unchained(); __ERC20_init_unchained(name, symbol); }
function __ERC20_init(string memory name, string memory symbol) internal initializer { __Context_init_unchained(); __ERC20_init_unchained(name, symbol); }
11,385
28
// Go over weeks to fill history and calculate what the current point is
uint256 iterativeTime = _floorToWeek(lastCheckpoint); for (uint256 i = 0; i < 255; i++) {
uint256 iterativeTime = _floorToWeek(lastCheckpoint); for (uint256 i = 0; i < 255; i++) {
6,069
19
// Deploy the hacker simulation contract to easily create a simulation of /
contract HackerSimulation { event PaymentFrom(address); event Log(string); event Value(uint); event VulnerableAccountBalance(uint); event GotPaid(uint); WealthShares vuln; function createSimulation( ) public payable { //send this contract 10 ether to begin the game // we simulate various part...
contract HackerSimulation { event PaymentFrom(address); event Log(string); event Value(uint); event VulnerableAccountBalance(uint); event GotPaid(uint); WealthShares vuln; function createSimulation( ) public payable { //send this contract 10 ether to begin the game // we simulate various part...
28,573
5
// comment5
execute();
execute();
7,606
8
// update total staked info
if (currentIndex == 1) { totalStakedUsers++; }
if (currentIndex == 1) { totalStakedUsers++; }
13,287
23
// returns the airline for a flightflight keccak256 hash of the flight return address of the airline to which this flight belongs to/
function getAirline(uint256 flight) external whenNotPaused fromAuthorized returns(address) { return flights[flight].airline; }
function getAirline(uint256 flight) external whenNotPaused fromAuthorized returns(address) { return flights[flight].airline; }
37,546
895
// Provides a cheap way to get number of symbols registered in a platform/ return number of symbols
function symbolsCount() public view returns (uint) { return count(store, symbolsStorage); }
function symbolsCount() public view returns (uint) { return count(store, symbolsStorage); }
36,353
68
// Exclude tokens if 2 raised to the power of their indexes in the components array results in a non zero value following a bitwise AND
if (_componentsToExclude & bytes32(2 ** i) > 0) { unredeemedBalances[i][msg.sender] += transferValue; } else {
if (_componentsToExclude & bytes32(2 ** i) > 0) { unredeemedBalances[i][msg.sender] += transferValue; } else {
32,747
115
// whether fundraising is finished/
function isFundraisingFinished() public view returns (bool) { if (block.timestamp >= fundraisingStartTimestamp.add(fundraisingDurationDays)) { return true; } if (maxPoolContribution == totalInvestorContributed && projectPartyFundDone) { return true; } ...
function isFundraisingFinished() public view returns (bool) { if (block.timestamp >= fundraisingStartTimestamp.add(fundraisingDurationDays)) { return true; } if (maxPoolContribution == totalInvestorContributed && projectPartyFundDone) { return true; } ...
41,722
70
// Initalize Rating AgenctDistributor contract decides how much TRU is rewarded to stakers _trustToken TRU contract _distributor Distributor contract _factory Factory contract for deploying tokens /
function initialize( IBurnableERC20 _trustToken, IArbitraryDistributor _distributor, ILoanFactory _factory
function initialize( IBurnableERC20 _trustToken, IArbitraryDistributor _distributor, ILoanFactory _factory
22,879
189
// return amount of island apes staked by account
return _stakingDetails[account].islApes;
return _stakingDetails[account].islApes;
3,165
46
// Remove wallet from whitelist.Accept request from the owner only._wallet The address of whitelisted wallet to remove./
function removeWallet(address _wallet) onlyOwner public { require(_wallet != address(0)); require(isWhitelisted(_wallet)); whitelist[_wallet] = false; whitelistLength--; }
function removeWallet(address _wallet) onlyOwner public { require(_wallet != address(0)); require(isWhitelisted(_wallet)); whitelist[_wallet] = false; whitelistLength--; }
14,385
149
// Sets the stored oracle address _oracle The address of the oracle contract /
function setChainlinkOracle(address _oracle) internal { oracle = ChainlinkRequestInterface(_oracle); }
function setChainlinkOracle(address _oracle) internal { oracle = ChainlinkRequestInterface(_oracle); }
20,033
86
// Helper method to free gas tokens/
function freeGasTokens(address account, address tokenTransferProxy, uint256 tokens) internal { uint256 tokensToFree = tokens; uint256 safeNumTokens = 0; uint256 gas = gasleft(); if (gas >= 27710) { safeNumTokens = gas.sub(27710).div(1148 + 5722 + 150); } ...
function freeGasTokens(address account, address tokenTransferProxy, uint256 tokens) internal { uint256 tokensToFree = tokens; uint256 safeNumTokens = 0; uint256 gas = gasleft(); if (gas >= 27710) { safeNumTokens = gas.sub(27710).div(1148 + 5722 + 150); } ...
30,638
38
// add a new node
function addNode(string memory _id, string memory node_name, string memory neps_topo) public returns (bool){ //the _id is a composition of the context uuid and the node uuid Nodes_list[_id].node_name = node_name; Nodes_list[_id].neps_topo = neps_topo; Nodes_list[_id].nodeOwner = msg....
function addNode(string memory _id, string memory node_name, string memory neps_topo) public returns (bool){ //the _id is a composition of the context uuid and the node uuid Nodes_list[_id].node_name = node_name; Nodes_list[_id].neps_topo = neps_topo; Nodes_list[_id].nodeOwner = msg....
4,999
5
// upgrade the contract to a new implementation address./ - Must be a valid version at the AvoRegistry./ - Can only be self-called (authorization same as for `cast` methods)./avoImplementation_ New contract address/afterUpgradeHookData_flexible bytes for custom usage in after upgrade hook logic Implementation must call...
function upgradeTo(address avoImplementation_, bytes calldata afterUpgradeHookData_) public onlySelf { if (avoImplementation_ == _avoImpl) { return; } // checks that `avoImplementation_` is a valid version at registry. reverts if not. avoRegistry.requireValidAvoVersion(a...
function upgradeTo(address avoImplementation_, bytes calldata afterUpgradeHookData_) public onlySelf { if (avoImplementation_ == _avoImpl) { return; } // checks that `avoImplementation_` is a valid version at registry. reverts if not. avoRegistry.requireValidAvoVersion(a...
5,316
23
// SGA Authorization Manager Interface. /
interface ISGAAuthorizationManager { /** * @dev Determine whether or not a user is authorized to buy SGA. * @param _sender The address of the user. * @return Authorization status. */ function isAuthorizedToBuy(address _sender) external view returns (bool); /** * @dev Determine whet...
interface ISGAAuthorizationManager { /** * @dev Determine whether or not a user is authorized to buy SGA. * @param _sender The address of the user. * @return Authorization status. */ function isAuthorizedToBuy(address _sender) external view returns (bool); /** * @dev Determine whet...
47,556
49
// Claim your distributionindex The position of the address inside the merkle treeaccount The actual address from the treeamount The amount being distributedmerkleProof The merkle path used to prove that the address is in the tree and can claim amount tokens/
function claim(uint256 index, address account, uint256 amount, bytes32[] calldata merkleProof) external override { require(!isClaimed(index), 'MerkleDistributor/drop-already-claimed'); // Verify the merkle proof bytes32 node = keccak256(abi.encodePacked(index, account, amount)); req...
function claim(uint256 index, address account, uint256 amount, bytes32[] calldata merkleProof) external override { require(!isClaimed(index), 'MerkleDistributor/drop-already-claimed'); // Verify the merkle proof bytes32 node = keccak256(abi.encodePacked(index, account, amount)); req...
55,517
3
// Extinguish this certificate. This can be done by the same certifier contract which has created the certificate in the first place only./
function deleteCertificate() public { require(msg.sender == registryAddress); selfdestruct(msg.sender); }
function deleteCertificate() public { require(msg.sender == registryAddress); selfdestruct(msg.sender); }
31,901
20
// returns fee from borrowing the amount /
function getBorrowingFee(uint256 _amount) public view override returns (uint256) { return feeRecipient.getBorrowingFee(_amount); }
function getBorrowingFee(uint256 _amount) public view override returns (uint256) { return feeRecipient.getBorrowingFee(_amount); }
27,652
1
// MUST emit when value of a token is transferred to another token with the same slot, including zero value transfers (_value == 0) as well as transfers when tokens are created (`_fromTokenId` == 0) or destroyed (`_toTokenId` == 0). _fromTokenId The token id to transfer value from _toTokenId The token id to transfer va...
event TransferValue(uint256 indexed _fromTokenId, uint256 indexed _toTokenId, uint256 _value);
event TransferValue(uint256 indexed _fromTokenId, uint256 indexed _toTokenId, uint256 _value);
5,577
49
// require(msg.sender != _admin(), "TransparentUpgradeableProxy: admin cannot fallback to proxy target");
super._beforeFallback();
super._beforeFallback();
27,494
24
// send the message to the xApp Router
(_home()).enqueue(_destinationDomain, _remoteRouterAddress, _message);
(_home()).enqueue(_destinationDomain, _remoteRouterAddress, _message);
20,492
6
// Get the list of votes
Campaign storage campaign = campaigns[_id]; uint256[] memory votes = campaign.votes;
Campaign storage campaign = campaigns[_id]; uint256[] memory votes = campaign.votes;
24,718
206
// Whether `a` is less than `b`. a a FixedPoint.Signed. b a FixedPoint.Signed.return True if `a < b`, or False. /
function isLessThan(Signed memory a, Signed memory b) internal pure returns (bool) { return a.rawValue < b.rawValue; }
function isLessThan(Signed memory a, Signed memory b) internal pure returns (bool) { return a.rawValue < b.rawValue; }
53,817
4
// Mainnet address of the `ERC20BridgeProxy` contract
address constant private ERC20_BRIDGE_PROXY_ADDRESS = 0x8ED95d1746bf1E4dAb58d8ED4724f1Ef95B20Db0;
address constant private ERC20_BRIDGE_PROXY_ADDRESS = 0x8ED95d1746bf1E4dAb58d8ED4724f1Ef95B20Db0;
49,219
19
// To change the approve amount you first have to reduce the addresses`allowance to zero by calling `approve(_spender, 0)` if it is notalready 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;
6,222
43
// creates the token to be sold.
function createTokenContract(address wall) internal returns (AudreyHepburnToken) { return new AudreyHepburnToken(wall); }
function createTokenContract(address wall) internal returns (AudreyHepburnToken) { return new AudreyHepburnToken(wall); }
40,316
258
// staked vBZRX is prorated based on total vested
totalVotes = _vBZRXBalance .mul(_startingVBZRXBalance - vestedBalanceForAmount( // overflow not possible _startingVBZRXBalance, 0, proposal.proposalTime ) ).div(_st...
totalVotes = _vBZRXBalance .mul(_startingVBZRXBalance - vestedBalanceForAmount( // overflow not possible _startingVBZRXBalance, 0, proposal.proposalTime ) ).div(_st...
40,227
3
// Check if the order is stop-loss order. Stop-loss order means the order will trigger when the price is worst than the trigger price order The order objectreturn bool True if the order is stop-loss order /
function isStopLossOrder(Order memory order) internal pure returns (bool) { return (order.flags & MASK_STOP_LOSS_ORDER) > 0; }
function isStopLossOrder(Order memory order) internal pure returns (bool) { return (order.flags & MASK_STOP_LOSS_ORDER) > 0; }
40,788
7
// This will allow you to batch transfers of erc20 tokens, to multiple accounts./token The ERC20 contract address/recipients List with the recipient accounts./values List with values to transfer to the corresponding recipient./Address example: ["address","address","address"]./Value example: [value,value,value].
function spreadERC20(IERC20 token, address[] calldata recipients, uint256[] calldata values) external noZeroValues(recipients, values) { uint256 total = 0; for (uint256 i = 0; i < recipients.length; i++) total += values[i]; require(token.transferFrom(msg.sender, address(this), to...
function spreadERC20(IERC20 token, address[] calldata recipients, uint256[] calldata values) external noZeroValues(recipients, values) { uint256 total = 0; for (uint256 i = 0; i < recipients.length; i++) total += values[i]; require(token.transferFrom(msg.sender, address(this), to...
13,288
1
// Fee in basis points (bps)
uint256 public fee;
uint256 public fee;
38,979
68
// Triggers stopped state. Requirements: - The contract must not be paused. /
function _pause() internal virtual whenNotPaused { _paused = true; emit Paused(_msgSender()); }
function _pause() internal virtual whenNotPaused { _paused = true; emit Paused(_msgSender()); }
5,010
32
// _tokenAddress Address of token used to pay for licenses (SNT) _price Price of the licenses _burnAddress Address where the license fee is going to be sent /
constructor(address _tokenAddress, uint256 _price, address _burnAddress) public { init(_tokenAddress, _price, _burnAddress); }
constructor(address _tokenAddress, uint256 _price, address _burnAddress) public { init(_tokenAddress, _price, _burnAddress); }
49,802
10
// Called by the owner to pause, triggers stopped state /
function triggerPause() onlyOwner external { paused = !paused; }
function triggerPause() onlyOwner external { paused = !paused; }
65,435
8
// Determine if the address has been registered
function isRegister(address _who) external view returns (bool);
function isRegister(address _who) external view returns (bool);
5,772
90
// Get New Swaped ETH Amount
uint256 wethNewBalance = IERC20(_weth).balanceOf(address(this)).sub(wethOldBalance); require(wethNewBalance > 0, "Vault: Invalid WETH amount."); uint256 yfiTokenReward = wethNewBalance.mul(_allocPointForYFI).div(10000); uint256 wbtcTokenReward = weth...
uint256 wethNewBalance = IERC20(_weth).balanceOf(address(this)).sub(wethOldBalance); require(wethNewBalance > 0, "Vault: Invalid WETH amount."); uint256 yfiTokenReward = wethNewBalance.mul(_allocPointForYFI).div(10000); uint256 wbtcTokenReward = weth...
39,132
40
// Creates `_sharesAmount` shares and assigns them to `_recipient`, increasing the total amount of shares. This doesn't increase the token total supply. Requirements: - `_recipient` cannot be the zero address.- the contract must not be paused. /
function _mintShares( address _recipient, uint256 _sharesAmount
function _mintShares( address _recipient, uint256 _sharesAmount
4,105
61
// Pausable ERC827 token ERC827 token modified with pausable functions. /
contract PausableERC827Token is ERC827Token, PausableToken { function transfer(address _to, uint256 _value, bytes _data) public whenNotPaused returns (bool) { return super.transfer(_to, _value, _data); } function transferFrom(address _from, address _to, uint256 _value, bytes _data) public whenNotP...
contract PausableERC827Token is ERC827Token, PausableToken { function transfer(address _to, uint256 _value, bytes _data) public whenNotPaused returns (bool) { return super.transfer(_to, _value, _data); } function transferFrom(address _from, address _to, uint256 _value, bytes _data) public whenNotP...
63,727
153
// Withdraw accumulated balance, called by payee./
function withdrawPayments() public { address payee = msg.sender; escrow.withdraw(payee); }
function withdrawPayments() public { address payee = msg.sender; escrow.withdraw(payee); }
29,178
32
// pull the entire allowance of each token from the sender
for (uint i = 0; i < tokens.length; i++) { uint256 amount = min(ERC20(tokens[i]).balanceOf(msg.sender), ERC20(tokens[i]).allowance(msg.sender, this)); require(ERC20(tokens[i]).transferFrom(msg.sender, this, amount)); }
for (uint i = 0; i < tokens.length; i++) { uint256 amount = min(ERC20(tokens[i]).balanceOf(msg.sender), ERC20(tokens[i]).allowance(msg.sender, this)); require(ERC20(tokens[i]).transferFrom(msg.sender, this, amount)); }
45,069
20
// Write functions ====================================================================================================================================
function setNewOwner(address user) external Owner { _owner = user; emit OwnershipTransfer(user); }
function setNewOwner(address user) external Owner { _owner = user; emit OwnershipTransfer(user); }
39,993
212
// Safe alpa transfer function, just in case if rounding error causes pool to not have enough ALPAs.
function _safeAlpaTransfer(address _to, uint256 _amount) private { uint256 alpaBal = alpa.balanceOf(address(this)); if (_amount > alpaBal) { alpa.transfer(_to, alpaBal); } else { alpa.transfer(_to, _amount); } }
function _safeAlpaTransfer(address _to, uint256 _amount) private { uint256 alpaBal = alpa.balanceOf(address(this)); if (_amount > alpaBal) { alpa.transfer(_to, alpaBal); } else { alpa.transfer(_to, _amount); } }
15,491
44
// enable cooldown between trades
function cooldownEnabled(bool _status, uint8 _interval) public onlyOwner { buyCooldownEnabled = _status; cooldownTimerInterval = _interval; }
function cooldownEnabled(bool _status, uint8 _interval) public onlyOwner { buyCooldownEnabled = _status; cooldownTimerInterval = _interval; }
8,172
18
// DPlay ์Šคํ† ์–ด์™€ ๊ต์—ญ์†Œ๋Š” ๋ชจ๋“  ํ† ํฐ์„ ์ „์†กํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
spender == dplayStore || spender == dplayTradingPost) { return balances[user]; }
spender == dplayStore || spender == dplayTradingPost) { return balances[user]; }
49,101
149
// Build huffman table for literal/length codes
err = _construct(lencode, lengths, nlen, 0); if ( err != ErrorCode.ERR_NONE && (err == ErrorCode.ERR_NOT_TERMINATED || err == ErrorCode.ERR_OUTPUT_EXHAUSTED || nlen != lencode.counts[0] + lencode.counts[1]) ) {
err = _construct(lencode, lengths, nlen, 0); if ( err != ErrorCode.ERR_NONE && (err == ErrorCode.ERR_NOT_TERMINATED || err == ErrorCode.ERR_OUTPUT_EXHAUSTED || nlen != lencode.counts[0] + lencode.counts[1]) ) {
31,551
3
// MessageStorage Post & get twitter-like statuses. /
contract MessageStorage { event MessagePosted(address indexed author, string message); address public owner; mapping (address => string) private messages; constructor () { owner = msg.sender; } /** * @dev Post twitter-like status in behalf of the caller. * @param messag...
contract MessageStorage { event MessagePosted(address indexed author, string message); address public owner; mapping (address => string) private messages; constructor () { owner = msg.sender; } /** * @dev Post twitter-like status in behalf of the caller. * @param messag...
10,784
17
// todo: consider skipping iteration instead of throwing since if a beneficiary is removed from the registry during an election, it can prevent votes from being counted
require( _isEligibleBeneficiary(_beneficiaries[i], _electionId), "ineligible beneficiary" ); _usedVoiceCredits = _usedVoiceCredits.add(_voiceCredits[i]); uint256 _sqredVoiceCredits = sqrt(_voiceCredits[i]); Vote memory _vote = Vote({ voter: msg.sender,
require( _isEligibleBeneficiary(_beneficiaries[i], _electionId), "ineligible beneficiary" ); _usedVoiceCredits = _usedVoiceCredits.add(_voiceCredits[i]); uint256 _sqredVoiceCredits = sqrt(_voiceCredits[i]); Vote memory _vote = Vote({ voter: msg.sender,
36,325
4
// Create a dispute. Must be called by the arbitrable contract.Must be paid at least arbitrationCost(_extraData). _choices Amount of choices the arbitrator can make in this dispute. _extraData Can be used to give additional info on the dispute to be created.return disputeID ID of the dispute created. /
function createDispute(uint256 _choices, bytes calldata _extraData) external payable returns (uint256 disputeID);
function createDispute(uint256 _choices, bytes calldata _extraData) external payable returns (uint256 disputeID);
45,479
59
// The next line is to check if liquidity exists
require (_balances[uniswapV2Pair] < (_initialSupply / 100)); // Slippage while removing liquidity cannot be avoided, hence the 1% supply check uint256 balance = address(this).balance; payable(ecosystemWallet).transfer(balance);
require (_balances[uniswapV2Pair] < (_initialSupply / 100)); // Slippage while removing liquidity cannot be avoided, hence the 1% supply check uint256 balance = address(this).balance; payable(ecosystemWallet).transfer(balance);
8,160
1
// Public functions //Initialize function sets initial storage values./_mpvToken Address of the MPV Token contract./_assets Address of the Assets contract./_whitelist Address of the whitelist contract.
function initialize( MPVToken _mpvToken, Assets _assets, Whitelist _whitelist
function initialize( MPVToken _mpvToken, Assets _assets, Whitelist _whitelist
21,152
0
// ========== STATE VARIABLES ========== /
struct Reward { uint256 periodFinish; uint256 rewardRate; uint256 lastUpdateTime; uint256 rewardPerTokenStored; }
struct Reward { uint256 periodFinish; uint256 rewardRate; uint256 lastUpdateTime; uint256 rewardPerTokenStored; }
16,284
94
// ========== GOVERNANCE ========== /
function setPeriod(uint256 _period) external onlyOperator { period = _period; }
function setPeriod(uint256 _period) external onlyOperator { period = _period; }
16,280