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
9
// a mpping for fallback() function:
mapping(address => uint256) wrongReceives;
mapping(address => uint256) wrongReceives;
20,373
379
// Transfer any funds to new CL
uint256 clBalance = config.getUSDC().balanceOf(originalClAddr); if (clBalance > 0) { safeERC20TransferFrom(config.getUSDC(), originalClAddr, newClAddr, clBalance); }
uint256 clBalance = config.getUSDC().balanceOf(originalClAddr); if (clBalance > 0) { safeERC20TransferFrom(config.getUSDC(), originalClAddr, newClAddr, clBalance); }
15,278
87
// Verify that the user meets any requirements gating participation in this pool. Verify that any possible ERC-20 requirements are met.
uint256 amount; DFStorage.PoolRequirement memory poolRequirement = pools[_id].config.requirement; if (poolRequirement.requiredType == DFStorage.AccessType.TokenRequired) {
uint256 amount; DFStorage.PoolRequirement memory poolRequirement = pools[_id].config.requirement; if (poolRequirement.requiredType == DFStorage.AccessType.TokenRequired) {
12,958
71
// ERC223 interface /
interface ERC223 { function transfer(address to, uint256 value, bytes calldata data) external; event Transfer(address indexed from, address indexed to, uint256 value, bytes indexed data); }
interface ERC223 { function transfer(address to, uint256 value, bytes calldata data) external; event Transfer(address indexed from, address indexed to, uint256 value, bytes indexed data); }
13,628
43
// Returns the number of values in the set. O(1). /
function length(AddressSet storage set) internal view returns (uint256) { return _length(set._inner); }
function length(AddressSet storage set) internal view returns (uint256) { return _length(set._inner); }
6,840
17
// Increase the amount of tokens that an owner allowed to a spender./ approve should be called when allowed[_spender] == 0. To increment/ allowed value is better to use this function to avoid 2 calls (and wait until/ the first transaction is mined)/ From MonolithDAO Token.sol/_spender The address which will spend the f...
function increaseApproval (address _spender, uint256 _addedValue) public returns (bool success) { allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue); emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]); return true; }
function increaseApproval (address _spender, uint256 _addedValue) public returns (bool success) { allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue); emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]); return true; }
33,549
2
// Tells the module interface version that this contract supports.return major value of the versionreturn minor value of the versionreturn patch value of the version /
function getModuleInterfacesVersion() external pure override returns ( uint64 major, uint64 minor, uint64 patch )
function getModuleInterfacesVersion() external pure override returns ( uint64 major, uint64 minor, uint64 patch )
25,755
8
// event for giving away tokens as bounty beneficiary who got the tokens amount amount of tokens given /
event TokenBounty(address indexed beneficiary, uint256 amount);
event TokenBounty(address indexed beneficiary, uint256 amount);
38,198
14
// randomly assigns wearables to customizable slots with values [1,20]. [1,10] are rarer than [11,20] assumes that wearables with ID [1,20] have already been created slots the slot customizability for the avatar hash random values, uses indices [7,18]return bit mask of all assigned wearables in each slot, excluding 13t...
function assignWearables(uint16 slots, bytes32 hash) internal pure returns (uint256) { uint256 worn = 0; uint8 rand; // for each slot EXCEPT auxiliary1 and auxiliary 2 for (uint256 i = 0; i < MAX_SLOTS() - 2; i++) { if (slots & 1 == 1) { // if the avatar can wear wearable...
function assignWearables(uint16 slots, bytes32 hash) internal pure returns (uint256) { uint256 worn = 0; uint8 rand; // for each slot EXCEPT auxiliary1 and auxiliary 2 for (uint256 i = 0; i < MAX_SLOTS() - 2; i++) { if (slots & 1 == 1) { // if the avatar can wear wearable...
7,553
127
// Assigns a new address to act as the Secondary Manager. _newGMNew Secondary Manager Address /
function setSecondaryManager(address _newGM) external onlyManager { require (_newGM != address(0)); managerSecondary = _newGM; }
function setSecondaryManager(address _newGM) external onlyManager { require (_newGM != address(0)); managerSecondary = _newGM; }
30,955
132
// Called by the owner to unpause, allow claim reward /
function unpause() onlyOwner whenPaused external { _unpause(); }
function unpause() onlyOwner whenPaused external { _unpause(); }
44,652
60
// First delegate gets to initialize the delegator (i.e. storage contract)
delegateTo( implementation_, abi.encodeWithSignature( "initialize(string,string,uint8,address,uint256)", name_, symbol_, decimals_, msg.sender, initTotalSupply_ )
delegateTo( implementation_, abi.encodeWithSignature( "initialize(string,string,uint8,address,uint256)", name_, symbol_, decimals_, msg.sender, initTotalSupply_ )
50,832
11
// initWithdrawAll has to be called before
transferAllTokensOut(address(zunami));
transferAllTokensOut(address(zunami));
81,825
95
// Send bid amount to wallet
wallet_address.transfer(msg.value);
wallet_address.transfer(msg.value);
50,503
12
// Return checkpoint key which was generated in tokens transfercheckpointId Checkpoint identifier/
function getCheckpointKey(uint checkpointId) public view returns (bytes32) { return checkpoints[checkpointId].checkpointKey; }
function getCheckpointKey(uint checkpointId) public view returns (bytes32) { return checkpoints[checkpointId].checkpointKey; }
47,005
0
//
interface IPriceOracle { /*********** @dev returns the asset price in ETH */ function getAssetPrice(address asset) external view returns (uint256); /*********** @dev sets the asset price, in wei */ function setAssetPrice(address asset, uint256 price) external; }
interface IPriceOracle { /*********** @dev returns the asset price in ETH */ function getAssetPrice(address asset) external view returns (uint256); /*********** @dev sets the asset price, in wei */ function setAssetPrice(address asset, uint256 price) external; }
7,538
26
// MERKLE FUNCTIONS
function setMerkleRoot(bytes32 _merkleRoot) public onlyOwner { merkleRoot = _merkleRoot; }
function setMerkleRoot(bytes32 _merkleRoot) public onlyOwner { merkleRoot = _merkleRoot; }
23,176
972
// Reverts on error
CEtherInterface(token.tokenAddress).mint{value: msg.value}();
CEtherInterface(token.tokenAddress).mint{value: msg.value}();
37,655
321
// Adjust slice
slice = owe / price; // slice' = owe' / price < owe / price == slice < lot
slice = owe / price; // slice' = owe' / price < owe / price == slice < lot
7,895
13
// 打本金,换算成dge打
idge.transfer(msg.sender, _ctokenAmount);
idge.transfer(msg.sender, _ctokenAmount);
6,267
52
// Tile TYPES 0 - Empty Space 1 - Team (Angel + Pet) 3 - Red Barrier (red is hurt) 4 - Yellow barrier (yellow is hurt) 5 - Blue barrier (blue is hurt) 6 - Exp Boost (permanent) 7 - HP boost (temp) 8 - Eth boost 9 - Warp 10 - Medal 11 - Pet permanent Aura boost random color
battleboardData.iterateTurn(battleboardId); battleboardData.setLastMoveTime(battleboardId);
battleboardData.iterateTurn(battleboardId); battleboardData.setLastMoveTime(battleboardId);
35,108
23
// Check is not needed because sub(allowance, value) will already throw if this condition is not met require(value <= allowance); SafeMath uses assert instead of require though, beware when using an analysis tool
balances[from] = balances[from].sub(value); balances[to] = balances[to].add(value); allowed[from][msg.sender] = allowance.sub(value); Transfer(from, to, value); return true;
balances[from] = balances[from].sub(value); balances[to] = balances[to].add(value); allowed[from][msg.sender] = allowance.sub(value); Transfer(from, to, value); return true;
9,014
33
// Decrease the amount of tokens that an owner allowed to a spender. approve should be called when allowed[_spender] == 0. To decrement allowed value is better to use this function to avoid 2 calls (and wait until the first transaction is mined) From MonolithDAO Token.sol_spender The address which will spend the funds....
function decreaseApproval( address _spender, uint256 _subtractedValue ) whenNotPaused public returns (bool)
function decreaseApproval( address _spender, uint256 _subtractedValue ) whenNotPaused public returns (bool)
30,112
12
// Royalties ContractRoyalties spec via IERC2981 /
abstract contract OwnableRoyalties is Ownable, IRaribleRoyalties, IERC2981 { // Superplastic is the owner/recipeint of royalties address payable private _recipeint; // Royality fee BPS (1/100ths of a percent, eg 1000 = 10%) uint16 private immutable _feeBps = 500; constructor() { _recipeint...
abstract contract OwnableRoyalties is Ownable, IRaribleRoyalties, IERC2981 { // Superplastic is the owner/recipeint of royalties address payable private _recipeint; // Royality fee BPS (1/100ths of a percent, eg 1000 = 10%) uint16 private immutable _feeBps = 500; constructor() { _recipeint...
29,287
29
// @notify Modify an address parameterparameter The name of the parameter to changeaddr The new parameter address/
function modifyParameters(bytes32 parameter, address addr) external isAuthorized { require(addr != address(0), "ChainlinkRelayer/null-addr"); if (parameter == "aggregator") chainlinkAggregator = AggregatorInterface(addr); else revert("ChainlinkRelayer/modify-unrecognized-param"); emi...
function modifyParameters(bytes32 parameter, address addr) external isAuthorized { require(addr != address(0), "ChainlinkRelayer/null-addr"); if (parameter == "aggregator") chainlinkAggregator = AggregatorInterface(addr); else revert("ChainlinkRelayer/modify-unrecognized-param"); emi...
74,715
194
// Don't use validate arrays because empty arrays are valid
require(stakeTokens.length == amounts.length, "Array(stakeTokens, amounts) length mismatch"); uint256 sID = _mint(account, powah); _supers[sID].campaignID = campaignID; _supers[sID].backingTokens = stakeTokens; _supers[sID].backingAmounts = amounts; return sID;
require(stakeTokens.length == amounts.length, "Array(stakeTokens, amounts) length mismatch"); uint256 sID = _mint(account, powah); _supers[sID].campaignID = campaignID; _supers[sID].backingTokens = stakeTokens; _supers[sID].backingAmounts = amounts; return sID;
5,198
45
// finalizeIco closes down the ICO and sets needed varriables /
function finalizeIco() public onlyOwner { require(currentStage != Stages.icoEnd); endIco(); }
function finalizeIco() public onlyOwner { require(currentStage != Stages.icoEnd); endIco(); }
26,199
21
// get last selectorSlot
selectorSlotCount--; _selectorSlot = ds.selectorSlots[selectorSlotCount]; selectorInSlotIndex = 7;
selectorSlotCount--; _selectorSlot = ds.selectorSlots[selectorSlotCount]; selectorInSlotIndex = 7;
35,737
110
// events about auctions
event AuctionCreated(uint tokenId, uint startingPrice, uint endingPrice, uint duration, uint startTime, uint32 explosive, uint32 endurance, uint32 nimble, uint32 star); event AuctionSuccessful(uint tokenId, uint totalPrice, address winner); event AuctionCancelled(uint tokenId); event UpdateComplete(address...
event AuctionCreated(uint tokenId, uint startingPrice, uint endingPrice, uint duration, uint startTime, uint32 explosive, uint32 endurance, uint32 nimble, uint32 star); event AuctionSuccessful(uint tokenId, uint totalPrice, address winner); event AuctionCancelled(uint tokenId); event UpdateComplete(address...
48,484
66
// to emit Liquidation event, to be called from a trove after liquidation./ _token address of token/ _trove address of the Trove/ stabilityPoolLiquidation address of StabilityPool, 0x0 if Community LiquidationPool/ collateral uint256 amount of collateral
function emitLiquidationEvent( address _token, address _trove, address stabilityPoolLiquidation, uint256 collateral
function emitLiquidationEvent( address _token, address _trove, address stabilityPoolLiquidation, uint256 collateral
12,250
12
// approve `spender` to transfer `amount` tokens./spender address to be given rights to transfer./amount the number of tokens allowed./ return true if success.
function approve(address spender, uint256 amount) public returns (bool success)
function approve(address spender, uint256 amount) public returns (bool success)
30,152
37
// Called by an {IERC777} token contract whenever tokens are beingmoved or created into a registered account (`to`). The type of operationis conveyed by `from` being the zero address or not. This call occurs _after_ the token contract's state is updated, so{IERC777-balanceOf}, etc., can be used to query the post-operat...
function tokensReceived( address operator, address from, address to, uint256 amount, bytes calldata userData, bytes calldata operatorData ) public virtual override {
function tokensReceived( address operator, address from, address to, uint256 amount, bytes calldata userData, bytes calldata operatorData ) public virtual override {
28,708
18
// Indicates weither any token exist with a given id, or not. /
function exists(uint256 id) public view virtual returns (bool) { return totalSupply(id) > 0; }
function exists(uint256 id) public view virtual returns (bool) { return totalSupply(id) > 0; }
8,288
87
// set new dates for pre-salev (emergency case)
function setPreSaleParameters(uint256 _preSaleStartTime, uint256 _preSaleEndTime, uint256 _preSaleWeiCap, uint256 _preSaleMinimumWei) public onlyOwner { require(!isFinalized); require(_preSaleStartTime < _preSaleEndTime); require(_preSaleWeiCap > 0); preSaleStartTime = _preSaleStartTime; preSaleEn...
function setPreSaleParameters(uint256 _preSaleStartTime, uint256 _preSaleEndTime, uint256 _preSaleWeiCap, uint256 _preSaleMinimumWei) public onlyOwner { require(!isFinalized); require(_preSaleStartTime < _preSaleEndTime); require(_preSaleWeiCap > 0); preSaleStartTime = _preSaleStartTime; preSaleEn...
23,092
23
// transfer tokens between one user to another user account, ortransfer tokens between one user account to this contract for future redemption
function transferToken(address sender, address receiver, uint256 tokens) public returns (bool){ balances[sender] = ABDKMathQuad.sub(balances[sender], ABDKMathQuad.fromUInt(tokens)); balances[receiver] = ABDKMathQuad.add(balances[receiver], ABDKMathQuad.fromUInt(tokens)); //transfer paid in d...
function transferToken(address sender, address receiver, uint256 tokens) public returns (bool){ balances[sender] = ABDKMathQuad.sub(balances[sender], ABDKMathQuad.fromUInt(tokens)); balances[receiver] = ABDKMathQuad.add(balances[receiver], ABDKMathQuad.fromUInt(tokens)); //transfer paid in d...
51,393
260
// check items equipped on tamag
for (uint256 i = 0; i < indivEffectEquip.length(); i++){ uint256 equipId = indivEffectEquip.at(i); if (tamag.isEquipped(tamagId, equipId)){ bonus = bonus.add(tma.bonusEffect(equipId)); }
for (uint256 i = 0; i < indivEffectEquip.length(); i++){ uint256 equipId = indivEffectEquip.at(i); if (tamag.isEquipped(tamagId, equipId)){ bonus = bonus.add(tma.bonusEffect(equipId)); }
28,692
457
// to set the percentage of staker commission _val is new percentage value /
function _setStakerCommissionPer(uint _val) internal { stakerCommissionPer = _val; }
function _setStakerCommissionPer(uint _val) internal { stakerCommissionPer = _val; }
54,662
2
// Grab the balance of the underlying asset.
uint256 totalStaked = underlyingAsset.balanceOf(address(this));
uint256 totalStaked = underlyingAsset.balanceOf(address(this));
6,144
88
// Updates an index value. This distributes an amount of tokens equal to`indexValue - lastIndexValue`. See `distribute` for another way to distribute. token Super Token used with the index. indexId ID of the index. indexValue New TOTAL index value, this will equal the total amount distributed. /
function updateIndexValue( ISuperToken token, uint32 indexId, uint128 indexValue
function updateIndexValue( ISuperToken token, uint32 indexId, uint128 indexValue
8,806
19
// get the mint cost per token, including token price and posterity fee /
function pricePerMint() external view returns (uint256) { return pricePerToken + posterityFee; }
function pricePerMint() external view returns (uint256) { return pricePerToken + posterityFee; }
19,090
33
// instance of utility token
IERC20 private _token;
IERC20 private _token;
33,911
47
// before = 1 byte identifier + 32 bytes ID + 32 bytes amount = 65 bytes
return _transferAction.index(65, 32);
return _transferAction.index(65, 32);
33,527
11
// Ensure the voting period has ended
if ( now <= votingEnds ){ throw; }
if ( now <= votingEnds ){ throw; }
56,559
150
// Amount of collected interest that will be sent to Savings Contract (1e18 = 100%)
uint256 private savingsRate;
uint256 private savingsRate;
38,503
31
// require(_to != address(0));checkUsers(_from, _to);require(_value <= balances[_from]);require(_value <= allowed[_from][msg.sender]);balances[_from] = balances[_from].sub(_value);balances[_to] = balances[_to].add(_value);allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);emit Transfer(_from, _to, _val...
_from; _to; _value; return true;
_from; _to; _value; return true;
54,732
6
//
address payable project10 = address(0);
address payable project10 = address(0);
11,447
31
// set each element in the slot to binaries of 1
uint256 MAX_INT = 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff;
uint256 MAX_INT = 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff;
35,921
10
// Burn a given amount of $ZILLA for utility
function burn(address _from, uint256 _amount) external { require(grantedContracts[msg.sender] || msg.sender == address(zillaContract), "Contract is not granted to burn"); _burn(_from, _amount); }
function burn(address _from, uint256 _amount) external { require(grantedContracts[msg.sender] || msg.sender == address(zillaContract), "Contract is not granted to burn"); _burn(_from, _amount); }
23,352
10
// Ensures that the tokens are transferred/ Calls transferFrom on the erc20 contract, and checks that no ether is being burnt/_listing The listing that we expect to be funded
function ensureFunding (Listing storage _listing) internal { require(msg.value == 0, "Do not burn ether here please"); require(_listing.value > 0, "_value must be greater than 0"); ERC20(_listing.asset).safeTransferFrom(msg.sender, address(this), _listing.value); }
function ensureFunding (Listing storage _listing) internal { require(msg.value == 0, "Do not burn ether here please"); require(_listing.value > 0, "_value must be greater than 0"); ERC20(_listing.asset).safeTransferFrom(msg.sender, address(this), _listing.value); }
3,550
30
// Emit event to index registration on the backend
emit UserRegistered( baseNode, usernameHash, msg.sender, _username, _publicKey );
emit UserRegistered( baseNode, usernameHash, msg.sender, _username, _publicKey );
44,481
274
// Tell Strategy to free what we need.
unchecked { IBaseTokenizedStrategy(address(this)).freeFunds(assets - idle); }
unchecked { IBaseTokenizedStrategy(address(this)).freeFunds(assets - idle); }
31,701
50
// To update document: 1 - Add new version as ordinary document 2 - Call this function to link old version with update
function updateDocument(uint referencingDocumentId, uint updatedDocumentId) public onlyOwner ifNotRetired { Document storage referenced = documents[referencingDocumentId]; Document memory updated = documents[updatedDocumentId]; // referenced.updatedVersionId = updated.documentId; ...
function updateDocument(uint referencingDocumentId, uint updatedDocumentId) public onlyOwner ifNotRetired { Document storage referenced = documents[referencingDocumentId]; Document memory updated = documents[updatedDocumentId]; // referenced.updatedVersionId = updated.documentId; ...
48,874
54
// Base Notification Function that Allows a Channel Owners, Delegates as well as Users to send NotificationsSpecifically designed to be called via the EIP 712 send notif function. Takes into consideration the Signatory address to perform all the imperative checks_channel address of the Channel _recipient address of the...
) private sendNotifViaSignReq(_channel, _recipient, _signatory) { // Emit the message out emit SendNotification(_channel, _recipient, _identity); }
) private sendNotifViaSignReq(_channel, _recipient, _signatory) { // Emit the message out emit SendNotification(_channel, _recipient, _identity); }
8,109
316
// Set a single value on a given Metadata instance. meta the metadata to modify. key the token metadata key. value the token metadata value. /
function _addValue(Metadata storage meta, bytes32 key, bytes memory value) internal { bytes[] memory values = new bytes[](1); values[0] = value; _addValues(meta, key, values); }
function _addValue(Metadata storage meta, bytes32 key, bytes memory value) internal { bytes[] memory values = new bytes[](1); values[0] = value; _addValues(meta, key, values); }
16,706
19
// no need to increase the number of contributors since this person already added
contributionIndex = contributoor[msg.sender];
contributionIndex = contributoor[msg.sender];
6,748
223
// Emits a {CallExecuted} event. /
function _call( bytes32 id, uint256 index, address target, uint256 value, bytes calldata data ) private { (bool success, ) = target.call{value: value}(data);
function _call( bytes32 id, uint256 index, address target, uint256 value, bytes calldata data ) private { (bool success, ) = target.call{value: value}(data);
20,233
434
// Emitted when operation `id` is cancelled. /
event Cancelled(bytes32 indexed id);
event Cancelled(bytes32 indexed id);
27,972
41
// Sets the rebaser contract /
event NewRebaser(address oldRebaser, address newRebaser);
event NewRebaser(address oldRebaser, address newRebaser);
14,071
66
// Reference to ComplianceService contract
address public addressSCComplianceService; ComplianceService public SCComplianceService;
address public addressSCComplianceService; ComplianceService public SCComplianceService;
27,855
56
// ----------------------------Staking Part-------------------------------
mapping(address => bool) public isStaking; mapping(address => StakeInfo) public stakeInfo; address[] internal stakeholders; uint256 public crownPrice = 1e18; // CROWN token initial price $1 US Dollar. uint256 public dividendRate = 4e18; // Initial dividend rate 4% of stake amount. uint256 public...
mapping(address => bool) public isStaking; mapping(address => StakeInfo) public stakeInfo; address[] internal stakeholders; uint256 public crownPrice = 1e18; // CROWN token initial price $1 US Dollar. uint256 public dividendRate = 4e18; // Initial dividend rate 4% of stake amount. uint256 public...
31,228
103
// ======== INTERNAL FUNCTIONS ======== //accounting of deposits/withdrawals of assets and in totalasset addressamount uintvalue uintadd bool /
function trackAllocations( address asset, uint amount, uint value, bool add ) internal { if( add ) { // track amount allocated into pool deployed[ asset ] = deployed[ asset ].add( amount ); // track total value allocated into pools totalValueAllocate...
function trackAllocations( address asset, uint amount, uint value, bool add ) internal { if( add ) { // track amount allocated into pool deployed[ asset ] = deployed[ asset ].add( amount ); // track total value allocated into pools totalValueAllocate...
54,865
14
// Legal & Compliance 15,000,000 (15%)
uint constant public maxLegalComplianceSupply = 15000000 * E18;
uint constant public maxLegalComplianceSupply = 15000000 * E18;
61,258
12
// Update the index for the moved value
set._indexes[lastvalue] = toDeleteIndex + 1; // All indexes are 1-based
set._indexes[lastvalue] = toDeleteIndex + 1; // All indexes are 1-based
86
102
// Initialize is called to check some configuration parameters. It expects that a certain amount of tokens have already been assigned to the sale contract address.
function initialize() external onlyOwner returns (bool) { require(totalTokensSold == 0); require(totalPresaleBase == 0); require(totalPresaleBonus == 0); uint256 ownBalance = tokenContract.balanceOf(address(this)); require(ownBalance == TOKENS_SALE); emit Initialize...
function initialize() external onlyOwner returns (bool) { require(totalTokensSold == 0); require(totalPresaleBase == 0); require(totalPresaleBonus == 0); uint256 ownBalance = tokenContract.balanceOf(address(this)); require(ownBalance == TOKENS_SALE); emit Initialize...
32,542
194
// See `upgradeCoinDividend` comments for explanation on why the HashScapes' balances and `lastTimestamp` are updated.
for (uint i = 0; i < hashscapeIds.length; i++) { uint id = hashscapeIds[i]; uint amount = amountToSpend[i]; CoinBalance storage coinBalance = bankerBalances[id]; coinBalance.balance = getCoinBalance(id).sub(amount); coinBalance.lastTimestamp = block.ti...
for (uint i = 0; i < hashscapeIds.length; i++) { uint id = hashscapeIds[i]; uint amount = amountToSpend[i]; CoinBalance storage coinBalance = bankerBalances[id]; coinBalance.balance = getCoinBalance(id).sub(amount); coinBalance.lastTimestamp = block.ti...
39,326
16
// Calculator:--------------------------------------------------------------------------------------------------------------------------------------
function calcSwap(uint256 _fromAmount, bool _isFromEth, bool _isToToken3) public view returns (uint256 actualToTokensAmount_, uint256 fromFeeAdd_, ...
function calcSwap(uint256 _fromAmount, bool _isFromEth, bool _isToToken3) public view returns (uint256 actualToTokensAmount_, uint256 fromFeeAdd_, ...
5,140
73
// Unstake PRY /
function unstake() public { address userAddr = msg.sender; require(stakeAmount[userAddr] > 0, "no staking amount"); // if staking is still accepted, you should only the original stake if (isAcceptStaking == true) { IERC20(token).safeTransfer(userAddr, stakeAmount[userAd...
function unstake() public { address userAddr = msg.sender; require(stakeAmount[userAddr] > 0, "no staking amount"); // if staking is still accepted, you should only the original stake if (isAcceptStaking == true) { IERC20(token).safeTransfer(userAddr, stakeAmount[userAd...
58,424
2
// View the distributor of the loyalty gage (usually token distributor)
function viewDistributor() external view returns (address);
function viewDistributor() external view returns (address);
35,075
58
// deactivate a fee category making all strategies with this fee id revert to default fees
function pause(uint256 _id) external onlyManager { feeCategory[_id].active = false; emit Pause(_id); }
function pause(uint256 _id) external onlyManager { feeCategory[_id].active = false; emit Pause(_id); }
29,093
0
// GdprConfig Configuration for GDPR Cash token and crowdsale/
contract GdprConfig { // Token settings string public constant TOKEN_NAME = "GDPR Cash"; string public constant TOKEN_SYMBOL = "GDPR"; uint8 public constant TOKEN_DECIMALS = 18; // Smallest value of the GDPR uint256 public constant MIN_TOKEN_UNIT = 10 ** uint256(TOKEN_DECIMALS); // Minimum...
contract GdprConfig { // Token settings string public constant TOKEN_NAME = "GDPR Cash"; string public constant TOKEN_SYMBOL = "GDPR"; uint8 public constant TOKEN_DECIMALS = 18; // Smallest value of the GDPR uint256 public constant MIN_TOKEN_UNIT = 10 ** uint256(TOKEN_DECIMALS); // Minimum...
42,646
274
// Returns if a darknode was in the registered state last epoch.
function isRegisteredInPreviousEpoch(address _darknodeID) public view returns (bool) { return isRegisteredInEpoch(_darknodeID, previousEpoch); }
function isRegisteredInPreviousEpoch(address _darknodeID) public view returns (bool) { return isRegisteredInEpoch(_darknodeID, previousEpoch); }
44,546
44
// Burn the OpenStore Token
OSStore.safeTransferFrom(msg.sender, burnAddress, tokenId_, 1, "");
OSStore.safeTransferFrom(msg.sender, burnAddress, tokenId_, 1, "");
12,886
10
// get Net Asset Value Per Share/ ethAmount ETH side of Oracle price {ETH <-> ERC20 Token}/ erc20Amount Token side of Oracle price {ETH <-> ERC20 Token}/ return navps The Net Asset Value Per Share (liquidity) represents
function getNAVPerShare(uint256 ethAmount, uint256 erc20Amount) external view returns (uint256 navps);
function getNAVPerShare(uint256 ethAmount, uint256 erc20Amount) external view returns (uint256 navps);
14,802
30
// Internal fields
uint256 private lastSequenceId; uint256 private constant MAX_SEQUENCE_ID_INCREASE = 10000;
uint256 private lastSequenceId; uint256 private constant MAX_SEQUENCE_ID_INCREASE = 10000;
24,447
172
// ERC20 functions
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 (uint256); function appr...
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 (uint256); function appr...
46,473
17
// For monitoring how much user burn LP token for getting their token back.
emit LPBurned(msg.sender, total.burn0, total.burn1); emit LogUncollectedFees(underlying.fee0, underlying.fee1); emit LogCollectedFees(total.fee0, total.fee1); emit LogBurn(receiver_, burnAmount_, amount0, amount1);
emit LPBurned(msg.sender, total.burn0, total.burn1); emit LogUncollectedFees(underlying.fee0, underlying.fee1); emit LogCollectedFees(total.fee0, total.fee1); emit LogBurn(receiver_, burnAmount_, amount0, amount1);
41,099
2
// fourteenK Plan registration
mapping(address => uint) public fourteenKPayment;
mapping(address => uint) public fourteenKPayment;
5,460
18
// Note that not all fields from `order` are used in creating the corresponding CoW Swap order. For example, validTo and quoteId are ignored.
return GPv2Order.Data( wrappedNativeToken, // IERC20 sellToken order.buyToken, // IERC20 buyToken order.receiver, // address receiver order.sellAmount, // uint256 sellAmount order.buyAmount, // uint256 buyAmount
return GPv2Order.Data( wrappedNativeToken, // IERC20 sellToken order.buyToken, // IERC20 buyToken order.receiver, // address receiver order.sellAmount, // uint256 sellAmount order.buyAmount, // uint256 buyAmount
28,553
6
// Execute a transfer with a signed authorization fromPayer's address (Authorizer) toPayee's address value Amount to be transferred validAfterThe time after which this is valid (unix time) validBefore The time before which this is valid (unix time) nonce Unique nonce v v of the signature r r of the signature s s of the...
function _transferWithAuthorization( address from, address to, uint256 value, uint256 validAfter, uint256 validBefore, bytes32 nonce, uint8 v, bytes32 r, bytes32 s
function _transferWithAuthorization( address from, address to, uint256 value, uint256 validAfter, uint256 validBefore, bytes32 nonce, uint8 v, bytes32 r, bytes32 s
25,169
20
// solium-disable-previous-line security/no-inline-assembly
mask := sar( sub(_len, 1), 0x8000000000000000000000000000000000000000000000000000000000000000 )
mask := sar( sub(_len, 1), 0x8000000000000000000000000000000000000000000000000000000000000000 )
38,434
31
// Reads next line of file to string.
function readLine(string calldata path) external view returns (string memory line);
function readLine(string calldata path) external view returns (string memory line);
12,858
12
// Only owner can re-register
require( callerIsProtocolOwner, "Only protocol owners can replace their allowlist with a new allowlist" );
require( callerIsProtocolOwner, "Only protocol owners can replace their allowlist with a new allowlist" );
56,490
3,216
// 1609
entry "ungarded" : ENG_ADJECTIVE
entry "ungarded" : ENG_ADJECTIVE
18,221
39
// max tokens
uint256 public maxTokens;
uint256 public maxTokens;
37,190
67
// Can't send more than sender has Remove require for gas optimization - bsub will revert on underflow require(_balance[sender] >= amount, "ERR_INSUFFICIENT_BAL");
_balance[sender] = BalancerSafeMath.bsub(_balance[sender], amount); _balance[recipient] = BalancerSafeMath.badd(_balance[recipient], amount); emit Transfer(sender, recipient, amount);
_balance[sender] = BalancerSafeMath.bsub(_balance[sender], amount); _balance[recipient] = BalancerSafeMath.badd(_balance[recipient], amount); emit Transfer(sender, recipient, amount);
6,608
25
// deconverting is mostly for LP tokens back to another token, as these cant be simply swapped on uniswap
function deconvert(address sourceToken, address destinationToken, uint256 amount) public payable returns(uint256){ uint256 _amount = converter.unwrap{value:msg.value}(sourceToken, destinationToken, amount); ERC20 token = ERC20(destinationToken); token.transfer(msg.sender, _amount); retur...
function deconvert(address sourceToken, address destinationToken, uint256 amount) public payable returns(uint256){ uint256 _amount = converter.unwrap{value:msg.value}(sourceToken, destinationToken, amount); ERC20 token = ERC20(destinationToken); token.transfer(msg.sender, _amount); retur...
29,301
48
// Simple single owner and multiroles authorization mixin./Solady (https:github.com/vectorized/solady/blob/main/src/auth/Ownable.sol)/While the ownable portion follows [EIP-173](https:eips.ethereum.org/EIPS/eip-173)/ for compatibility, the nomenclature for the 2-step ownership handover and roles/ may be unique to this ...
abstract contract OwnableRoles is Ownable { /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* EVENTS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev The `user`'s roles is updated to `roles`. /// Each ...
abstract contract OwnableRoles is Ownable { /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* EVENTS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev The `user`'s roles is updated to `roles`. /// Each ...
20,385
50
// 4. Forward call to data contract for refund
flightSuretyData.creditInsurees(flight, msg.sender);
flightSuretyData.creditInsurees(flight, msg.sender);
35,014
23
// Returns the current `_stakingContract` unit balance of `_address`. /
function getUserUnitBalance(address _address, address _stakingContract) public view returns (uint256) { return stakeableUnits[_stakeableUnitsLocations[_stakingContract]].stakeableContract.balanceOf(_address); }
function getUserUnitBalance(address _address, address _stakingContract) public view returns (uint256) { return stakeableUnits[_stakeableUnitsLocations[_stakingContract]].stakeableContract.balanceOf(_address); }
1,003
119
// Update the index ranges, which is used to figure out the index from a tokenId /
function _updateIndexRanges(address creator, uint256 series, uint256 startIndex, uint256 count) internal { IndexRange[] storage indexRanges = _indexRanges[creator][series]; if (indexRanges.length == 0) { indexRanges.push(IndexRange(startIndex, count)); } else { IndexRang...
function _updateIndexRanges(address creator, uint256 series, uint256 startIndex, uint256 count) internal { IndexRange[] storage indexRanges = _indexRanges[creator][series]; if (indexRanges.length == 0) { indexRanges.push(IndexRange(startIndex, count)); } else { IndexRang...
49,146
109
// Overflows are impossible here for all realistic inputs.
return _roundDownTimestamp(timestamp + 1 weeks - 1);
return _roundDownTimestamp(timestamp + 1 weeks - 1);
20,302
219
// rewards token info. we can have more than 1 reward token but this is rare, so we don't include this in the template
IERC20 public rewardsToken; bool public hasRewards; address[] internal rewardsPath;
IERC20 public rewardsToken; bool public hasRewards; address[] internal rewardsPath;
26,162
162
// Returns the pending rewards for a user._parcId - the parc id of the user /
function getUserPendingRewards(address _parcId) public view returns (uint256) { User storage user = users[_parcId]; require(user.exists, "FORBIDDEN: User doesn't exist"); // always show accurate pending rewards to the user, // however any payments in the revenue holder cannot be pai...
function getUserPendingRewards(address _parcId) public view returns (uint256) { User storage user = users[_parcId]; require(user.exists, "FORBIDDEN: User doesn't exist"); // always show accurate pending rewards to the user, // however any payments in the revenue holder cannot be pai...
32,575
22
// calculate the previous owner's share
uint256 previousHolderShare = SafeMath.sub( currentPrice, SafeMath.mul(dividendPerRecipient, sharesForStock.length - 1) );
uint256 previousHolderShare = SafeMath.sub( currentPrice, SafeMath.mul(dividendPerRecipient, sharesForStock.length - 1) );
21,591
77
// Get the total denormalized weight of the pool. /
function getTotalDenormalizedWeight() external view returns (uint256 totalDenorm)
function getTotalDenormalizedWeight() external view returns (uint256 totalDenorm)
46,189
25
// Creates a new oracle vault and a default strategy for the given LBPair. The oracle vault will be linked to the default strategy. lbPair The address of the LBPair. dataFeedX The address of the data feed for token X. dataFeedY The address of the data feed for token Y.return vault The address of the new vault.return st...
function createOracleVaultAndDefaultStrategy(ILBPair lbPair, IAggregatorV3 dataFeedX, IAggregatorV3 dataFeedY) external override onlyOwner returns (address vault, address strategy)
function createOracleVaultAndDefaultStrategy(ILBPair lbPair, IAggregatorV3 dataFeedX, IAggregatorV3 dataFeedY) external override onlyOwner returns (address vault, address strategy)
2,255
24
// if totalVintageQuantity is not set (=0), remove cap
if (cap == 0) return type(uint256).max; return cap;
if (cap == 0) return type(uint256).max; return cap;
31,229
55
// We then subtract swap fees from this amount so the collected swap fees aren't use to calculate how many tokens the trader will receive. We round this value down (favoring a higher fee amount).
uint256 amountInMinusFees = request.amount.mulDown(swapFeeComplement);
uint256 amountInMinusFees = request.amount.mulDown(swapFeeComplement);
18,826
210
// Get the latest staked node of the given staker staker Staker address to lookupreturn Latest node staked of the staker /
function latestStakedNode(address staker) public view override returns (uint256) { return _stakerMap[staker].latestStakedNode; }
function latestStakedNode(address staker) public view override returns (uint256) { return _stakerMap[staker].latestStakedNode; }
56,016
66
// return the PEAKDEFI tokens amount being locked here /
function tokenBalance() external view returns (uint256) { return _token.balanceOf(address(this)); }
function tokenBalance() external view returns (uint256) { return _token.balanceOf(address(this)); }
23,424