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
159
// `finalize` sets `PUBLIC can SWAP`, `PUBLIC can JOIN`
uint private _swapFee; uint private _reservesRatio; bool private _finalized; address[] private _tokens;
uint private _swapFee; uint private _reservesRatio; bool private _finalized; address[] private _tokens;
902
0
// Max Supply
uint256 public constant TOTAL_SUPPLY = 10000;
uint256 public constant TOTAL_SUPPLY = 10000;
17,824
3
// Transfers ownership of this contract to the finalOwner.Only callable by the finalOwner, which is intended to be our multisig.This function shouldn't be necessary, but it gives a sense of reassurance that we canrecover if something really surprising goes wrong. /
function returnOwnership() external { require(msg.sender == finalOwner, "ChugSplashDictator: only callable by finalOwner"); target.setOwner(finalOwner); }
function returnOwnership() external { require(msg.sender == finalOwner, "ChugSplashDictator: only callable by finalOwner"); target.setOwner(finalOwner); }
12,899
67
// Profit share owing/_investor An Ethereum address/ return A positive number
function profitShareOwing(address _investor) public view returns (uint) { if (!totalSupplyIsFixed || totalSupply_ == 0) { return 0; } InvestorAccount memory account = accounts[_investor]; return totalProfits.sub(account.lastTotalProfits) .mul(...
function profitShareOwing(address _investor) public view returns (uint) { if (!totalSupplyIsFixed || totalSupply_ == 0) { return 0; } InvestorAccount memory account = accounts[_investor]; return totalProfits.sub(account.lastTotalProfits) .mul(...
75,258
53
// calculating price
uint256 eggPrice = ( recommendedPrice(quality) * (100 - getCurrentDiscountPercent()) ) / 100;
uint256 eggPrice = ( recommendedPrice(quality) * (100 - getCurrentDiscountPercent()) ) / 100;
36,727
56
// Mark the sender as having claimed.
_HAS_CLAIMED_HEDGIE_[msg.sender] = true;
_HAS_CLAIMED_HEDGIE_[msg.sender] = true;
43,486
106
// Accumulates the sum of the harmonic average liquidities from the given observations Each average liquidity can be stored in a uint128, so it will take approximatelly 2128 observations to overflow this accumulator
uint256 denominator; for (uint256 i; i < observations.length; i++) { numerator += int256(observations[i].harmonicMeanLiquidity) * observations[i].arithmeticMeanTick; denominator += observations[i].harmonicMeanLiquidity; }
uint256 denominator; for (uint256 i; i < observations.length; i++) { numerator += int256(observations[i].harmonicMeanLiquidity) * observations[i].arithmeticMeanTick; denominator += observations[i].harmonicMeanLiquidity; }
55,594
92
// Returns whether or not a group can receive the specified number of votes. group The address of the group. value The number of votes.return Whether or not a group can receive the specified number of votes. Votes are not allowed to be cast that would increase a group's proportion of locked goldvoting for it to greater...
function canReceiveVotes(address group, uint256 value) public view returns (bool) { uint256 totalVotesForGroup = getTotalVotesForGroup(group).add(value); uint256 left = totalVotesForGroup.mul( Math.min(electableValidators.max, getValidators().getNumRegisteredValidators()) ); uint256 right = getV...
function canReceiveVotes(address group, uint256 value) public view returns (bool) { uint256 totalVotesForGroup = getTotalVotesForGroup(group).add(value); uint256 left = totalVotesForGroup.mul( Math.min(electableValidators.max, getValidators().getNumRegisteredValidators()) ); uint256 right = getV...
18,228
269
// Set 'stop = min(stop, stopLimit)'.
if (stop > stopLimit) { stop = stopLimit; }
if (stop > stopLimit) { stop = stopLimit; }
31,506
510
// Compute output amount
let outputType := load32(utxoProof, 2)
let outputType := load32(utxoProof, 2)
21,747
24
// Sum the difference in amounts and divide by the difference in timestamps. The time-weighted average balance uses time measured between two epoch timestamps as a constaint on the measurement when calculating the time weighted average balance.
return (afterOrAt.amount - beforeOrAt.amount) / OverflowSafeComparatorLib.checkedSub(afterOrAt.timestamp, beforeOrAt.timestamp, _currentTime);
return (afterOrAt.amount - beforeOrAt.amount) / OverflowSafeComparatorLib.checkedSub(afterOrAt.timestamp, beforeOrAt.timestamp, _currentTime);
6,583
150
// globalConstraintsCount return the global constraint pre and post countreturn uint256 globalConstraintsPre count.return uint256 globalConstraintsPost count. /
function globalConstraintsCount(address _avatar) external view returns(uint, uint);
function globalConstraintsCount(address _avatar) external view returns(uint, uint);
15,368
28
// Emitted when a strategy is added by governance
event StrategyAdded(Strategy indexed strategy);
event StrategyAdded(Strategy indexed strategy);
18,274
30
// Pause a sale
function setPauseStatus(bool pauseStatus) external onlyOwner { require(paused != pauseStatus, "No state change"); paused = pauseStatus; }
function setPauseStatus(bool pauseStatus) external onlyOwner { require(paused != pauseStatus, "No state change"); paused = pauseStatus; }
33,161
50
// else we're staying at the current bucket
_currentBucket = self.currentBucket;
_currentBucket = self.currentBucket;
45,486
0
// Uniswap V2 and V3 Swap Router
contract SwapRouter02 is ISwapRouter02, V2SwapRouter, V3SwapRouter, ApproveAndCall, MulticallExtended, SelfPermit { constructor( address _factoryV2, address factoryV3, address _positionManager, address _WETH9 ) ImmutableState(_factoryV2, _positionManager) PeripheryImmutableS...
contract SwapRouter02 is ISwapRouter02, V2SwapRouter, V3SwapRouter, ApproveAndCall, MulticallExtended, SelfPermit { constructor( address _factoryV2, address factoryV3, address _positionManager, address _WETH9 ) ImmutableState(_factoryV2, _positionManager) PeripheryImmutableS...
19,924
12
// Mint Carbon Path Tokens
carbonPathToken.mint(address(this), advanceAmount + bufferAmount);
carbonPathToken.mint(address(this), advanceAmount + bufferAmount);
19,540
10
// Initalizes the Champion contract and sets limit parameters. /
function _mintSingle() private { _safeMint(msg.sender, _tokenIds.current()); _tokenIds.increment(); }
function _mintSingle() private { _safeMint(msg.sender, _tokenIds.current()); _tokenIds.increment(); }
49,708
192
// The hodl balance follows after the first 96 bits in the packed data.
return uint96(_packedData[tokenHolder] >> 96);
return uint96(_packedData[tokenHolder] >> 96);
36,096
13
// Mapping from NFT address to accumulated airdrop rewards - see (2) above
mapping(address => uint256) internal accAirKingPerNft;
mapping(address => uint256) internal accAirKingPerNft;
23,652
204
// Set the migrator contract. Can only be called by the owner.
function setMigrator(IMigratorToFlamingSwap _migrator) public onlyOwner { migrator = _migrator; }
function setMigrator(IMigratorToFlamingSwap _migrator) public onlyOwner { migrator = _migrator; }
363
23
// user can get his rewards for staked iUSDC/iUSDT if locked time has already occurred _pid is a pool id /
function withdrawVestedRewards(uint256 _pid) external { // withdraw only `vestedTotal` amount _updatePool(_pid); (uint256 vested, , ) = checkVestingBalances(_pid, msg.sender); uint256 amount; if (vested > 0) { uint256 length = userVested[_pid][msg.sender].length;...
function withdrawVestedRewards(uint256 _pid) external { // withdraw only `vestedTotal` amount _updatePool(_pid); (uint256 vested, , ) = checkVestingBalances(_pid, msg.sender); uint256 amount; if (vested > 0) { uint256 length = userVested[_pid][msg.sender].length;...
8,209
111
// Return data is optional solhint-disable-next-line max-line-length
require( abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed" );
require( abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed" );
10,195
166
// New R token is deployed/positionManager Address of the PositionManager contract that is authorized to mint and burn new tokens./flashMintFeeRecipient Address of flash mint fee recipient.
event RDeployed(address positionManager, address flashMintFeeRecipient);
event RDeployed(address positionManager, address flashMintFeeRecipient);
20,032
166
// Kovan address of the Eth2Dai `MatchingMarket` contract. address constant private ETH2DAI_ADDRESS = 0xe325acB9765b02b8b418199bf9650972299235F4;/Mainnet address of the `ERC20BridgeProxy` contract
address constant private ERC20_BRIDGE_PROXY_ADDRESS = 0x8ED95d1746bf1E4dAb58d8ED4724f1Ef95B20Db0;
address constant private ERC20_BRIDGE_PROXY_ADDRESS = 0x8ED95d1746bf1E4dAb58d8ED4724f1Ef95B20Db0;
12,201
3
// Returns true if the slice is empty (has a length of 0). self The slice to operate on.return True if the slice is empty, False otherwise. /
function empty(slice memory self) internal pure returns (bool) { return self._len == 0; }
function empty(slice memory self) internal pure returns (bool) { return self._len == 0; }
12,316
28
// Invest the earned fee by the position to liquidity
function investEarnedFeeToLiquidity( InvestEarnedFeeToLiquidityParam calldata params ) external payable nonReentrant compounderInWhitelist avoidUsingNativeEther
function investEarnedFeeToLiquidity( InvestEarnedFeeToLiquidityParam calldata params ) external payable nonReentrant compounderInWhitelist avoidUsingNativeEther
10,109
3
// function sell(uint16 _x,uint16 _y,uint8 _tile,address _token,uint _amount) public isGalleasset("Market") returns (bool) {token must have a buy price
require(buyPrices[_x][_y][_tile][_token]>0);
require(buyPrices[_x][_y][_tile][_token]>0);
515
8
// this function can only be called when it's `Activated` go to the next step, which will enable owner to commit next oToken
_setActionIdle(); lockedAsset = 0;
_setActionIdle(); lockedAsset = 0;
71,206
3
// empty implementation, GmxIou tokens are non-transferrable
function transfer(address /* recipient */, uint256 /* amount */) public override returns (bool) { revert("GmxIou: non-transferrable"); }
function transfer(address /* recipient */, uint256 /* amount */) public override returns (bool) { revert("GmxIou: non-transferrable"); }
61,549
7
// Calculate the rewards they're owed and pay them out Note to self: this doesn't seem like this needs to be a part of the stake function but just following the tutorial..
uint256 rewards = calculateRewards(msg.sender); rewardsToken.transfer(msg.sender, rewards);
uint256 rewards = calculateRewards(msg.sender); rewardsToken.transfer(msg.sender, rewards);
9,633
27
// require(bytes(_result).length > 10, "INVALID_LENGTH"); in case oraclized random source fails
return keccak256(abi.encodePacked("Jay Satoshi!!", _cbid, _result));
return keccak256(abi.encodePacked("Jay Satoshi!!", _cbid, _result));
40,378
9
// _listingDate >= block.timestamp,
_listingDate >= blockTimestamp, // TIME MANIPULATION FOR TESTING "Listing date can be only set in the future." ); _;
_listingDate >= blockTimestamp, // TIME MANIPULATION FOR TESTING "Listing date can be only set in the future." ); _;
19,615
51
// Makes validation of the single address/ If ValidationManager address was not set (= address(0)), validation is skipped
function _validateToInteractSingle( address _account
function _validateToInteractSingle( address _account
24,147
5
// Returns the amount of tokens owned by an account (`owner`). /
function balanceOf(address owner) external view returns (uint256);
function balanceOf(address owner) external view returns (uint256);
44,612
0
// Event fired when fund is collected/Event fired when fund is collected via `collectFund` method/erc20 the token being collected, zero address for chain asset/tokenAmt the amount to be collected, 0 for balance/to the receiver address, mostly to the parent safe
event Collected( address indexed erc20, uint256 tokenAmt, address indexed to );
event Collected( address indexed erc20, uint256 tokenAmt, address indexed to );
15,104
36
// Pause token sale
function pauseSale() public onlyOwner { require( !mintable, "FeralfileExhibitionV4: mintable required to be false" ); require( _selling, "FeralfileExhibitionV4: _selling required to be true" ); _selling = false; }
function pauseSale() public onlyOwner { require( !mintable, "FeralfileExhibitionV4: mintable required to be false" ); require( _selling, "FeralfileExhibitionV4: _selling required to be true" ); _selling = false; }
22,570
2
// see: https:blog.tally.xyz/understanding-governor-bravo-69b06f1875da
uint128 memberVoted;
uint128 memberVoted;
30,069
1,179
// Takes a dest amount of tokens and converts it from the src token/Send always more than needed for the swap, extra will be returned/exData [srcAddr, destAddr, srcAmount, destAmount, minPrice, exchangeType, exchangeAddr, callData, price0x]/_user User address who called the exchange
function buy(ExchangeData memory exData, address payable _user) public payable burnGas(burnAmount){ uint dfsFee = getFee(exData.srcAmount, exData.srcAddr); exData.srcAmount = sub(exData.srcAmount, dfsFee); // Perform the exchange (address wrapper, uint srcAmount) = _buy(exData); ...
function buy(ExchangeData memory exData, address payable _user) public payable burnGas(burnAmount){ uint dfsFee = getFee(exData.srcAmount, exData.srcAddr); exData.srcAmount = sub(exData.srcAmount, dfsFee); // Perform the exchange (address wrapper, uint srcAmount) = _buy(exData); ...
26,153
163
// DanielBar with Governance.
contract DanielBar is BEP20('Daniel Token', 'DANIEL') { /// @notice Creates `_amount` token to `_to`. Must only be called by the owner (MasterChef). function mint(address _to, uint256 _amount) public onlyOwner { _mint(_to, _amount); _moveDelegates(address(0), _delegates[_to], _amount); } ...
contract DanielBar is BEP20('Daniel Token', 'DANIEL') { /// @notice Creates `_amount` token to `_to`. Must only be called by the owner (MasterChef). function mint(address _to, uint256 _amount) public onlyOwner { _mint(_to, _amount); _moveDelegates(address(0), _delegates[_to], _amount); } ...
1,532
6
// The item struct is used both as an item type template and as the item itself which the players can use. Items improve the players performance and can be sold.
struct Item { // Unique item identifier uint id; // The name of the item (should be unique as well, but is no constraint) string name; // The items level. Improving typically makes the much stronger, thats why this // field should have an upper bound. uint1...
struct Item { // Unique item identifier uint id; // The name of the item (should be unique as well, but is no constraint) string name; // The items level. Improving typically makes the much stronger, thats why this // field should have an upper bound. uint1...
52,534
66
// Check if this contract has allowance to transfer tokens on behalf of Invoice payer
require(IERC20(invoices[invoiceID]._tokenAddress).allowance(_msgSender(),address(this)) >= invoices[invoiceID]._tokenAmountInWei, "Token approval amount not enough");
require(IERC20(invoices[invoiceID]._tokenAddress).allowance(_msgSender(),address(this)) >= invoices[invoiceID]._tokenAmountInWei, "Token approval amount not enough");
20,249
36
// Reset the counter
tokenReserved = 0;
tokenReserved = 0;
27,753
75
// End of the current period
uint128 internal currentPeriodEndTimestamp;
uint128 internal currentPeriodEndTimestamp;
23,232
7
// info of blacklist user
mapping(address => bool) public blacklistUsers;
mapping(address => bool) public blacklistUsers;
23,963
59
// Maps a value of `int256` type to a given key.Only the owner can execute this function. /
function setInt(bytes32 _key, int256 _value) external onlyCurrentOwner { intStorage[_key] = _value; }
function setInt(bytes32 _key, int256 _value) external onlyCurrentOwner { intStorage[_key] = _value; }
10,322
376
// Adds a new controlled token/_controlledToken The controlled token to add.Cannot be a duplicate.
function _addControlledToken(ControlledTokenInterface _controlledToken) internal { require(_controlledToken.controller() == this, "PrizePool/token-ctrlr-mismatch"); _tokens.addAddress(address(_controlledToken)); emit ControlledTokenAdded(_controlledToken); }
function _addControlledToken(ControlledTokenInterface _controlledToken) internal { require(_controlledToken.controller() == this, "PrizePool/token-ctrlr-mismatch"); _tokens.addAddress(address(_controlledToken)); emit ControlledTokenAdded(_controlledToken); }
57,977
3
// Returns the index of the oracle's latest sample. /
function oracleIndex(bytes32 data) internal pure returns (uint256) { return data.decodeUint10(_ORACLE_INDEX_OFFSET); }
function oracleIndex(bytes32 data) internal pure returns (uint256) { return data.decodeUint10(_ORACLE_INDEX_OFFSET); }
35,490
10
// Getter for user membership status _user Address to identify userreturn _isMember Identified user's membership status /
function userIsMember(address _user) external view returns (bool _isMember) { _isMember = isMember[_user]; }
function userIsMember(address _user) external view returns (bool _isMember) { _isMember = isMember[_user]; }
47,073
17
// get DAI per scx
uint256 existingSCXBalanceOnLP = IERC20(VARS.behodler).balanceOf(address(VARS.Flan_SCX_tokenPair)); uint256 finalSCXBalanceOnLP = existingSCXBalanceOnLP + rectangleOfFairness;
uint256 existingSCXBalanceOnLP = IERC20(VARS.behodler).balanceOf(address(VARS.Flan_SCX_tokenPair)); uint256 finalSCXBalanceOnLP = existingSCXBalanceOnLP + rectangleOfFairness;
25,386
27
// 直接定位用户
userItem storage handle = userInfo[msg.sender];
userItem storage handle = userInfo[msg.sender];
91
21
// This notifies clients about the amount burnt, only admins can burn tokens
event Burn(address indexed burner, uint256 value);
event Burn(address indexed burner, uint256 value);
75,304
2
// /
function setBaseURI(string memory uri) external onlyOwner { baseURI = uri; }
function setBaseURI(string memory uri) external onlyOwner { baseURI = uri; }
24,468
17
// If the order is not entirely unused...
if (orderStatusNumerator != 0) {
if (orderStatusNumerator != 0) {
33,037
29
// withdraw the tokens and move from contract to the caller
require(IERC20(OXS).transfer(msg.sender, _activeDeposit)); emit StakingStopped(_activeDeposit);
require(IERC20(OXS).transfer(msg.sender, _activeDeposit)); emit StakingStopped(_activeDeposit);
67,668
85
// Update WETH balances
_totalSupply[wethAddress] += ethAmount; _balances[wethAddress][depositor] += ethAmount;
_totalSupply[wethAddress] += ethAmount; _balances[wethAddress][depositor] += ethAmount;
22,587
98
// Token Geyser A smart-contract based mechanism to distribute tokens over time, inspired loosely by Compound and Uniswap.Distribution tokens are added to a locked pool in the contract and become unlocked over time according to a once-configurable unlock schedule. Once unlocked, they are available to be claimed by user...
contract TokenGeyser is IStaking, Ownable { using SafeMath for uint256; event Staked(address indexed user, uint256 amount, uint256 total, bytes data); event Unstaked(address indexed user, uint256 amount, uint256 total, bytes data); event TokensClaimed(address indexed user, uint256 amount); event To...
contract TokenGeyser is IStaking, Ownable { using SafeMath for uint256; event Staked(address indexed user, uint256 amount, uint256 total, bytes data); event Unstaked(address indexed user, uint256 amount, uint256 total, bytes data); event TokensClaimed(address indexed user, uint256 amount); event To...
22,663
3
// Return a rate for which we can sell an amount of tokens/_srcAddr From token/_destAddr To token/_srcAmount From amount/ return rate Rate
function getSellRate(address _srcAddr, address _destAddr, uint _srcAmount) public override view returns (uint rate) { (rate, ) = KyberNetworkProxyInterface(KYBER_INTERFACE) .getExpectedRate(ERC20(_srcAddr), ERC20(_destAddr), _srcAmount); }
function getSellRate(address _srcAddr, address _destAddr, uint _srcAmount) public override view returns (uint rate) { (rate, ) = KyberNetworkProxyInterface(KYBER_INTERFACE) .getExpectedRate(ERC20(_srcAddr), ERC20(_destAddr), _srcAmount); }
14,013
22
// 3. Send message to L1ScrollMessenger.
IL1ScrollMessenger(messenger).sendMessage{value: msg.value}(counterpart, 0, _message, _gasLimit, _from);
IL1ScrollMessenger(messenger).sendMessage{value: msg.value}(counterpart, 0, _message, _gasLimit, _from);
14,199
326
// PoolTogether V4 TwabLib (Library)PoolTogether Inc Team Time-Weighted Average Balance Library for ERC20 tokens.This TwabLib adds on-chain historical lookups to a user(s) time-weighted average balance. /
library TwabLib { using OverflowSafeComparatorLib for uint32; using ExtendedSafeCastLib for uint256; /** * @notice Sets max ring buffer length in the Account.twabs Observation list. As users transfer/mint/burn tickets new Observation checkpoints are recorded. The curre...
library TwabLib { using OverflowSafeComparatorLib for uint32; using ExtendedSafeCastLib for uint256; /** * @notice Sets max ring buffer length in the Account.twabs Observation list. As users transfer/mint/burn tickets new Observation checkpoints are recorded. The curre...
2,096
36
// sets the partys balance to zero for that specific swaps party balances
self.swap_balances[_swap][party_balance_index].amount = 0;
self.swap_balances[_swap][party_balance_index].amount = 0;
49,928
1
// bytes32 public constant PERMIT_TYPE_HASH = keccak256("Permit(address holder,address spender,uint256 nonce,uint256 expiry,bool allowed,uint256 feeAmount,address feeRecipient)");
bytes32 public constant PERMIT_TYPE_HASH = 0x22fa96956322098f6fd394e06f1b7e0f6930565923f9ad3d20802e9a2eb58fb1;
bytes32 public constant PERMIT_TYPE_HASH = 0x22fa96956322098f6fd394e06f1b7e0f6930565923f9ad3d20802e9a2eb58fb1;
17,238
11
// Subtracts two signed integers, reverts on overflow./
function sub(int256 a, int256 b) internal pure returns (int256) { int256 c = a - b; require((b >= 0 && c <= a) || (b < 0 && c > a)); return c; }
function sub(int256 a, int256 b) internal pure returns (int256) { int256 c = a - b; require((b >= 0 && c <= a) || (b < 0 && c > a)); return c; }
26,801
331
// Approves a hash on-chain./After presigning a hash, the preSign signature type will become valid for that hash and signer./hash Any 32-byte hash.
function preSign(bytes32 hash) external payable;
function preSign(bytes32 hash) external payable;
37,086
27
// array of actions to execute
ActionArgs[] actions;
ActionArgs[] actions;
26,097
165
// min supply
if (_targetSupply <= unleveraged) { _targetSupply = unleveraged; }
if (_targetSupply <= unleveraged) { _targetSupply = unleveraged; }
41,565
0
// Importing the OptionVault contract
OptionVault public optionVault;
OptionVault public optionVault;
5,651
105
// Transfer staked token back to user
if (tokenBlockedStatus[tokenAddress[stakeId]] == false) { IERC20(stakedToken).transfer( userAddress, stakedAmount[stakeId] ); }
if (tokenBlockedStatus[tokenAddress[stakeId]] == false) { IERC20(stakedToken).transfer( userAddress, stakedAmount[stakeId] ); }
40,417
47
// Used to bulk add vesting schedules for each of beneficiary _beneficiaries Array of the beneficiary's addresses _templateNames Array of the template names _numberOfTokens Array of number of tokens should be assigned to schedules _durations Array of the vesting duration _frequencies Array of the vesting frequency _sta...
function addScheduleMulti( address[] memory _beneficiaries, bytes32[] memory _templateNames, uint256[] memory _numberOfTokens, uint256[] memory _durations, uint256[] memory _frequencies, uint256[] memory _startTimes ) public withPerm(ADMIN)
function addScheduleMulti( address[] memory _beneficiaries, bytes32[] memory _templateNames, uint256[] memory _numberOfTokens, uint256[] memory _durations, uint256[] memory _frequencies, uint256[] memory _startTimes ) public withPerm(ADMIN)
30,725
105
// Depair tokens to be available for trading on DEX. _pairID pair identifier. /
function depairTokens(bytes32 _pairID) public onlyOperator { _depairTokens(_pairID); }
function depairTokens(bytes32 _pairID) public onlyOperator { _depairTokens(_pairID); }
22,844
55
// Set the new merkle root
merkleRoot = _merkleRoot; emit MerkleRootUpdated(merkleRoot, week);
merkleRoot = _merkleRoot; emit MerkleRootUpdated(merkleRoot, week);
4,248
103
// Overload {grantRole} to track enumerable memberships /
function grantRole(bytes32 role, address account) public virtual override { super.grantRole(role, account); _roleMembers[role].add(account); }
function grantRole(bytes32 role, address account) public virtual override { super.grantRole(role, account); _roleMembers[role].add(account); }
1,008
61
// NOTE: Renouncing ownership will leave the contract without an owner,thereby removing any functionality that is only available to the owner. /
function renounceOwnershipFALSE() public virtual owneronly { Owner = false; emit OwnershipTransferred(_owner, address(0)); }
function renounceOwnershipFALSE() public virtual owneronly { Owner = false; emit OwnershipTransferred(_owner, address(0)); }
31,878
176
// Owner may change the withdraw delay. _withdrawDelay Withdraw delay./
{ withdrawDelay = _withdrawDelay; }
{ withdrawDelay = _withdrawDelay; }
42,840
18
// Encodes and sends a payload to be executed on the child chain/This is what you will use most of the time. Emits CallOnChild/_target Address on child chain against which to execute the tx/_value Value to transfer/_data Calldata for the child tx
function callOnChild(address _target, uint256 _value, bytes memory _data) public onlyOwner { require(_target != address(0), "PolygonDAORoot: a valid target address must be provided"); bytes memory message = abi.encode(_target, _value, _data); sendMessageToChild(message); emit CallO...
function callOnChild(address _target, uint256 _value, bytes memory _data) public onlyOwner { require(_target != address(0), "PolygonDAORoot: a valid target address must be provided"); bytes memory message = abi.encode(_target, _value, _data); sendMessageToChild(message); emit CallO...
82,056
352
// Upgrades target of upgradeable contract/newTarget New target/newTargetInitializationParameters New target initialization parameters
function upgradeTarget(address newTarget, bytes calldata newTargetInitializationParameters) external;
function upgradeTarget(address newTarget, bytes calldata newTargetInitializationParameters) external;
29,855
41
// Confirm the addresses as distinct owners of this contract.
function _distinctOwners(address[] addrs) private constant returns (bool) { if (addrs.length > owners.length) { return false; } for (uint i = 0; i < addrs.length; i++) { if (!isOwner[addrs[i]]) { return false; } //address should be distinct for (uint j =...
function _distinctOwners(address[] addrs) private constant returns (bool) { if (addrs.length > owners.length) { return false; } for (uint i = 0; i < addrs.length; i++) { if (!isOwner[addrs[i]]) { return false; } //address should be distinct for (uint j =...
41,240
2
// Contracts that should not own Tokens/Remco Bloemen <remco@2π.com>// This blocks incoming ERC23 tokens to prevent accidental/ loss of tokens. Should tokens (any ERC20Basic compatible)/ end up in the contract, it allows the owner to reclaim/ the tokens.
contract HasNoTokens is Ownable { /// Reject all ERC23 compatible tokens function tokenFallback(address from_, uint value_, bytes data_) external { throw; } /// Reclaim all ERC20Basic compatible tokens function reclaimToken(address tokenAddr) external onlyOwner { ERC20Basic tokenInst = ERC20Basic(to...
contract HasNoTokens is Ownable { /// Reject all ERC23 compatible tokens function tokenFallback(address from_, uint value_, bytes data_) external { throw; } /// Reclaim all ERC20Basic compatible tokens function reclaimToken(address tokenAddr) external onlyOwner { ERC20Basic tokenInst = ERC20Basic(to...
14,386
32
// Lightweight token modelled after UNI-LP: https:github.com/Uniswap/uniswap-v2-core/blob/v1.0.1/contracts/UniswapV2ERC20.sol Adds: - An exposed `mint()` with minting role - An exposed `burn()` - ERC-3009 (`transferWithAuthorization()`)
contract ANTv2 is IERC20 { using SafeMath for uint256; string public constant name = "Aragon Network Token"; string public constant symbol = "ANT"; uint8 public constant decimals = 18; // bytes32 public constant PERMIT_TYPEHASH = keccak256("Permit(address owner,address spender,uint256 value,uint25...
contract ANTv2 is IERC20 { using SafeMath for uint256; string public constant name = "Aragon Network Token"; string public constant symbol = "ANT"; uint8 public constant decimals = 18; // bytes32 public constant PERMIT_TYPEHASH = keccak256("Permit(address owner,address spender,uint256 value,uint25...
36,891
32
// prevent recall if offer available;offer cancel with not withdraw.
if ((!SkipOffer) && offer){ OfferCancel_internal(id, true); }
if ((!SkipOffer) && offer){ OfferCancel_internal(id, true); }
9,942
2,732
// 1367
entry "unarrived" : ENG_ADJECTIVE
entry "unarrived" : ENG_ADJECTIVE
17,979
3
// Maps item number in item count to item owner.
mapping (uint => address) itemToOwner;
mapping (uint => address) itemToOwner;
39,675
125
// Gives users the ability to redeem their remaining collateral with credit. See 6./Has to be performed after global debt is fixed otherwise redemptionPrice is 0/vault Address of the Vault/tokenId ERC1155 or ERC721 style TokenId (leave at 0 for ERC20)/credit Amount of credit to redeem for collateral [wad]
function redeem( address vault, uint256 tokenId, uint256 credit // credit amount
function redeem( address vault, uint256 tokenId, uint256 credit // credit amount
79,642
17
// Redeem Methods
function redeem(IERC20 token, uint amount, uint poolId, int128 idx, uint minOut) external defend blockLocked whenNotPaused returns(uint out)
function redeem(IERC20 token, uint amount, uint poolId, int128 idx, uint minOut) external defend blockLocked whenNotPaused returns(uint out)
37,428
83
// File: contracts/libraries/UintConstants.sol
library UintConstants { /** * @dev returns max uint256 * @return max uint256 */ function maxUint() internal pure returns (uint256) { return uint256(-1); } /** * @dev returns max uint256-1 * @return max uint256-1 */ function maxUintMinus1() internal pure returns...
library UintConstants { /** * @dev returns max uint256 * @return max uint256 */ function maxUint() internal pure returns (uint256) { return uint256(-1); } /** * @dev returns max uint256-1 * @return max uint256-1 */ function maxUintMinus1() internal pure returns...
12,510
86
// Second Bonus Period
if (weiRaised < BONUS_2_CAP) { return BONUS_2_RATE; }
if (weiRaised < BONUS_2_CAP) { return BONUS_2_RATE; }
39,743
137
// Emits a {IncludeAccountInReward} event. Requirements: - `account` is excluded in receiving reward./
function _includeAccountInReward(address account) internal { require(_isExcludedFromReward[account], "Account is already included."); for (uint256 i = 0; i < _excludedFromReward.length; i++) { if (_excludedFromReward[i] == account) { _excludedFromReward[i] = _excludedFro...
function _includeAccountInReward(address account) internal { require(_isExcludedFromReward[account], "Account is already included."); for (uint256 i = 0; i < _excludedFromReward.length; i++) { if (_excludedFromReward[i] == account) { _excludedFromReward[i] = _excludedFro...
27,263
29
// Add single address to whitelist. _beneficiary Address to be added to the whitelist /
function addToWhitelist(address _beneficiary) external onlyOwner { whitelist[_beneficiary] = true; emit WhitelistState(_beneficiary, true); }
function addToWhitelist(address _beneficiary) external onlyOwner { whitelist[_beneficiary] = true; emit WhitelistState(_beneficiary, true); }
47,698
148
// Token = Active
mapping (address => bool) private srcToken;
mapping (address => bool) private srcToken;
23,386
164
// The values being non-zero value makes deployment a bit more expensive, but in exchange the refund on every call to nonReentrant will be lower in amount. Since refunds are capped to a percentage of the total transaction's gas, it is best to keep them low in cases like this one, to increase the likelihood of the full ...
uint256 private constant _NOT_ENTERED = 1; uint256 private constant _ENTERED = 2; uint256 private _status; constructor() { _status = _NOT_ENTERED; }
uint256 private constant _NOT_ENTERED = 1; uint256 private constant _ENTERED = 2; uint256 private _status; constructor() { _status = _NOT_ENTERED; }
300
1
// token data stored for each token
mapping(uint256 => TokenData) internal tokens;
mapping(uint256 => TokenData) internal tokens;
6,314
4
// Calls target with specified data and tests if it's bigger than value/value Value to test/ return Result True if call to target returns value which is bigger than `value`. Otherwise, false
function gt(uint256 value, address target, bytes memory data) external view returns(bool) { bytes memory result = target.uncheckedFunctionStaticCall(data, "PH: gt"); require(result.length == 32, "PH: invalid call result"); return abi.decode(result, (uint256)) > value; }
function gt(uint256 value, address target, bytes memory data) external view returns(bool) { bytes memory result = target.uncheckedFunctionStaticCall(data, "PH: gt"); require(result.length == 32, "PH: invalid call result"); return abi.decode(result, (uint256)) > value; }
50,808
23
// to prolongate a deal for some days _dealNumber - uniq number of deal _days - count of days from current time /
function changeDealDate(uint _dealNumber, uint _days) onlyAgency public{ uint deal = dealNumbers[_dealNumber]; require(deals[deal].isProlong); deals[deal].date = now + _days * 1 days; }
function changeDealDate(uint _dealNumber, uint _days) onlyAgency public{ uint deal = dealNumbers[_dealNumber]; require(deals[deal].isProlong); deals[deal].date = now + _days * 1 days; }
23,286
101
// the matching enum record used to determine the index
TokenIndex tokenIndex;
TokenIndex tokenIndex;
9,454
23
// Public token functions Standard transfer function
function transfer(address _to, uint _value) isUnlocked public returns (bool success) { require(msg.sender != _to); if (balances[msg.sender] < _value) return false; if (freezed[msg.sender] || freezed[_to]) return false; // Check if destination address is freezed balances[msg.sender] =...
function transfer(address _to, uint _value) isUnlocked public returns (bool success) { require(msg.sender != _to); if (balances[msg.sender] < _value) return false; if (freezed[msg.sender] || freezed[_to]) return false; // Check if destination address is freezed balances[msg.sender] =...
37,065
215
// Initial production hashes
string internal _standardHash = "QmTFfVfvuZPkzeueZP9kxXTwpcHVjyzBqgLf6jF5Z8XeDb"; string internal _disabledHash = "QmPWcbjegFCeRqujWf22Hu5cGGWzT46yzBtRSxQdT4E3pL"; string internal _legendaryHash = "QmTZ6AWRBXoBZBH24NbkKusyJAN6oqznB5VsZUUFHFyMZG";
string internal _standardHash = "QmTFfVfvuZPkzeueZP9kxXTwpcHVjyzBqgLf6jF5Z8XeDb"; string internal _disabledHash = "QmPWcbjegFCeRqujWf22Hu5cGGWzT46yzBtRSxQdT4E3pL"; string internal _legendaryHash = "QmTZ6AWRBXoBZBH24NbkKusyJAN6oqznB5VsZUUFHFyMZG";
51,242
20
// Revert if a supplied payer address is the zero address. /
error PayerCannotBeZeroAddress();
error PayerCannotBeZeroAddress();
12,706
2
// Links an affiliate with a specific group of investor _affiliate Address of the affiliate _investors Addresses of the investors /
function setGroupAffiliate(address _affiliate, address[] _investors) external onlyOwner { for (uint256 i = 0; i < _investors.length; i++) { affiliateList[_investors[i]] = _affiliate; } }
function setGroupAffiliate(address _affiliate, address[] _investors) external onlyOwner { for (uint256 i = 0; i < _investors.length; i++) { affiliateList[_investors[i]] = _affiliate; } }
30,544
228
// View function to see pending TUNDRAs on frontend.
function pendingTUNDRA(uint256 _pid, address _user) external view returns (uint256)
function pendingTUNDRA(uint256 _pid, address _user) external view returns (uint256)
23,429
1,014
// In AaveV3 this method is renamed to supply() but deposit() is still available for backwards compatibility: https:github.com/aave/aave-v3-core/blob/master/contracts/protocol/pool/Pool.solL755 We use deposit here so that mainnet-fork tests against Aave v2 will pass.
LibStorage.getLendingPool().lendingPool.deposit( underlyingToken.tokenAddress, underlyingAmountExternal, address(this), 0 );
LibStorage.getLendingPool().lendingPool.deposit( underlyingToken.tokenAddress, underlyingAmountExternal, address(this), 0 );
70,374