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 |
|---|---|---|---|---|
103 | // Buy Bancor pool according converter version and type encode and compare converter version | if(uint256(_additionalArgs[0]) >= 28) {
| if(uint256(_additionalArgs[0]) >= 28) {
| 5,615 |
25 | // Update user's bonus debt as current accumulated bonus value (accBonusPerShareeffectiveTotal) | function _updateBonusDebt(address tokenAddress, address account) private {
userLockUps[tokenAddress][account].bonusDebt = tokenStats[tokenAddress].accBonusPerShare
.mul(userLockUps[tokenAddress][account].effectiveTotal).div(1e18);
}
| function _updateBonusDebt(address tokenAddress, address account) private {
userLockUps[tokenAddress][account].bonusDebt = tokenStats[tokenAddress].accBonusPerShare
.mul(userLockUps[tokenAddress][account].effectiveTotal).div(1e18);
}
| 49,983 |
221 | // we solve Aave's Interest Rates equation for utilisation rates above optimal U IR = BASERATE + SLOPE1 + SLOPE2(CURRENT_UTIL_RATE - OPTIMAL_UTIL_RATE) / (1-OPTIMAL_UTIL_RATE) | vars.targetUtilizationRate = (
_acceptableCostsRay.sub(irsVars.baseRate.add(irsVars.slope1))
)
.rayMul(uint256(1e27).sub(irsVars.optimalRate))
.rayDiv(irsVars.slope2)
.add(irsVars.optimalRate);
| vars.targetUtilizationRate = (
_acceptableCostsRay.sub(irsVars.baseRate.add(irsVars.slope1))
)
.rayMul(uint256(1e27).sub(irsVars.optimalRate))
.rayDiv(irsVars.slope2)
.add(irsVars.optimalRate);
| 26,493 |
9 | // Returns the integer division of two unsigned integers. Reverts with custom message ondivision by zero. The result is rounded towards zero. Counterpart to Solidity's `/` operator. Note: this function uses a`revert` opcode (which leaves remaining gas untouched) while Solidityuses an invalid opcode to revert (consuming... |
require(b > 0);
uint256 c = a / b;
return c;
|
require(b > 0);
uint256 c = a / b;
return c;
| 27,225 |
5,448 | // 2726 | entry "intersexually" : ENG_ADVERB
| entry "intersexually" : ENG_ADVERB
| 23,562 |
175 | // Immutable integers | uint256 public cost = 700000000000000000; // 0.07 eth
uint256 public maxSupply = 10000;
uint256 public maxMintAmount = 1000;
bool public paused = false;
bool public publicMintIsActive = false;
bool public revealed = false;
bool public governanceWhitelisted = true;
bool public onlyWhitelisted = true;
... | uint256 public cost = 700000000000000000; // 0.07 eth
uint256 public maxSupply = 10000;
uint256 public maxMintAmount = 1000;
bool public paused = false;
bool public publicMintIsActive = false;
bool public revealed = false;
bool public governanceWhitelisted = true;
bool public onlyWhitelisted = true;
... | 65,288 |
24 | // converts ESOP into equity token or an internal 'payout token', completed only when conversion is over | ConvertESOP,
| ConvertESOP,
| 37,161 |
111 | // Check if tokens can be burned at address before burning account account to burn tokens from amount amount of tokens to burn / | function _burn(address account, uint256 amount) internal override {
require(canBurn[account], "TrueCurrency: cannot burn from this address");
super._burn(account, amount);
}
| function _burn(address account, uint256 amount) internal override {
require(canBurn[account], "TrueCurrency: cannot burn from this address");
super._burn(account, amount);
}
| 87,721 |
8 | // Require that the deadline is a date in the future | require(campaign.deadline < block.timestamp, "The deadline should be a date in the future.");
| require(campaign.deadline < block.timestamp, "The deadline should be a date in the future.");
| 3,468 |
19 | // This function is called by a EulerProblem when a user/ successfully submitted a solution. The function verifies that/ the sender is indeed an EulerProblem contract as expected. The/ function emits en event and calls the EulerUser contract to/ record the information/problem: the number of the problem/pubkey: the user... | function has_solved( uint32 problem,
uint256 pubkey ) public override
| function has_solved( uint32 problem,
uint256 pubkey ) public override
| 34,423 |
49 | // Init token by setting its total supplytotalSupply total token supply/ | function WealthInternet(
uint256 totalSupply
) DetailedERC20(
"Wealth Internet",
"WIC",
6
| function WealthInternet(
uint256 totalSupply
) DetailedERC20(
"Wealth Internet",
"WIC",
6
| 40,006 |
8 | // Accumulate DSR interest -- must do this in order to doTransferIn | pot.drip();
| pot.drip();
| 12,453 |
45 | // Pause the public function / | function pause() public onlyOwner {
_pause();
}
| function pause() public onlyOwner {
_pause();
}
| 751 |
130 | // Ethen Decentralized Exchange Contract https:ethen.io/ | contract Ethen is Pausable {
// Trade & order types
uint public constant BUY = 1; // order type BID
uint public constant SELL = 0; // order type ASK
// Percent multiplier in makeFee & takeFee
uint public FEE_MUL = 1000000;
// x1000000, 0.5%
uint public constant MAX_FEE = 5000;
// Time... | contract Ethen is Pausable {
// Trade & order types
uint public constant BUY = 1; // order type BID
uint public constant SELL = 0; // order type ASK
// Percent multiplier in makeFee & takeFee
uint public FEE_MUL = 1000000;
// x1000000, 0.5%
uint public constant MAX_FEE = 5000;
// Time... | 32,665 |
77 | // Lets the owner cancel an ongoing recovery procedure.Must be confirmed by N guardians, where N = ceil(Nb Guardian at executeRecovery + 1) / 2) - 1. _wallet The target wallet. / | function cancelRecovery(address _wallet) external onlySelf() onlyWhenRecovery(_wallet) {
address recoveryOwner = recoveryConfigs[_wallet].recovery;
delete recoveryConfigs[_wallet];
_setLock(_wallet, 0, bytes4(0));
emit RecoveryCanceled(_wallet, recoveryOwner);
}
| function cancelRecovery(address _wallet) external onlySelf() onlyWhenRecovery(_wallet) {
address recoveryOwner = recoveryConfigs[_wallet].recovery;
delete recoveryConfigs[_wallet];
_setLock(_wallet, 0, bytes4(0));
emit RecoveryCanceled(_wallet, recoveryOwner);
}
| 29,272 |
16 | // The upper tick of the range | function tickUpper() external view returns (int24);
| function tickUpper() external view returns (int24);
| 4,585 |
33 | // Series available in Cauldron. | function series(bytes6 seriesId)
external
view
returns (DataTypes.Series memory);
| function series(bytes6 seriesId)
external
view
returns (DataTypes.Series memory);
| 2,765 |
270 | // Mapping from an address to quantity of AO bought from all pool | mapping (address => uint256) public totalBought;
| mapping (address => uint256) public totalBought;
| 53,075 |
14 | // Set metadata on an owned areax1, y1, x2, y2 - area coordinatestokenURI - token URI/ | function setMetadataOnArea(uint256 x1, uint256 y1, uint256 x2, uint256 y2, string memory tokenURI) external whenNotPaused {
require(_isValidRange(x1, y1, x2, y2), "Cannot set metadata: Invalid area");
uint256 tokenId = _getTokenId(x1, y1, x2, y2);
_setAreaMetadata(msg.sender, tokenURI, token... | function setMetadataOnArea(uint256 x1, uint256 y1, uint256 x2, uint256 y2, string memory tokenURI) external whenNotPaused {
require(_isValidRange(x1, y1, x2, y2), "Cannot set metadata: Invalid area");
uint256 tokenId = _getTokenId(x1, y1, x2, y2);
_setAreaMetadata(msg.sender, tokenURI, token... | 27,981 |
135 | // Withdraw LP TOKENs from UBXTStaking. | function withdraw(uint256 _pid, uint256 _amount) public {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][msg.sender];
require(user.amount >= _amount, "withdraw: not good");
updatePool(_pid);
uint256 pending =
user.amount.mul(pool.ac... | function withdraw(uint256 _pid, uint256 _amount) public {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][msg.sender];
require(user.amount >= _amount, "withdraw: not good");
updatePool(_pid);
uint256 pending =
user.amount.mul(pool.ac... | 5,897 |
24 | // Adds multiple reward tokens to the pool in a single call, only contract owner can call this _rewardSettings array of struct composed of "IERC20 rewardToken" and "uint256 totalRewards" / | function addMulti(RewardSettings[] memory _rewardSettings)
external
override
nonReentrant
onlyOwner
onlyRewardsPeriod
| function addMulti(RewardSettings[] memory _rewardSettings)
external
override
nonReentrant
onlyOwner
onlyRewardsPeriod
| 48,076 |
76 | // Retrieve the dividend balance of any single address. / | function dividendsOf(address customerAddress)
view
public
returns(uint256)
| function dividendsOf(address customerAddress)
view
public
returns(uint256)
| 7,058 |
521 | // Artem Distribution // Recalculate and update ARTEM speeds for all ARTEM markets / | function refreshArtemSpeeds() public {
require(msg.sender == tx.origin, "only externally owned accounts may refresh speeds");
refreshArtemSpeedsInternal();
}
| function refreshArtemSpeeds() public {
require(msg.sender == tx.origin, "only externally owned accounts may refresh speeds");
refreshArtemSpeedsInternal();
}
| 21,570 |
3 | // DailyDist extends Dist and contains a large period of daily distributions (from 1 day to exact) | struct DistPeriod {
Dist dist;
uint256 id;
uint256 start_time;
uint256 end_time;
uint256 days_total;
uint256 descending_amount;
bytes32 caption;
uint256 amount;
uint256 daily_amount;
uint256 ref_reserve_percentage;
... | struct DistPeriod {
Dist dist;
uint256 id;
uint256 start_time;
uint256 end_time;
uint256 days_total;
uint256 descending_amount;
bytes32 caption;
uint256 amount;
uint256 daily_amount;
uint256 ref_reserve_percentage;
... | 48,458 |
110 | // Creates a new ordernftAddress - Non fungible registry addressassetId - ID of the published NFTpriceInWei - Price in Wei for the supported coinexpiresAt - Duration of the order (in hours)/ | function createOrder(
address nftAddress,
uint256 assetId,
uint256 priceInWei,
uint256 expiresAt
)
public
whenNotPaused
| function createOrder(
address nftAddress,
uint256 assetId,
uint256 priceInWei,
uint256 expiresAt
)
public
whenNotPaused
| 19,072 |
207 | // Save current values for inclusion in log | address oldAdmin = admin;
address oldPendingAdmin = pendingAdmin;
| address oldAdmin = admin;
address oldPendingAdmin = pendingAdmin;
| 228 |
96 | // Get time lock array length account The address want to know the time lock length.return time lock length / | function getTimeLockLength(address account) public view returns (uint256) {
return _timeLocks[account].length;
}
| function getTimeLockLength(address account) public view returns (uint256) {
return _timeLocks[account].length;
}
| 81,842 |
35 | // Computes the next vesting schedule identifier for a given holder address./ | function computeNextVestingScheduleIdForHolder(address holder)
public
view
| function computeNextVestingScheduleIdForHolder(address holder)
public
view
| 26,316 |
93 | // Gets the transfer cap defined in this contract./return Returns maximum allowed value for a single transfer operation of ERC20 token and Ethereum. | function getCap() external view returns(uint256, uint256) {
return (_maximumTransfer, _maximumTransferWei);
}
| function getCap() external view returns(uint256, uint256) {
return (_maximumTransfer, _maximumTransferWei);
}
| 45,264 |
8 | // Throws if called by any account other than the owner. / | modifier onlyOwner() {
if (_owner != msg.sender) revert ProposedOwnable__onlyOwner_notOwner();
_;
}
| modifier onlyOwner() {
if (_owner != msg.sender) revert ProposedOwnable__onlyOwner_notOwner();
_;
}
| 9,742 |
9 | // the roles is used to restrict who is allowed to publish liquidity protection events. | bytes32 public constant ROLE_PUBLISHER = keccak256("ROLE_PUBLISHER");
| bytes32 public constant ROLE_PUBLISHER = keccak256("ROLE_PUBLISHER");
| 70,890 |
0 | // stores created Ponds by user | mapping(address => Pond[]) public getUserPond;
Pond[] public getPond;
event PondCreated(address addr, address owner, uint256 timestamp);
| mapping(address => Pond[]) public getUserPond;
Pond[] public getPond;
event PondCreated(address addr, address owner, uint256 timestamp);
| 11,867 |
109 | // Sets whether `operator` is approved to manage the tokens of the caller./ | /// Emits a {ApprovalForAll} event.
function setApprovalForAll(address operator, bool isApproved) public virtual {
/// @solidity memory-safe-assembly
assembly {
// Convert to 0 or 1.
isApproved := iszero(iszero(isApproved))
// Update the `isApproved` for (`msg.sender`... | /// Emits a {ApprovalForAll} event.
function setApprovalForAll(address operator, bool isApproved) public virtual {
/// @solidity memory-safe-assembly
assembly {
// Convert to 0 or 1.
isApproved := iszero(iszero(isApproved))
// Update the `isApproved` for (`msg.sender`... | 21,871 |
122 | // This event emits when distributed funds are withdrawn by a token holder. by the address of the receiver of funds fundsWithdrawn the amount of funds that were withdrawn / | event FundsWithdrawn(address indexed by, uint256 fundsWithdrawn);
| event FundsWithdrawn(address indexed by, uint256 fundsWithdrawn);
| 11,461 |
252 | // decide which crab will have the legendary part | _crabWithLegendaryPart = _generateRandomNumber(bytes32(_currentTokenId), 10);
| _crabWithLegendaryPart = _generateRandomNumber(bytes32(_currentTokenId), 10);
| 36,957 |
75 | // Set a loan duration and its interest rate. Owner sets a loan duration and its interest rate. _duration Loan duration. _interest Loan interest. / | function setLoanDurationAndInterest(uint256 _duration, uint256 _interest) external onlyByManager{
uint256 _tariffId = uint256(keccak256(abi.encodePacked(lnTfId.length, block.timestamp, _duration)));
lnTfId.push(_tariffId);
lnTariffIdToInfo[_tariffId] = LoanTariff(_duration, _interest);
... | function setLoanDurationAndInterest(uint256 _duration, uint256 _interest) external onlyByManager{
uint256 _tariffId = uint256(keccak256(abi.encodePacked(lnTfId.length, block.timestamp, _duration)));
lnTfId.push(_tariffId);
lnTariffIdToInfo[_tariffId] = LoanTariff(_duration, _interest);
... | 19,670 |
318 | // burn sUSD from messageSender (liquidator) and reduce account's debt | _burnSynths(account, liquidator, amountToLiquidate, debtBalance, totalDebtIssued);
| _burnSynths(account, liquidator, amountToLiquidate, debtBalance, totalDebtIssued);
| 49,680 |
11 | // Emitted when `tokenId` is unlocked. / | event Unlocked(uint256 tokenId);
| event Unlocked(uint256 tokenId);
| 28,942 |
74 | // ADMINISTRATOR FUNCTIONS FOR COMPETITION MAINTENANCE / | modifier isAdministrator() {
address _sender = msg.sender;
if (_sender == administrator) {
_;
} else {
revert();
}
}
| modifier isAdministrator() {
address _sender = msg.sender;
if (_sender == administrator) {
_;
} else {
revert();
}
}
| 38,431 |
34 | // ----- temp ----- | uint256 public tTokenPerEth = 0;
uint256 public tAmount = 0;
uint i = 0;
bool private tIcoOpen = false;
| uint256 public tTokenPerEth = 0;
uint256 public tAmount = 0;
uint i = 0;
bool private tIcoOpen = false;
| 73,697 |
59 | // Array with all token ids, used for enumeration | uint256[] private _allTokens;
| uint256[] private _allTokens;
| 2,403 |
115 | // send token's worth of ethers to the owner | sendTo.transfer(msg.value);
| sendTo.transfer(msg.value);
| 39,847 |
23 | // src/lender/deployer.sol/ pragma solidity >=0.6.12; / | /* import { ReserveFabLike, AssessorFabLike, TrancheFabLike, CoordinatorFabLike, OperatorFabLike, MemberlistFabLike, RestrictedTokenFabLike, PoolAdminFabLike, ClerkFabLike } from "./fabs/interfaces.sol"; */
/* import {FixedPoint} from "./../fixed_point.sol"; */
interface DependLike_3 {
function depend(bytes... | /* import { ReserveFabLike, AssessorFabLike, TrancheFabLike, CoordinatorFabLike, OperatorFabLike, MemberlistFabLike, RestrictedTokenFabLike, PoolAdminFabLike, ClerkFabLike } from "./fabs/interfaces.sol"; */
/* import {FixedPoint} from "./../fixed_point.sol"; */
interface DependLike_3 {
function depend(bytes... | 52,452 |
121 | // Creates a new vesting schedule for a beneficiary._beneficiary address of the beneficiary to whom vested tokens are transferred_start start time of the vesting period_cliff duration in seconds of the cliff in which tokens will begin to vest_duration duration in seconds of the period in which the tokens will vest_slic... | function createVestingSchedule(
address _beneficiary,
uint256 _start,
uint256 _cliff,
uint256 _duration,
uint256 _slicePeriodSeconds,
bool _revocable,
uint256 _amount
)
public
| function createVestingSchedule(
address _beneficiary,
uint256 _start,
uint256 _cliff,
uint256 _duration,
uint256 _slicePeriodSeconds,
bool _revocable,
uint256 _amount
)
public
| 27,624 |
100 | // See {IERC20Permit-permit}. / | function permit(
| function permit(
| 3,338 |
35 | // divides the random seed into components | function getComponents(
uint cardIndex, uint rand
) internal pure returns (
RandomnessComponents memory
| function getComponents(
uint cardIndex, uint rand
) internal pure returns (
RandomnessComponents memory
| 2,091 |
66 | // 0.5% fee by dividing by 200 | uint256 tCharity = tAmount.mul(_charityFee).div(200);
uint256 tBurn = tAmount.mul(_burnFee).div(200);
| uint256 tCharity = tAmount.mul(_charityFee).div(200);
uint256 tBurn = tAmount.mul(_burnFee).div(200);
| 53,677 |
97 | // Initialize to all zeros, and set the amount associated with the swap. | uint256[] memory amounts = new uint256[](tokens.length);
IERC20 token = isJoin ? request.tokenIn : request.tokenOut;
for (uint256 i = 0; i < tokens.length; i++) {
if (tokens[i] == token) {
amounts[i] = amount;
break;
}
| uint256[] memory amounts = new uint256[](tokens.length);
IERC20 token = isJoin ? request.tokenIn : request.tokenOut;
for (uint256 i = 0; i < tokens.length; i++) {
if (tokens[i] == token) {
amounts[i] = amount;
break;
}
| 22,285 |
96 | // and get a portion of the eventual unlent balance | redeemedTokens = redeemedTokens.add(_amount.mul(_balanceUnderlying).div(idleSupply));
| redeemedTokens = redeemedTokens.add(_amount.mul(_balanceUnderlying).div(idleSupply));
| 65,992 |
52 | // Function to disable trading | function disableTrading() external {
require(msg.sender == _owner);
_trading = false;
}
| function disableTrading() external {
require(msg.sender == _owner);
_trading = false;
}
| 69,894 |
14 | // set the actual output length | mstore(result, encodedLen)
| mstore(result, encodedLen)
| 23,859 |
7 | // e.g. totalInputAmount = realPrice | totalInputAmount = totalInputAmount.add(userAmount);
| totalInputAmount = totalInputAmount.add(userAmount);
| 27,948 |
14 | // Query if a contract implements an interface/interfaceId The interface identifier, as specified in ERC-165/Interface identification is specified in ERC-165. This function/uses less than 30,000 gas./ return `true` if the contract implements `interfaceID` and/`interfaceID` is not 0xffffffff, `false` otherwise | function supportsInterface(bytes4 interfaceId)
public
view
virtual
override(ERC721Enumerable)
returns (bool)
| function supportsInterface(bytes4 interfaceId)
public
view
virtual
override(ERC721Enumerable)
returns (bool)
| 78,086 |
25 | // return The address of the BaseOperators contract. / | function getOperatorsContract() public view returns (address) {
return address(operatorsInst);
}
| function getOperatorsContract() public view returns (address) {
return address(operatorsInst);
}
| 65,325 |
143 | // Calls wraper contract for exchage to preform an on-chain swap/_exData Exchange data struct/_type Type of action SELL|BUY/ return swapedTokens For Sell that the destAmount, for Buy thats the srcAmount | function saverSwap(ExchangeData memory _exData, ActionType _type) internal returns (uint swapedTokens) {
require(SaverExchangeRegistry(SAVER_EXCHANGE_REGISTRY).isWrapper(_exData.wrapper), ERR_WRAPPER_INVALID);
ERC20(_exData.srcAddr).safeTransfer(_exData.wrapper, _exData.srcAmount);
if (_ty... | function saverSwap(ExchangeData memory _exData, ActionType _type) internal returns (uint swapedTokens) {
require(SaverExchangeRegistry(SAVER_EXCHANGE_REGISTRY).isWrapper(_exData.wrapper), ERR_WRAPPER_INVALID);
ERC20(_exData.srcAddr).safeTransfer(_exData.wrapper, _exData.srcAmount);
if (_ty... | 2,600 |
311 | // return The actual exit fee paid |
function withdrawInstantlyFrom(
address from,
uint256 amount,
address controlledToken,
uint256 maximumExitFee
|
function withdrawInstantlyFrom(
address from,
uint256 amount,
address controlledToken,
uint256 maximumExitFee
| 5,095 |
174 | // Returns the community fee rate and community fee receiver.return communitySwapFee - community swap fee rate.return communityJoinFee - community join fee rate.return communityExitFee - community exit fee rate.return communityFeeReceiver - community fee receiver address. / | function getCommunityFee()
external view override
_viewlock_
returns (uint communitySwapFee, uint communityJoinFee, uint communityExitFee, address communityFeeReceiver)
| function getCommunityFee()
external view override
_viewlock_
returns (uint communitySwapFee, uint communityJoinFee, uint communityExitFee, address communityFeeReceiver)
| 34,572 |
3 | // send `_value` token to `_to` from `msg.sender`/_to The address of the recipient/_value The amount of token to be transferred/ return Whether the transfer was successful or not | function transfer(address _to, uint256 _value) returns (bool success);
| function transfer(address _to, uint256 _value) returns (bool success);
| 27,944 |
18 | // Internal function to burn an amount of a token with the given ID owner Account which owns the token to be burnt id ID of the token to be burnt value Amount of the token to be burnt / | function _burn(address owner, uint256 id, uint256 value) internal {
_balances[id][owner] -= value;
emit TransferSingle(msg.sender, owner, address(0), id, value);
}
| function _burn(address owner, uint256 id, uint256 value) internal {
_balances[id][owner] -= value;
emit TransferSingle(msg.sender, owner, address(0), id, value);
}
| 12,838 |
210 | // swap your base asset to quote asset; the impact of the price can be restricted with fluctuationLimitRatio only clearingHouse can call this function _dir ADD_TO_AMM for short, REMOVE_FROM_AMM for long, opposite direction from swapInput _baseAssetAmount base asset amount _quoteAssetAmountLimit limit of quote asset amo... | function swapOutput(
Dir _dir,
Decimal.decimal calldata _baseAssetAmount,
Decimal.decimal calldata _quoteAssetAmountLimit,
bool _skipFluctuationCheck
| function swapOutput(
Dir _dir,
Decimal.decimal calldata _baseAssetAmount,
Decimal.decimal calldata _quoteAssetAmountLimit,
bool _skipFluctuationCheck
| 21,979 |
43 | // implemented the functionality, which checks whether a transfer goes to a contract | function transfer(address _to, uint256 _value) public returns (bool)
| function transfer(address _to, uint256 _value) public returns (bool)
| 37,174 |
26 | // Use data (could come offchain, for example) to gaurd the withdraw | require(proof == VALID_DATA, "_execWithdrawal: Invalid data provided");
_supplyOf[supplier] -= _value;
emit Withdraw(_operator, _value, _data);
| require(proof == VALID_DATA, "_execWithdrawal: Invalid data provided");
_supplyOf[supplier] -= _value;
emit Withdraw(_operator, _value, _data);
| 17,183 |
11 | // function allowance(address owner, address spender) external view returns (uint); function approve(address spender, uint value) external returns (bool); |
IERC20 token0 = IERC20(address(path0[0].from));
IERC20 token1 = IERC20(address(path0[0].to));
|
IERC20 token0 = IERC20(address(path0[0].from));
IERC20 token1 = IERC20(address(path0[0].to));
| 26,616 |
28 | // Autonomous Sub Art contract Extends ERC721 Non-Fungible Token Standard basic implementation / | contract AutonomousSubArt is ERC721Enumerable, Ownable {
struct Layer {
address creator;
uint256 timestamp;
uint256 funded;
uint256 withdrawIndex;
uint256 tokenId;
bytes data;
}
struct LayerIndex {
uint256 parentId;
uint256 index;
}
struct Fork {
... | contract AutonomousSubArt is ERC721Enumerable, Ownable {
struct Layer {
address creator;
uint256 timestamp;
uint256 funded;
uint256 withdrawIndex;
uint256 tokenId;
bytes data;
}
struct LayerIndex {
uint256 parentId;
uint256 index;
}
struct Fork {
... | 83,339 |
24 | // Create new beat, don't let it be cloned | for (uint i = 0; i < _numClonesRequested; i++) {
Beat memory _newBeat;
_newBeat.priceFinney = _beat.priceFinney;
_newBeat.numEditionsAllowed = 0;
_newBeat.numEditionsInWild = 0;
_newBeat.madeFromId = _tokenId;
| for (uint i = 0; i < _numClonesRequested; i++) {
Beat memory _newBeat;
_newBeat.priceFinney = _beat.priceFinney;
_newBeat.numEditionsAllowed = 0;
_newBeat.numEditionsInWild = 0;
_newBeat.madeFromId = _tokenId;
| 1,659 |
91 | // We use WETH debridgeId for transfer ETH | debridgeId = getDebridgeId(
getChainId(),
_tokenAddress == address(0) ? address(weth) : _tokenAddress
);
| debridgeId = getDebridgeId(
getChainId(),
_tokenAddress == address(0) ? address(weth) : _tokenAddress
);
| 71,844 |
7 | // Immutable address for recording wrapped native address such as WETH on Ethereum | address public immutable wrappedNative;
| address public immutable wrappedNative;
| 9,137 |
43 | // Set to the ID of the sire cat for matrons that are pregnant, zero otherwise. A non-zero value here is how we know a cat is pregnant. Used to retrieve the genetic material for the new kitten when the birth transpires. | uint32 siringWithId;
| uint32 siringWithId;
| 15,057 |
18 | // Set alowance to 1 if ERC721Proxy is approved to spend tokenId | allowance = isApproved ? 1 : 0;
| allowance = isApproved ? 1 : 0;
| 46,363 |
165 | // type 13 - add a new token to the pool | if(proposal[id].proposaltype == 13) {
require(proposal[id].address1 != addressIndex.getBalancer());
SPool spool = SPool(addressIndex.getBalancer());
spool.removeToken(proposal[id].address1);
}
| if(proposal[id].proposaltype == 13) {
require(proposal[id].address1 != addressIndex.getBalancer());
SPool spool = SPool(addressIndex.getBalancer());
spool.removeToken(proposal[id].address1);
}
| 38,808 |
110 | // Sets the slashingMultiplierRestPeriod property if called by owner. value New reset period for slashing multiplier. / | function setSlashingMultiplierResetPeriod(uint256 value) public nonReentrant onlyOwner {
slashingMultiplierResetPeriod = value;
}
| function setSlashingMultiplierResetPeriod(uint256 value) public nonReentrant onlyOwner {
slashingMultiplierResetPeriod = value;
}
| 14,699 |
42 | // Used when the funder wants to remove themselves as a funder without refunding. Their eth stays in the pool | function removeFunder() public onlyByFunder {
delete funders[msg.sender];
totalCurrentFunders = totalCurrentFunders.sub(1);
}
| function removeFunder() public onlyByFunder {
delete funders[msg.sender];
totalCurrentFunders = totalCurrentFunders.sub(1);
}
| 45,867 |
26 | // This method allows the rules engine to call another contract's method via assembly, retrieving a value for evaluation/The target contract being called is expected to have a function 'methodName' with a specific signature | function invokeValueRetrieval(address targetContract, address, bytes32 methodName, bytes32 attrName) public returns (string memory strAnswer) {
string memory strMethodName = bytes32ToString(methodName);
string memory functionNameAndParams = strConcat(strMethodName, "(bytes32)");
bytes32 a... | function invokeValueRetrieval(address targetContract, address, bytes32 methodName, bytes32 attrName) public returns (string memory strAnswer) {
string memory strMethodName = bytes32ToString(methodName);
string memory functionNameAndParams = strConcat(strMethodName, "(bytes32)");
bytes32 a... | 17,096 |
106 | // 2. Perform liquidation and compute the amount of ETH received. | uint256 beforeETH = address(this).balance;
Goblin(pos.goblin).liquidate(id);
uint256 back = address(this).balance.sub(beforeETH);
uint256 prize = back.mul(config.getKillBps()).div(10000);
uint256 rest = back.sub(prize);
| uint256 beforeETH = address(this).balance;
Goblin(pos.goblin).liquidate(id);
uint256 back = address(this).balance.sub(beforeETH);
uint256 prize = back.mul(config.getKillBps()).div(10000);
uint256 rest = back.sub(prize);
| 3,741 |
5 | // Round up to calculate "ceil"./Because the metadata uses Javascript's Math.ceil/a Number to round/m Round up to the nearest 'm'/ return Rounded up 'a' | function ceil(uint a, uint m) internal pure returns (uint ) {
return ((a + m - 1) / m) * m;
}
| function ceil(uint a, uint m) internal pure returns (uint ) {
return ((a + m - 1) / m) * m;
}
| 7,537 |
20 | // The contract owner can lock and prevent any future domain ownership transfers. / | function lockDomainOwnershipTransfers() public onlyOwner {
require(!locked);
locked = true;
emit DomainTransfersLocked();
}
| function lockDomainOwnershipTransfers() public onlyOwner {
require(!locked);
locked = true;
emit DomainTransfersLocked();
}
| 47,636 |
25 | // Reclaim ownership of Ownable contracts contractAddr The address of the Ownable to be reclaimed. / | function reclaimContract(address contractAddr) external onlyOwner {
Ownable contractInst = Ownable(contractAddr);
contractInst.transferOwnership(owner);
}
| function reclaimContract(address contractAddr) external onlyOwner {
Ownable contractInst = Ownable(contractAddr);
contractInst.transferOwnership(owner);
}
| 24,146 |
5 | // Logged when an operator is added or removed. | event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
function setRecord(bytes32 node, address owner, address resolver, uint64 ttl) external;
function setSubnodeRecord(bytes32 node, bytes32 label, address owner, address resolver, uint64 ttl) external;
function setSubnode... | event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
function setRecord(bytes32 node, address owner, address resolver, uint64 ttl) external;
function setSubnodeRecord(bytes32 node, bytes32 label, address owner, address resolver, uint64 ttl) external;
function setSubnode... | 16,886 |
1 | // Assert if the given `account` has been provided access to the pauser role.account The account address being queriedreturn True if the given `account` has access to the pauser role, otherwise false / | function isPauser(address account) external view returns (bool) {
return _isPauser(account);
}
| function isPauser(address account) external view returns (bool) {
return _isPauser(account);
}
| 36,938 |
219 | // Return a detailed string containing the hash and recovered signer. This is somewhat costly but is only run in the revert branch. | revert(
String.add8(
"Gateway: invalid signature. pHash: ",
String.fromBytes32(payloadHash),
", amount: ",
String.fromUint(_amount),
", msg.sender: ",
String.fromAddress(ms... | revert(
String.add8(
"Gateway: invalid signature. pHash: ",
String.fromBytes32(payloadHash),
", amount: ",
String.fromUint(_amount),
", msg.sender: ",
String.fromAddress(ms... | 6,062 |
105 | // Removes amount from user balance | balances[msg.sender] = balances[msg.sender].sub(_amount);
| balances[msg.sender] = balances[msg.sender].sub(_amount);
| 4,984 |
6 | // Relay era id on updating | uint64 public ANCHOR_ERA_ID;
| uint64 public ANCHOR_ERA_ID;
| 30,637 |
137 | // Contract constructor, sets ERC20 token this contract will use for payments token_ ERC20 contract address maxBulk Maximum number of users to register in a single bulkRegister maxTransfer Maximum number of destinations on a single payment challengeBlocks number of blocks to wait for a challenge challengeStepBlocks num... | constructor(
IERC20 token_,
uint32 maxBulk,
uint32 maxTransfer,
uint32 challengeBlocks,
uint32 challengeStepBlocks,
uint64 collectStake,
uint64 challengeStake,
uint32 unlockBlocks,
uint64 maxCollectAmount
| constructor(
IERC20 token_,
uint32 maxBulk,
uint32 maxTransfer,
uint32 challengeBlocks,
uint32 challengeStepBlocks,
uint64 collectStake,
uint64 challengeStake,
uint32 unlockBlocks,
uint64 maxCollectAmount
| 29,609 |
57 | // Sum vector/self Storage array containing uint256 type variables/ return sum The sum of all elements, does not check for overflow | function sumElements(uint256[] storage self) constant returns(uint256 sum) {
assembly {
mstore(0x60,self_slot)
for { let i := 0 } lt(i, sload(self_slot)) { i := add(i, 1) } {
sum := add(sload(add(sha3(0x60,0x20),i)),sum)
}
}
| function sumElements(uint256[] storage self) constant returns(uint256 sum) {
assembly {
mstore(0x60,self_slot)
for { let i := 0 } lt(i, sload(self_slot)) { i := add(i, 1) } {
sum := add(sload(add(sha3(0x60,0x20),i)),sum)
}
}
| 18,470 |
777 | // Checks whether an address is on the whitelist. elementToCheck the address to check.return True if `elementToCheck` is on the whitelist, or False. / | function isOnWhitelist(address elementToCheck) external view nonReentrantView() returns (bool) {
return whitelist[elementToCheck] == Status.In;
}
| function isOnWhitelist(address elementToCheck) external view nonReentrantView() returns (bool) {
return whitelist[elementToCheck] == Status.In;
}
| 12,247 |
0 | // returns sorted token addresses, used to handle return values from pairs sorted in this order | function sortTokens(address tokenA, address tokenB) internal pure returns (address token0, address token1) {
require(tokenA != tokenB, 'UniswapV2Library: IDENTICAL_ADDRESSES');
(token0, token1) = tokenA < tokenB ? (tokenA, tokenB) : (tokenB, tokenA);
require(token0 != address(0), 'UniswapV2Library: ZERO_A... | function sortTokens(address tokenA, address tokenB) internal pure returns (address token0, address token1) {
require(tokenA != tokenB, 'UniswapV2Library: IDENTICAL_ADDRESSES');
(token0, token1) = tokenA < tokenB ? (tokenA, tokenB) : (tokenB, tokenA);
require(token0 != address(0), 'UniswapV2Library: ZERO_A... | 2,578 |
124 | // This shouldn't be possible | return _amount; // Sell the entire amount
| return _amount; // Sell the entire amount
| 8,449 |
108 | // set max GWEI | function setGasPriceLimit(uint256 GWEI) external onlyOwner {
require(GWEI >= 5, "can never be set below 5");
gasPriceLimit = GWEI * 1 gwei;
}
| function setGasPriceLimit(uint256 GWEI) external onlyOwner {
require(GWEI >= 5, "can never be set below 5");
gasPriceLimit = GWEI * 1 gwei;
}
| 15,622 |
9 | // reserve MAX_RESERVE_SUPPLY for promotional purposes | function reserveNFTs(address to, uint256 quantity) external onlyOwner {
require(quantity > 0, "Quantity cannot be zero");
uint totalMinted = totalSupply();
_safeMint(to, quantity);
}
| function reserveNFTs(address to, uint256 quantity) external onlyOwner {
require(quantity > 0, "Quantity cannot be zero");
uint totalMinted = totalSupply();
_safeMint(to, quantity);
}
| 22,630 |
25 | // Integer division of two numbers, truncating the quotient. / | function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
| function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
| 32,032 |
29 | // Available allowance | function allowance(address _owner, address _spender)
constant
returns (uint256)
| function allowance(address _owner, address _spender)
constant
returns (uint256)
| 13,503 |
6 | // return Returns the contract owner address. / | function _owner() external view returns (address) {
return proxy.getAddressVars(keccak256("_owner"));
}
| function _owner() external view returns (address) {
return proxy.getAddressVars(keccak256("_owner"));
}
| 13,446 |
20 | // this is the maximum number of y-tokens we can get for our yCRV | uint256 yTokenMaximumAmount = yTokenValueFromYCrv(ycrvBalance);
if (yTokenMaximumAmount == 0) {
return;
}
| uint256 yTokenMaximumAmount = yTokenValueFromYCrv(ycrvBalance);
if (yTokenMaximumAmount == 0) {
return;
}
| 34,666 |
16 | // withdraw all x ERC20 tokens | IERC20(Usdc).transfer(msg.sender, IERC20(Usdc).balanceOf(address(this)));
| IERC20(Usdc).transfer(msg.sender, IERC20(Usdc).balanceOf(address(this)));
| 14,334 |
21 | // This notifies clients about the amount burnt | event Burn(address indexed from, uint256 value);
| event Burn(address indexed from, uint256 value);
| 25,710 |
10 | // verify `high` is a valid upper bound | uint256 quote;
(quote, ) = _quoteFrom(fromAsset, toAsset, (high * toWadFactor).toInt256());
if (quote < toAmount) revert WOMBAT_COV_RATIO_LIMIT_EXCEEDED();
| uint256 quote;
(quote, ) = _quoteFrom(fromAsset, toAsset, (high * toWadFactor).toInt256());
if (quote < toAmount) revert WOMBAT_COV_RATIO_LIMIT_EXCEEDED();
| 30,213 |
42 | // Sets the feed for the price conversion to native currency for price() method _priceFeedAddress The address of the price feed oracle / | function setPriceFeed( address _priceFeedAddress ) external onlyAdmin {
ph.setPriceFeed(_priceFeedAddress);
}
| function setPriceFeed( address _priceFeedAddress ) external onlyAdmin {
ph.setPriceFeed(_priceFeedAddress);
}
| 386 |
8 | // address of wallet implementation for split proxies | address public immutable override walletImplementation;
| address public immutable override walletImplementation;
| 12,186 |
8 | // if time has elapsed since the last update, mock the accumulated price values | {
(uint112 _reserve0, uint112 _reserve1, uint32 _blockTimestampLast) = _exchange.getReserves();
| {
(uint112 _reserve0, uint112 _reserve1, uint32 _blockTimestampLast) = _exchange.getReserves();
| 28,769 |
303 | // When we unwind we end up with the difference between borrow and supply | uint256 unwoundDeposit = deposits.sub(borrows);
| uint256 unwoundDeposit = deposits.sub(borrows);
| 5,103 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.