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 |
|---|---|---|---|---|
49 | // to change autoLP threshold, GAS savings | function setLiquityAddThreshold(uint256 threshold) external onlyOwner {
addLiquityThresholdETH = threshold;
}
| function setLiquityAddThreshold(uint256 threshold) external onlyOwner {
addLiquityThresholdETH = threshold;
}
| 42,401 |
28 | // random number generation | uint256 public randomNumber; // for debugging
bytes32 public lastRequestId;
uint256 public lastRequestAt;
event SwapETHForTokens(
uint256 amountIn,
address[] path
);
| uint256 public randomNumber; // for debugging
bytes32 public lastRequestId;
uint256 public lastRequestAt;
event SwapETHForTokens(
uint256 amountIn,
address[] path
);
| 76,871 |
11 | // Data about the future reward rates. emissionSchedule stored in reverse chronological order, whenever the number of blocks since the start block exceeds the next block offset a new reward rate is applied. | EmissionPoint[] public emissionSchedule;
| EmissionPoint[] public emissionSchedule;
| 12,624 |
51 | // Method for setting royalty/_nftAddress NFT contract address/_royalty Royalty | function registerCollectionRoyalty(
address _nftAddress,
address _creator,
uint16 _royalty,
address _feeRecipient
| function registerCollectionRoyalty(
address _nftAddress,
address _creator,
uint16 _royalty,
address _feeRecipient
| 16,519 |
3 | // this is not a payable function so we cannot use msg.value or msg.sender | function withdrawFunds(uint amount) ifClient {
if (client.send(amount)) {
UpdateStatus("User withdraw some money", amount);
_switch = true;
} else {
_switch = false;
}
}
| function withdrawFunds(uint amount) ifClient {
if (client.send(amount)) {
UpdateStatus("User withdraw some money", amount);
_switch = true;
} else {
_switch = false;
}
}
| 20,699 |
26 | // ---------------------------------------------------------------------------- ERC20 Token, with the addition of symbol, name and decimals and assisted token transfers ---------------------------------------------------------------------------- | contract ADZbuzzCommunityToken is ERC20Interface, Owned, SafeMath {
string public symbol;
string public name;
uint8 public decimals;
uint public _totalSupply;
mapping(address => uint) balances;
mapping(address => mapping(address => uint)) allowed;
... | contract ADZbuzzCommunityToken is ERC20Interface, Owned, SafeMath {
string public symbol;
string public name;
uint8 public decimals;
uint public _totalSupply;
mapping(address => uint) balances;
mapping(address => mapping(address => uint)) allowed;
... | 1,399 |
23 | // Change royalty address | function setRoyaltyAddress(address addr) external onlyOwner {
royaltyAddress = addr;
emit RoyaltyAddressUpdated(addr);
}
| function setRoyaltyAddress(address addr) external onlyOwner {
royaltyAddress = addr;
emit RoyaltyAddressUpdated(addr);
}
| 25,417 |
140 | // Assigns rewards and sets a new monthly rate for the geenral commitee bootstrap. | function setGeneralCommitteeAnnualBootstrap(uint256 annual_amount) external /* onlyFunctionalOwner */;
| function setGeneralCommitteeAnnualBootstrap(uint256 annual_amount) external /* onlyFunctionalOwner */;
| 43,050 |
36 | // withdraw tokens from boardroom _amount amount of staked tokens / | function withdraw(uint256 _amount)
public
override(IBoardroomV2, TokenStoreWrapper)
directorExists
updateReward(_msgSender())
| function withdraw(uint256 _amount)
public
override(IBoardroomV2, TokenStoreWrapper)
directorExists
updateReward(_msgSender())
| 19,315 |
59 | // Creates a checkpoint that can be used to query historical balances / totalSuppy / | function createCheckpoint() public returns(uint256);
| function createCheckpoint() public returns(uint256);
| 46,483 |
35 | // --- EIP712 niceties --- | bytes32 public DOMAIN_SEPARATOR;
| bytes32 public DOMAIN_SEPARATOR;
| 6,036 |
5 | // g2 elements | vk.g2_elements[0] = PairingsBn254.new_g2(
[
0x198e9393920d483a7260bfb731fb5d25f1aa493335a9e71297e485b7aef312c2,
0x1800deef121f1e76426a00665e5c4479674322d4f75edadd46debd5cd992f6ed
],
[
0x090689d0585ff075ec9e99ad690c3395bc4b313370... | vk.g2_elements[0] = PairingsBn254.new_g2(
[
0x198e9393920d483a7260bfb731fb5d25f1aa493335a9e71297e485b7aef312c2,
0x1800deef121f1e76426a00665e5c4479674322d4f75edadd46debd5cd992f6ed
],
[
0x090689d0585ff075ec9e99ad690c3395bc4b313370... | 27,736 |
168 | // Events/emitted upon dispute tally | event DisputeVoteTallied(
uint256 indexed _disputeID,
int256 _result,
address indexed _reportedMiner,
address _reportingParty,
bool _passed
);
event StakeWithdrawn(address indexed _sender); //Emits when a staker is block.timestamp no longer staked
event StakeWithd... | event DisputeVoteTallied(
uint256 indexed _disputeID,
int256 _result,
address indexed _reportedMiner,
address _reportingParty,
bool _passed
);
event StakeWithdrawn(address indexed _sender); //Emits when a staker is block.timestamp no longer staked
event StakeWithd... | 7,344 |
20 | // Proof of oracle iterator contract/Verifies that contract is a oracle iterator contract/ return true if contract is a oracle iterator contract | function isOracleIterator() external pure returns(bool);
| function isOracleIterator() external pure returns(bool);
| 10,428 |
23 | // bonus cap in wei | uint256 private _bonusCap;
| uint256 private _bonusCap;
| 33,526 |
26 | // Oracle types enabled for this asset | uint16 oracleType;
CDP cdp;
| uint16 oracleType;
CDP cdp;
| 39,761 |
140 | // buy | if(swapV2Pairs[sender]){
_fee = amount * buyFee / 100;
}else{
| if(swapV2Pairs[sender]){
_fee = amount * buyFee / 100;
}else{
| 22,128 |
225 | // 0. 加载配置 | Config memory config = _config;
| Config memory config = _config;
| 30,510 |
120 | // Ensure that the from and to positions are valid positions for a slice within the byte array that is being used. | if (from > to) {
LibRichErrors.rrevert(LibBytesRichErrors.InvalidByteOperationError(
LibBytesRichErrors.InvalidByteOperationErrorCodes.FromLessThanOrEqualsToRequired,
from,
to
));
}
| if (from > to) {
LibRichErrors.rrevert(LibBytesRichErrors.InvalidByteOperationError(
LibBytesRichErrors.InvalidByteOperationErrorCodes.FromLessThanOrEqualsToRequired,
from,
to
));
}
| 32,530 |
39 | // Tokens balance /_owner holder address / return balance amount | function balanceOf(address _owner) constant returns (uint balance) {
return balances[_owner];
}
| function balanceOf(address _owner) constant returns (uint balance) {
return balances[_owner];
}
| 10,297 |
43 | // return {uint} number of blocks to mine/validate until this license is considered expired | function blocksRemaining(
LicenseStorage storage self
)internal view returns(
uint
){
| function blocksRemaining(
LicenseStorage storage self
)internal view returns(
uint
){
| 6,446 |
86 | // exclude from paying fees or having max transaction amount, max wallet amount | excludeFromFees(owner(), true);
excludeFromFees(address(this), true);
excludeFromFees(address(0xdead), true);
excludeFromMaxTransaction(owner(), true);
excludeFromMaxTransaction(address(this), true);
excludeFromMaxTransaction(address(0xdead), true);
excl... | excludeFromFees(owner(), true);
excludeFromFees(address(this), true);
excludeFromFees(address(0xdead), true);
excludeFromMaxTransaction(owner(), true);
excludeFromMaxTransaction(address(this), true);
excludeFromMaxTransaction(address(0xdead), true);
excl... | 17,383 |
0 | // aToken interface Aegis / | contract ATokenInterface is AegisTokenCommon {
bool public constant aToken = true;
/**
* @notice Emitted when interest is accrued
*/
event AccrueInterest(uint _cashPrior, uint _interestAccumulated, uint _borrowIndex, uint _totalBorrows);
/**
* @notice Emitted when tokens are minted
... | contract ATokenInterface is AegisTokenCommon {
bool public constant aToken = true;
/**
* @notice Emitted when interest is accrued
*/
event AccrueInterest(uint _cashPrior, uint _interestAccumulated, uint _borrowIndex, uint _totalBorrows);
/**
* @notice Emitted when tokens are minted
... | 20,990 |
16 | // Apply the Dampening factor. | supplyDelta = supplyDelta.div(rebaseLag.toInt256Safe());
if (
supplyDelta > 0 &&
uFrags.totalSupply().add(uint256(supplyDelta)) > MAX_SUPPLY
) {
supplyDelta = (MAX_SUPPLY.sub(uFrags.totalSupply())).toInt256Safe();
}
| supplyDelta = supplyDelta.div(rebaseLag.toInt256Safe());
if (
supplyDelta > 0 &&
uFrags.totalSupply().add(uint256(supplyDelta)) > MAX_SUPPLY
) {
supplyDelta = (MAX_SUPPLY.sub(uFrags.totalSupply())).toInt256Safe();
}
| 38,986 |
14 | // Check for number of increases to start price | uint256 timeDiff = _currentTime.sub(_startTime).div(timeDelta);
| uint256 timeDiff = _currentTime.sub(_startTime).div(timeDelta);
| 44,679 |
109 | // Gets the current day indexreturn day index / | function getDayIndex()
internal
view
returns (uint)
| function getDayIndex()
internal
view
returns (uint)
| 6,435 |
43 | // ^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/ _Available since v4.1._ / | modifier onlyRole(bytes32 role) {
_checkRole(role);
_;
}
| modifier onlyRole(bytes32 role) {
_checkRole(role);
_;
}
| 10,094 |
595 | // Amount in SDVD. After hard cap reached, stake ETH will function as normal staking. | uint256 public LGE_HARD_CAP = 200 ether;
| uint256 public LGE_HARD_CAP = 200 ether;
| 45,007 |
23 | // Function to increment the value of a slot in a blob by some amount _slot Slot value. Up to 7 _amount Amout to increment a slot _tokenId Token ID from which to update the blob data / | function incSlot(
uint8 _slot,
uint256 _amount,
uint256 _tokenId
| function incSlot(
uint8 _slot,
uint256 _amount,
uint256 _tokenId
| 9,955 |
45 | // Populate the store owner's storefront record with the details/ Both storefronts (mapping to storefront struct) and/ storefrontIndexes (array of hashes) would be updated accordingly | storefronts[uniqueId].storeOwner = msg.sender;
storefronts[uniqueId].index = (storefrontIndexes.push(uniqueId)).sub(1);
storefronts[uniqueId].storefrontName = newStorefrontName;
storefronts[uniqueId].balance = 0;
emit LogCreateStorefront(uniqueId);
return (storefrontIndex... | storefronts[uniqueId].storeOwner = msg.sender;
storefronts[uniqueId].index = (storefrontIndexes.push(uniqueId)).sub(1);
storefronts[uniqueId].storefrontName = newStorefrontName;
storefronts[uniqueId].balance = 0;
emit LogCreateStorefront(uniqueId);
return (storefrontIndex... | 51,726 |
7 | // Override supportsInterface function to resolve conflict | function supportsInterface(
bytes4 interfaceId
)
public
view
override(
ERC721Upgradeable,
ERC721URIStorageUpgradeable,
ERC721EnumerableUpgradeable
)
| function supportsInterface(
bytes4 interfaceId
)
public
view
override(
ERC721Upgradeable,
ERC721URIStorageUpgradeable,
ERC721EnumerableUpgradeable
)
| 27,923 |
47 | // Can Set % | function setFeeBurnUnstake(uint256 _percentage) external virtual {
if (!_canSetStakeConditions()) {
revert("Not authorized");
}
require(_percentage <= 100, "Invalid percentage");
feePercentage = _percentage;
}
| function setFeeBurnUnstake(uint256 _percentage) external virtual {
if (!_canSetStakeConditions()) {
revert("Not authorized");
}
require(_percentage <= 100, "Invalid percentage");
feePercentage = _percentage;
}
| 9,479 |
8 | // if there were previous tax objects then they must have been revoked | if (licenceTaxObjects[_licence_Id].length > 0) {
require(
taxObjects[licenceTaxObjects[_licence_Id][licenceTaxObjects[_licence_Id].length - 1]].status ==
TaxObjectStatus.Revoked,
"Can only create tax object if previous revoked"
);
... | if (licenceTaxObjects[_licence_Id].length > 0) {
require(
taxObjects[licenceTaxObjects[_licence_Id][licenceTaxObjects[_licence_Id].length - 1]].status ==
TaxObjectStatus.Revoked,
"Can only create tax object if previous revoked"
);
... | 44,950 |
45 | // Second | second = getSecond(timestamp);
| second = getSecond(timestamp);
| 30,265 |
50 | // KeeperRewardDistributor | error INCORRECT_PART_IN_REWARD();
| error INCORRECT_PART_IN_REWARD();
| 29,190 |
15 | // See {AccessControl-renounceRole}. For the `DEFAULT_ADMIN_ROLE`, it only allows renouncing in two steps by first calling{beginDefaultAdminTransfer} to the `address(0)`, so it's required that the {pendingDefaultAdmin} schedulehas also passed when calling this function. After its execution, it will not be possible to c... | function renounceRole(bytes32 role, address account) public virtual override(AccessControl, IAccessControl) {
if (role == DEFAULT_ADMIN_ROLE && account == defaultAdmin()) {
(address newDefaultAdmin, uint48 schedule) = pendingDefaultAdmin();
if (newDefaultAdmin != address(0) || !_isSc... | function renounceRole(bytes32 role, address account) public virtual override(AccessControl, IAccessControl) {
if (role == DEFAULT_ADMIN_ROLE && account == defaultAdmin()) {
(address newDefaultAdmin, uint48 schedule) = pendingDefaultAdmin();
if (newDefaultAdmin != address(0) || !_isSc... | 767 |
5 | // Utils Anton / | library StaticCall {
function isContract(address what) internal view returns (bool) {
uint256 size;
assembly {
size := extcodesize(what)
}
return size > 0;
}
/**
* @dev Execute a STATICCALL (introduced with Ethereum Metropolis, non-state-modifying external c... | library StaticCall {
function isContract(address what) internal view returns (bool) {
uint256 size;
assembly {
size := extcodesize(what)
}
return size > 0;
}
/**
* @dev Execute a STATICCALL (introduced with Ethereum Metropolis, non-state-modifying external c... | 13,839 |
3 | // Set number of seconds used for the time window of the UniV3 price oracle | function setTimeWindowLengthSeconds(uint32 _timeWindowLengthSeconds) external onlyOwner {
timeWindowLengthSeconds = _timeWindowLengthSeconds;
}
| function setTimeWindowLengthSeconds(uint32 _timeWindowLengthSeconds) external onlyOwner {
timeWindowLengthSeconds = _timeWindowLengthSeconds;
}
| 17,706 |
118 | // Decode an array of fixed16 values from a Witnet.Result as an `int128[]` value./_result An instance of Witnet.Result./ return The `int128[]` decoded from the Witnet.Result. | function asFixed16Array(Witnet.Result memory _result) external pure returns (int32[] memory);
| function asFixed16Array(Witnet.Result memory _result) external pure returns (int32[] memory);
| 54,153 |
18 | // ========== INTERNAL FUNCTIONS ========== / | function _deposit(address asset, uint256 amount) internal {
(address pool, address aToken) = _getLendingPoolAndAToken(asset);
_tokenApprove(asset, pool, amount);
try
ILendingPoolV2(pool).deposit(
asset,
amount,
address(this),
... | function _deposit(address asset, uint256 amount) internal {
(address pool, address aToken) = _getLendingPoolAndAToken(asset);
_tokenApprove(asset, pool, amount);
try
ILendingPoolV2(pool).deposit(
asset,
amount,
address(this),
... | 4,004 |
20 | // set pausable methods to unpaused | function unpause() public override onlyGuardianOrGovernor {
_unpause();
}
| function unpause() public override onlyGuardianOrGovernor {
_unpause();
}
| 23,015 |
350 | // this is the case in which we are starting with two amounts of the same LP asset. we update the first harvestAmount in place to contain the total amount of this asset | tokenAmountsArray[0] = tokenAmountsArray[0] + tokenAmountsArray[1];
| tokenAmountsArray[0] = tokenAmountsArray[0] + tokenAmountsArray[1];
| 15,331 |
59 | // call to stake more KNC for msg.sender amount amount of KNC to stake / | function deposit(uint256 amount) external override {
require(amount > 0, "deposit: amount is 0");
uint256 curEpoch = getCurrentEpochNumber();
address staker = msg.sender;
// collect KNC token from staker
require(
kncToken.transferFrom(staker, address(this), amou... | function deposit(uint256 amount) external override {
require(amount > 0, "deposit: amount is 0");
uint256 curEpoch = getCurrentEpochNumber();
address staker = msg.sender;
// collect KNC token from staker
require(
kncToken.transferFrom(staker, address(this), amou... | 13,788 |
15 | // rlp(child) was at least 32 bytes. node[1] contains Keccak256(rlp(child)). | nodeHashHash = node[1].payloadKeccak256();
| nodeHashHash = node[1].payloadKeccak256();
| 39,546 |
308 | // : Change fees amounts for each token : Must pass an array with complete fee structure with all 5 fees | function setFeesAmounts(uint256[] calldata _feesAmounts) external onlyOwner() {
feesAmounts = _feesAmounts;
}
| function setFeesAmounts(uint256[] calldata _feesAmounts) external onlyOwner() {
feesAmounts = _feesAmounts;
}
| 20,139 |
274 | // keccak256(abi.encodePacked("ERC1820_ACCEPT_MAGIC")); | bytes32 public constant ACCEPT_MAGIC =
0xa2ef4600d742022d532d4747cb3547474667d6f13804902513b2ec01c848f4b4;
bytes4 public constant ERC165_INTERFACE_ID_ERC165 = 0x01ffc9a7;
bytes4 public constant ERC165_INTERFACE_ID_ERC721 = 0x80ac58cd;
| bytes32 public constant ACCEPT_MAGIC =
0xa2ef4600d742022d532d4747cb3547474667d6f13804902513b2ec01c848f4b4;
bytes4 public constant ERC165_INTERFACE_ID_ERC165 = 0x01ffc9a7;
bytes4 public constant ERC165_INTERFACE_ID_ERC721 = 0x80ac58cd;
| 23,674 |
78 | // Fallback function | function () payable {
throw;
}
| function () payable {
throw;
}
| 4,624 |
14 | // Right now, the contract owner can just arbitrarily rule on any outstanding challenge. Decentralizing this is a high priority. | function ruleOnChallenge(
uint40 challengee,
uint256 challengeIndex,
bool challengerWon
| function ruleOnChallenge(
uint40 challengee,
uint256 challengeIndex,
bool challengerWon
| 12,202 |
10 | // updates the votes amount of the given user / | function updateVote(
address user,
uint256 originAmount, // original amount before change
uint256 currentAmount // current amount after change
| function updateVote(
address user,
uint256 originAmount, // original amount before change
uint256 currentAmount // current amount after change
| 47,437 |
10 | // Calc amounts of token0 and token1 including fees | (amount0, amount1) = amountsForLiquidity(pool, liquidity, _tickLower, _tickUpper);
amount0 = amount0.add(uint256(tokensOwed0));
amount1 = amount1.add(uint256(tokensOwed1));
| (amount0, amount1) = amountsForLiquidity(pool, liquidity, _tickLower, _tickUpper);
amount0 = amount0.add(uint256(tokensOwed0));
amount1 = amount1.add(uint256(tokensOwed1));
| 33,250 |
276 | // Constant values used in ramping A calculations | uint256 public constant A_PRECISION = 100;
uint256 public constant MAX_A = 10**6;
uint256 private constant MAX_A_CHANGE = 2;
uint256 private constant MIN_RAMP_TIME = 14 days;
| uint256 public constant A_PRECISION = 100;
uint256 public constant MAX_A = 10**6;
uint256 private constant MAX_A_CHANGE = 2;
uint256 private constant MIN_RAMP_TIME = 14 days;
| 8,790 |
47 | // Withdraw collateral | function investorWithdraw(uint256 amount) external onlyInvestor {
require(collateral_invested.add(amount) <= availableForInvestment(), 'Investment cap reached');
collateral_invested = collateral_invested.add(amount);
collateral_token.transfer(investor_contract_address, amount);
}
| function investorWithdraw(uint256 amount) external onlyInvestor {
require(collateral_invested.add(amount) <= availableForInvestment(), 'Investment cap reached');
collateral_invested = collateral_invested.add(amount);
collateral_token.transfer(investor_contract_address, amount);
}
| 51,650 |
136 | // Calculates maker amount/ return Floored maker amount | function getMakerAmount(uint256 orderMakerAmount, uint256 orderTakerAmount, uint256 swapTakerAmount) external pure returns(uint256) {
return swapTakerAmount * orderMakerAmount / orderTakerAmount;
}
| function getMakerAmount(uint256 orderMakerAmount, uint256 orderTakerAmount, uint256 swapTakerAmount) external pure returns(uint256) {
return swapTakerAmount * orderMakerAmount / orderTakerAmount;
}
| 12,583 |
24 | // Get a reference to the tokenUriResolver. | IJB721TokenUriResolver _resolver = store.tokenUriResolverOf(address(this));
| IJB721TokenUriResolver _resolver = store.tokenUriResolverOf(address(this));
| 30,522 |
14 | // setup next round | currentRoundID += 1;
rounds[currentRoundID].initTime = block.timestamp;
rounds[currentRoundID].initPrice = rate();
rounds[currentRoundID].status = 1;
return true;
| currentRoundID += 1;
rounds[currentRoundID].initTime = block.timestamp;
rounds[currentRoundID].initPrice = rate();
rounds[currentRoundID].status = 1;
return true;
| 19,945 |
106 | // Copyright (c) The Force Protocol Development Team / | interface ICoreUtils {
function d(uint256 id) external view returns (address);
function bondData(uint256 id) external view returns (IBondData);
//principal + interest = principal * (1 + couponRate);
function calcPrincipalAndInterest(uint256 principal, uint256 couponRate)
external
pure
... | interface ICoreUtils {
function d(uint256 id) external view returns (address);
function bondData(uint256 id) external view returns (IBondData);
//principal + interest = principal * (1 + couponRate);
function calcPrincipalAndInterest(uint256 principal, uint256 couponRate)
external
pure
... | 36,058 |
6 | // 25% dividends for token selling | uint8 constant internal exitFee_ = 25;
| uint8 constant internal exitFee_ = 25;
| 13,123 |
252 | // Emitted when `minter` is removed from `minters`. / | event MinterRemoved(address minter);
| event MinterRemoved(address minter);
| 52,189 |
44 | // My Cayman Condos token smart contract. / | contract MKYCToken is AbstractToken {
/**
* Maximum allowed number of tokens in circulation.
* tokenSupply = tokensIActuallyWant * (10 ^ decimals)
*/
uint256 constant MAX_TOKEN_COUNT = 200000000 * (10**18);
/**
* Address of the owner of this smart contract.
*/
address private owner;
... | contract MKYCToken is AbstractToken {
/**
* Maximum allowed number of tokens in circulation.
* tokenSupply = tokensIActuallyWant * (10 ^ decimals)
*/
uint256 constant MAX_TOKEN_COUNT = 200000000 * (10**18);
/**
* Address of the owner of this smart contract.
*/
address private owner;
... | 58,841 |
44 | // mapping of checkpoint header numbers to block details These checkpoints are submited by plasma contracts / | mapping(uint256 => HeaderBlock) public headerBlocks;
| mapping(uint256 => HeaderBlock) public headerBlocks;
| 12,723 |
56 | // A trusted proxy for updating where current answers are read from This contract provides a consistent address for theCurrentAnwerInterface but delegates where it reads from to the owner, who istrusted to update it. / | contract AggregatorProxy is AggregatorV2V3Interface, Owned {
struct Phase {
uint16 id;
AggregatorV2V3Interface aggregator;
}
Phase private currentPhase;
AggregatorV2V3Interface public proposedAggregator;
mapping(uint16 => AggregatorV2V3Interface) public phaseAggregators;
uint256 constant private P... | contract AggregatorProxy is AggregatorV2V3Interface, Owned {
struct Phase {
uint16 id;
AggregatorV2V3Interface aggregator;
}
Phase private currentPhase;
AggregatorV2V3Interface public proposedAggregator;
mapping(uint16 => AggregatorV2V3Interface) public phaseAggregators;
uint256 constant private P... | 66,096 |
24 | // Checks if group with the given index is terminated. / | function isGroupTerminated(
Storage storage self,
uint256 groupIndex
| function isGroupTerminated(
Storage storage self,
uint256 groupIndex
| 2,029 |
45 | // Sender redeems saving assets in exchange for a specified amount of underlying asset Interst shall be accrued redeemAmount The amount of underlying to redeemreturn uint256 Amount of saving assets burned / | function redeemUnderlying(uint256 redeemAmount) external returns (uint256);
| function redeemUnderlying(uint256 redeemAmount) external returns (uint256);
| 10,403 |
23 | // WRITE METHOD Private/ | function setZeroLevelOfLandI(uint256 lLand, uint8 lLevel) private {
require(msg.sender == ownerOf(lLand));
zeroLevelOfLand_[lLand] = lLevel;
}
| function setZeroLevelOfLandI(uint256 lLand, uint8 lLevel) private {
require(msg.sender == ownerOf(lLand));
zeroLevelOfLand_[lLand] = lLevel;
}
| 24,022 |
13 | // Internal function to set the sources for each asset/_assets The addresses of the assets/_sources The address of the source of each asset | function internalSetAssetsSources(address[] memory _assets, address[] memory _sources) internal {
require(_assets.length == _sources.length, "INCONSISTENT_PARAMS_LENGTH");
for (uint256 i = 0; i < _assets.length; i++) {
assetsSources[_assets[i]] = IChainlinkAggregator(_sources[i]);
... | function internalSetAssetsSources(address[] memory _assets, address[] memory _sources) internal {
require(_assets.length == _sources.length, "INCONSISTENT_PARAMS_LENGTH");
for (uint256 i = 0; i < _assets.length; i++) {
assetsSources[_assets[i]] = IChainlinkAggregator(_sources[i]);
... | 15,991 |
97 | // Verifies that the hash is valid Snapshot Hub will call this function when a vote is submitted using snapshot.js on behalf of this contract. Snapshot Hub will call this function with the hash and the signature of the vote that was cast. _hash Hash of the message that was sent to Snapshot Hub to cast a votereturn EIP1... | function isValidSignature(bytes32 _hash, bytes memory) public view returns (bytes4) {
if(votes[_hash]) {
return EIP1271_MAGIC_VALUE;
} else {
return 0xffffffff;
}
}
| function isValidSignature(bytes32 _hash, bytes memory) public view returns (bytes4) {
if(votes[_hash]) {
return EIP1271_MAGIC_VALUE;
} else {
return 0xffffffff;
}
}
| 39,714 |
199 | // The Prepaid Aggregator contract Handles aggregating data pushed in from off-chain, and unlockspayment for oracles as they report. Oracles' submissions are gathered inrounds, with each round aggregating the submissions for each oracle into asingle answer. The latest aggregated answer is exposed as well as historicala... | contract FluxAggregator is AggregatorV2V3Interface, Owned {
using SafeMathChainlink for uint256;
using SafeMath128 for uint128;
using SafeMath64 for uint64;
using SafeMath32 for uint32;
struct Round {
int256 answer;
uint64 startedAt;
uint64 updatedAt;
uint32 answeredInRound;
}
struct Rou... | contract FluxAggregator is AggregatorV2V3Interface, Owned {
using SafeMathChainlink for uint256;
using SafeMath128 for uint128;
using SafeMath64 for uint64;
using SafeMath32 for uint32;
struct Round {
int256 answer;
uint64 startedAt;
uint64 updatedAt;
uint32 answeredInRound;
}
struct Rou... | 8,232 |
15 | // Closes the escrow, and increments the fork id. Once the escrow is closed, all the escrowed tokenscan no longer be unescrowed by the owner, but can be withdrawn by the DAO. Can only be called by the DAO contractreturn closedForkId The fork id which was closed / | function closeEscrow() external onlyDAO returns (uint32 closedForkId) {
numTokensInEscrow = 0;
closedForkId = forkId;
forkId++;
}
| function closeEscrow() external onlyDAO returns (uint32 closedForkId) {
numTokensInEscrow = 0;
closedForkId = forkId;
forkId++;
}
| 32,597 |
536 | // Grab the sUSD Synth | ISynth sUSDSynth = issuer().synths(sUSD);
| ISynth sUSDSynth = issuer().synths(sUSD);
| 34,260 |
51 | // Write the selector first, since it overlaps the digest | mstore(selectorPtr, 0x44)
| mstore(selectorPtr, 0x44)
| 38,591 |
9 | // Events ------------------------------------------------------------------------ | event BaseTokenURIChanged(string baseTokenURI);
event Received(address, uint256);
| event BaseTokenURIChanged(string baseTokenURI);
event Received(address, uint256);
| 71,169 |
332 | // Get the current allowance from `owner` for `spender`owner The address of the account which owns the tokens to be spentspender The address of the account which may transfer tokens return remaining The number of tokens allowed to be spent (-1 means infinite)/ | function allowance(address owner, address spender) external view returns (uint256 remaining);
| function allowance(address owner, address spender) external view returns (uint256 remaining);
| 3,885 |
25 | // If last point was in this block, the slope change has been applied already But in such case we have 0 slope(s) | last_point.slope += (u_new.slope - u_old.slope);
last_point.bias += (u_new.bias - u_old.bias);
if (last_point.slope < 0) {
last_point.slope = 0;
}
| last_point.slope += (u_new.slope - u_old.slope);
last_point.bias += (u_new.bias - u_old.bias);
if (last_point.slope < 0) {
last_point.slope = 0;
}
| 18,664 |
303 | // to get the status of recently holded coverIDuserAdd is the user address in concernreturn the status of the concerned coverId / | function getRecentHoldedCoverIdStatus(address userAdd) public view returns(int) {
uint holdedCoverLen = qd.getUserHoldedCoverLength(userAdd);
if (holdedCoverLen == 0) {
return -1;
} else {
uint holdedCoverID = qd.getUserHoldedCoverByIndex(userAdd, holdedCoverLen.sub(... | function getRecentHoldedCoverIdStatus(address userAdd) public view returns(int) {
uint holdedCoverLen = qd.getUserHoldedCoverLength(userAdd);
if (holdedCoverLen == 0) {
return -1;
} else {
uint holdedCoverID = qd.getUserHoldedCoverByIndex(userAdd, holdedCoverLen.sub(... | 12,891 |
44 | // This function makes it easy to read the `allowed[]` map/_owner The address of the account that owns the token/_spender The address of the account able to transfer the tokens/ return Amount of remaining tokens of _owner that _spender is allowed/to spend | function allowance(address _owner, address _spender) public constant returns (uint256 remaining) {
return allowed[_owner][_spender];
}
| function allowance(address _owner, address _spender) public constant returns (uint256 remaining) {
return allowed[_owner][_spender];
}
| 47,072 |
63 | // Checks that a nonce has the correct format and is valid. | * It must be constructed as nonce = {block number}{timestamp} where each component is 16 bytes.
* @param _wallet The target wallet.
* @param _nonce The nonce
*/
function checkAndUpdateNonce(BaseWallet _wallet, uint256 _nonce) internal returns (bool) {
if(_nonce <= relayer[address(_wallet)].n... | * It must be constructed as nonce = {block number}{timestamp} where each component is 16 bytes.
* @param _wallet The target wallet.
* @param _nonce The nonce
*/
function checkAndUpdateNonce(BaseWallet _wallet, uint256 _nonce) internal returns (bool) {
if(_nonce <= relayer[address(_wallet)].n... | 1,923 |
57 | // Add an address to operator list of token / | function addOperator(address minter) external returns (bool);
| function addOperator(address minter) external returns (bool);
| 19,530 |
77 | // We copy the first 4 bytes to check if it matches with the expected signature, otherwise there was another revert reason and we should forward it. | returndatacopy(0, 0, 0x04)
let error := and(mload(0), 0xffffffff00000000000000000000000000000000000000000000000000000000)
| returndatacopy(0, 0, 0x04)
let error := and(mload(0), 0xffffffff00000000000000000000000000000000000000000000000000000000)
| 4,338 |
159 | // reset request URL for balance / | function setBalanceRequestUrl(string memory _balanceRequestUrl) public onlyOwner {
balanceRequestUrl = _balanceRequestUrl;
}
| function setBalanceRequestUrl(string memory _balanceRequestUrl) public onlyOwner {
balanceRequestUrl = _balanceRequestUrl;
}
| 16,636 |
79 | // produces the cumulative price using counterfactuals to save gas and avoid a call to sync. only gets the first price | function currentCumulativePrice0(address pair)
internal
view
returns (uint256 price0Cumulative, uint32 blockTimestamp)
| function currentCumulativePrice0(address pair)
internal
view
returns (uint256 price0Cumulative, uint32 blockTimestamp)
| 8,239 |
10 | // Creates a new escrow contract | function newEscrow(uint256 _id, address payable _seller, address payable _buyer) external {
// Check a contract doesnt already exist with that ID
require(!this.exists(_id), 'Sorry a contract with that ID already exist.');
// Check _seller, _buyer are not empty inputs
require(_selle... | function newEscrow(uint256 _id, address payable _seller, address payable _buyer) external {
// Check a contract doesnt already exist with that ID
require(!this.exists(_id), 'Sorry a contract with that ID already exist.');
// Check _seller, _buyer are not empty inputs
require(_selle... | 42,648 |
111 | // disables an address from minting / burningcontroller the address to disbale/ | function removeController(address controller) external returns(bool);
| function removeController(address controller) external returns(bool);
| 5,386 |
3 | // Add function to set the power levelThis function is only callable by admin members | function setPowerLevel(uint256 tokenId, uint256 _powerLevel) public onlyRole(DEFAULT_ADMIN_ROLE)
| function setPowerLevel(uint256 tokenId, uint256 _powerLevel) public onlyRole(DEFAULT_ADMIN_ROLE)
| 9,658 |
161 | // update token withdraw balance | tokenWithdrawBalances[address(pool.rewardToken)] += penaltyFee + unstakingFee;
| tokenWithdrawBalances[address(pool.rewardToken)] += penaltyFee + unstakingFee;
| 17,190 |
2 | // Revert with an error if the mint quantity is zero. / | error MintQuantityCannotBeZero();
| error MintQuantityCannotBeZero();
| 6,839 |
40 | // Batch token transfer. Used by contract creator to distribute initial tokens to holders / | function batchTransfer(address[] _recipients, uint[] _values) onlyOwner returns (bool) {
require( _recipients.length > 0 && _recipients.length == _values.length);
uint total = 0;
for(uint i = 0; i < _values.length; i++){
total = total.add(_values[i]);
}
require(t... | function batchTransfer(address[] _recipients, uint[] _values) onlyOwner returns (bool) {
require( _recipients.length > 0 && _recipients.length == _values.length);
uint total = 0;
for(uint i = 0; i < _values.length; i++){
total = total.add(_values[i]);
}
require(t... | 13,096 |
173 | // share x 1000 | uint16 share;
| uint16 share;
| 24,826 |
202 | // Safe remit transfer function, just in case if rounding error causes pool to not have enough REMITs. | function safeRemitTransfer(address _to, uint256 _amount) internal {
uint256 remitBal = remit.balanceOf(address(this));
if (_amount > remitBal) {
remit.transfer(_to, remitBal);
} else {
remit.transfer(_to, _amount);
}
}
| function safeRemitTransfer(address _to, uint256 _amount) internal {
uint256 remitBal = remit.balanceOf(address(this));
if (_amount > remitBal) {
remit.transfer(_to, remitBal);
} else {
remit.transfer(_to, _amount);
}
}
| 35,912 |
23 | // Burn existing tokens for the account Modifiers:- onlySelf/ | function selfBurn(
| function selfBurn(
| 21,811 |
72 | // We don't really care if the burn fails for someweird reason./ | bool ret = burnAddress.send(value);
| bool ret = burnAddress.send(value);
| 4,789 |
54 | // If no vote is underway, then there is nothing to action. | VoteType action = blockchains[_blockchainId].votes[_voteTarget].voteType;
require(action != VoteType.VOTE_NONE);
| VoteType action = blockchains[_blockchainId].votes[_voteTarget].voteType;
require(action != VoteType.VOTE_NONE);
| 9,154 |
90 | // Account dYdX Library of structs and functions that represent an account / | library Account {
// ============ Enums ============
/*
* Most-recently-cached account status.
*
* Normal: Can only be liquidated if the account values are violating the global margin-ratio.
* Liquid: Can be liquidated no matter the account values.
* Can be vaporized if there a... | library Account {
// ============ Enums ============
/*
* Most-recently-cached account status.
*
* Normal: Can only be liquidated if the account values are violating the global margin-ratio.
* Liquid: Can be liquidated no matter the account values.
* Can be vaporized if there a... | 59,113 |
18 | // 验证金额 1000000000000000000 => 1100000000000000000 500000000000000000=> 550000000000000000 100000000000000000=> 110000000000000000 | if (value != eth && value != eth.div(2) && value != eth.div(10)) {
require(eth < 1, "Wrong amount of first investment");
}
| if (value != eth && value != eth.div(2) && value != eth.div(10)) {
require(eth < 1, "Wrong amount of first investment");
}
| 5,774 |
164 | // EVENTS// MODIFIERS / | modifier onlyManager() {
require(isManager[msg.sender], "not manager");
_;
}
| modifier onlyManager() {
require(isManager[msg.sender], "not manager");
_;
}
| 48,497 |
273 | // write ILV address | ilv = _ilv;
| ilv = _ilv;
| 68,014 |
22 | // player_submitted | if(eventName == 4){
emit playerSubmitted(talentId, ti.scoutId, data);
}
| if(eventName == 4){
emit playerSubmitted(talentId, ti.scoutId, data);
}
| 30,363 |
4 | // set committer & deadline | committer = msg.sender;
deadline = block.timestamp + 1 hours;
| committer = msg.sender;
deadline = block.timestamp + 1 hours;
| 28,436 |
18 | // set the cat price | catPrice[newCatId] = calculateMinCatPrice(newCatId);
| catPrice[newCatId] = calculateMinCatPrice(newCatId);
| 23,566 |
1 | // Function to calculate the interest accumulated using a linear interest rate formula rate The interest rate, in ray lastUpdateTimestamp The timestamp of the last update of the interestreturn The interest rate linearly accumulated during the timeDelta, in ray /solium-disable-next-line | uint256 result = rate *
(block.timestamp - uint256(lastUpdateTimestamp));
unchecked {
result = result / SECONDS_PER_YEAR;
}
| uint256 result = rate *
(block.timestamp - uint256(lastUpdateTimestamp));
unchecked {
result = result / SECONDS_PER_YEAR;
}
| 4,457 |
304 | // Calculate RFT to mint | uint256 rftTotalSupply = rariFundToken.totalSupply();
uint256 fundBalanceUsd = rftTotalSupply > 0 ? getFundBalance() : 0; // Only set if used
uint256 rftAmount = 0;
if (rftTotalSupply > 0 && fundBalanceUsd > 0) rftAmount = amountUsd.mul(rftTotalSupply).div(fundBalanceUsd);
else r... | uint256 rftTotalSupply = rariFundToken.totalSupply();
uint256 fundBalanceUsd = rftTotalSupply > 0 ? getFundBalance() : 0; // Only set if used
uint256 rftAmount = 0;
if (rftTotalSupply > 0 && fundBalanceUsd > 0) rftAmount = amountUsd.mul(rftTotalSupply).div(fundBalanceUsd);
else r... | 2,347 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.