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
41
// Airdrop tokens Remove `_value` tokens from the system irreversibly_value the amount with decimals(18)/
mapping (address => uint256) public airDropHistory; event AirDrop(address _receiver, uint256 _amount);
mapping (address => uint256) public airDropHistory; event AirDrop(address _receiver, uint256 _amount);
25,661
11
// Modifier is Owner address
modifier isOwner { assert(owner == msg.sender); _; }
modifier isOwner { assert(owner == msg.sender); _; }
47,366
6
// information that have to be added from the cryptonomica server: string signedStringFromServer;
string firstName; string lastName; string keyFingerprint; uint keyValidUntil; // unix time uint birthDateYear; uint birthDateMonth; uint birthDateDay;
string firstName; string lastName; string keyFingerprint; uint keyValidUntil; // unix time uint birthDateYear; uint birthDateMonth; uint birthDateDay;
3,870
45
// Private function to mint without any access checks.Called by the public edition minting functions. /
function _mintEditions(address[] memory recipients) internal returns (uint256) { require(uint64(mintable()) >= recipients.length, "Sold out"); for (uint i = 0; i < recipients.length; i++) { _mint(recipients[i], counter.current()); counter.increment(); } retur...
function _mintEditions(address[] memory recipients) internal returns (uint256) { require(uint64(mintable()) >= recipients.length, "Sold out"); for (uint i = 0; i < recipients.length; i++) { _mint(recipients[i], counter.current()); counter.increment(); } retur...
40,942
57
// Function to pause recieving of deposits.Available only to the owner. /
function pause() external onlyOwner { require(!paused); paused = true; }
function pause() external onlyOwner { require(!paused); paused = true; }
19,687
5
// The array to store the guesses submitted by each piece
Guess[MAX_NFT_SUPPLY] private guesses; bytes32 private secretMintCodeHash = 0x0aadf7eaabe5d56139de8e76813c132769e31f1738b8633e8376ae55330c9de3; event StakingFeeChanged(uint256 _stakeAmount);
Guess[MAX_NFT_SUPPLY] private guesses; bytes32 private secretMintCodeHash = 0x0aadf7eaabe5d56139de8e76813c132769e31f1738b8633e8376ae55330c9de3; event StakingFeeChanged(uint256 _stakeAmount);
82,761
56
// Returns an identifier for the bridge contract so that the latter could/ ensure it works with the BlockReward contract.
function blockRewardContractId() public pure returns(bytes4) { return 0x0d35a7ca; // bytes4(keccak256("blockReward")) }
function blockRewardContractId() public pure returns(bytes4) { return 0x0d35a7ca; // bytes4(keccak256("blockReward")) }
13,238
0
// Set BaseURL for the degens.
setBaseURI(_baseNFTURI);
setBaseURI(_baseNFTURI);
36,191
62
// Returns the id of the Aave market to which this contracts points toreturn The market id /
function getMarketId() external view override returns (string memory) { return _marketId; }
function getMarketId() external view override returns (string memory) { return _marketId; }
39,774
303
// Unlock as much collateral as possible while keeping the target ratio
amountToFree = Math.min(amountToFree, _maxWithdrawal()); _freeCollateralAndRepayDai(amountToFree, 0);
amountToFree = Math.min(amountToFree, _maxWithdrawal()); _freeCollateralAndRepayDai(amountToFree, 0);
76,984
77
// user must be proxy owner
require(DSProxyInterface(_proxy).owner() == _user); require(_user == ecrecover(digest, _v, _r, _s), "DFSProxy/user-not-valid"); require(!nonces[_user][_nonce], "DFSProxy/invalid-nonce"); nonces[_user][_nonce] = true;
require(DSProxyInterface(_proxy).owner() == _user); require(_user == ecrecover(digest, _v, _r, _s), "DFSProxy/user-not-valid"); require(!nonces[_user][_nonce], "DFSProxy/invalid-nonce"); nonces[_user][_nonce] = true;
25,988
171
// Marble NFT Interface Defines Marbles unique extension of NFT....It contains methodes returning core properties what describe Marble NFTs and provides management options to create,burn NFT or change approvals of it. /
interface MarbleNFTInterface { /** * @dev Mints Marble NFT. * @notice This is a external function which should be called just by the owner of contract or any other user who has priviladge of being resposible * of creating valid Marble NFT. Valid token contains all neccessary information to be able recreate ...
interface MarbleNFTInterface { /** * @dev Mints Marble NFT. * @notice This is a external function which should be called just by the owner of contract or any other user who has priviladge of being resposible * of creating valid Marble NFT. Valid token contains all neccessary information to be able recreate ...
12,941
32
// the proposal quorum is the lowest of minProposalPower and the proposal quorum because it is awkward for the proposal to require more voting power than the execution
uint256 minPower = quorum <= minProposalPower ? quorum : minProposalPower;
uint256 minPower = quorum <= minProposalPower ? quorum : minProposalPower;
1,320
1
// queried by others ({ERC165Checker}).For an implementation, see {ERC165}./ Returns true if this contract implements the interface defined by`interfaceId`. See the correspondingto learn more about how these ids are created. This function call must use less than 30 000 gas. /
function supportsInterface(bytes4 interfaceId) external view returns (bool);
function supportsInterface(bytes4 interfaceId) external view returns (bool);
945
26
// all okay!
UserStatus("User has withdrawn funds", msg.sender, amount);
UserStatus("User has withdrawn funds", msg.sender, amount);
39,893
136
// Add a new token to registry _token ERC20 Token address _decimals Token's decimals _isTransferFeeEnabled Is token changes transfer fee _isSupportedOnCompound Is token supported on Compound _cToken cToken contract address _chainLinkOracle Chain Link Aggregator address to get TOKEN/ETH rate /
function addToken( address _token, uint8 _decimals, bool _isTransferFeeEnabled, bool _isSupportedOnCompound, address _cToken, address _chainLinkOracle ) public onlyOwner
function addToken( address _token, uint8 _decimals, bool _isTransferFeeEnabled, bool _isSupportedOnCompound, address _cToken, address _chainLinkOracle ) public onlyOwner
32,968
36
// uniswap tokenB pair address --> USDC
address pairB = address(0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48);
address pairB = address(0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48);
31,803
7
// Sets reveal state/_state New reveal state
function setRevealed(bool _state) public onlyOwner { revealed = _state; emit RevealStateChanged(_state); }
function setRevealed(bool _state) public onlyOwner { revealed = _state; emit RevealStateChanged(_state); }
27,070
11
// iterate through oracle list and check if enough oracles(minimum quorum)have voted the same answer has the current one
for(uint i = 0; i < totalOracleCount; i++){ bytes memory a = bytes(currRequest.anwers[i]); bytes memory b = bytes(_valueRetrieved); if(keccak256(a) == keccak256(b)){ currentQuorum++; if(currentQuorum >= minQuorum){ currRequest.agreedValue = _valueRetrieved; emi...
for(uint i = 0; i < totalOracleCount; i++){ bytes memory a = bytes(currRequest.anwers[i]); bytes memory b = bytes(_valueRetrieved); if(keccak256(a) == keccak256(b)){ currentQuorum++; if(currentQuorum >= minQuorum){ currRequest.agreedValue = _valueRetrieved; emi...
39,454
6
// fee are either zero, or being paid in the collateral token
feeAmount = MathLib.multiply( qtyToMint, marketContract.COLLATERAL_TOKEN_FEE_PER_UNIT() ); totalCollateralTokenTransferAmount = neededCollateral.add(feeAmount); feeToken = collateralTokenAddress;
feeAmount = MathLib.multiply( qtyToMint, marketContract.COLLATERAL_TOKEN_FEE_PER_UNIT() ); totalCollateralTokenTransferAmount = neededCollateral.add(feeAmount); feeToken = collateralTokenAddress;
10,156
57
// Views
function lastTimeRewardApplicable() external view returns (uint256); function rewardPerToken() external view returns (uint256); function earned(address account) external view returns (uint256); function getRewardForDuration() external view returns (uint256); function totalSupply() external view ...
function lastTimeRewardApplicable() external view returns (uint256); function rewardPerToken() external view returns (uint256); function earned(address account) external view returns (uint256); function getRewardForDuration() external view returns (uint256); function totalSupply() external view ...
8,896
3
// Tell if a Witnet.Result is errored./_result An instance of Witnet.Result./ return `true` if errored, `false` if successful.
function isError(Witnet.Result memory _result) external pure returns (bool);
function isError(Witnet.Result memory _result) external pure returns (bool);
14,041
184
// returns the delta between the current stable rate and the user stable rate atwhich the borrow position of the user will be rebalanced (scaled down)/
function getRebalanceDownRateDelta() external pure returns (uint256) { return REBALANCE_DOWN_RATE_DELTA; }
function getRebalanceDownRateDelta() external pure returns (uint256) { return REBALANCE_DOWN_RATE_DELTA; }
34,828
21
// start = startTime;end = endTime;
prices = etherCostOfEachToken * 0.0000001 ether;
prices = etherCostOfEachToken * 0.0000001 ether;
33,437
9
// If a decimal, we need to left-pad if the numTens isn't enough
if (decimal) { while (numTens < 3) { bstr[k--] = bytes1("0"); numTens++; }
if (decimal) { while (numTens < 3) { bstr[k--] = bytes1("0"); numTens++; }
38,795
225
// discount vesting amounts for vesting time
uint256 multiplier = vestedBalanceForAmount( 1e36, 0, block.timestamp ); bzrxRewardsVesting = bzrxRewardsVesting .sub(bzrxRewardsVesting .mul(multiplier) .div(1e36) );
uint256 multiplier = vestedBalanceForAmount( 1e36, 0, block.timestamp ); bzrxRewardsVesting = bzrxRewardsVesting .sub(bzrxRewardsVesting .mul(multiplier) .div(1e36) );
40,217
96
// it must implement {IPollenCallee}/
function execute(uint256 proposalId, bytes calldata data) external;
function execute(uint256 proposalId, bytes calldata data) external;
47,822
45
// claim before invalidating if there is something to claim
claimHodlRewardFor(_account);
claimHodlRewardFor(_account);
17,751
17
// get past rounds answers _roundId the answer number to retrieve the answer for[deprecated] Use getRoundData instead. This does not error if noanswer has been reached, it will simply return 0. Either wait to point toan already answered Aggregator or use the recommended getRoundDatainstead which includes better verific...
function getAnswer(uint256 _roundId) external view virtual override returns (int256)
function getAnswer(uint256 _roundId) external view virtual override returns (int256)
26,744
2
// Helper functions
function getEthBalance(address addr) public view returns (uint256 balance) { balance = addr.balance; }
function getEthBalance(address addr) public view returns (uint256 balance) { balance = addr.balance; }
27,650
83
// change address of Olympus Treasury_olympusTreasury uint /
function changeOlympusTreasury(address _olympusTreasury) external { require( msg.sender == olympusDAO, "Only Olympus DAO" ); olympusTreasury = _olympusTreasury; }
function changeOlympusTreasury(address _olympusTreasury) external { require( msg.sender == olympusDAO, "Only Olympus DAO" ); olympusTreasury = _olympusTreasury; }
35,522
10
// Only the director is permitted
require(msg.sender == director); _;
require(msg.sender == director); _;
16,664
2
// - Token 小数位
uint8 public decimals;
uint8 public decimals;
38,806
13
// allows owner to change tournament parameters (for next tournament)
function update(uint _players, uint _rounds, uint _time, uint _fee) public authority { nPlayers = _players; nRounds = _rounds; nTime = _time; nFee = _fee; }
function update(uint _players, uint _rounds, uint _time, uint _fee) public authority { nPlayers = _players; nRounds = _rounds; nTime = _time; nFee = _fee; }
50,983
52
// Library computes the startBlock, computes startWeights as the current denormalized weights of the core pool tokens.
SmartPoolManager.updateWeightsGradually( bPool, gradualUpdate, newWeights, startBlock, endBlock, minimumWeightChangeBlockPeriod );
SmartPoolManager.updateWeightsGradually( bPool, gradualUpdate, newWeights, startBlock, endBlock, minimumWeightChangeBlockPeriod );
21,687
56
//
if(shouldSwapBack()){ swapBack(); }
if(shouldSwapBack()){ swapBack(); }
2,570
0
// config
bool public EnableSystem; uint256 public DelayBlockOutGame; mapping(uint256 => uint256) public PriceUpgrate; mapping(uint256 => uint256) public BlockUpgrate; uint256 public MaxLevel; uint256 public DelayBlockLearn; uint256 public TotalBlockLearn; mapping(uint256 => uint256) public Re...
bool public EnableSystem; uint256 public DelayBlockOutGame; mapping(uint256 => uint256) public PriceUpgrate; mapping(uint256 => uint256) public BlockUpgrate; uint256 public MaxLevel; uint256 public DelayBlockLearn; uint256 public TotalBlockLearn; mapping(uint256 => uint256) public Re...
21,033
6
// Calculates the utilization rate of the market: `borrows / (cash + borrows - reserves)` cash The amount of cash in the market borrows The amount of borrows in the market reserves The amount of reserves in the market (currently unused)return The utilization rate as a mantissa between [0, 1e18] /
function utilizationRate( uint256 cash, uint256 borrows, uint256 reserves
function utilizationRate( uint256 cash, uint256 borrows, uint256 reserves
32,484
64
// ERC721, ERC1155 imports // WalletSimple============ Basic multi-signer wallet designed for use in a co-signing environment where 2 signatures are required to move funds.Typically used in a 2-of-3 signing configuration. Uses ecrecover to allow for 2 signatures in a single transaction. The first signature is created o...
contract WalletSimple is IERC721Receiver, ERC1155Receiver { // Events event Deposited(address from, uint256 value, bytes data); event SafeModeActivated(address msgSender); event Transacted( address msgSender, // Address of the sender of the message initiating the transaction address otherSigner, // Addr...
contract WalletSimple is IERC721Receiver, ERC1155Receiver { // Events event Deposited(address from, uint256 value, bytes data); event SafeModeActivated(address msgSender); event Transacted( address msgSender, // Address of the sender of the message initiating the transaction address otherSigner, // Addr...
16,886
28
// return - the number of hours wait time for any critical update/
function speedBumpHours() public view returns (uint16){ TreasuryBase t = TreasuryBase(treasuryAddress()); return t.speedBumpHours(); }
function speedBumpHours() public view returns (uint16){ TreasuryBase t = TreasuryBase(treasuryAddress()); return t.speedBumpHours(); }
17,450
1,302
// 653
entry "sundrily" : ENG_ADVERB
entry "sundrily" : ENG_ADVERB
21,489
19
// instead of reverting, return 0 if nothing is due so multiple schedules can be checked
if (vested == 0) { return 0; }
if (vested == 0) { return 0; }
35,130
57
// set parent references in child proposals
if (i > 0) { Proposal storage p = proposals[id]; p.parentProposalId = ids[0]; }
if (i > 0) { Proposal storage p = proposals[id]; p.parentProposalId = ids[0]; }
47,394
64
// @_amount: wbtc amount
function deposit_wbtc(uint256 _amount) internal { IERC20(wbtc).transferFrom(msg.sender, address(this), _amount); IERC20(wbtc).approve(address(pool_deposit), 0); IERC20(wbtc).approve(address(pool_deposit), _amount); uint256[2] memory uamounts = [uint256(0), _amount]; pool_deposit.add_liquidity(uamo...
function deposit_wbtc(uint256 _amount) internal { IERC20(wbtc).transferFrom(msg.sender, address(this), _amount); IERC20(wbtc).approve(address(pool_deposit), 0); IERC20(wbtc).approve(address(pool_deposit), _amount); uint256[2] memory uamounts = [uint256(0), _amount]; pool_deposit.add_liquidity(uamo...
35,703
27
// Transfer a tile owned by another address, for which the calling address/has previously been granted transfer approval by the owner./_from The address that owns the tile to be transfered./_to The address that should take ownership of the tile. Can be any address,/including the caller./_tokenId The ID of the tile to b...
function transferFrom( address _from, address _to, uint256 _tokenId ) external
function transferFrom( address _from, address _to, uint256 _tokenId ) external
18,726
85
// Determine Runner PortionsNote, torch has already been passed, so torchRunners[0]is the current torch runner
if (_previousLast != address(0)) { runnerPortions[2] = _forPayout.mul(10).div(100); }
if (_previousLast != address(0)) { runnerPortions[2] = _forPayout.mul(10).div(100); }
64,503
50
// -------------------------- Trait Rarity functions--------------------------/ Clears the trait rarity for a given trait (Ex. hair which is 0). traitIndex The index we want to clear. /
function clearTraitRarity(uint256 traitIndex) external onlyOwner { delete traitRarity[traitIndex]; }
function clearTraitRarity(uint256 traitIndex) external onlyOwner { delete traitRarity[traitIndex]; }
70,620
46
// The contract can be initialized with a number of tokensAll the tokens are deposited to the owner address_balance Initial supply of the contract_name Token Name_symbol Token symbol_decimals Token decimals
function TetherToken1(uint _initialSupply, string _name, string _symbol, uint _decimals) public { _totalSupply = _initialSupply; name = _name; symbol = _symbol; decimals = _decimals; balances[owner] = _initialSupply; deprecated = false; }
function TetherToken1(uint _initialSupply, string _name, string _symbol, uint _decimals) public { _totalSupply = _initialSupply; name = _name; symbol = _symbol; decimals = _decimals; balances[owner] = _initialSupply; deprecated = false; }
5,297
1
// Emits on updating the virtual price bounds
event NewLimiterParams(uint256 lowerBound, uint256 upperBound);
event NewLimiterParams(uint256 lowerBound, uint256 upperBound);
34,805
20
// ------------------------------------------------------------------------ Transfer tokens from the from account to the to accountThe calling account must already have sufficient tokens approve(...)-d for spending from the from account and - From account must have sufficient balance to transfer - Spender must have suf...
function transferFrom(address from, address to, uint tokens) public returns (bool success) { balances[from] = safeSub(balances[from], tokens); allowed[from][msg.sender] = safeSub(allowed[from][msg.sender], tokens); balances[to] = safeAdd(balances[to], tokens); emit Transfer(from, to,...
function transferFrom(address from, address to, uint tokens) public returns (bool success) { balances[from] = safeSub(balances[from], tokens); allowed[from][msg.sender] = safeSub(allowed[from][msg.sender], tokens); balances[to] = safeAdd(balances[to], tokens); emit Transfer(from, to,...
28,479
490
// Decompress the data here so we can extract the data directly from calldata
bytes4 selector = IDecompressor(0x0).decompress.selector; bytes memory decompressed; assembly {
bytes4 selector = IDecompressor(0x0).decompress.selector; bytes memory decompressed; assembly {
28,766
1
// Can't access this vars using id, name, pickCount Must us position in function ex team[1] will return id team[0].toNumber will return int/
struct Team { uint id; string name; uint pickCount; }
struct Team { uint id; string name; uint pickCount; }
35,498
44
// Destroys `tokenId`. The approval is cleared when the token is burned.
function _burn(uint256 tokenId_) internal virtual { address owner = ownerOf(tokenId_); _beforeTokenTransfer(owner, address(0), tokenId_); // Clear approvals _approve(address(0), tokenId_); delete _owners[tokenId_]; totalSupply--; _balanceOf[owner]--; emit Transfer(owner, address(0),...
function _burn(uint256 tokenId_) internal virtual { address owner = ownerOf(tokenId_); _beforeTokenTransfer(owner, address(0), tokenId_); // Clear approvals _approve(address(0), tokenId_); delete _owners[tokenId_]; totalSupply--; _balanceOf[owner]--; emit Transfer(owner, address(0),...
11,338
50
// repeat while the mask is not empty
while (mask != 0) {
while (mask != 0) {
2,486
7
// Sets or unsets the approval of a given operatorAn operator is allowed to transfer all tokens of the sender on their behalf operator address to set the approval approved representing the status of the approval to be set /
function setApprovalForAll(address operator, bool approved) external override
function setApprovalForAll(address operator, bool approved) external override
8,793
14
// Performs a swap before bridging via Across/_lifiData data used purely for tracking and analytics/_swapData an array of swap related data for performing swaps before bridging/_acrossData data specific to Across
function swapAndStartBridgeTokensViaAcross( LiFiData calldata _lifiData, LibSwap.SwapData[] calldata _swapData, AcrossData memory _acrossData
function swapAndStartBridgeTokensViaAcross( LiFiData calldata _lifiData, LibSwap.SwapData[] calldata _swapData, AcrossData memory _acrossData
25,406
131
// Need to use proxy-wide FRAX balance if applicable, to prevent exploiting
veFXS_needed_for_max_boost = (the_proxy == address(0)) ? minVeFXSForMaxBoost(account) : minVeFXSForMaxBoostProxy(the_proxy); if (veFXS_needed_for_max_boost > 0){ uint256 user_vefxs_fraction = (vefxs_bal_to_use * MULTIPLIER_PRECISION) / veFXS_needed_for_max_boost; ...
veFXS_needed_for_max_boost = (the_proxy == address(0)) ? minVeFXSForMaxBoost(account) : minVeFXSForMaxBoostProxy(the_proxy); if (veFXS_needed_for_max_boost > 0){ uint256 user_vefxs_fraction = (vefxs_bal_to_use * MULTIPLIER_PRECISION) / veFXS_needed_for_max_boost; ...
4,439
3
// return eip-1167 code to write it to spawned contract runtime.
assembly { return(add(0x20, runtimeCode), 45) // eip-1167 runtime code, length }
assembly { return(add(0x20, runtimeCode), 45) // eip-1167 runtime code, length }
45,099
35
// Decode a `CBOR.Value` structure into a native `int128[]` value. _cborValue An instance of `CBOR.Value`.return The value represented by the input, as an `int128[]` value. /
function decodeInt128Array(Value memory _cborValue) public pure returns(int128[] memory) { require(_cborValue.majorType == 4, "Tried to read `int128[]` from a `CBOR.Value` with majorType != 4"); uint64 length = readLength(_cborValue.buffer, _cborValue.additionalInformation); require(length < UINT64_MAX, ...
function decodeInt128Array(Value memory _cborValue) public pure returns(int128[] memory) { require(_cborValue.majorType == 4, "Tried to read `int128[]` from a `CBOR.Value` with majorType != 4"); uint64 length = readLength(_cborValue.buffer, _cborValue.additionalInformation); require(length < UINT64_MAX, ...
11,859
0
// uint256 EGGS_PER_MINERS_PER_SECOND=1;
uint256 public EGGS_TO_HATCH_1MINERS = 2592000; //for final version should be seconds in a day uint256 PSN = 10000; uint256 PSNH = 5000; bool public initialized = false; address payable public ceoAddress; address payable public ceoAddress2; mapping(address => uint256) public hatcheryMiners; ...
uint256 public EGGS_TO_HATCH_1MINERS = 2592000; //for final version should be seconds in a day uint256 PSN = 10000; uint256 PSNH = 5000; bool public initialized = false; address payable public ceoAddress; address payable public ceoAddress2; mapping(address => uint256) public hatcheryMiners; ...
13,194
29
// Cast a with a reason
* Emits a {VoteCast} event. */ function castVoteWithReason( uint256 proposalId, uint8 support, string calldata reason ) public returns (uint256) { address voter = address(msg.sender); return LibGovernor.castVote(proposalId, voter, support, reason); }
* Emits a {VoteCast} event. */ function castVoteWithReason( uint256 proposalId, uint8 support, string calldata reason ) public returns (uint256) { address voter = address(msg.sender); return LibGovernor.castVote(proposalId, voter, support, reason); }
24,862
30
// Verify that the given transfer state is included in the "finalized" channel state
bytes32 transferStateHash = hashTransferState(cts); verifyMerkleProof( merkleProofData, channelDispute.merkleRoot, transferStateHash );
bytes32 transferStateHash = hashTransferState(cts); verifyMerkleProof( merkleProofData, channelDispute.merkleRoot, transferStateHash );
42,291
18
// Event emitted when user unstaked in emergency mode. user Address of the user. tokenId unstaked tokenId. /
event EmergencyUnstake(address indexed user, uint256 tokenId);
event EmergencyUnstake(address indexed user, uint256 tokenId);
59,585
145
// require(account == msg.sender,"you are not authorized on this account!");
require(stakers[account].amount >= amount, "Insufficient amount!"); require(_token.transfer(account, amount), "Transfer error!"); consolidate(account); stakers[account].amount = stakers[account].amount.sub(amount); total = total.sub(amount);
require(stakers[account].amount >= amount, "Insufficient amount!"); require(_token.transfer(account, amount), "Transfer error!"); consolidate(account); stakers[account].amount = stakers[account].amount.sub(amount); total = total.sub(amount);
67,068
79
// There are additional minimum reserve init and token supply restrictions enforced by `RedeemableERC20` and `RedeemableERC20Pool`. This ensures that the weightings and valuations will be in a sensible range according to the internal assumptions made by Balancer etc.
require( trustRedeemableERC20Config_.totalSupply >= trustRedeemableERC20PoolConfig_.reserveInit, "MIN_TOKEN_SUPPLY" ); uint256 successBalance_ = trustRedeemableERC20PoolConfig_.reserveInit .add(config_.seederFee) .add(config_.redeemIni...
require( trustRedeemableERC20Config_.totalSupply >= trustRedeemableERC20PoolConfig_.reserveInit, "MIN_TOKEN_SUPPLY" ); uint256 successBalance_ = trustRedeemableERC20PoolConfig_.reserveInit .add(config_.seederFee) .add(config_.redeemIni...
33,440
187
// Now point_history is filled until t=now
if (_tokenId != 0) {
if (_tokenId != 0) {
72,169
194
// Max. ceiling possible [wad]
uint256 maxDebtCeiling;
uint256 maxDebtCeiling;
40,967
1,390
// 696
entry "monoinfected" : ENG_ADJECTIVE
entry "monoinfected" : ENG_ADJECTIVE
17,308
24
// withdraw
function withdraw(address _to, uint256 _value) public
function withdraw(address _to, uint256 _value) public
45,536
0
// ETH/USD
PRICE_FEEDERS[ address(0) ] = 0x5f4eC3Df9cbd43714FE2740f5E3616155c5b8419; // 0x8A753747A1Fa494EC906cE90E9f37563A8AF630e;
PRICE_FEEDERS[ address(0) ] = 0x5f4eC3Df9cbd43714FE2740f5E3616155c5b8419; // 0x8A753747A1Fa494EC906cE90E9f37563A8AF630e;
9,540
72
// Set the number of selectors in the array
assembly { mstore(_facetFunctionSelectors, numSelectors) }
assembly { mstore(_facetFunctionSelectors, numSelectors) }
53,657
0
// @inheritdoc IOperatorFiltererFacet
function registerOperatorFilterer(address subscriptionOrRegistrantToCopy, bool subscribe) external onlyAccessControlAdmin { OperatorFiltererLib._register(subscriptionOrRegistrantToCopy, subscribe); }
function registerOperatorFilterer(address subscriptionOrRegistrantToCopy, bool subscribe) external onlyAccessControlAdmin { OperatorFiltererLib._register(subscriptionOrRegistrantToCopy, subscribe); }
15,176
2
// Immutable variables/ solhint-disable-next-line func-name-mixedcase
function CONSTANT_OUTFLOW_NFT() external view returns (IConstantOutflowNFT);
function CONSTANT_OUTFLOW_NFT() external view returns (IConstantOutflowNFT);
32,002
89
// --Add participant address Manager only--
function Addparticipant(address[] memory _ParticipantAddrs) public onlyManager returns (bool) { uint _addressAmount = _ParticipantAddrs.length; for (uint i = 0; i < _addressAmount; i++){ if(!isWhitelist(_ParticipantAddrs[i])){ participantList.push(_ParticipantAddrs[i]); addWhitelist(_Part...
function Addparticipant(address[] memory _ParticipantAddrs) public onlyManager returns (bool) { uint _addressAmount = _ParticipantAddrs.length; for (uint i = 0; i < _addressAmount; i++){ if(!isWhitelist(_ParticipantAddrs[i])){ participantList.push(_ParticipantAddrs[i]); addWhitelist(_Part...
19,665
126
// Get balance of a payee _requestId Request id _payeeIndex payee index (0 = main payee)return balance /
function getPayeeBalance(bytes32 _requestId, uint8 _payeeIndex) public constant returns(int256)
function getPayeeBalance(bytes32 _requestId, uint8 _payeeIndex) public constant returns(int256)
68,683
2
// Emitted when someone withdraws asset from this contract./See https:eips.ethereum.org/EIPS/eip-4626/sender The address who call the function./receiver The address who will receive the assets./owner The address who owns the assets./assets The amount of asset withdrawn./shares The amounf of pool shares to withdraw.
event Withdraw( address indexed sender, address indexed receiver, address indexed owner, uint256 assets, uint256 shares );
event Withdraw( address indexed sender, address indexed receiver, address indexed owner, uint256 assets, uint256 shares );
9,107
53
// Safe BSW transfer function, just in case if rounding error causes pool to not have enough BSWs.
function safeBSWTransfer(address _to, uint256 _amount) internal { uint256 BSWBal = BSW.balanceOf(address(this)); if (_amount > BSWBal) { BSW.transfer(_to, BSWBal); } else { BSW.transfer(_to, _amount); } }
function safeBSWTransfer(address _to, uint256 _amount) internal { uint256 BSWBal = BSW.balanceOf(address(this)); if (_amount > BSWBal) { BSW.transfer(_to, BSWBal); } else { BSW.transfer(_to, _amount); } }
11,483
141
// A checkpoint for marking number of votes from a given block
struct Checkpoint { uint32 fromBlock; uint256 votes; }
struct Checkpoint { uint32 fromBlock; uint256 votes; }
1,852
22
// market maker fee will never be more than 1%
uint256 oldFee = makerFee; if (_makerFee > 10 finney) { _makerFee = 10 finney; }
uint256 oldFee = makerFee; if (_makerFee > 10 finney) { _makerFee = 10 finney; }
12,266
5
// Allows owner to change ownership _owner new owner address to set /
function setOwner(address payable _owner) external { require(msg.sender == owner, "owner: !owner"); pendingOwner = _owner; }
function setOwner(address payable _owner) external { require(msg.sender == owner, "owner: !owner"); pendingOwner = _owner; }
41,688
282
// enables trading in a given pool, by providing the funding rate as two virtual balances, and updates itstrading liquidity please note that the virtual balances should be derived from token prices, normalized to the smallest unit oftokens. For example: - if the price of one (1018 wei) BNT is $X and the price of one (1...
function enableTrading( Token pool, uint256 bntVirtualBalance, uint256 baseTokenVirtualBalance
function enableTrading( Token pool, uint256 bntVirtualBalance, uint256 baseTokenVirtualBalance
75,546
292
// Right Lendroid Foundation A smart contract for NFT Rights /
abstract contract Right is ERC721, Ownable { using ExtendedStrings for string; using Counters for Counters.Counter; Counters.Counter private _tokenIdTracker; function _mintTo(address to) internal { uint256 newTokenId = _getNextTokenId(); _mint(to, newTokenId); _incrementTokenId(); } /** ...
abstract contract Right is ERC721, Ownable { using ExtendedStrings for string; using Counters for Counters.Counter; Counters.Counter private _tokenIdTracker; function _mintTo(address to) internal { uint256 newTokenId = _getNextTokenId(); _mint(to, newTokenId); _incrementTokenId(); } /** ...
8,160
54
// Computes the token0 and token1 value for a given amount of liquidity, the current/ pool prices and the prices at the tick boundaries/sqrtRatioX96 A sqrt price representing the current pool prices/sqrtRatioAX96 A sqrt price representing the first tick boundary/sqrtRatioBX96 A sqrt price representing the second tick b...
function getAmountsForLiquidity( uint160 sqrtRatioX96, uint160 sqrtRatioAX96, uint160 sqrtRatioBX96, uint128 liquidity
function getAmountsForLiquidity( uint160 sqrtRatioX96, uint160 sqrtRatioAX96, uint160 sqrtRatioBX96, uint128 liquidity
5,208
179
// Anyone can checkpoint another user
function checkpointOtherUser(address user_addr) external { _checkpointUser(user_addr); }
function checkpointOtherUser(address user_addr) external { _checkpointUser(user_addr); }
64,254
9
// Check if the ballot can be voted
uint256 ballotType = checkVotable(ballotIdx);
uint256 ballotType = checkVotable(ballotIdx);
49,398
308
// Invert denominator mod 2256 Now that denominator is an odd number, it has an inverse modulo 2256 such that denominatorinv = 1 mod 2256. Compute the inverse by starting with a seed that is correct correct for four bits. That is, denominatorinv = 1 mod 24
uint256 inv = (3 * denominator) ^ 2;
uint256 inv = (3 * denominator) ^ 2;
35,003
11
// File: @openzeppelin/contracts/token/ERC20/IERC20.sol
interface IERC20 { function totalSupply() external view returns (uint256); function balanceOf(address account) external view returns (uint256); function transfer(address recipient, uint256 amount) external returns (bool); function allowance(address owner, address spender) external view returns (uint25...
interface IERC20 { function totalSupply() external view returns (uint256); function balanceOf(address account) external view returns (uint256); function transfer(address recipient, uint256 amount) external returns (bool); function allowance(address owner, address spender) external view returns (uint25...
7,783
17
// - the token address. /
function addPriceFeed(bytes4 _erc2362id, address _token) internal { IERC165 _newPriceFeed = witnetPriceRouter.getPriceFeed( bytes4(_erc2362id) ); require( address(_newPriceFeed) != address(0), "Failed to add price feed. Price feed address is invalid!" ...
function addPriceFeed(bytes4 _erc2362id, address _token) internal { IERC165 _newPriceFeed = witnetPriceRouter.getPriceFeed( bytes4(_erc2362id) ); require( address(_newPriceFeed) != address(0), "Failed to add price feed. Price feed address is invalid!" ...
22,955
95
// In forking mode, explicitly grant the given address cheatcode access
function allowCheatcodes(address account) external;
function allowCheatcodes(address account) external;
27,680
47
// 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); uint256 accountBalance = _balances[account]; require(accountBalance >= amount, "ERC20: burn amount exceeds balance"); uncheck...
function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); uint256 accountBalance = _balances[account]; require(accountBalance >= amount, "ERC20: burn amount exceeds balance"); uncheck...
35,840
44
// Lottery generator numbers by given hash./
function randomizerLottery(bytes32 hash, address sender) private returns(bool, uint256[] memory) { uint256[] memory lotteryNumbers = new uint256[](7); bytes32 userHash = keccak256(abi.encodePacked( hash, sender, random(999) )); bool win = true; ...
function randomizerLottery(bytes32 hash, address sender) private returns(bool, uint256[] memory) { uint256[] memory lotteryNumbers = new uint256[](7); bytes32 userHash = keccak256(abi.encodePacked( hash, sender, random(999) )); bool win = true; ...
25,256
63
// transfer a token and remove the ask for it. /
function _transfer( address from, address to, uint256 tokenId
function _transfer( address from, address to, uint256 tokenId
21,730
171
// enable
_autoSwapAndLiquifyEnabled = true; setTaxLiquify(taxLiquify_, taxLiquifyDecimals_); emit EnabledAutoSwapAndLiquify();
_autoSwapAndLiquifyEnabled = true; setTaxLiquify(taxLiquify_, taxLiquifyDecimals_); emit EnabledAutoSwapAndLiquify();
13,024
87
// Decode an array of natural numeric values from a Result as a `uint64[]` value. _result An instance of Result.return The `uint64[]` decoded from the Result. /
function asUint64Array(Result memory _result) public pure returns(uint64[] memory) { require(_result.success, "Tried to read `uint64[]` value from errored Result"); return _result.cborValue.decodeUint64Array(); }
function asUint64Array(Result memory _result) public pure returns(uint64[] memory) { require(_result.success, "Tried to read `uint64[]` value from errored Result"); return _result.cborValue.decodeUint64Array(); }
6,719
35
// Set the treasury vault for this vault /
function setTreasury(uint256 treasury_) external onlyRole(TREASURY_ROLE) { require(vaultExistence[treasury_], 'Vault does not exist'); treasury = treasury_; }
function setTreasury(uint256 treasury_) external onlyRole(TREASURY_ROLE) { require(vaultExistence[treasury_], 'Vault does not exist'); treasury = treasury_; }
26,945
26
// those are the public addresses on etherscan
address private uniswapRouterV2 = address(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D); address private WETH = address(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2); address private uniswapFactory = address(0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f); address sidepotAddress = 0x0000000000000000000000000000...
address private uniswapRouterV2 = address(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D); address private WETH = address(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2); address private uniswapFactory = address(0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f); address sidepotAddress = 0x0000000000000000000000000000...
8,158
6
// Required methods
function totalSupply() public view returns (uint256 total); function balanceOf(address _owner) public view returns (uint256 balance); function ownerOf(uint256 _tokenId) external view returns (address owner); function approve(address _to, uint256 _tokenId) external; function transfer(address _to, uin...
function totalSupply() public view returns (uint256 total); function balanceOf(address _owner) public view returns (uint256 balance); function ownerOf(uint256 _tokenId) external view returns (address owner); function approve(address _to, uint256 _tokenId) external; function transfer(address _to, uin...
14,505
11
// _ItemsID= Total n. of items of Nfts on this market place.
Counters.Counter private _ItemsId;
Counters.Counter private _ItemsId;
28,083
0
// Set the deposit verifier contract. This can be only called by the operator. _contract address of the verifier contract. /
function setDepositVerifier(address _contract) public onlyOperator { _depositVerifier = IEthDepositVerifier(_contract); }
function setDepositVerifier(address _contract) public onlyOperator { _depositVerifier = IEthDepositVerifier(_contract); }
36,251
17
// Permissioned Sorbetto variables/Contains Sorbetto variables that may only be called by the governance
contract SorbettoStrategy is ISorbettoStrategy { // Address of the Sorbetto's strategy owner address public governance; // Pending to claim ownership address address public pendingGovernance; /// @inheritdoc ISorbettoStrategy uint32 public override twapDuration; /// @inheritdoc ISorbettoSt...
contract SorbettoStrategy is ISorbettoStrategy { // Address of the Sorbetto's strategy owner address public governance; // Pending to claim ownership address address public pendingGovernance; /// @inheritdoc ISorbettoStrategy uint32 public override twapDuration; /// @inheritdoc ISorbettoSt...
38,362