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 |
|---|---|---|---|---|
21 | // Lottery | function splitPot()
canClearing()
private
| function splitPot()
canClearing()
private
| 4,299 |
13 | // TODO: should not change if not enough proposals | function toVotingState() internal {
toState(States.Voting);
votingDeadline = block.timestamp + votingLifetime;
emit StateChanged(States.Proposal, States.Voting);
}
| function toVotingState() internal {
toState(States.Voting);
votingDeadline = block.timestamp + votingLifetime;
emit StateChanged(States.Proposal, States.Voting);
}
| 50,749 |
333 | // Need to call again to make sure everything is correct | updateRewardAndBalance(staker_address, false);
emit WithdrawLocked(staker_address, liquidity, kek_id, destination_address);
| updateRewardAndBalance(staker_address, false);
emit WithdrawLocked(staker_address, liquidity, kek_id, destination_address);
| 12,179 |
55 | // rebalances an existing Basket/First calculates the rewards the basket has built up, then sets the new allocations and communicates the deltas to the vault/Finally it locks or unlocks tokens/_basketId Basket ID (tokenID) in the BasketToken (NFT) contract./_deltaAllocations delta allocations set by the user of the bas... | function rebalanceBasket(
uint256 _basketId,
int256[][] memory _deltaAllocations
| function rebalanceBasket(
uint256 _basketId,
int256[][] memory _deltaAllocations
| 22,333 |
187 | // Maximum token supply. Reduced to `type(uint96).max` (2^96^ - 1) to fit COMP interface. / | function _maxSupply() internal view virtual override returns (uint224) {
return type(uint96).max;
}
| function _maxSupply() internal view virtual override returns (uint224) {
return type(uint96).max;
}
| 26,853 |
204 | // Schedules a WolframAlpha query to Oraclize to determine the winner of the competition. / | function queryWinningTeam(uint256 delay) private {
oraclize_query(delay, "WolframAlpha", "FIFA World Cup 2018 Winner");
WinningTeamQuerySent("FIFA World Cup 2018 Winner");
}
| function queryWinningTeam(uint256 delay) private {
oraclize_query(delay, "WolframAlpha", "FIFA World Cup 2018 Winner");
WinningTeamQuerySent("FIFA World Cup 2018 Winner");
}
| 66,051 |
63 | // 尚未开始解锁 | if (timeRemained >= vesting.term) {
return 0;
}
| if (timeRemained >= vesting.term) {
return 0;
}
| 32,059 |
166 | // via https:github.com/oraclize/ethereum-api/blob/master/oraclizeAPI_0.5.sol | function strConcat(
string memory _a,
string memory _b,
string memory _c,
string memory _d,
string memory _e
| function strConcat(
string memory _a,
string memory _b,
string memory _c,
string memory _d,
string memory _e
| 50,689 |
12 | // check if mortgage payment if complete, if complete, then release the property | function checkMortgagePayoff(){
if(balances[loan.actorAccounts.mortgageHolder]
==loan.monthlyPayment.pi*12*loan.loanTerms.term &&
balances[loan.actorAccounts.insurer]
==loan.monthlyPayment.tax*12*loan.loanTerms.term &&
balances[loan.actorAccounts.irs]
... | function checkMortgagePayoff(){
if(balances[loan.actorAccounts.mortgageHolder]
==loan.monthlyPayment.pi*12*loan.loanTerms.term &&
balances[loan.actorAccounts.insurer]
==loan.monthlyPayment.tax*12*loan.loanTerms.term &&
balances[loan.actorAccounts.irs]
... | 38,418 |
50 | // The total amount of wei given | uint totalWeiGiven;
| uint totalWeiGiven;
| 7,447 |
129 | // Add the ETH and token to LP. The LP tokens will be sent to burnAccount. No one will have access to them, so the liquidity will be locked forever. | _uniswapV2Router.addLiquidityETH{value: ethAmount}(
| _uniswapV2Router.addLiquidityETH{value: ethAmount}(
| 21,709 |
3 | // repay the loan | uint256 amountOwing = amounts[i] + premiums[i];
IERC20(assets[i]).approve(address(POOL), amountOwing);
| uint256 amountOwing = amounts[i] + premiums[i];
IERC20(assets[i]).approve(address(POOL), amountOwing);
| 52,870 |
183 | // returns the maximum stable rate borrow size, in percentage of the available liquidity./ | function getMaxStableRateBorrowSizePercent() external pure returns (uint256) {
return MAX_STABLE_RATE_BORROW_SIZE_PERCENT;
}
| function getMaxStableRateBorrowSizePercent() external pure returns (uint256) {
return MAX_STABLE_RATE_BORROW_SIZE_PERCENT;
}
| 15,125 |
31 | // Adjust the extraction ratio newRatio The new extraction ratio / | function adjustRatio(uint newRatio) external onlyOwner {
require(newRatio <= 1e18, "invalid ratio");
uint oldRatio = ratio;
ratio = newRatio;
emit RatioUpdated(oldRatio, newRatio);
}
| function adjustRatio(uint newRatio) external onlyOwner {
require(newRatio <= 1e18, "invalid ratio");
uint oldRatio = ratio;
ratio = newRatio;
emit RatioUpdated(oldRatio, newRatio);
}
| 12,519 |
67 | // Transfer `amount` tokens from `sender` to `recipient` as long as`msg.sender` has sufficient allowance. sender address The account to transfer tokens from. recipient address The account to transfer tokens to. amount uint256 The amount of tokens to transfer.return A boolean indicating whether the transfer was successf... | function transferFrom(
address sender, address recipient, uint256 amount
| function transferFrom(
address sender, address recipient, uint256 amount
| 30,760 |
64 | // 设置是否开启 | * @param {Object} bool
*/
function setactive(bool tags) public onlyOwner {
actived = tags;
}
| * @param {Object} bool
*/
function setactive(bool tags) public onlyOwner {
actived = tags;
}
| 18,915 |
72 | // Transfers mintership of the contract to a new account (`newMinter`).Can only be called by the current minter. / | function transferMintership(address newMinter) public virtual onlyMinter {
require(newMinter != address(0), "Mintable: new minter is the zero address");
emit MintershipTransferred(_minter, newMinter);
_minter = newMinter;
}
| function transferMintership(address newMinter) public virtual onlyMinter {
require(newMinter != address(0), "Mintable: new minter is the zero address");
emit MintershipTransferred(_minter, newMinter);
_minter = newMinter;
}
| 41,932 |
15 | // Max number of cars to gift (includes unicorns) | uint256 public constant MAX_CARS_TO_GIFT = 99;
| uint256 public constant MAX_CARS_TO_GIFT = 99;
| 32,132 |
24 | // Returns the platform fee bps and recipient. | function getPlatformFeeInfo() external view returns (address, uint16) {
return (platformFeeRecipient, uint16(platformFeeBps));
}
| function getPlatformFeeInfo() external view returns (address, uint16) {
return (platformFeeRecipient, uint16(platformFeeBps));
}
| 9,719 |
91 | // if (_addr == address(0)) { _addr == msg.sender; } | uint256 _pID = pIDxAddr_[_addr];
return
(
_pID,
plyr_[_pID].name,
plyr_[_pID].laff,
plyr_[_pID].eth,
plyr_[_pID].cosd,
plyr_[_pID].cosc,
| uint256 _pID = pIDxAddr_[_addr];
return
(
_pID,
plyr_[_pID].name,
plyr_[_pID].laff,
plyr_[_pID].eth,
plyr_[_pID].cosd,
plyr_[_pID].cosc,
| 39,772 |
1 | // Probability in % that a rare variant occurs | uint8 constant RARE_VARIANT_PROBABILITY = 2;
| uint8 constant RARE_VARIANT_PROBABILITY = 2;
| 22,757 |
6 | // frontend calls to add funds to task | function fundTask(uint256 amount) public payable{
amount = amount * 10**18;
// require(msg.sender == taskOwner, "Task: Only Task Owner can fund this contract.");
// require(TOKEN.balanceOf(msg.sender) >= amount, "Task: insufficient funds.");
require(msg.sender.balance >= amount, "Tas... | function fundTask(uint256 amount) public payable{
amount = amount * 10**18;
// require(msg.sender == taskOwner, "Task: Only Task Owner can fund this contract.");
// require(TOKEN.balanceOf(msg.sender) >= amount, "Task: insufficient funds.");
require(msg.sender.balance >= amount, "Tas... | 14,173 |
5 | // By default only owner and parent contract are authorized to call any of the functions with this modifier.That includes SetPermission functions meaning only owner and parent can change permissions. | modifier RestrictedCall() {
require(_APICall(msg.sig, msg.sender));
if(true) {
_;
}
}
| modifier RestrictedCall() {
require(_APICall(msg.sig, msg.sender));
if(true) {
_;
}
}
| 1,239 |
2 | // The ID of the project to pay when this contract receives funds. | uint256 public immutable override projectId;
| uint256 public immutable override projectId;
| 23,652 |
17 | // Find the owner of an NFT/NFTs assigned to zero address are considered invalid, and queries/about them do throw./_bankID The identifier for an NFT/ return owner_ The address of the owner of the NFT | function ownerOf(uint256 _bankID) external view returns (address owner_) {
owner_ = s.banks[_bankID].owner;
require(owner_ != address(0), "BankFacet: invalid _bankID");
}
| function ownerOf(uint256 _bankID) external view returns (address owner_) {
owner_ = s.banks[_bankID].owner;
require(owner_ != address(0), "BankFacet: invalid _bankID");
}
| 17,865 |
23 | // pending onchain txs have not been executed - revert pending deposits and withdrawals back into offchain balances | } else { //txCount[1] > channel.txCount[1]
| } else { //txCount[1] > channel.txCount[1]
| 1,901 |
18 | // verify checkpoint inclusion | _checkBlockMembershipInCheckpoint(
blockNumber,
payload.getBlockTime(),
payload.getTxRoot(),
receiptRoot,
payload.getHeaderNumber(),
payload.getBlockProof()
);
ExitPayloadReader.LogTopics memory topics = log.getTopics();
| _checkBlockMembershipInCheckpoint(
blockNumber,
payload.getBlockTime(),
payload.getTxRoot(),
receiptRoot,
payload.getHeaderNumber(),
payload.getBlockProof()
);
ExitPayloadReader.LogTopics memory topics = log.getTopics();
| 27,298 |
51 | // uint amount3; | address tokenIn;
address tokenOut;
assembly{
third32bytes:=calldataload(68)
amount2:= and(shr(8,third32bytes),0xffffffffffffffffffffff)
needap:=and(third32bytes,0xf0)
type2:=and(third32bytes,0x0f)
... | address tokenIn;
address tokenOut;
assembly{
third32bytes:=calldataload(68)
amount2:= and(shr(8,third32bytes),0xffffffffffffffffffffff)
needap:=and(third32bytes,0xf0)
type2:=and(third32bytes,0x0f)
... | 30,065 |
1 | // FIXME: check who is sending the recommendation | ipfs_hash = _ipfs_hash;
recipient = _recipient;
| ipfs_hash = _ipfs_hash;
recipient = _recipient;
| 40,069 |
67 | // This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployedbehind a proxy. Since a proxied contract can't have a constructor, it's common to move constructor logic to anexternal initializer function, usually called `initialize`. It then becomes necessary to protect ... | * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.
*
* TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as
* possible by providing the encoded function call as the `_data` argument to {Upg... | * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.
*
* TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as
* possible by providing the encoded function call as the `_data` argument to {Upg... | 517 |
111 | // Emits a {ValidatorWasDisabled} event.Requirements:- Validator must not already be disabled. / | function disableValidator(uint validatorId) external checkValidatorExists(validatorId) onlyAdmin {
require(_trustedValidators[validatorId], "Validator is already disabled");
_trustedValidators[validatorId] = false;
uint position = _find(trustedValidatorsList, validatorId);
if (positi... | function disableValidator(uint validatorId) external checkValidatorExists(validatorId) onlyAdmin {
require(_trustedValidators[validatorId], "Validator is already disabled");
_trustedValidators[validatorId] = false;
uint position = _find(trustedValidatorsList, validatorId);
if (positi... | 81,575 |
139 | // Whether further changes to the token URI have been disabled. | bool public _isFinalized = false;
| bool public _isFinalized = false;
| 19,339 |
54 | // To be raised when the current ruling is appealed._disputeID ID of the dispute._arbitrable The contract which created the dispute. / | event AppealDecision(uint indexed _disputeID, Arbitrable indexed _arbitrable);
| event AppealDecision(uint indexed _disputeID, Arbitrable indexed _arbitrable);
| 20,508 |
386 | // This funcion allows the contract owner to add more locked distribution tokens, along with the associated "unlock schedule". These locked tokens immediately begin unlocking linearly over the duraction of durationSec timeframe. amount Number of distribution tokens to lock. These are transferred from the caller. durati... | function lockTokens(uint256 amount, uint256 durationSec)
external
onlyOwner
| function lockTokens(uint256 amount, uint256 durationSec)
external
onlyOwner
| 5,320 |
57 | // triggered when counted | event Counted(address _sender, uint256 _intervals);
uint256 constant _day = 24 * 60 * 60 * 1 seconds;
bytes5 internal _td = bytes5("day");
bytes5 internal _tw = bytes5("week");
bytes5 internal _tm = bytes5("month");
bytes5 internal _ty = bytes5("year");
uint256 internal _creation;
| event Counted(address _sender, uint256 _intervals);
uint256 constant _day = 24 * 60 * 60 * 1 seconds;
bytes5 internal _td = bytes5("day");
bytes5 internal _tw = bytes5("week");
bytes5 internal _tm = bytes5("month");
bytes5 internal _ty = bytes5("year");
uint256 internal _creation;
| 49,943 |
15 | // Freezes minting on smart contract forever / | uint8 internal _mintFrozen;
| uint8 internal _mintFrozen;
| 40,491 |
128 | // Propose delisting the tokenAddress from the whitelist.The proposer needs to commit minimum deposit amount. / | function proposeDelistWhitelist(address tokenAddress) external override {
bytes32 proposeId = _generateUnregisterWhitelistProposeId(
DelistParameters({tokenAddress: tokenAddress})
);
uint32 blockTime = block.timestamp.toUint32();
uint32 preVoteDeadline = blockTime + _preV... | function proposeDelistWhitelist(address tokenAddress) external override {
bytes32 proposeId = _generateUnregisterWhitelistProposeId(
DelistParameters({tokenAddress: tokenAddress})
);
uint32 blockTime = block.timestamp.toUint32();
uint32 preVoteDeadline = blockTime + _preV... | 29,087 |
7 | // Function to grant the USER_ROLE to a specific address account Address of the account to grant role / | function grantUserRole(address account) public {
_grantRole(USER_ROLE, account);
}
| function grantUserRole(address account) public {
_grantRole(USER_ROLE, account);
}
| 11,021 |
283 | // @inheritdoc IPopsicleV3Optimizer | address public immutable override token0;
| address public immutable override token0;
| 4,199 |
21 | // uint16 currencyId,uint256 maturity,uint256 settlementDate | MarketParameters memory market = getMarketNoRevert(currencyId,threeMonthMaturity,threeMonthMaturity) ;
| MarketParameters memory market = getMarketNoRevert(currencyId,threeMonthMaturity,threeMonthMaturity) ;
| 33,101 |
49 | // File: contracts/uniswapv2/UniswapV2Factory.sol |
pragma solidity =0.6.12;
contract UniswapV2Factory is IUniswapV2Factory {
address public override feeTo;
address public override feeToSetter;
address public override migrator;
|
pragma solidity =0.6.12;
contract UniswapV2Factory is IUniswapV2Factory {
address public override feeTo;
address public override feeToSetter;
address public override migrator;
| 30,990 |
6 | // Initializes the ZRX treasury and creates the default/staking pool./stakingProxy_ The 0x staking proxy contract./params Immutable treasury parameters. | constructor(
IStaking stakingProxy_,
TreasuryParameters memory params
)
public
| constructor(
IStaking stakingProxy_,
TreasuryParameters memory params
)
public
| 14,096 |
255 | // Wrapped Ether address | address internal weth;
| address internal weth;
| 35,879 |
14 | // DotTokenContract / | contract DotTokenContract is ERC20Capped, ERC20Burnable, ERC1363, Roles, TokenRecover, Pausable {
// indicates if transfer is enabled
bool private _transferEnabled = false;
/**
* Emitted during transfer enabling
*/
event TransferEnabled();
/**
* Tokens can be moved only after if tr... | contract DotTokenContract is ERC20Capped, ERC20Burnable, ERC1363, Roles, TokenRecover, Pausable {
// indicates if transfer is enabled
bool private _transferEnabled = false;
/**
* Emitted during transfer enabling
*/
event TransferEnabled();
/**
* Tokens can be moved only after if tr... | 32,340 |
8 | // 0xa9059cbb = bytes4(keccak256("transfer(address,uint256)")) | abi.encodeWithSelector(0xa9059cbb, to, amount)
);
require(success && (data.length == 0 || abi.decode(data, (bool)))); // ERC20 Transfer failed
| abi.encodeWithSelector(0xa9059cbb, to, amount)
);
require(success && (data.length == 0 || abi.decode(data, (bool)))); // ERC20 Transfer failed
| 9,313 |
5 | // Helper library to compute polymarket proxy wallet addresses | library PolyProxyLib {
/// @notice Gets the polymarket proxy address for a signer
/// @param signer - Address of the signer
function getProxyWalletAddress(address signer, address implementation, address deployer)
internal
pure
returns (address proxyWallet)
{
return _compu... | library PolyProxyLib {
/// @notice Gets the polymarket proxy address for a signer
/// @param signer - Address of the signer
function getProxyWalletAddress(address signer, address implementation, address deployer)
internal
pure
returns (address proxyWallet)
{
return _compu... | 1,381 |
37 | // ------------------------------------------------------------------------ Don't accept ETH ------------------------------------------------------------------------ | function () external payable {
revert();
}
| function () external payable {
revert();
}
| 30,492 |
25 | // Cancel transfer and get sent ether back. Only transfer sender cancancel transfer. _transitAddress transit address assigned to transferreturn True if success. / | function cancelTransfer(address _transitAddress) public returns (bool success) {
Transfer memory transferOrder = transferDct[_transitAddress];
// only sender can cancel transfer;
require(msg.sender == transferOrder.from);
delete transferDct[_transitAddress];
// transfer ether to recipient's... | function cancelTransfer(address _transitAddress) public returns (bool success) {
Transfer memory transferOrder = transferDct[_transitAddress];
// only sender can cancel transfer;
require(msg.sender == transferOrder.from);
delete transferDct[_transitAddress];
// transfer ether to recipient's... | 37,568 |
7 | // Peak may request withdrawl of any token. This may also be used to withdraw all liquidity when deprecating the controller/ | function withdraw(IERC20 token, uint amount) public onlyPeak {
amount = amount.min(token.balanceOf(address(this)));
token.safeTransfer(msg.sender, amount);
}
| function withdraw(IERC20 token, uint amount) public onlyPeak {
amount = amount.min(token.balanceOf(address(this)));
token.safeTransfer(msg.sender, amount);
}
| 7,772 |
150 | // Total amount of ether withdrawed | uint256 public weiWithdrawed = 0;
| uint256 public weiWithdrawed = 0;
| 33,553 |
283 | // Adds the {flashLoan} method, which provides flash loan support at the tokenlevel. By default there is no fee, but this can be changed by overriding {flashFee}./ Returns the maximum amount of tokens available for loan. token The address of the token that is requested.return The amount of token that can be loaned. / | function maxFlashLoan(address token) public view virtual override returns (uint256) {
return token == address(this) ? type(uint256).max - ERC20.totalSupply() : 0;
}
| function maxFlashLoan(address token) public view virtual override returns (uint256) {
return token == address(this) ? type(uint256).max - ERC20.totalSupply() : 0;
}
| 44,911 |
69 | // Increase total supply by `_val` _val Value to increasereturn Operation status / solhint-disable-next-line no-unused-vars | function incTotalSupply(uint _val) external onlyOwner returns (bool) {
return false;
}
| function incTotalSupply(uint _val) external onlyOwner returns (bool) {
return false;
}
| 30,484 |
7 | // address of the active staking contracts | address[] public activeContracts;
event GasCostSet(uint256 newGasCost);
event CollectInterestTimeThresholdSet(
uint256 newCollectInterestTimeThreshold
);
event InterestMultiplierSet(uint8 newInterestMultiplier);
event GasCostExceptInterestCollectSet(
uint256 newGasCostExceptInterestCollect
);
| address[] public activeContracts;
event GasCostSet(uint256 newGasCost);
event CollectInterestTimeThresholdSet(
uint256 newCollectInterestTimeThreshold
);
event InterestMultiplierSet(uint8 newInterestMultiplier);
event GasCostExceptInterestCollectSet(
uint256 newGasCostExceptInterestCollect
);
| 4,893 |
14 | // decode init data | (uint256[] memory _hatIds, ClaimType[] memory _claimTypes) = abi.decode(_initData, (uint256[], ClaimType[]));
_setHatsClaimabilityMemory(_hatIds, _claimTypes);
| (uint256[] memory _hatIds, ClaimType[] memory _claimTypes) = abi.decode(_initData, (uint256[], ClaimType[]));
_setHatsClaimabilityMemory(_hatIds, _claimTypes);
| 28,773 |
9 | // Send VNET Token / | function sendVNET(address _to, uint256 _amount) external onlyOwner {
assert(vnetToken.transfer(_to, _amount));
}
| function sendVNET(address _to, uint256 _amount) external onlyOwner {
assert(vnetToken.transfer(_to, _amount));
}
| 9,336 |
15 | // This contract is called through the proxy.//_protocolConfig BNPLProtocolConfig contract address/_configurator BNPL contract platform configurator address/_minimumBankNodeBondedAmount The minimum BankNode bonded amount required to create the bankNode/_loanOverdueGracePeriod Loan overdue grace period (secs)/_bankNodeL... | function initialize(
IBNPLProtocolConfig _protocolConfig,
address _configurator,
uint256 _minimumBankNodeBondedAmount,
uint256 _loanOverdueGracePeriod,
BankNodeLendingRewards _bankNodeLendingRewards,
BNPLKYCStore _bnplKYCStore
) external;
| function initialize(
IBNPLProtocolConfig _protocolConfig,
address _configurator,
uint256 _minimumBankNodeBondedAmount,
uint256 _loanOverdueGracePeriod,
BankNodeLendingRewards _bankNodeLendingRewards,
BNPLKYCStore _bnplKYCStore
) external;
| 43,091 |
35 | // Q_AC AC | t = proof.state_polys_openings_at_z[0].copy();
t.mul_assign(proof.state_polys_openings_at_z[2]);
scaled = vk.gate_setup_commitments[5].point_mul(t);
result.point_add_assign(scaled);
| t = proof.state_polys_openings_at_z[0].copy();
t.mul_assign(proof.state_polys_openings_at_z[2]);
scaled = vk.gate_setup_commitments[5].point_mul(t);
result.point_add_assign(scaled);
| 20,732 |
34 | // get the total amount of balance this user has in offer | uint256 nTotalOffers = getTotalInOffer(_aInvestor);
| uint256 nTotalOffers = getTotalInOffer(_aInvestor);
| 8,606 |
6 | // Indexing for shitcoins array | mapping(string => uint16) shitcoin_index;
| mapping(string => uint16) shitcoin_index;
| 34,281 |
44 | // Emits a {MinDelayChange} event. Requirements: - the caller must be the timelock itself. This can only be achieved by scheduling and later executingan operation where the timelock is the target and the data is the ABI-encoded call to this function. / | function updateDelay(uint256 newDelay) external virtual {
address sender = _msgSender();
if (sender != address(this)) {
revert TimelockUnauthorizedCaller(sender);
}
| function updateDelay(uint256 newDelay) external virtual {
address sender = _msgSender();
if (sender != address(this)) {
revert TimelockUnauthorizedCaller(sender);
}
| 1,527 |
1 | // variables around the ramp management of A, the amplification coefficientn(n - 1) see https:www.curve.fi/stableswap-paper.pdf for details | uint256 initialA;
uint256 futureA;
uint256 initialATime;
uint256 futureATime;
| uint256 initialA;
uint256 futureA;
uint256 initialATime;
uint256 futureATime;
| 9,233 |
89 | // disable adding to whitelist forever | function renounceWhitelist() public onlyOwner {
// adding to whitelist has been disabled forever:
canWhitelist = false;
}
| function renounceWhitelist() public onlyOwner {
// adding to whitelist has been disabled forever:
canWhitelist = false;
}
| 14,886 |
222 | // Trading | bytes4 public constant TAKE_ORDER_SELECTOR = bytes4(
keccak256("takeOrder(address,bytes,bytes)")
);
| bytes4 public constant TAKE_ORDER_SELECTOR = bytes4(
keccak256("takeOrder(address,bytes,bytes)")
);
| 52,510 |
19 | // Get allowance return Return amount allowed to spend from '_owner' by '_spender'/ | function allowance(address _owner, address _spender) public constant returns (uint256 _remaining) {
return allowances[_owner][_spender];
}
| function allowance(address _owner, address _spender) public constant returns (uint256 _remaining) {
return allowances[_owner][_spender];
}
| 8,201 |
10 | // Calculates the price of the pair token using the formula of weighted geometric mean. ethTotal_0 Total eth for token 0. ethTotal_1 Total eth for token 1. / | function getWeightedGeometricMean(uint256 ethTotal_0, uint256 ethTotal_1)
internal
view
returns (uint256)
| function getWeightedGeometricMean(uint256 ethTotal_0, uint256 ethTotal_1)
internal
view
returns (uint256)
| 56,441 |
1 | // Changes voted group. This call revokes all current votes for currently voted group./ votedGroupIndex is the index of votedGroup in SavingsCELO votes. This is expected to be 0 since/ SavingsCELO is supposed to be voting only for one group.// lesser.../greater... parameters are needed to perform Election.revokePending... | function changeVotedGroup(
address newGroup,
uint256 votedGroupIndex,
address lesserAfterPendingRevoke,
address greaterAfterPendingRevoke,
address lesserAfterActiveRevoke,
| function changeVotedGroup(
address newGroup,
uint256 votedGroupIndex,
address lesserAfterPendingRevoke,
address greaterAfterPendingRevoke,
address lesserAfterActiveRevoke,
| 40,134 |
50 | // if person income limit lesser than the daily ROI | else if(player[_playerAddress].incomeLimitLeft !=0) {
uint256 temp;
temp = player[_playerAddress].incomeLimitLeft;
player[_playerAddress].incomeLimitLeft = 0;
player[_playerAddress].dailyIncome = player[_playerAddress].dailyInc... | else if(player[_playerAddress].incomeLimitLeft !=0) {
uint256 temp;
temp = player[_playerAddress].incomeLimitLeft;
player[_playerAddress].incomeLimitLeft = 0;
player[_playerAddress].dailyIncome = player[_playerAddress].dailyInc... | 21,941 |
43 | // // Transferable tokenStandardToken modified with transfert on/off mechanism. / | contract TransferableToken is StandardToken,Ownable {
/** * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* @dev TRANSFERABLE MECANISM SECTION
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * **/
... | contract TransferableToken is StandardToken,Ownable {
/** * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* @dev TRANSFERABLE MECANISM SECTION
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * **/
... | 6,831 |
102 | // set withdrawn to true | hasWithdrawn[_msgSender()] = true;
| hasWithdrawn[_msgSender()] = true;
| 15,590 |
252 | // res += valcoefficients[42]. | res := addmod(res,
mulmod(val, /*coefficients[42]*/ mload(0x940), PRIME),
PRIME)
| res := addmod(res,
mulmod(val, /*coefficients[42]*/ mload(0x940), PRIME),
PRIME)
| 19,592 |
89 | // Name and symbol of the non fungible token, as defined in ERC721. | string internal constant NAME = "GAME Credits ERC721";
string internal constant SYMBOL = "GAME";
bytes4 private constant ON_ERC721_RECEIVED = bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"));
| string internal constant NAME = "GAME Credits ERC721";
string internal constant SYMBOL = "GAME";
bytes4 private constant ON_ERC721_RECEIVED = bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"));
| 26,564 |
24 | // transfer tokens | function transfer(address _to, uint256 _value) public returns (bool success) {
require(_balanceOf[msg.sender] >= _value);
_transfer(msg.sender, _to, _value);
return true;
}
| function transfer(address _to, uint256 _value) public returns (bool success) {
require(_balanceOf[msg.sender] >= _value);
_transfer(msg.sender, _to, _value);
return true;
}
| 43,935 |
33 | // RBAC (Role-Based Access Control) Matt Condon (@Shrugs) Stores and provides setters and getters for roles and addresses.Supports unlimited numbers of roles and addresses.This RBAC method uses strings to key roles. It may be beneficialfor you to write your own implementation of this interface using Enums or similar.It... | contract RBAC {
using Roles for Roles.Role;
mapping (string => Roles.Role) private roles;
event RoleAdded(address indexed operator, string role);
event RoleRemoved(address indexed operator, string role);
/**
* @dev reverts if addr does not have role
* @param _operator address
* @param _role the na... | contract RBAC {
using Roles for Roles.Role;
mapping (string => Roles.Role) private roles;
event RoleAdded(address indexed operator, string role);
event RoleRemoved(address indexed operator, string role);
/**
* @dev reverts if addr does not have role
* @param _operator address
* @param _role the na... | 41,980 |
12 | // Checks if provided address has tokens of current DAO_participantAddress Address of potential participant return boolean indicating if the address has at least one token/ | function isParticipant(address _participantAddress) external constant returns (bool) {
return token.balanceOf(_participantAddress) > 0;
}
| function isParticipant(address _participantAddress) external constant returns (bool) {
return token.balanceOf(_participantAddress) > 0;
}
| 35,949 |
6 | // remove one's vote from the previous choice first | if (hadVote)
removeVote(prev_choice);
| if (hadVote)
removeVote(prev_choice);
| 21,651 |
474 | // Either portfolioId, hack or bug | revert(ERROR_CORE_UNKNOWN_POSITION_TYPE);
| revert(ERROR_CORE_UNKNOWN_POSITION_TYPE);
| 29,543 |
52 | // Other | function getCurrentBlockNumber() public view returns(uint256 blockNumber) {
return block.number;
}
| function getCurrentBlockNumber() public view returns(uint256 blockNumber) {
return block.number;
}
| 30,443 |
3 | // There's only one cCHEESE, but it can be shared in slices of 0.00000000000000001 / | contract Cheese is ERC20, ERC20Burnable {
address vault = address(0x93282c09B426a3961D304726f47105498A8d30B4); // the cCHEESE FREEZER
constructor() ERC20("cCHEESE", "CHEESE") {
uint256 total = 1 * 10 ** decimals();
_mint(msg.sender, total);
// 0.25 goes to the freezer
super.tra... | contract Cheese is ERC20, ERC20Burnable {
address vault = address(0x93282c09B426a3961D304726f47105498A8d30B4); // the cCHEESE FREEZER
constructor() ERC20("cCHEESE", "CHEESE") {
uint256 total = 1 * 10 ** decimals();
_mint(msg.sender, total);
// 0.25 goes to the freezer
super.tra... | 18,672 |
12 | // ------------------------------------------------------------------------ Transfer the balance from token owner's account to `to` account - Owner's account must have sufficient balance to transfer - 0 value transfers are allowed ------------------------------------------------------------------------ | function transfer(address to, uint tokens) public returns (bool success) {
// prevent transfer to 0x0, use burn instead
require(to != address(0));
require(balances[msg.sender] >= tokens );
require(balances[to] + tokens >= balances[to]);
balances[msg.se... | function transfer(address to, uint tokens) public returns (bool success) {
// prevent transfer to 0x0, use burn instead
require(to != address(0));
require(balances[msg.sender] >= tokens );
require(balances[to] + tokens >= balances[to]);
balances[msg.se... | 39,312 |
128 | // On January 02, 2022 @ UTC 23:59 = FTST2625/100000 (2.625% of final total supply of tokens) to the wallet [E]. | if (order == 7) {
| if (order == 7) {
| 63,735 |
5 | // Test unexpected revert | Multicall.Call[] memory calls = new Multicall.Call[](2);
calls[0] = Multicall.Call(
address(callee),
abi.encodeWithSignature("getBlockHash(uint256)", block.number)
);
calls[1] = Multicall.Call(address(callee), abi.encodeWithSignature("thisMethodReverts()")
);
vm.expectRevert(byte... | Multicall.Call[] memory calls = new Multicall.Call[](2);
calls[0] = Multicall.Call(
address(callee),
abi.encodeWithSignature("getBlockHash(uint256)", block.number)
);
calls[1] = Multicall.Call(address(callee), abi.encodeWithSignature("thisMethodReverts()")
);
vm.expectRevert(byte... | 30,085 |
77 | // address of the current voting strategy to use on the governancereturn address of the voting strategy / | function getPowerStrategy() external view returns (IGovernancePowerStrategy);
| function getPowerStrategy() external view returns (IGovernancePowerStrategy);
| 15,931 |
6 | // verify that the number of elements is larger than 2 and odd | require(path.length > 2 && path.length % 2 == 1, "ERR_INVALID_PATH");
uint256 amount = sourceAmount;
| require(path.length > 2 && path.length % 2 == 1, "ERR_INVALID_PATH");
uint256 amount = sourceAmount;
| 4,956 |
2 | // require() verifica che, se una condizione è valida, ritorna un messaggio personalizzato di errore | require(campaign.deadline < block.timestamp , "The deadline should be a date in the future.");
campaign.owner = _owner;
campaign.title = _title;
campaign.description = _description;
campaign.target = _target;
campaign.deadline = _deadline;
campaign.amountCollecte... | require(campaign.deadline < block.timestamp , "The deadline should be a date in the future.");
campaign.owner = _owner;
campaign.title = _title;
campaign.description = _description;
campaign.target = _target;
campaign.deadline = _deadline;
campaign.amountCollecte... | 15,406 |
356 | // transfer USDC received back to pool and decrease amountInvested | holyPool.returnInvested(USDCReceived);
| holyPool.returnInvested(USDCReceived);
| 41,489 |
2 | // pool related functions //Creates the pool of swappable tokens _tokenAaddress Address of token A contract_tokenBaddress Address of token B contract_tokenAsupplySupply of tokens A in the pool_tokenBsupplySupply of tokens B in the pool_slippageMaximum slippage_exchangeRateThe price of token B in token A/ |
function createPool(
address _tokenAaddress,
address _tokenBaddress,
uint256 _tokenAsupply,
uint256 _tokenBsupply,
uint256 _slippage,
uint256 _exchangeRate
)
external
|
function createPool(
address _tokenAaddress,
address _tokenBaddress,
uint256 _tokenAsupply,
uint256 _tokenBsupply,
uint256 _slippage,
uint256 _exchangeRate
)
external
| 52,917 |
123 | // Computes the entropy used to generate the random number.The blockhash of the lock end block is XOR'd with the secret revealed by the owner.return The computed entropy value / | function _entropy() internal view returns (uint256) {
return uint256(blockhash(lockEndBlock) ^ secret);
}
| function _entropy() internal view returns (uint256) {
return uint256(blockhash(lockEndBlock) ^ secret);
}
| 7,332 |
147 | // 86400 - 1 day |
oraclizeBalance = oraclizeBalance.sub(oraclize_getPrice("URL")); //request to oraclize
|
oraclizeBalance = oraclizeBalance.sub(oraclize_getPrice("URL")); //request to oraclize
| 37,436 |
387 | // Pool token state variables | string poolName;
string symbol;
uint _totalSupply;
mapping(address => uint) balanceOf;
mapping(address => mapping(address => uint)) allowance;
mapping(address => uint) nonces;
| string poolName;
string symbol;
uint _totalSupply;
mapping(address => uint) balanceOf;
mapping(address => mapping(address => uint)) allowance;
mapping(address => uint) nonces;
| 29,176 |
49 | // Class constructor creates the main CSportsContest smart contract instance. | constructor(uint256 _cut) public {
require(_cut <= 10000);
ownerCut = _cut;
// All C-level roles are the message sender
ceoAddress = msg.sender;
cfoAddress = msg.sender;
cooAddress = msg.sender;
commissionerAddress = msg.sender;
// Create a contest to take up the 0th ... | constructor(uint256 _cut) public {
require(_cut <= 10000);
ownerCut = _cut;
// All C-level roles are the message sender
ceoAddress = msg.sender;
cfoAddress = msg.sender;
cooAddress = msg.sender;
commissionerAddress = msg.sender;
// Create a contest to take up the 0th ... | 48,446 |
97 | // Trigger sweep | PaymentHandler(address(uint160(handlers[i]))).sweepTokens(tokenContract);
| PaymentHandler(address(uint160(handlers[i]))).sweepTokens(tokenContract);
| 34,157 |
116 | // unset the value | has = false;
| has = false;
| 71,366 |
30 | // Constructor for creating the uRaiden microtransfer channels contract./_token_address The address of the Token used by the uRaiden contract./_challenge_period A fixed number of blocks representing the challenge period./ We enforce a minimum of 500 blocks waiting period./ after a sender requests the closing of the cha... | function RaidenMicroTransferChannels(address _token_address, uint32 _challenge_period) public {
event ChannelCloseRequested(
address indexed _sender,
address indexed _receiver,
uint32 indexed _open_block_number,
uint192 _balance);
event ChannelSettled(
address indexed... | function RaidenMicroTransferChannels(address _token_address, uint32 _challenge_period) public {
event ChannelCloseRequested(
address indexed _sender,
address indexed _receiver,
uint32 indexed _open_block_number,
uint192 _balance);
event ChannelSettled(
address indexed... | 4,459 |
140 | // Claim all pie accrued by the holders holders The addresses to claim PIE for pTokens The list of markets to claim PIE in borrowers Whether or not to claim PIE earned by borrowing suppliers Whether or not to claim PIE earned by supplying / | function claimPie(address[] memory holders, address[] memory pTokens, bool borrowers, bool suppliers) public {
for (uint i = 0; i < pTokens.length; i++) {
address pToken = pTokens[i];
require(markets[pToken].isListed, "market must be listed");
if (borrowers == true) {
... | function claimPie(address[] memory holders, address[] memory pTokens, bool borrowers, bool suppliers) public {
for (uint i = 0; i < pTokens.length; i++) {
address pToken = pTokens[i];
require(markets[pToken].isListed, "market must be listed");
if (borrowers == true) {
... | 76,782 |
25 | // Allow the current owner to remove an Admin | function removeAdmin(address _adminAddress) public onlyOwner{
require(adminsmap[_adminAddress].isAdmin == true,"Sorry,address is not an admin");
require(adminIndex > 1,"Atleast one admin is required");
require(_adminAddress != owner,"owner cannot be removed");
delete adminsmap[_adminAddress];
ad... | function removeAdmin(address _adminAddress) public onlyOwner{
require(adminsmap[_adminAddress].isAdmin == true,"Sorry,address is not an admin");
require(adminIndex > 1,"Atleast one admin is required");
require(_adminAddress != owner,"owner cannot be removed");
delete adminsmap[_adminAddress];
ad... | 20,536 |
20 | // An array of all the DividendSnapshot so far | DividendSnapshot[] dividendSnapshots;
| DividendSnapshot[] dividendSnapshots;
| 7,240 |
27 | // oods_coefficients[17]/ mload(add(context, 0x5be0)), res += c_18(f_1(x) - f_1(g^255z)) / (x - g^255z). | res := add(
res,
mulmod(mulmod(/*(x - g^255 * z)^(-1)*/ mload(add(denominatorsPtr, 0x8a0)),
| res := add(
res,
mulmod(mulmod(/*(x - g^255 * z)^(-1)*/ mload(add(denominatorsPtr, 0x8a0)),
| 28,827 |
181 | // Update non rebasing supply | nonRebasingSupply = nonRebasingSupply.add(balanceOf(_account));
| nonRebasingSupply = nonRebasingSupply.add(balanceOf(_account));
| 25,953 |
3 | // modifier inState(State expectedState, uint id){require(order_list[id].currentState == expectedState); _;} |
modifier timePassedRefund(uint256 id, uint256 time) {
require(now - order_list[id].OrderTime >= time);
require(order_list[id].deposit != 0);
require(msg.sender == order_list[id].buyer);
require(order_list[id].currentState == State.AWAITING_DELIVERY);
_;
}
|
modifier timePassedRefund(uint256 id, uint256 time) {
require(now - order_list[id].OrderTime >= time);
require(order_list[id].deposit != 0);
require(msg.sender == order_list[id].buyer);
require(order_list[id].currentState == State.AWAITING_DELIVERY);
_;
}
| 24,983 |
101 | // Check is user registered//_user user address// return status | function isRegisteredUser(address _user) public view returns (bool) {
return memberAddress2index[_user] != 0;
}
| function isRegisteredUser(address _user) public view returns (bool) {
return memberAddress2index[_user] != 0;
}
| 19,295 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.