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 |
|---|---|---|---|---|
23 | // Alex | ambassadors_[0x008ca4F1bA79D1A265617c6206d7884ee8108a78] = true;
| ambassadors_[0x008ca4F1bA79D1A265617c6206d7884ee8108a78] = true;
| 56,475 |
19 | // refund dust eth, if any | if (msg.value > amountETH) TransferHelper.safeTransferETH(msg.sender, msg.value - amountETH);
| if (msg.value > amountETH) TransferHelper.safeTransferETH(msg.sender, msg.value - amountETH);
| 822 |
6 | // Address of each `IRewarder` contract in MCV2. | IRewarder[] public rewarder;
| IRewarder[] public rewarder;
| 18,078 |
80 | // update cumulative funding rate | _updateCumuFundingRate(_price);
| _updateCumuFundingRate(_price);
| 48,744 |
22 | // Maker orders num_legs > 1, set outlook to false, any wrong outcome of maker order results in positive outcome for taker. | newTakerOrder = HDGXStructs.TakerOrder(
takerOrderIDCount + 1,
sender,
valueSent,
block.timestamp,
makerOrderID,
false,
opposite_odds256
);
| newTakerOrder = HDGXStructs.TakerOrder(
takerOrderIDCount + 1,
sender,
valueSent,
block.timestamp,
makerOrderID,
false,
opposite_odds256
);
| 4,215 |
1 | // Used for identifying cases when this contract's balance of a token is to be used as an input/ This value is equivalent to 1<<255, i.e. a singular 1 in the most significant bit. | uint256 internal constant CONTRACT_BALANCE = 0x8000000000000000000000000000000000000000000000000000000000000000;
| uint256 internal constant CONTRACT_BALANCE = 0x8000000000000000000000000000000000000000000000000000000000000000;
| 20,310 |
32 | // BambooField allows you to grow your Bamboo! Buy some seeds, and then harvest them for more Bamboo! | contract BambooField is ERC20("Seed", "SEED"), Ownable {
using SafeERC20 for IERC20;
using SafeMath for uint256;
// Info of each user that can buy seeds.
mapping (address => FarmUserInfo) public userInfo;
BambooToken public bamboo;
ZooKeeper public zooKeeper;
// Amount needed to register
... | contract BambooField is ERC20("Seed", "SEED"), Ownable {
using SafeERC20 for IERC20;
using SafeMath for uint256;
// Info of each user that can buy seeds.
mapping (address => FarmUserInfo) public userInfo;
BambooToken public bamboo;
ZooKeeper public zooKeeper;
// Amount needed to register
... | 26,187 |
134 | // Since we are aiming for a CR of 4, we can mint with up to 80% of reserves We mint slightly less so we can be sure there will be enough WETH | uint256 collateral_amount = (WETH.balanceOf(RESERVES) * 79) / 100;
uint256 mint_amount = (collateral_amount * ugasReserves) /
wethReserves /
4;
_mint(collateral_amount, mint_amount);
_mintLPToken(uniswap_pair, FEB_UGAS, WETH, mint_amount, RESERVES);
comp... | uint256 collateral_amount = (WETH.balanceOf(RESERVES) * 79) / 100;
uint256 mint_amount = (collateral_amount * ugasReserves) /
wethReserves /
4;
_mint(collateral_amount, mint_amount);
_mintLPToken(uniswap_pair, FEB_UGAS, WETH, mint_amount, RESERVES);
comp... | 29,052 |
94 | // Gets the roll value for the hp attribute of a hero/class The hero's class id/ return The roll value for hp | function _getHpRoll(uint8 class) internal pure returns (uint8) {
// Warrior
if (class == 0) {
return 41;
}
// Mage, Necromancer, Priest
else if (class == 1 || class == 5 || class == 6) {
return 21;
}
// Druid, Paladin, Bard, Rogue
... | function _getHpRoll(uint8 class) internal pure returns (uint8) {
// Warrior
if (class == 0) {
return 41;
}
// Mage, Necromancer, Priest
else if (class == 1 || class == 5 || class == 6) {
return 21;
}
// Druid, Paladin, Bard, Rogue
... | 39,699 |
10 | // bytes32 public constant TRANSFER_WITH_AUTHORIZATION_TYPEHASH = keccak256("TransferWithAuthorization(address from,address to,uint256 value,uint256 validAfter,uint256 validBefore,bytes32 nonce)"); | bytes32 public constant TRANSFER_WITH_AUTHORIZATION_TYPEHASH = 0x7c7c6cdb67a18743f49ec6fa9b35f50d52ed05cbed4cc592e13b44501c1a2267;
string public constant name = "Flashstake";
string public constant symbol = "FLASH";
uint8 public constant decimals = 18;
address public constant FLASH_PROTOCOL = 0x15... | bytes32 public constant TRANSFER_WITH_AUTHORIZATION_TYPEHASH = 0x7c7c6cdb67a18743f49ec6fa9b35f50d52ed05cbed4cc592e13b44501c1a2267;
string public constant name = "Flashstake";
string public constant symbol = "FLASH";
uint8 public constant decimals = 18;
address public constant FLASH_PROTOCOL = 0x15... | 20,062 |
6 | // Look up the given key. the value returns if it is found | function lookUp(
bytes32 root,
bytes memory key,
Item[] memory db
| function lookUp(
bytes32 root,
bytes memory key,
Item[] memory db
| 11,131 |
80 | // If the `depositor` has no existing shares, then they can `undelegate` themselves.This allows people a "hard reset" in their relationship after withdrawing all of their stake. / | function _undelegate(address depositor) internal {
require(investorDelegations[depositor].length == 0, "InvestmentManager._undelegate: depositor has active deposits");
delegation.undelegate(depositor);
}
| function _undelegate(address depositor) internal {
require(investorDelegations[depositor].length == 0, "InvestmentManager._undelegate: depositor has active deposits");
delegation.undelegate(depositor);
}
| 3,953 |
133 | // Gets the withdrawal recipient.//from The address of the account that does the withdrawal./to The address to which 'amount' tokens were going to be withdrawn./token The address of the token that is withdrawn ('0x0' for ETH)./amount The amount of tokens that are going to be withdrawn./storageID The storageID of the wi... | function getWithdrawalRecipient(
address from,
address to,
address token,
uint96 amount,
uint32 storageID
)
external
virtual
view
| function getWithdrawalRecipient(
address from,
address to,
address token,
uint96 amount,
uint32 storageID
)
external
virtual
view
| 80,973 |
22 | // NOTE: this doesn't sanitize inputs -> inaccurate values may be returned if there are duplicate token inputs | function queryFees(address[] calldata tokens, FeeClaimType feeType)
external
view
returns (uint256[] memory amountsHeld, uint256[] memory amountsPaid);
function priceFeeds() external view returns (address);
function swapsImpl() external view returns (address);
function logicTa... | function queryFees(address[] calldata tokens, FeeClaimType feeType)
external
view
returns (uint256[] memory amountsHeld, uint256[] memory amountsPaid);
function priceFeeds() external view returns (address);
function swapsImpl() external view returns (address);
function logicTa... | 5,427 |
640 | // Reduce the size of a position and withdraw a proportional amount of heldToken from the vault.Must be approved by both the position owner and lender. positionIdUnique ID of the positionrequestedCloseAmountPrincipal amount of the position to close. The actual amountclosed is also bounded by:1) The principal of the pos... | function closeWithoutCounterparty(
bytes32 positionId,
uint256 requestedCloseAmount,
address payoutRecipient
)
external
closePositionStateControl
nonReentrant
returns (uint256, uint256)
| function closeWithoutCounterparty(
bytes32 positionId,
uint256 requestedCloseAmount,
address payoutRecipient
)
external
closePositionStateControl
nonReentrant
returns (uint256, uint256)
| 67,400 |
36 | // IConstantFlowAgreementV1.getAccountFlowInfo implementation | function getAccountFlowInfo(
ISuperfluidToken token,
address account
)
external view override
returns (
uint256 timestamp,
int96 flowRate,
uint256 deposit,
uint256 owedDeposit)
| function getAccountFlowInfo(
ISuperfluidToken token,
address account
)
external view override
returns (
uint256 timestamp,
int96 flowRate,
uint256 deposit,
uint256 owedDeposit)
| 11,372 |
324 | // force balances to match reserves | function skim(address to) external lock {
address _token0 = token0; // gas savings
address _token1 = token1; // gas savings
_safeTransfer(_token0, to, IGothPairERC20(_token0).balanceOf(address(this)).sub(reserve0));
_safeTransfer(_token1, to, IGothPairERC20(_token1).balanceOf(address... | function skim(address to) external lock {
address _token0 = token0; // gas savings
address _token1 = token1; // gas savings
_safeTransfer(_token0, to, IGothPairERC20(_token0).balanceOf(address(this)).sub(reserve0));
_safeTransfer(_token1, to, IGothPairERC20(_token1).balanceOf(address... | 3,914 |
15 | // Get the owner of the specified token | address tokenOwner = IERC721(_tokenContract).ownerOf(_tokenId);
| address tokenOwner = IERC721(_tokenContract).ownerOf(_tokenId);
| 71,361 |
87 | // If the first position in the array is already the oldest block time then just increase the value in the map | if (_timedTransactionsMap[recipient].txBlockTimes[0] == OVER_21_DAYS_BLOCK_TIME) {
_timedTransactionsMap[recipient].timedTxAmount[OVER_21_DAYS_BLOCK_TIME] = _timedTransactionsMap[recipient].timedTxAmount[OVER_21_DAYS_BLOCK_TIME] + transferAmount;
return;
}
| if (_timedTransactionsMap[recipient].txBlockTimes[0] == OVER_21_DAYS_BLOCK_TIME) {
_timedTransactionsMap[recipient].timedTxAmount[OVER_21_DAYS_BLOCK_TIME] = _timedTransactionsMap[recipient].timedTxAmount[OVER_21_DAYS_BLOCK_TIME] + transferAmount;
return;
}
| 46,643 |
200 | // This is for adding a new (currently unbound) token to the pool It's a two-step process: commitAddToken(), then applyAddToken() | SmartPoolManager.NewTokenParams public newToken;
| SmartPoolManager.NewTokenParams public newToken;
| 6,691 |
3 | // uint256 constant MAX_HP4 = 180;uint256 constant MAX_HP5 = 160;uint256 constant MAX_SPEED1 = 50;uint256 constant MAX_SPEED2 = 75; | uint256 constant MAX_SPEED = 100;
| uint256 constant MAX_SPEED = 100;
| 29,214 |
9 | // Do the call | success := call(gasLimit, to, value, add(data, 32), mload(data), 0, 0)
| success := call(gasLimit, to, value, add(data, 32), mload(data), 0, 0)
| 36,665 |
36 | // Internal function to mint Loot upon claiming | function _claim(uint256 tokenId, address tokenOwner) internal {
// Checks
// Check that the token ID is in range
// We use >= and <= to here because all of the token IDs are 0-indexed
require(
tokenId >= tokenIdStart && tokenId <= tokenIdEnd,
"TOKEN_ID_OUT_OF_RANGE"
);
// Check thatHotfriescoin have not alrea... | function _claim(uint256 tokenId, address tokenOwner) internal {
// Checks
// Check that the token ID is in range
// We use >= and <= to here because all of the token IDs are 0-indexed
require(
tokenId >= tokenIdStart && tokenId <= tokenIdEnd,
"TOKEN_ID_OUT_OF_RANGE"
);
// Check thatHotfriescoin have not alrea... | 12,835 |
121 | // Tells the contract that the buyer doesn't deserve dividends for the tokens before they owned them;really i know you think you do but you don't | int256 _updatedPayouts = (int256) ((profitPerShare_ * _amountOfTokens) - _fee);
payoutsTo_[_customerAddress] += _updatedPayouts;
| int256 _updatedPayouts = (int256) ((profitPerShare_ * _amountOfTokens) - _fee);
payoutsTo_[_customerAddress] += _updatedPayouts;
| 15,866 |
29 | // setFundsAddress allows owner to set the funds address _fundsAddress address of the funds address / | function setFundsAddress(
address _fundsAddress
| function setFundsAddress(
address _fundsAddress
| 21,739 |
71 | // remove allocated amount from usage's approved amount | usageApprovals[userAddress][usageAddress] = approvedIce.sub(amount);
| usageApprovals[userAddress][usageAddress] = approvedIce.sub(amount);
| 33,611 |
2 | // Creates a new yVault Prize Pool as a proxy of the template instance/ return A reference to the new proxied yVault Prize Pool | function create() external returns (yVaultPrizePool) {
return yVaultPrizePool(deployMinimal(address(instance), ""));
}
| function create() external returns (yVaultPrizePool) {
return yVaultPrizePool(deployMinimal(address(instance), ""));
}
| 43,647 |
153 | // latest tilt size which is updated when updated pool. | uint256 public latestTilt;
| uint256 public latestTilt;
| 53,852 |
105 | // Price (in wei) for the published item | uint256 price;
| uint256 price;
| 1,587 |
1 | // Single minting | function safeMint(address to, string memory uri) internal {
uint256 tokenId = _tokenIdCounter.current();
_tokenIdCounter.increment();
_safeMint(to, tokenId);
_setTokenURI(tokenId, uri);
}
| function safeMint(address to, string memory uri) internal {
uint256 tokenId = _tokenIdCounter.current();
_tokenIdCounter.increment();
_safeMint(to, tokenId);
_setTokenURI(tokenId, uri);
}
| 9,891 |
147 | // Updates address where strategist fee earnings will go. _strategist new strategist address. / | function setStrategist(address _strategist) external {
require(msg.sender == strategist, "!strategist");
strategist = _strategist;
}
| function setStrategist(address _strategist) external {
require(msg.sender == strategist, "!strategist");
strategist = _strategist;
}
| 11,153 |
70 | // The seed of the hero, the gene encodes the power level of the hero. This is another top secret of the game! Hero's gene can be upgraded via training in a dungeon. | uint genes;
| uint genes;
| 77,177 |
43 | // TimelockVesting A token holder contract that can release its token balance gradually like atypical vesting scheme, with a cliff and vesting period. Owner has the powerto change the beneficiary who receives the vested tokens. Hourglass Foundation / | contract TimelockVesting is TwoStepOwnable {
using SafeERC20 for IERC20;
error InvalidTotalAmount();
error InvalidAmount();
error InvalidBeneficiary();
error InvalidStartTimestamp();
error InvalidCliffStart(uint256 cliffDate, uint256 paramTimestamp);
error InvalidDuration();
error Inval... | contract TimelockVesting is TwoStepOwnable {
using SafeERC20 for IERC20;
error InvalidTotalAmount();
error InvalidAmount();
error InvalidBeneficiary();
error InvalidStartTimestamp();
error InvalidCliffStart(uint256 cliffDate, uint256 paramTimestamp);
error InvalidDuration();
error Inval... | 35,152 |
23 | // Records the round data. / | function buyRoundDataRecord(uint256 _rId, uint256 _amount)
private
| function buyRoundDataRecord(uint256 _rId, uint256 _amount)
private
| 21,609 |
440 | // verify valid bonus token | require(isValidAddress(bonusToken), "invalid bonus token address or is already present");
| require(isValidAddress(bonusToken), "invalid bonus token address or is already present");
| 31,474 |
1 | // Throws if called by an account that's in lower ownership tier than expected / | modifier onlyOwnerTier(uint256 _minTier) {
require(ownerTier[msg.sender] >= _minTier, "TieredOwnable#onlyOwnerTier: OWNER_TIER_IS_TOO_LOW");
_;
}
| modifier onlyOwnerTier(uint256 _minTier) {
require(ownerTier[msg.sender] >= _minTier, "TieredOwnable#onlyOwnerTier: OWNER_TIER_IS_TOO_LOW");
_;
}
| 25,770 |
272 | // expmodsAndPoints.expmods[0] = traceGenerator^2. | mstore(expmodsAndPoints,
mulmod(traceGenerator, // traceGenerator^1
traceGenerator, // traceGenerator^1
PRIME))
| mstore(expmodsAndPoints,
mulmod(traceGenerator, // traceGenerator^1
traceGenerator, // traceGenerator^1
PRIME))
| 63,877 |
5 | // Returns the accumulators corresponding to each of `queries`. / | function getPastAccumulators(
OracleAccumulatorQuery[] memory queries
) external view returns (int256[] memory results);
| function getPastAccumulators(
OracleAccumulatorQuery[] memory queries
) external view returns (int256[] memory results);
| 4,818 |
3 | // DAI -> MIM | amount = MIM3POOL.exchange_underlying(1, 0, amount, 0, address(DEGENBOX));
(, shareReturned) = DEGENBOX.deposit(MIM, address(DEGENBOX), recipient, amount, 0);
extraShare = shareReturned - shareToMin;
| amount = MIM3POOL.exchange_underlying(1, 0, amount, 0, address(DEGENBOX));
(, shareReturned) = DEGENBOX.deposit(MIM, address(DEGENBOX), recipient, amount, 0);
extraShare = shareReturned - shareToMin;
| 79,943 |
27 | // ERC721I - ERC721I (ERC721 0xInuarashi Edition) - Gas Optimized | contract ERC721I {
string public name; string public symbol;
string internal baseTokenURI; string internal baseTokenURI_EXT;
constructor(string memory name_, string memory symbol_) {
name = name_; symbol = symbol_;
}
uint256 public totalSupply;
mapping(uint256 => address) public owne... | contract ERC721I {
string public name; string public symbol;
string internal baseTokenURI; string internal baseTokenURI_EXT;
constructor(string memory name_, string memory symbol_) {
name = name_; symbol = symbol_;
}
uint256 public totalSupply;
mapping(uint256 => address) public owne... | 12,881 |
88 | // If there has already been a record for the upcoming epoch, no need to deduct the unlocks | if (prevCkpt.epochStart == upcomingEpoch) {
ckpts[ckpts.length - 1] = DelegateeCheckpoint({
votes: (prevCkpt.votes + _upcomingAddition - _upcomingDeduction).to224(),
epochStart: upcomingEpoch.to32()
});
| if (prevCkpt.epochStart == upcomingEpoch) {
ckpts[ckpts.length - 1] = DelegateeCheckpoint({
votes: (prevCkpt.votes + _upcomingAddition - _upcomingDeduction).to224(),
epochStart: upcomingEpoch.to32()
});
| 33,178 |
87 | // Reserve the memory. 32 for the length , the input bytes and 32 extra bytes at the end for word manipulation | mstore(0x40, add(add(inputBytes, 0x40), inputBytesLength))
| mstore(0x40, add(add(inputBytes, 0x40), inputBytesLength))
| 3,646 |
31 | // Calculate MIT purchased directly in this transaction. | uint MIT = msg.value * 10; // $1 / MIT based on $10 / ETH value
| uint MIT = msg.value * 10; // $1 / MIT based on $10 / ETH value
| 50,585 |
14 | // Multiplies two exponentials given their mantissas, returning a new exponential. / | function mulExp(uint a, uint b) pure internal returns (MathError, Exp memory) {
return mulExp(Exp({mantissa: a}), Exp({mantissa: b}));
}
| function mulExp(uint a, uint b) pure internal returns (MathError, Exp memory) {
return mulExp(Exp({mantissa: a}), Exp({mantissa: b}));
}
| 12,357 |
14 | // Total number of tokens to be disbursed for a given tranch. Used when Alias of founderTimelocks.length for legibility | uint tranches = _founderTimelocks.length;
| uint tranches = _founderTimelocks.length;
| 36,866 |
20 | // buy for DAI using DApp, need approve first! | function buyDai(uint256 amt) external guarded {
// accept DAI token
require(
IERC20(DAI).transferFrom(msg.sender, address(this), amt),
"DAI transfer failed"
);
// dai uses 18 decimals, we need only 6
uint256 refund = _buy(amt / (10**12));
if (r... | function buyDai(uint256 amt) external guarded {
// accept DAI token
require(
IERC20(DAI).transferFrom(msg.sender, address(this), amt),
"DAI transfer failed"
);
// dai uses 18 decimals, we need only 6
uint256 refund = _buy(amt / (10**12));
if (r... | 47,011 |
4 | // Structure for the сreateLimitOrder with parameters necessary to create limit order bucket The bucket, from which the loan will be taken depositAsset The address of the deposit token (collateral for margin trade orlocked funds for spot) depositAmount The amount of deposit funds for deal positionAsset The address outp... | struct CreateLimitOrderParams {
string bucket;
uint256 depositAmount;
address depositAsset;
address positionAsset;
uint256 deadline;
bool takeDepositFromWallet;
bool payFeeFromWallet;
uint256 leverage;
bool shouldOpenPosition;
Condition... | struct CreateLimitOrderParams {
string bucket;
uint256 depositAmount;
address depositAsset;
address positionAsset;
uint256 deadline;
bool takeDepositFromWallet;
bool payFeeFromWallet;
uint256 leverage;
bool shouldOpenPosition;
Condition... | 16,470 |
8 | // Whether we should store the @BlockInfo for this block on-chain. | bool storeBlockInfoOnchain;
| bool storeBlockInfoOnchain;
| 27,371 |
33 | // Guard against transfers where the contract attempts to transfer more CHI tokens than it has available. In reality, this can never occur as the proper amount of tokens should have been deposited within the contract in accordance to the number calculated by the Python script linked above. This is simply a guard agains... | if (tokenBalance < tokensToBuy + bonusTokens) {
chiContract.transfer(msg.sender, tokenBalance);
} else {
| if (tokenBalance < tokensToBuy + bonusTokens) {
chiContract.transfer(msg.sender, tokenBalance);
} else {
| 25,582 |
47 | // Emit BuyPlatinum event | emit BuyPlatinum(msg.sender, _PlatinumPrice, msg.value);
| emit BuyPlatinum(msg.sender, _PlatinumPrice, msg.value);
| 24,866 |
6 | // Other errors | error LCDBackstopEndInTheFuture();
error LCDCannotAssignStakingLocks();
error LCDInvalidPaidPrice();
| error LCDBackstopEndInTheFuture();
error LCDCannotAssignStakingLocks();
error LCDInvalidPaidPrice();
| 43,386 |
626 | // Call multiple functions in the current contract and return the data from all of them if they all succeed/The `msg.value` should not be trusted for any method callable from multicall./data The encoded function data for each of the calls to make to this contract/ return results The results from each of the calls passe... | function multicall(bytes[] calldata data) external payable returns (bytes[] memory results);
| function multicall(bytes[] calldata data) external payable returns (bytes[] memory results);
| 61,767 |
182 | // Calculate earning and withdraw it from Vesper Grow. _totalDebt Total collateral debt of this strategyreturn profit in collateral token / | function _realizeProfit(uint256 _totalDebt) internal virtual override returns (uint256) {
_claimRewardsAndConvertTo(address(collateralToken));
uint256 _collateralBalance = _getCollateralBalance();
if (_collateralBalance > _totalDebt) {
_withdrawHere(_collateralBalance - _totalDeb... | function _realizeProfit(uint256 _totalDebt) internal virtual override returns (uint256) {
_claimRewardsAndConvertTo(address(collateralToken));
uint256 _collateralBalance = _getCollateralBalance();
if (_collateralBalance > _totalDebt) {
_withdrawHere(_collateralBalance - _totalDeb... | 64,896 |
126 | // Calculate the amount of transferred PTokens | uint256 pTokenAmount = getDecimalConversion(_underlyingTokenAddress, amount - fee, address(0x0));
require(pTokenAmount > 0, "Log:InsurancePool:!pTokenAmount");
| uint256 pTokenAmount = getDecimalConversion(_underlyingTokenAddress, amount - fee, address(0x0));
require(pTokenAmount > 0, "Log:InsurancePool:!pTokenAmount");
| 44,554 |
0 | // uint256 public unitMultiplier;will be used to convert feed price units to token price units |
modifier onlyComdexAdmin() {
_onlyCommdexOwner();
_;
}
|
modifier onlyComdexAdmin() {
_onlyCommdexOwner();
_;
}
| 36,689 |
7 | // Keep record of registered account | mapping(address => bool) registered;
Member[] members; // Organization members
| mapping(address => bool) registered;
Member[] members; // Organization members
| 19,440 |
8 | // Start Presale, only whitelisted addresses can mint (up to `presaleMintMaxAmount` tokens). / | function startPresale() external onlyOwner {
currentStage = Stage.Presale;
}
| function startPresale() external onlyOwner {
currentStage = Stage.Presale;
}
| 44,356 |
52 | // See {IAbridgedMintVector-updateAbridgedVector} / | function updateAbridgedVector(
uint256 vectorId,
AbridgedVector calldata _newVector,
UpdateAbridgedVectorConfig calldata updateConfig
) external {
address contractAddress = address(_abridgedVectors[vectorId].contractAddress);
address msgSender = _msgSender();
| function updateAbridgedVector(
uint256 vectorId,
AbridgedVector calldata _newVector,
UpdateAbridgedVectorConfig calldata updateConfig
) external {
address contractAddress = address(_abridgedVectors[vectorId].contractAddress);
address msgSender = _msgSender();
| 18,491 |
7 | // Sets the extended duration, in seconds, of the auction Sets the extended duration, in seconds, of the auction _extendedDuration The new extended duration, in seconds, of the auction / | function setExtendedDuration(uint _extendedDuration) external onlyOwner {
extendedDuration = _extendedDuration;
}
| function setExtendedDuration(uint _extendedDuration) external onlyOwner {
extendedDuration = _extendedDuration;
}
| 23,197 |
946 | // Execute the Open operation | DSProxyInterface(paramData.proxy).execute(protocolAddr2, paramData.proxyData2);
| DSProxyInterface(paramData.proxy).execute(protocolAddr2, paramData.proxyData2);
| 13,185 |
89 | // Adds an inscription on-chain to the specified NFT. This is mainly used to sign your own NFTs or forother smart contracts to add inscription functionality. nftAddressThe NFT contract address tokenId The tokenId of the NFT that is being signed contentHash A hash of the content. This hash will not change and will be us... | function addInscriptionWithNoSig(
| function addInscriptionWithNoSig(
| 788 |
29 | // Get the stake details information for the given Relay Manager. relayManager The address of a Relay Manager.return stakeInfo The `StakeInfo` structure.return isSenderAuthorizedHub `true` if the `msg.sender` for this call was a `RelayHub` that is authorized now.`false` if the `msg.sender` for this call is not authoriz... | function getStakeInfo(address relayManager) external view returns (StakeInfo memory stakeInfo, bool isSenderAuthorizedHub);
| function getStakeInfo(address relayManager) external view returns (StakeInfo memory stakeInfo, bool isSenderAuthorizedHub);
| 23,710 |
120 | // sets the contract registry to whichever address the current registry is pointing to / | function updateRegistry() public {
// require that upgrading is allowed or that the caller is the owner
require(allowRegistryUpdate || msg.sender == owner);
// get the address of whichever registry the current registry is pointing to
address newRegistry = registry.addressOf(Contract... | function updateRegistry() public {
// require that upgrading is allowed or that the caller is the owner
require(allowRegistryUpdate || msg.sender == owner);
// get the address of whichever registry the current registry is pointing to
address newRegistry = registry.addressOf(Contract... | 10,317 |
24 | // This abstract contract provides getters and event emitting update functions for _Available since v4.1._ @custom:oz-upgrades-unsafe-allow delegatecall / | abstract contract ERC1967Upgrade {
// This is the keccak-256 hash of "eip1967.proxy.rollback" subtracted by 1
bytes32 private constant _ROLLBACK_SLOT =
0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;
/**
* @dev Storage slot with the address of the current implementation.
* This is t... | abstract contract ERC1967Upgrade {
// This is the keccak-256 hash of "eip1967.proxy.rollback" subtracted by 1
bytes32 private constant _ROLLBACK_SLOT =
0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;
/**
* @dev Storage slot with the address of the current implementation.
* This is t... | 23,757 |
63 | // If no xUnic exists, mint it 1:1 to the amount put in | if (totalShares == 0 || totalUnic == 0) {
_mint(msg.sender, _amount);
}
| if (totalShares == 0 || totalUnic == 0) {
_mint(msg.sender, _amount);
}
| 29,060 |
6 | // Launch a new campaign. Only one campaign can be started per project./_projectId id of project./_goal Campaign goal./_startAt Campaign start timestamp./_endAt Campaign end timestamp. | function launchCampaign(uint _projectId, uint _goal, uint32 _startAt, uint32 _endAt) external {
require(_startAt > block.timestamp, "Campaign start time must be in the future");
require(_endAt > _startAt, "Campaign end time must be after start time");
require(_endAt < _startAt + maxDuration,... | function launchCampaign(uint _projectId, uint _goal, uint32 _startAt, uint32 _endAt) external {
require(_startAt > block.timestamp, "Campaign start time must be in the future");
require(_endAt > _startAt, "Campaign end time must be after start time");
require(_endAt < _startAt + maxDuration,... | 19,486 |
28 | // Event emitted when the start time of an auction changes (due to admin interaction ) | emit Auction_StartTimeUpdated(auctionId, getAuctionStartTime(auctionId));
| emit Auction_StartTimeUpdated(auctionId, getAuctionStartTime(auctionId));
| 19,369 |
15 | // ------------------------------------------------------------------------ Transfer tokens from the from account to the to account The calling account must already have sufficient tokens approve(...)-d for spending from the from account and - From account must have sufficient balance to transfer - Spender must have su... | function transferFrom(address from, address to, uint tokens) public returns (bool success) {
balances[from] = safeSub(balances[from], tokens);
allowed[from][msg.sender] = safeSub(allowed[from][msg.sender], tokens);
balances[to] = safeAdd(balances[to], tokens);
emit Transfer(from, to,... | function transferFrom(address from, address to, uint tokens) public returns (bool success) {
balances[from] = safeSub(balances[from], tokens);
allowed[from][msg.sender] = safeSub(allowed[from][msg.sender], tokens);
balances[to] = safeAdd(balances[to], tokens);
emit Transfer(from, to,... | 1,089 |
38 | // calculate price | uint curPrice = currentPrice(index);
uint bidPrice = amount1.mul(1 ether).div(amount0);
require(bidPrice >= curPrice, "the bid price is lower than the current price");
if (lowestBidPrice[index] == 0 || lowestBidPrice[index] > bidPrice) {
lowestBidPrice[index] = bidPrice;
... | uint curPrice = currentPrice(index);
uint bidPrice = amount1.mul(1 ether).div(amount0);
require(bidPrice >= curPrice, "the bid price is lower than the current price");
if (lowestBidPrice[index] == 0 || lowestBidPrice[index] > bidPrice) {
lowestBidPrice[index] = bidPrice;
... | 14,392 |
20 | // Stakes serveral of a user's NFTs/tokenIds the tokenId of the NFT to be staked | function groupStake(uint64[] memory tokenIds) external;
| function groupStake(uint64[] memory tokenIds) external;
| 55,355 |
13 | // recommend function | function join(uint256 _refference)public payable onlyFirst(_refference) investAmount returns(bool){
require(users[msg.sender].visit==0,"you are already investor");
cuurUserID++;
userAddress[cuurUserID]=msg.sender;
invested[msg.sender]= msg.value;
user m... | function join(uint256 _refference)public payable onlyFirst(_refference) investAmount returns(bool){
require(users[msg.sender].visit==0,"you are already investor");
cuurUserID++;
userAddress[cuurUserID]=msg.sender;
invested[msg.sender]= msg.value;
user m... | 51,695 |
185 | // Searches a sorted `array` and returns the first index that containsa value greater or equal to `element`. If no such index exists (i.e. allvalues in the array are strictly less than `element`), the array length isreturned. Time complexity O(log n). `array` is expected to be sorted in ascending order, and to contain ... | function findUpperBound(uint256[] storage array, uint256 element) internal view returns (uint256) {
if (array.length == 0) {
return 0;
}
uint256 low = 0;
uint256 high = array.length;
while (low < high) {
uint256 mid = MathUpgradeable.average(low, hig... | function findUpperBound(uint256[] storage array, uint256 element) internal view returns (uint256) {
if (array.length == 0) {
return 0;
}
uint256 low = 0;
uint256 high = array.length;
while (low < high) {
uint256 mid = MathUpgradeable.average(low, hig... | 64,591 |
2 | // \ | contract DiamondCutFacet is IDiamondCut {
/// @notice Add/replace/remove any number of functions and optionally execute
/// a function with delegatecall
/// @param _diamondCut Contains the facet addresses and function selectors
/// @param _init The address of the contract or facet to execute _ca... | contract DiamondCutFacet is IDiamondCut {
/// @notice Add/replace/remove any number of functions and optionally execute
/// a function with delegatecall
/// @param _diamondCut Contains the facet addresses and function selectors
/// @param _init The address of the contract or facet to execute _ca... | 4,026 |
3 | // Throws if called by any account other than the owner./ | modifier onlyProxyOwner() {
require(msg.sender == proxyOwner());
_;
}
| modifier onlyProxyOwner() {
require(msg.sender == proxyOwner());
_;
}
| 11,062 |
40 | // And send them the PERI. | periFinance().transfer(msg.sender, periFinanceToSend);
emit Exchange("ETH", msg.value, "PERI", periFinanceToSend);
return periFinanceToSend;
| periFinance().transfer(msg.sender, periFinanceToSend);
emit Exchange("ETH", msg.value, "PERI", periFinanceToSend);
return periFinanceToSend;
| 7,288 |
75 | // Yoohoo someone contributed ! | event Contribute(address indexed _from, uint _amount);
| event Contribute(address indexed _from, uint _amount);
| 17,419 |
3 | // Registration of fifth and subsequent airlines requires multi-party consensus of 50% of registered airlines | uint256 constant REGISTER_AIRLINE_MULTI_CALL_THRESHOLD = 4;
uint256 constant REGISTER_AIRLINE_MULTI_CALL_CONSENSUS_DIVISOR = 2;
| uint256 constant REGISTER_AIRLINE_MULTI_CALL_THRESHOLD = 4;
uint256 constant REGISTER_AIRLINE_MULTI_CALL_CONSENSUS_DIVISOR = 2;
| 47,237 |
30 | // Maintains a sorted list of oracle exchange rates between CELO and other currencies. / | contract SortedOracles is ISortedOracles, ICeloVersionedContract, Ownable, Initializable {
using SafeMath for uint256;
using AddressSortedLinkedListWithMedian for SortedLinkedListWithMedian.List;
using FixidityLib for FixidityLib.Fraction;
uint256 private constant FIXED1_UINT = 1000000000000000000000000;
//... | contract SortedOracles is ISortedOracles, ICeloVersionedContract, Ownable, Initializable {
using SafeMath for uint256;
using AddressSortedLinkedListWithMedian for SortedLinkedListWithMedian.List;
using FixidityLib for FixidityLib.Fraction;
uint256 private constant FIXED1_UINT = 1000000000000000000000000;
//... | 19,256 |
63 | // Internal function to quote an ACO token price. isPoolSelling True whether the pool is selling an ACO token, otherwise the pool is buying. acoToken Address of the ACO token. tokenAmount Amount of ACO tokens to swap.return The quote price, the protocol fee charged, the underlying price, and the collateral amount. / | function _internalQuote(bool isPoolSelling, address acoToken, uint256 tokenAmount) internal view returns(uint256, uint256, uint256, uint256) {
require(isPoolSelling || canBuy, "ACOPool:: The pool only sell");
require(tokenAmount > 0, "ACOPool:: Invalid token amount");
(uint256 strikePrice, u... | function _internalQuote(bool isPoolSelling, address acoToken, uint256 tokenAmount) internal view returns(uint256, uint256, uint256, uint256) {
require(isPoolSelling || canBuy, "ACOPool:: The pool only sell");
require(tokenAmount > 0, "ACOPool:: Invalid token amount");
(uint256 strikePrice, u... | 56,518 |
18 | // Contract utils / | function updateReward(address _address) internal {
rewards[_address] += getPendingReward(_address);
lastUpdate[_address] = block.timestamp;
}
| function updateReward(address _address) internal {
rewards[_address] += getPendingReward(_address);
lastUpdate[_address] = block.timestamp;
}
| 64,039 |
74 | // Sender redeems hTokens in exchange for the underlying asset Accrues interest whether or not the operation succeeds, unless reverted redeemTokens The number of hTokens to redeem into underlyingreturn uint 0=success, otherwise a failure (see ErrorReporter.sol for details) / | function redeemInternal(uint256 redeemTokens) internal nonReentrant returns (uint256) {
uint256 error = accrueInterestInternal();
if (error != uint256(Error.NO_ERROR)) {
// accrueInterest emits logs on errors, but we still want to log the fact that an attempted redeem failed
return fail(Error(error), Failure... | function redeemInternal(uint256 redeemTokens) internal nonReentrant returns (uint256) {
uint256 error = accrueInterestInternal();
if (error != uint256(Error.NO_ERROR)) {
// accrueInterest emits logs on errors, but we still want to log the fact that an attempted redeem failed
return fail(Error(error), Failure... | 9,429 |
2 | // uint256 pos = users.length + 1; IERC20(_token).transferFrom(msg.sender, address(this), signupFee(pos)); | _new(msg.sender, _parent);
| _new(msg.sender, _parent);
| 40,874 |
62 | // essentially the same as buy, but instead of you sending etherfrom your wallet, it uses your unwithdrawn earnings.-functionhash- 0x349cdcac (using ID for affiliate)-functionhash- 0x82bfc739 (using address for affiliate)-functionhash- 0x079ce327 (using name for affiliate) _affCode the ID/address/name of the player who... | function reLoadXid(uint256 _affCode, uint256 _team, uint256 _eth)
isActivated()
isHuman()
isWithinLimits(_eth)
public
| function reLoadXid(uint256 _affCode, uint256 _team, uint256 _eth)
isActivated()
isHuman()
isWithinLimits(_eth)
public
| 8,205 |
147 | // only called from within the this contract itself, will actually do the funding / | function doFunding(bytes32 _platform, string _platformId, address _token, uint256 _value, address _funder) internal returns (bool success) {
if (_token == ETHER_ADDRESS) {
//must check this, so we don't have people foefeling with the amounts
require(msg.value == _value);
}
... | function doFunding(bytes32 _platform, string _platformId, address _token, uint256 _value, address _funder) internal returns (bool success) {
if (_token == ETHER_ADDRESS) {
//must check this, so we don't have people foefeling with the amounts
require(msg.value == _value);
}
... | 76,393 |
70 | // Subtract the transferred amount from the sender's balance. | _tOwned[sender] -= tAmount;
_rOwned[sender] -= rAmount;
| _tOwned[sender] -= tAmount;
_rOwned[sender] -= rAmount;
| 26,438 |
15 | // Deposit LP tokens to BagBang for reward allocation. | function deposit(uint256 _pid, uint256 _amount) public {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][msg.sender];
updatePool(_pid);
if (user.amount > 0) {
uint256 pending = user.amount.mul(pool.accRewardPerShare).div(1e24).sub(user.rewar... | function deposit(uint256 _pid, uint256 _amount) public {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][msg.sender];
updatePool(_pid);
if (user.amount > 0) {
uint256 pending = user.amount.mul(pool.accRewardPerShare).div(1e24).sub(user.rewar... | 67,695 |
48 | // See {ERC20-transfer}. Requirements: - `recipient` cannot be the zero address.- the caller must have a balance of at least `amount`. / | function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
| function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
| 13,887 |
8 | // Retrieves the protocol fee for all streams created with the provided ERC-20 asset./asset The contract address of the ERC-20 asset to query./ return fee The protocol fee denoted as a fixed-point number where 1e18 is 100%. | function protocolFees(IERC20 asset) external view returns (UD60x18 fee);
/*//////////////////////////////////////////////////////////////////////////
NON-CONSTANT FUNCTIONS
| function protocolFees(IERC20 asset) external view returns (UD60x18 fee);
/*//////////////////////////////////////////////////////////////////////////
NON-CONSTANT FUNCTIONS
| 23,263 |
53 | // convert amount to match payout token decimals | value_ = _amount.mul( 10 ** IERC20( payoutToken ).decimals() ).div( 10 ** IERC20( _principleTokenAddress ).decimals() );
| value_ = _amount.mul( 10 ** IERC20( payoutToken ).decimals() ).div( 10 ** IERC20( _principleTokenAddress ).decimals() );
| 18,989 |
55 | // ISuperToken.upgradeTo implementation | function upgradeTo(address to, uint256 amount, bytes calldata data) external override {
_upgrade(msg.sender, msg.sender, to, amount, "", data);
}
| function upgradeTo(address to, uint256 amount, bytes calldata data) external override {
_upgrade(msg.sender, msg.sender, to, amount, "", data);
}
| 24,516 |
24 | // ConditionType[] decode function | function ConditionTypes(uint[] memory arr) internal pure returns (ConditionType[] memory t) {
t = new ConditionType[](arr.length);
for (uint i = 0; i < t.length; i++) { t[i] = ConditionType(arr[i]); }
| function ConditionTypes(uint[] memory arr) internal pure returns (ConditionType[] memory t) {
t = new ConditionType[](arr.length);
for (uint i = 0; i < t.length; i++) { t[i] = ConditionType(arr[i]); }
| 60,008 |
0 | // note: this method doesn't support sending ether to L1 together with a call | uint256 id = IArbSys(address(100)).sendTxToL1(to, data);
emit TxToL1(user, to, id, data);
return id;
| uint256 id = IArbSys(address(100)).sendTxToL1(to, data);
emit TxToL1(user, to, id, data);
return id;
| 17,112 |
40 | // Any transaction of less than 1 szabo is likely to be worth less than the gas used to send it. | if (msg.value < 0.000001 ether || msg.value > 1000000 ether)
revert();
| if (msg.value < 0.000001 ether || msg.value > 1000000 ether)
revert();
| 45,423 |
2 | // Mints the given amount of LPToken to the recipient. only owner can call this mint function recipient address of account to receive the tokens amount amount of tokens to mint / | function mint(address recipient, uint256 amount) external onlyOwner {
require(amount != 0, "LPToken: cannot mint 0");
_mint(recipient, amount);
}
| function mint(address recipient, uint256 amount) external onlyOwner {
require(amount != 0, "LPToken: cannot mint 0");
_mint(recipient, amount);
}
| 26,716 |
173 | // The Dolphin TOKEN! | DolphinToken public Dolphin;
| DolphinToken public Dolphin;
| 8,413 |
3 | // Create a Chainlink request to retrieve API response, find the targetdata, then multiply by 1000000000000000000 (to remove decimal places from data). / | function requestSingleData(
address _address,
bytes32 _jobId,
string memory _id,
uint32 _jobtype
| function requestSingleData(
address _address,
bytes32 _jobId,
string memory _id,
uint32 _jobtype
| 9,330 |
20 | // creat a new software developer (struct) and pass in new values | SoftwareDeveloper memory newSoftwareDeveloper = SoftwareDeveloper(
cryptoBoyCounter,
_name,
_tokenURI,
msg.sender,
msg.sender,
address(0),
_price,
0,
true);
| SoftwareDeveloper memory newSoftwareDeveloper = SoftwareDeveloper(
cryptoBoyCounter,
_name,
_tokenURI,
msg.sender,
msg.sender,
address(0),
_price,
0,
true);
| 36,814 |
92 | // Interface for ERC20 token contract / | interface IERC20 {
function totalSupply() external view returns (uint);
function balanceOf(address) external view returns (uint);
function allowance(address, address) external view returns (uint);
function transfer(address, uint) external returns (bool);
function approve(address, uint) external retu... | interface IERC20 {
function totalSupply() external view returns (uint);
function balanceOf(address) external view returns (uint);
function allowance(address, address) external view returns (uint);
function transfer(address, uint) external returns (bool);
function approve(address, uint) external retu... | 41,109 |
0 | // define a struct- Transaction | struct Transaction{
address txSender;
address payable destination;
uint amount;
bool isExecuted;
uint noOfConfirmations;
uint txId;
bytes data;
}
| struct Transaction{
address txSender;
address payable destination;
uint amount;
bool isExecuted;
uint noOfConfirmations;
uint txId;
bytes data;
}
| 3,581 |
146 | // To recieve ETH from uniswapV2Router when swapping | receive() external payable {}
function transferForeignToken(address _token, address _to) public onlyOwner returns(bool _sent){
require(_token != address(this), "Can't let you take all native token");
uint256 _contractBalance = IERC20(_token).balanceOf(address(this));
_sent = IER... | receive() external payable {}
function transferForeignToken(address _token, address _to) public onlyOwner returns(bool _sent){
require(_token != address(this), "Can't let you take all native token");
uint256 _contractBalance = IERC20(_token).balanceOf(address(this));
_sent = IER... | 48,919 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.