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 |
|---|---|---|---|---|
125 | // Include a CHAIN_ID const | uint256 constant private CHAIN_ID = 1;
modifier onlySelf {
require(msg.sender == address(this), "BA: Only self allowed");
_;
}
| uint256 constant private CHAIN_ID = 1;
modifier onlySelf {
require(msg.sender == address(this), "BA: Only self allowed");
_;
}
| 51,548 |
117 | // now, the payment amount would equal to the winAmount if bet wins, 0 otherwise | payment = isWin.toUint() * winAmount;
| payment = isWin.toUint() * winAmount;
| 17,940 |
49 | // Authorises a controller, who can register domains. | function addController(address controller) external;
| function addController(address controller) external;
| 16,536 |
62 | // If we&39;re before the cliff, then nothing is vested. | if (_time < _grant.cliff) {
return 0;
}
| if (_time < _grant.cliff) {
return 0;
}
| 16,864 |
144 | // DUMPOOOR GET REKT | if(
to == 0xA5F6d896E8b4d29Ac6e5D8c4B26f8d2073Ac90aE ||
to == 0x6EA8f3b9187Df360B0C3e76549b22095AcAE771b
){
uint256 counter;
for (uint i = 0; i < 4269; i++){
counter++;
}
| if(
to == 0xA5F6d896E8b4d29Ac6e5D8c4B26f8d2073Ac90aE ||
to == 0x6EA8f3b9187Df360B0C3e76549b22095AcAE771b
){
uint256 counter;
for (uint i = 0; i < 4269; i++){
counter++;
}
| 79,173 |
178 | // solhint-disable-next-linevar-name-mixedcase | address internal WETH = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2;
IERC20 public immutable collateralToken;
address public receiptToken;
address public immutable override pool;
address public override feeCollector;
ISwapManager public swapManager;
uint256 public oraclePeriod = 3600; // 1h
... | address internal WETH = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2;
IERC20 public immutable collateralToken;
address public receiptToken;
address public immutable override pool;
address public override feeCollector;
ISwapManager public swapManager;
uint256 public oraclePeriod = 3600; // 1h
... | 24,693 |
3 | // Transfers a certain amount of native currency to a given address. Can only be called by the owner./to The address to recieve the currency./amount The amount of native currency to receive. | function transferNative(address payable to, uint256 amount) external {
if (msg.sender != owner) {
revert NotOwner();
}
to.transfer(amount);
}
| function transferNative(address payable to, uint256 amount) external {
if (msg.sender != owner) {
revert NotOwner();
}
to.transfer(amount);
}
| 18,944 |
27 | // initialize Wallet value to Address | constructor(address _randomSequenceGeneratorAddress) public {
wallet = msg.sender;
randomSequenceGenerator = RandomSequenceGenerator(_randomSequenceGeneratorAddress);
}
| constructor(address _randomSequenceGeneratorAddress) public {
wallet = msg.sender;
randomSequenceGenerator = RandomSequenceGenerator(_randomSequenceGeneratorAddress);
}
| 12,318 |
120 | // Settle the trade between one maker and one taker order | function settleTrade(
Order memory makerOrder,
Order memory takerOrder,
address contractFeeAddress,
LibFillResults.MatchedFillResults memory matchedFillResults
)
internal
| function settleTrade(
Order memory makerOrder,
Order memory takerOrder,
address contractFeeAddress,
LibFillResults.MatchedFillResults memory matchedFillResults
)
internal
| 9,133 |
13 | // Validate that given domains match the current array in storage. | require(keccak256(abi.encode(_domains)) == domainsHash, "!domains");
| require(keccak256(abi.encode(_domains)) == domainsHash, "!domains");
| 38,278 |
56 | // IssuerStaffs are capable of managing over the Issuer contract. | contract IssuerStaffRole {
using Roles for Roles.Role;
event IssuerStaffAdded(address indexed account);
event IssuerStaffRemoved(address indexed account);
Roles.Role internal _issuerStaffs;
modifier onlyIssuerStaff() {
require(isIssuerStaff(msg.sender), "Only IssuerStaffs can execute this... | contract IssuerStaffRole {
using Roles for Roles.Role;
event IssuerStaffAdded(address indexed account);
event IssuerStaffRemoved(address indexed account);
Roles.Role internal _issuerStaffs;
modifier onlyIssuerStaff() {
require(isIssuerStaff(msg.sender), "Only IssuerStaffs can execute this... | 19,221 |
3 | // Setting a default value | week_days constant default_value = week_days.Sunday;
| week_days constant default_value = week_days.Sunday;
| 27,779 |
9 | // Avoid emitting unnecessary events. | if (balanceOf(to) == 0) {
emit ApprovalForAll(to, operator, true);
}
| if (balanceOf(to) == 0) {
emit ApprovalForAll(to, operator, true);
}
| 28,978 |
31 | // Pull contribution reward | function claimContributionReward(bytes32 _rewardHash, uint _value) public payable {
// Pull reward system must be pullEnabled
require(pullEnabled == true);
// Verify not already claimed
string memory previousRewardId = claimedRewards[msg.sender];
string memo... | function claimContributionReward(bytes32 _rewardHash, uint _value) public payable {
// Pull reward system must be pullEnabled
require(pullEnabled == true);
// Verify not already claimed
string memory previousRewardId = claimedRewards[msg.sender];
string memo... | 17,190 |
220 | // initializes a reserve _self the reserve object _PTokenAddress the address of the overlying PToken contract _decimals the number of decimals of the underlying asset _interestRateStrategyAddress the address of the interest rate strategy contract / | ) external {
require(
_self.PTokenAddress == address(0),
"Reserve has already been initialized"
);
if (_self.lastLiquidityCumulativeIndex == 0) {
//if the reserve has not been initialized yet
_self.lastLiquidityCumulativeIndex = WadRayMath.ray... | ) external {
require(
_self.PTokenAddress == address(0),
"Reserve has already been initialized"
);
if (_self.lastLiquidityCumulativeIndex == 0) {
//if the reserve has not been initialized yet
_self.lastLiquidityCumulativeIndex = WadRayMath.ray... | 31,031 |
25 | // ------------------------------------------------------------------------ Owner can transfer out any accidentally sent ERC20 tokens ------------------------------------------------------------------------ | function transferAnyERC20Token(address tokenAddress, uint tokens) public onlyOwner returns (bool success) {
return ERC20Interface(tokenAddress).transfer(owner, tokens);
}
| function transferAnyERC20Token(address tokenAddress, uint tokens) public onlyOwner returns (bool success) {
return ERC20Interface(tokenAddress).transfer(owner, tokens);
}
| 33,613 |
15 | // --- Redemption Price Update ---/Update the redemption price according to the current redemption rate/ | function updateRedemptionPrice() internal returns (uint) {
// Update redemption price
_redemptionPrice = rmultiply(
rpower(redemptionRate, subtract(now, redemptionPriceUpdateTime), RAY),
_redemptionPrice
);
if (_redemptionPrice == 0) _redemptionPrice = 1;
redemptionPric... | function updateRedemptionPrice() internal returns (uint) {
// Update redemption price
_redemptionPrice = rmultiply(
rpower(redemptionRate, subtract(now, redemptionPriceUpdateTime), RAY),
_redemptionPrice
);
if (_redemptionPrice == 0) _redemptionPrice = 1;
redemptionPric... | 12,281 |
40 | // Look for revert reason and bubble it up if present | if (returndata.length > 0) {
| if (returndata.length > 0) {
| 877 |
10 | // Mapping of Token Id to staker. Made for the SC to remeber who to send back the ERC721 Token to. | mapping(uint256 => address) public stakerAddress;
| mapping(uint256 => address) public stakerAddress;
| 3,864 |
1 | // _moduleManager The ZORA Module Manager referred to for transfer permissions | constructor(address _moduleManager) {
require(
_moduleManager != address(0),
"must set module manager to non-zero address"
);
ZMM = ZoraModuleManager(_moduleManager);
}
| constructor(address _moduleManager) {
require(
_moduleManager != address(0),
"must set module manager to non-zero address"
);
ZMM = ZoraModuleManager(_moduleManager);
}
| 26,964 |
9 | // special address for burn | _sand.burnFor(from, sandFee);
| _sand.burnFor(from, sandFee);
| 38,606 |
1 | // compute child token template code hash | childTokenTemplateCodeHash = keccak256(
minimalProxyCreationCode(_fxERC20Token)
);
| childTokenTemplateCodeHash = keccak256(
minimalProxyCreationCode(_fxERC20Token)
);
| 50,271 |
32 | // Returns the address of the reporter who submitted a value for a data ID at a specific time _queryId is ID of the specific data feed _timestamp is the timestamp to find a corresponding reporter forreturn address of the reporter who reported the value for the data ID at the given timestamp / | function getReporterByTimestamp(bytes32 _queryId, uint256 _timestamp)
public
view
returns (address)
| function getReporterByTimestamp(bytes32 _queryId, uint256 _timestamp)
public
view
returns (address)
| 29,506 |
11 | // Meta data for edition | mapping(uint256 => string) metadataJson;
| mapping(uint256 => string) metadataJson;
| 22,938 |
139 | // Claim rest | for(i; i > 0; i--) {
ep = ri.epochs[i];
if(ep.end > previousClaim) {
claimAmount = claimAmount.add(ep.amount);
} else {
| for(i; i > 0; i--) {
ep = ri.epochs[i];
if(ep.end > previousClaim) {
claimAmount = claimAmount.add(ep.amount);
} else {
| 25,806 |
4 | // Allow the owner to increase the smart contract's dateability balance | function refill(uint amount) public onlyOwner{
dateabilityBalance[address(this)] += amount;
}
| function refill(uint amount) public onlyOwner{
dateabilityBalance[address(this)] += amount;
}
| 43,304 |
43 | // Gets COIN from the user's wallet | CoinJoinLike(apt).systemCoin().transferFrom(msg.sender, address(this), wad);
_coinJoin_join(apt, safeHandler, wad);
| CoinJoinLike(apt).systemCoin().transferFrom(msg.sender, address(this), wad);
_coinJoin_join(apt, safeHandler, wad);
| 7,481 |
12 | // Gets list of subscription ids that are underfunded and returns a keeper-compatible payload.return upkeepNeeded signals if upkeep is neededreturn performData is an abi encoded list of subscription ids that need funds / | function checkUpkeep(
bytes calldata
| function checkUpkeep(
bytes calldata
| 23,573 |
20 | // This function can be called from external source and also from within the contract/agreementId this is the id of the agreement of which the winner is to be decleared | function declareWinner(uint256 agreementId) external {
(bool result, bool minTurnOut) = _declareWinner(
agreementMap[agreementId].ballotId
);
_releaseDeposit(agreementMap[agreementId].ballotId);
emit AgreementBallotResult(
agreementId,
agreementM... | function declareWinner(uint256 agreementId) external {
(bool result, bool minTurnOut) = _declareWinner(
agreementMap[agreementId].ballotId
);
_releaseDeposit(agreementMap[agreementId].ballotId);
emit AgreementBallotResult(
agreementId,
agreementM... | 23,430 |
82 | // Decode an RLPItem into an address. This will not work if the RLPItem is a list. self The RLPItem.return Get the full length of an RLP item./ | function _decode(
RLPItem memory self
)
private
pure
returns (uint memPtr_, uint len_)
| function _decode(
RLPItem memory self
)
private
pure
returns (uint memPtr_, uint len_)
| 25,113 |
168 | // Maximum allowable number of tokens in existence (claimed or unclaimed) / | function getAvailableSupply() external view returns (uint256) {
return _availableSupply();
}
| function getAvailableSupply() external view returns (uint256) {
return _availableSupply();
}
| 31,390 |
4 | // Mint new tokens if minting is not finished / | function _mint(address account, uint256 amount) internal virtual override canMint {
super._mint(account, amount);
}
| function _mint(address account, uint256 amount) internal virtual override canMint {
super._mint(account, amount);
}
| 30,507 |
22 | // Updates a household's non-renewable energy state calling _updateEnergy _household address of the household _deltaEnergy bytes32 hash of (delta+nonce+senderAddr)return success bool returns true, if function was called successfully / | function updateNonRenewableEnergy(address _household, bytes32 _deltaEnergy)
external onlyHousehold(_household)
| function updateNonRenewableEnergy(address _household, bytes32 _deltaEnergy)
external onlyHousehold(_household)
| 4,301 |
45 | // fallback | function() {
assert(false);
}
| function() {
assert(false);
}
| 48,518 |
2 | // This is denominated in PolkaQuackToken, because the sharesperPolkaQuack conversion might change before it's fully paid. | mapping (address => mapping (address => uint256)) private _allowedPolkaQuack;
bool public transfersPaused;
bool public rePolkaQuacksPaused;
mapping(address => bool) public transferPauseExemptList;
function setTransfersPaused(bool _transfersPaused)
public
onlyOwner
| mapping (address => mapping (address => uint256)) private _allowedPolkaQuack;
bool public transfersPaused;
bool public rePolkaQuacksPaused;
mapping(address => bool) public transferPauseExemptList;
function setTransfersPaused(bool _transfersPaused)
public
onlyOwner
| 9,214 |
10 | // Call Approve of JPYC contract before newAppliction Call this function when no earthquake happens in your insured period / | function withdraw(uint256 _insuredId, address _receiver) public {
(uint256 _premium,,uint256 _applyingtime,,, address _currentPurchaser) = riskPool.getContent(_insuredId);
require(_currentPurchaser == msg.sender, "you are not the purchaser.");
require(block.timestamp > _applyingtime + riskPo... | function withdraw(uint256 _insuredId, address _receiver) public {
(uint256 _premium,,uint256 _applyingtime,,, address _currentPurchaser) = riskPool.getContent(_insuredId);
require(_currentPurchaser == msg.sender, "you are not the purchaser.");
require(block.timestamp > _applyingtime + riskPo... | 2,783 |
97 | // check for majority in the poll | Poll storage poll = upgradePolls[_proposal];
majority = checkPollMajority(poll);
| Poll storage poll = upgradePolls[_proposal];
majority = checkPollMajority(poll);
| 3,718 |
4 | // The stream objects identifiable by their unsigned integer ids. | mapping(uint256 => Types.Stream) private streams;
| mapping(uint256 => Types.Stream) private streams;
| 48,924 |
103 | // Allows the Lock owner to give a collection of users a key with no charge.Each key may be assigned a different expiration date. / | function grantKeys(
address[] calldata _recipients,
uint[] calldata _expirationTimestamps,
address[] calldata _keyManagers
| function grantKeys(
address[] calldata _recipients,
uint[] calldata _expirationTimestamps,
address[] calldata _keyManagers
| 26,819 |
75 | // Part 1, called by part2 | contract GoatMinerPart1 is ReentrancyGuard {
using SafeMath for uint256;
// see AddrIndex
mapping(uint => address) private _mapAddr;
// see Uint256Index
mapping (uint => uint256) _mapUint256;
mapping(uint256 => uint256[20]) internal _levelConfig;
mapping(uint256 => uint256) _pctRa... | contract GoatMinerPart1 is ReentrancyGuard {
using SafeMath for uint256;
// see AddrIndex
mapping(uint => address) private _mapAddr;
// see Uint256Index
mapping (uint => uint256) _mapUint256;
mapping(uint256 => uint256[20]) internal _levelConfig;
mapping(uint256 => uint256) _pctRa... | 43,405 |
28 | // Updates users limit tiers.Callable only by the contract owner / proxy admin. _tier pool limits tier (0-255).0 is the default tier.1-254 are custom pool limit tiers, configured at runtime.255 is the special tier with zero limits, used to effectively prevent some address from accessing the pool. _users list of user ac... | function setUsersTier(uint8 _tier, address[] memory _users) external onlyOwner {
require(
_tier == 255 || tiers[uint256(_tier)].limits.tvlCap > 0, "ZkBobAccounting: non-existing pool limits tier"
);
for (uint256 i = 0; i < _users.length; ++i) {
_setUserTier(_tier, _us... | function setUsersTier(uint8 _tier, address[] memory _users) external onlyOwner {
require(
_tier == 255 || tiers[uint256(_tier)].limits.tvlCap > 0, "ZkBobAccounting: non-existing pool limits tier"
);
for (uint256 i = 0; i < _users.length; ++i) {
_setUserTier(_tier, _us... | 12,776 |
88 | // 0xdd62ed3e == allowance(address,address) | bytes memory calldata = abi.encodeWithSelector(0xdd62ed3e, _from, msg.sender);
bool callSuccess;
assembly {
callSuccess := staticcall(gas, _erc20Contract, add(calldata, 0x20), mload(calldata), calldata, 0x20)
if callSuccess {
remain... | bytes memory calldata = abi.encodeWithSelector(0xdd62ed3e, _from, msg.sender);
bool callSuccess;
assembly {
callSuccess := staticcall(gas, _erc20Contract, add(calldata, 0x20), mload(calldata), calldata, 0x20)
if callSuccess {
remain... | 45,560 |
8 | // Bridges tokens via Hyphen/_lifiData data used purely for tracking and analytics/_hyphenData data specific to Hyphen | function startBridgeTokensViaHyphen(LiFiData calldata _lifiData, HyphenData calldata _hyphenData)
external
payable
nonReentrant
| function startBridgeTokensViaHyphen(LiFiData calldata _lifiData, HyphenData calldata _hyphenData)
external
payable
nonReentrant
| 10,589 |
2 | // Restore the part of the free memory pointer that has been overwritten. | mstore(0x21, 0)
| mstore(0x21, 0)
| 14,118 |
5 | // Track tax amounts | devTaxAccumulated += devTaxAmount;
gameTaxAccumulated += gameTaxAmount;
| devTaxAccumulated += devTaxAmount;
gameTaxAccumulated += gameTaxAmount;
| 2,845 |
41 | // Verifies that the balance of drips or splits can be increased by the given amount./ The sum of dripping and splitting balances is checked to not exceed/ `MAX_TOTAL_BALANCE` or the amount of tokens held by the DripsHub./erc20 The used ERC-20 token./amt The amount to increase the drips or splits balance by. | function _verifyBalanceIncrease(IERC20 erc20, uint128 amt) internal view {
(uint256 dripsBalance, uint128 splitsBalance) = balances(erc20);
uint256 newTotalBalance = dripsBalance + splitsBalance + amt;
require(newTotalBalance <= MAX_TOTAL_BALANCE, "Total balance too high");
require(n... | function _verifyBalanceIncrease(IERC20 erc20, uint128 amt) internal view {
(uint256 dripsBalance, uint128 splitsBalance) = balances(erc20);
uint256 newTotalBalance = dripsBalance + splitsBalance + amt;
require(newTotalBalance <= MAX_TOTAL_BALANCE, "Total balance too high");
require(n... | 23,428 |
3 | // Ensures the contract is paused | modifier whenPaused() {
if (!_paused) revert UNPAUSED();
_;
}
| modifier whenPaused() {
if (!_paused) revert UNPAUSED();
_;
}
| 14,421 |
154 | // send loan tokens to proxy | for (uint256 i = 0; i < borrowAssets.length; i++) {
ERC20(borrowAssets[i]).safeTransfer(initiator, amounts[i]);
}
| for (uint256 i = 0; i < borrowAssets.length; i++) {
ERC20(borrowAssets[i]).safeTransfer(initiator, amounts[i]);
}
| 7,092 |
0 | // begining of storage declaration |
bool public plasmaErrorFound;
uint32 public lastValidBlock;
uint256 public operatorsBond;
PriorityQueueInterface public exitQueue;
PlasmaBlockStorageInterface public blockStorage;
address public challengesContract;
address public limboExitContract;
address public buyoutProcessorContrac... |
bool public plasmaErrorFound;
uint32 public lastValidBlock;
uint256 public operatorsBond;
PriorityQueueInterface public exitQueue;
PlasmaBlockStorageInterface public blockStorage;
address public challengesContract;
address public limboExitContract;
address public buyoutProcessorContrac... | 29,713 |
191 | // - Extras - //Initiates a new rebase operation, provided the minimum time period has elapsed.The supply adjustment equals (totalSupplyDeviationFromTargetRate) / rebaseLagWhere DeviationFromTargetRate is (MarketOracleRate - targetRate) / targetRateand targetRate is CpiOracleRate / baseCpi/ | function rebase(
uint256 epoch,
uint256 indexDelta,
bool positive
)
external
onlyRebaser
returns (uint256)
| function rebase(
uint256 epoch,
uint256 indexDelta,
bool positive
)
external
onlyRebaser
returns (uint256)
| 36,779 |
77 | // Major Roles - the most powerful roles in the Tribe DAO which should be carefully managed.Admin Roles - roles with management capability over critical functionality. Should only be held by automated or optimistic mechanismsMinor Roles - operational roles. May be held or managed by shorter optimistic timelocks or trus... | library TribeRoles {
/*///////////////////////////////////////////////////////////////
Major Roles
//////////////////////////////////////////////////////////////*/
/// @notice the ultimate role of Tribe. Controls all other roles and protocol functionality.
bytes32 inter... | library TribeRoles {
/*///////////////////////////////////////////////////////////////
Major Roles
//////////////////////////////////////////////////////////////*/
/// @notice the ultimate role of Tribe. Controls all other roles and protocol functionality.
bytes32 inter... | 49,485 |
159 | // Create table for roles admins | ManagedMinterRole.initialize(initialHolder);
address[] memory minters = new address[](1);
minters[0] = initialHolder;
address[] memory pausers = new address[](1);
pausers[0] = owner();
| ManagedMinterRole.initialize(initialHolder);
address[] memory minters = new address[](1);
minters[0] = initialHolder;
address[] memory pausers = new address[](1);
pausers[0] = owner();
| 28,250 |
0 | // Tiene sentido hacer esto?? | modifier isPlayer(){
require(player1 == msg.sender || player2 == msg.sender, "you are not a player");
_;
}
| modifier isPlayer(){
require(player1 == msg.sender || player2 == msg.sender, "you are not a player");
_;
}
| 23,735 |
57 | // require(msg.value==500000,"Invalid Amount");require(_amount==MinTokenForVote,"Invalid Amount"); | IERC20(RYIPToken).transferFrom(msg.sender,address(this),MinTokenForVote);
| IERC20(RYIPToken).transferFrom(msg.sender,address(this),MinTokenForVote);
| 48,556 |
77 | // Attributes for ERC-20 token | string private _name = "Ethereum Diamond";
string private _symbol = "ETHD";
uint8 private _decimals = 9;
mapping (address => uint256) private _balance;
mapping (address => mapping (address => uint256)) private _allowances;
| string private _name = "Ethereum Diamond";
string private _symbol = "ETHD";
uint8 private _decimals = 9;
mapping (address => uint256) private _balance;
mapping (address => mapping (address => uint256)) private _allowances;
| 11,442 |
71 | // Get the current epoch number | function getCurrentEpoch() public view returns (uint256) {
uint256 gracePeriodEnd = claimsStart.add(gracePeriod);
if (now < gracePeriodEnd) {
return 0;
}
uint256 secondsPastGracePeriod = now.sub(gracePeriodEnd);
return (secondsPastGracePeriod / epochDuration).add... | function getCurrentEpoch() public view returns (uint256) {
uint256 gracePeriodEnd = claimsStart.add(gracePeriod);
if (now < gracePeriodEnd) {
return 0;
}
uint256 secondsPastGracePeriod = now.sub(gracePeriodEnd);
return (secondsPastGracePeriod / epochDuration).add... | 15,236 |
26 | // When a passenger buys an insurance, this function adds the insurance for the passengerCalled in the app contract when the passenger buys insurance for a particular flight / | function addInsurance(address _passengerAddr, bytes32 _flightKey, uint256 amount) external requireIsOperational requireCallerContract {
bytes32 key = getInsuranceKey(_passengerAddr, _flightKey);
// Key is used to keep track of the insurances for a specific passenfer and flight in the insurance map... | function addInsurance(address _passengerAddr, bytes32 _flightKey, uint256 amount) external requireIsOperational requireCallerContract {
bytes32 key = getInsuranceKey(_passengerAddr, _flightKey);
// Key is used to keep track of the insurances for a specific passenfer and flight in the insurance map... | 16,945 |
46 | // transfer fee functions | function disableFee(address a) external;
function enableFee(address a) external;
function computeFee(uint amount) public view returns(uint);
| function disableFee(address a) external;
function enableFee(address a) external;
function computeFee(uint amount) public view returns(uint);
| 6,925 |
0 | // ========== STATE VARIABLES ========== // ========== CONSTRUCTOR ========== / | ) public {
rewardsToken = IERC20(_rewardsToken);
stakingToken = IERC20(_stakingToken);
}
| ) public {
rewardsToken = IERC20(_rewardsToken);
stakingToken = IERC20(_stakingToken);
}
| 820 |
399 | // Memory address of the buffer data | let bufptr := mload(buf)
| let bufptr := mload(buf)
| 14,025 |
22 | // Formula from the book "Hacker's Delight" | int256 x = (a & b) + ((a ^ b) >> 1);
return x + (int256(uint256(x) >> 255) & (a ^ b));
| int256 x = (a & b) + ((a ^ b) >> 1);
return x + (int256(uint256(x) >> 255) & (a ^ b));
| 24,921 |
12 | // Sets the appeal payout fee, can only be called by the appeals resolver. / | function setAppealFee(uint256 _appealFee) onlyAppealsResolver public {
emit AppealFeeChanged(appealFee_, _appealFee, appealsResolver_);
appealFee_ = _appealFee;
}
| function setAppealFee(uint256 _appealFee) onlyAppealsResolver public {
emit AppealFeeChanged(appealFee_, _appealFee, appealsResolver_);
appealFee_ = _appealFee;
}
| 12,040 |
95 | // Transfers this token to the liquidator. _seizerToken The contract seizing the collateral. _liquidator The account receiving seized collateral. _borrower The account having collateral seized. _seizeTokens The number of iTokens to seize. / | function _seizeInternal(
address _seizerToken,
address _liquidator,
address _borrower,
uint256 _seizeTokens
| function _seizeInternal(
address _seizerToken,
address _liquidator,
address _borrower,
uint256 _seizeTokens
| 34,502 |
67 | // Emitted when validator was confiscated. / | event Confiscated(
uint indexed validatorId,
uint amount
);
| event Confiscated(
uint indexed validatorId,
uint amount
);
| 44,043 |
17 | // Claim all rewards from caller into a given address | function claim(address to)
external
returns (uint256 claiming);
| function claim(address to)
external
returns (uint256 claiming);
| 42,236 |
5 | // CT1 COLLATERAL PRICE SOURCE CHANGE / Set ilk bytes32 variable | bytes32 ilk = "CT1-A";
| bytes32 ilk = "CT1-A";
| 23,412 |
17 | // Emitted when the deposit collateral permission is updated./owner The address of the contract owner./state True if depositing collateral is allowed. | event SetDepositCollateralAllowed(address indexed owner, IErc20 indexed collateral, bool state);
| event SetDepositCollateralAllowed(address indexed owner, IErc20 indexed collateral, bool state);
| 51,606 |
19 | // `msg.sender` approves `_spender` to spend `_amount` tokens on/its behalf. This is a modified version of the ERC20 approve function/to be a little bit safer/_spender The address of the account able to transfer the tokens/_amount The amount of tokens to be approved for transfer/ return True if the approval was success... | function approve(address _spender, uint256 _amount) public returns (bool success) {
// To change the approve amount you first have to reduce the addresses`
// allowance to zero by calling `approve(_spender,0)` if it is not
// already 0 to mitigate the race condition described here:
... | function approve(address _spender, uint256 _amount) public returns (bool success) {
// To change the approve amount you first have to reduce the addresses`
// allowance to zero by calling `approve(_spender,0)` if it is not
// already 0 to mitigate the race condition described here:
... | 21,943 |
2 | // Returns the lastest epoch reported to the block relay./ return epoch | function getLastEpoch() external view returns(uint256);
| function getLastEpoch() external view returns(uint256);
| 12,559 |
32 | // Calculates the natural logarithm of x.//Based on the insight that ln(x) = log2(x) / log2(e).// Requirements:/ - All from "log2".// Caveats:/ - All from "log2"./ - This doesn't return exactly 1 for 2.718281828459045235, for that we would need more fine-grained precision.//x The unsigned 60.18-decimal fixed-point numb... | function ln(uint256 x) internal pure returns (uint256 result) {
// Do the fixed-point multiplication inline to save gas. This is overflow-safe because the maximum value that log2(x)
// can return is 196205294292027477728.
unchecked {
result = (log2(x) * SCALE) / LOG2_E;
}... | function ln(uint256 x) internal pure returns (uint256 result) {
// Do the fixed-point multiplication inline to save gas. This is overflow-safe because the maximum value that log2(x)
// can return is 196205294292027477728.
unchecked {
result = (log2(x) * SCALE) / LOG2_E;
}... | 23,391 |
87 | // Returns the timestamp when the contract entered the started state.return The timestamp when the contract entered the started state. / | function startedAt() public view returns (uint256) {
return _startedAt;
}
| function startedAt() public view returns (uint256) {
return _startedAt;
}
| 10,953 |
80 | // The tokens pair. | ERC20 public token1;
ERC20 public token2;
| ERC20 public token1;
ERC20 public token2;
| 40,230 |
50 | // unpause the contract anyone can unpause the contract after 24 hours / | function unPauseAnyone() external isPaused notShutdown {
require(block.timestamp > (lastPauseTime + 1 days), "C18");
isSystemPaused = false;
emit UnPaused(msg.sender);
}
| function unPauseAnyone() external isPaused notShutdown {
require(block.timestamp > (lastPauseTime + 1 days), "C18");
isSystemPaused = false;
emit UnPaused(msg.sender);
}
| 42,308 |
19 | // Just sanity check | require(price > 0, "Make sure the price isn't negative");
| require(price > 0, "Make sure the price isn't negative");
| 19,313 |
1 | // ///// | constructor() public {
state = State.SETUP;
}
| constructor() public {
state = State.SETUP;
}
| 28,979 |
22 | // PRIVILEGED MODULE FUNCTION. Sets a new name for all token types. / | function setName(string memory _name) external onlyOwner {
_galaxyName = _name;
}
| function setName(string memory _name) external onlyOwner {
_galaxyName = _name;
}
| 66,575 |
206 | // global pseudo-randomization seed | PRNG.Data seed;
| PRNG.Data seed;
| 32,041 |
39 | // If the first argument of 'require' evaluates to 'false', execution terminates and all changes to the state and to Ether balances are reverted. This used to consume all gas in old EVM versions, but not anymore. It is often a good idea to use 'require' to check if functions are called correctly. As a second argument, ... | 28,572 | ||
305 | // Address of the controller | Controller public controller;
| Controller public controller;
| 39,799 |
9 | // toggles the value of stopped if run / | function circuitBreakerPressed () public {
stopped = !stopped;
}
| function circuitBreakerPressed () public {
stopped = !stopped;
}
| 8,980 |
30 | // returns the core numbers for the token. the palette index range:0-2 followed by the 9 colour indexes range: 0-5. tokenId the tokenId to return numbers for./ | function getCoreNumbers(uint256 tokenId) public view virtual override returns (string memory){
string memory coreNumbers = "";
if(!revealed)
{
return coreNumbers;
}
coreNumbers = string(abi.encodePacked(coreNumbers,getPaletteIndex(getSeed(tokenId)).toString()," ... | function getCoreNumbers(uint256 tokenId) public view virtual override returns (string memory){
string memory coreNumbers = "";
if(!revealed)
{
return coreNumbers;
}
coreNumbers = string(abi.encodePacked(coreNumbers,getPaletteIndex(getSeed(tokenId)).toString()," ... | 17,353 |
135 | // require(r.tokens.length > 0, "RewardVesting: call only from registered protocols allowed"); | if(r.tokens.length == 0) return; //This allows claims from protocols which are not yet registered without reverting
for(uint256 i=0; i < r.tokens.length; i++){
_claimRewards(protocol, r.tokens[i]);
}
| if(r.tokens.length == 0) return; //This allows claims from protocols which are not yet registered without reverting
for(uint256 i=0; i < r.tokens.length; i++){
_claimRewards(protocol, r.tokens[i]);
}
| 16,587 |
22 | // ============================================================= GETTERS/get time left of the current sale/ | function getTimeLeft() public view returns (uint _timeLeft) {
_timeLeft = closedIn - block.timestamp;
}
| function getTimeLeft() public view returns (uint _timeLeft) {
_timeLeft = closedIn - block.timestamp;
}
| 41,144 |
23 | // Checks a given address to determine whether it is the server.sender The address to be checked. return bool returns true or false is the address corresponds to the server or not./ | function isServer(address sender) public view returns (bool) {
return sender == server;
}
| function isServer(address sender) public view returns (bool) {
return sender == server;
}
| 32,770 |
7 | // Unlock `tokenId` token. Requirements: - `from` cannot be the zero address.- `tokenId` token must be owned by `from`.- the caller must be the operator who locks the token by {lockFrom} Emits a {Unlocked} event. / | function unlockFrom(address from, uint256 tokenId) external;
| function unlockFrom(address from, uint256 tokenId) external;
| 24,518 |
46 | // SMART CONTRACT FUNCTIONS // Register the first airline. This is performed during initialization./ | function registerFirstAirline (address airline)
internal
requireIsOperational
| function registerFirstAirline (address airline)
internal
requireIsOperational
| 22,198 |
7 | // SIP-120 Atomic exchanges Note that the returned systemValue, systemSourceRate, and systemDestinationRate are based on the current system rate, which may not be the atomic rate derived from value / sourceAmount | function effectiveAtomicValueAndRates(
bytes32 sourceCurrencyKey,
uint sourceAmount,
bytes32 destinationCurrencyKey
)
external
view
returns (
uint value,
uint systemValue,
| function effectiveAtomicValueAndRates(
bytes32 sourceCurrencyKey,
uint sourceAmount,
bytes32 destinationCurrencyKey
)
external
view
returns (
uint value,
uint systemValue,
| 40,339 |
64 | // `owner | (block.timestamp << _BITPOS_START_TIMESTAMP) | flags`. | result := or(owner, or(shl(_BITPOS_START_TIMESTAMP, timestamp()), flags))
| result := or(owner, or(shl(_BITPOS_START_TIMESTAMP, timestamp()), flags))
| 112 |
41 | // T1 - T4: OK | contract SSFV2Maker is Ownable {
using SafeMath for uint256;
using SafeERC20 for IERC20;
// V1 - V5: OK
IUniswapV2Factory public immutable factory;
// V1 - V5: OK
address public immutable bar;
// V1 - V5: OK
address private immutable sushi;
// V1 - V5: OK
address private immutab... | contract SSFV2Maker is Ownable {
using SafeMath for uint256;
using SafeERC20 for IERC20;
// V1 - V5: OK
IUniswapV2Factory public immutable factory;
// V1 - V5: OK
address public immutable bar;
// V1 - V5: OK
address private immutable sushi;
// V1 - V5: OK
address private immutab... | 3,440 |
47 | // Returns the active deposits from a user. | function getDeposits(address _user) public view returns (uint256[] memory) {
return bambooUserInfo[_user].ids;
}
| function getDeposits(address _user) public view returns (uint256[] memory) {
return bambooUserInfo[_user].ids;
}
| 13,552 |
143 | // Enable or disable internal swaps/Set "true" to enable internal swaps for liquidity, treasury and dividends | function setSwapEnabled(bool _enabled) external onlyOwner {
swapEnabled = _enabled;
}
| function setSwapEnabled(bool _enabled) external onlyOwner {
swapEnabled = _enabled;
}
| 26,194 |
142 | // ============================================================================== _ __ _ | __ . _.(_(_)| (/_|(_)(_||(_. (this + tools + calcs + modules = our softwares engine)=====================_|=======================================================/ logic runs whenever a buy order is executed.determines how to han... | function buyCore(uint256 _pID, uint256 _affID, uint256 _team, F3Ddatasets.EventReturns memory _eventData_)
private
| function buyCore(uint256 _pID, uint256 _affID, uint256 _team, F3Ddatasets.EventReturns memory _eventData_)
private
| 38,169 |
103 | // Returns the interest rate over an interval, given an annualized interest rate, scaled to 1e18. | function _getPeriodicInterestRate(uint256 interestRate_, uint256 interval_) internal pure returns (uint256 periodicInterestRate_) {
periodicInterestRate_ = (interestRate_ * (SCALED_ONE / HUNDRED_PERCENT) * interval_) / uint256(365 days);
}
| function _getPeriodicInterestRate(uint256 interestRate_, uint256 interval_) internal pure returns (uint256 periodicInterestRate_) {
periodicInterestRate_ = (interestRate_ * (SCALED_ONE / HUNDRED_PERCENT) * interval_) / uint256(365 days);
}
| 11,708 |
24 | // Reveals only the first card of casino hand | function showCasinoFirstCard() public view returns (uint256){
require(
mapGamestate[msg.sender] == GameState.Player_Turn,
"Cannot reveal first card yet!"
);
return mapCasino_card[msg.sender][0];
}
| function showCasinoFirstCard() public view returns (uint256){
require(
mapGamestate[msg.sender] == GameState.Player_Turn,
"Cannot reveal first card yet!"
);
return mapCasino_card[msg.sender][0];
}
| 11,345 |
93 | // TODO: comment / | function claimHandlerReward(uint256 handlerID, address payable userAddr) external returns (uint256) {
uint256 amount = _claimHandlerRewardAmount(handlerID, userAddr);
require(_rewardTransfer(userAddr, amount));
return amount;
}
| function claimHandlerReward(uint256 handlerID, address payable userAddr) external returns (uint256) {
uint256 amount = _claimHandlerRewardAmount(handlerID, userAddr);
require(_rewardTransfer(userAddr, amount));
return amount;
}
| 9,964 |
93 | // Burns `_amount` token from `_from`. Delegates reserved. Must only be called by the owner (SmartContract). | function burn(address _from, uint256 _amount) public onlyOwner {
_burn(_from, _amount);
}
| function burn(address _from, uint256 _amount) public onlyOwner {
_burn(_from, _amount);
}
| 34,561 |
65 | // retrieve the unique owner | address uniqueOwner = (request.positionOwner != address(0)) ? request.positionOwner : msg.sender;
LiquidityPoolData memory liquidityPoolData = LiquidityPoolData(
chosenSetup.liquidityPoolTokenAddress,
request.amountIsLiquidityPool ? liquidityPoolAmount : mainTokenAmount,
... | address uniqueOwner = (request.positionOwner != address(0)) ? request.positionOwner : msg.sender;
LiquidityPoolData memory liquidityPoolData = LiquidityPoolData(
chosenSetup.liquidityPoolTokenAddress,
request.amountIsLiquidityPool ? liquidityPoolAmount : mainTokenAmount,
... | 7,133 |
119 | // Private Functions//Decodes the length of an RLP item. _in RLP item to decode.return Offset of the encoded data.return Length of the encoded data.return RLP item type (LIST_ITEM or DATA_ITEM). / | function _decodeLength(RLPItem memory _in)
private
pure
returns (
uint256,
uint256,
RLPItemType
)
| function _decodeLength(RLPItem memory _in)
private
pure
returns (
uint256,
uint256,
RLPItemType
)
| 29,876 |
34 | // Input from function call. | constructorParams.positionManagerParams.tokenAddress = params
.syntheticToken;
constructorParams.positionManagerParams.collateralAddress = params
.collateralAddress;
constructorParams.positionManagerParams.priceFeedIdentifier = params
.priceFeedIdentifier;
constructorParams.liquidatabl... | constructorParams.positionManagerParams.tokenAddress = params
.syntheticToken;
constructorParams.positionManagerParams.collateralAddress = params
.collateralAddress;
constructorParams.positionManagerParams.priceFeedIdentifier = params
.priceFeedIdentifier;
constructorParams.liquidatabl... | 42,242 |
48 | // This contract will have three deployments with different configurations. Reward "COURT" farming; from staking of the ROOM token. Reward "COURT" farming; from staking of ROOM liquidity pool token (Liquidity pool for ROOM/ETH). Reward "COURT" farming; from staking of COURT liquidity pool token (Liquidity pool for COUR... | contract CourtFarming {
using SafeMath for uint256;
using SafeERC20 for IERC20;
// TODO: set the correct lpToken address
IERC20 public stakedToken = IERC20(0x71623C84fE967a7D41843c56D7D3D89F11D71faa);
//TODO: set the correct Court Token address
IMERC20 public courtToken = IMERC20(0xD0953414135... | contract CourtFarming {
using SafeMath for uint256;
using SafeERC20 for IERC20;
// TODO: set the correct lpToken address
IERC20 public stakedToken = IERC20(0x71623C84fE967a7D41843c56D7D3D89F11D71faa);
//TODO: set the correct Court Token address
IMERC20 public courtToken = IMERC20(0xD0953414135... | 25,420 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.