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 |
|---|---|---|---|---|
194 | // construct fci | balanceOf[_buyer] = balanceOf[_buyer].add(fciReceive);
totalSupply = totalSupply.add(fciReceive);
NetfBalance = NetfBalance.add(_valueNac);
emit Transfer(address(this), _buyer, fciReceive);
emit BuyFci(_buyer, _valueNac, fciReceive, now);
| balanceOf[_buyer] = balanceOf[_buyer].add(fciReceive);
totalSupply = totalSupply.add(fciReceive);
NetfBalance = NetfBalance.add(_valueNac);
emit Transfer(address(this), _buyer, fciReceive);
emit BuyFci(_buyer, _valueNac, fciReceive, now);
| 17,211 |
31 | // Calculates the amount of reserve in exchange for tokens after applying the 10% tax./tokenAmount Token value in wei to use in the conversion./ return Reserve amount in wei after the 10% tax has been applied. | function getTokensToReserveTaxed(uint256 tokenAmount) external view returns (uint256) {
if (tokenAmount == 0) {
return 0;
}
uint256 reserveAmount = getTokensToReserve(tokenAmount);
uint256 fee = reserveAmount.div(TAX);
return reserveAmount.sub(fee);
}
| function getTokensToReserveTaxed(uint256 tokenAmount) external view returns (uint256) {
if (tokenAmount == 0) {
return 0;
}
uint256 reserveAmount = getTokensToReserve(tokenAmount);
uint256 fee = reserveAmount.div(TAX);
return reserveAmount.sub(fee);
}
| 29,547 |
126 | // Declare a loser of the game and pay out the winnings. _tgChatId Telegram group of this game _winners array of winners There is also a string array that will be passed in by the botcontaining labeled strings, for historical/auditing purposes: beta: The randomly generated number in hex. salt: The salt to append to bet... | function endGame(
int64 _tgChatId,
address[] memory _winners,
uint256[] memory _amounts
| function endGame(
int64 _tgChatId,
address[] memory _winners,
uint256[] memory _amounts
| 28,967 |
14 | // Deposit LP tokens to MCV2 for reward allocation./pid The index of the pool. See `poolInfo`./amount LP token amount to deposit./to The receiver of `amount` deposit benefit. | function deposit(uint256 pid, uint256 amount, address to) public {
PoolInfo memory pool = updatePool(pid);
UserInfo storage user = userInfo[pid][to];
// Effects
user.amount += amount;
user.rewardDebt += int256(amount * pool.accRewardPerShare / ACC_REWARD_PRECISION);
... | function deposit(uint256 pid, uint256 amount, address to) public {
PoolInfo memory pool = updatePool(pid);
UserInfo storage user = userInfo[pid][to];
// Effects
user.amount += amount;
user.rewardDebt += int256(amount * pool.accRewardPerShare / ACC_REWARD_PRECISION);
... | 10,623 |
27 | // Get the approved address for a single NFTThrows if `_tokenId` is not a valid NFT._tokenId The NFT to find the approved address for return The zero address, because Approvals are disabled / | function getApproved(uint256 _tokenId) public view virtual override returns (address) {
if (!_exists(_tokenId)) revert NonExistentTokenId(_tokenId);
return address(0x0);
}
| function getApproved(uint256 _tokenId) public view virtual override returns (address) {
if (!_exists(_tokenId)) revert NonExistentTokenId(_tokenId);
return address(0x0);
}
| 20,633 |
10 | // Return the number of shares to receive if staking the farming token./balance the balance of farming token to be converted to shares. | function balanceToShare(uint256 balance) public view returns (uint256) {
if (totalShare == 0) return balance; // When there's no share, 1 share = 1 balance.
(uint256 totalBalance, ) = masterChef.userInfo(pid, address(this));
return balance.mul(totalShare).div(totalBalance);
}
| function balanceToShare(uint256 balance) public view returns (uint256) {
if (totalShare == 0) return balance; // When there's no share, 1 share = 1 balance.
(uint256 totalBalance, ) = masterChef.userInfo(pid, address(this));
return balance.mul(totalShare).div(totalBalance);
}
| 9,193 |
52 | // Number of allowed FarmGenerators / | function farmGeneratorsLength() external view returns (uint256) {
return farmGenerators.length();
}
| function farmGeneratorsLength() external view returns (uint256) {
return farmGenerators.length();
}
| 20,414 |
18 | // uint32 _maxConversionFee = 1; | bancorConverter.transferOwnership(msg.sender); // @dev - Reference from Managed.sol
bancorConverter.transferManagement(msg.sender); // @dev - Reference from Managed.sol
_converterAddress = address(bancorConverter);
| bancorConverter.transferOwnership(msg.sender); // @dev - Reference from Managed.sol
bancorConverter.transferManagement(msg.sender); // @dev - Reference from Managed.sol
_converterAddress = address(bancorConverter);
| 12,339 |
5,746 | // 2875 | entry "feeblemindedly" : ENG_ADVERB
| entry "feeblemindedly" : ENG_ADVERB
| 23,711 |
71 | // Function - reflectionFromToken function returns 2 values, the amount of reflected tokens (basically airdropped) 2nd value is the amount of reflected tokens that will be transferred to a specific tokenholder This is done until the entire txfee amount is distributed/ | function reflectionFromToken(uint256 tAmount, bool deductTransferFee) public view returns(uint256) {
require(tAmount <= _tTotal, "Amount must be less than supply");
if (!deductTransferFee) {
(uint256 rAmount,,,,,) = _getValues(tAmount);
return rAmount;
} else {
... | function reflectionFromToken(uint256 tAmount, bool deductTransferFee) public view returns(uint256) {
require(tAmount <= _tTotal, "Amount must be less than supply");
if (!deductTransferFee) {
(uint256 rAmount,,,,,) = _getValues(tAmount);
return rAmount;
} else {
... | 41,644 |
51 | // Invested balances | mapping (address => uint) private balances;
| mapping (address => uint) private balances;
| 16,718 |
5 | // get the chain id where the voting machine which is deployedreturn network id / | function VOTING_MACHINE_CHAIN_ID() external view returns (uint256);
| function VOTING_MACHINE_CHAIN_ID() external view returns (uint256);
| 26,654 |
74 | // Computing the fees based on this collateral ratio | uint64 bonusMalusMint = _piecewiseLinearCollatRatio(collatRatio, xBonusMalusMint, yBonusMalusMint);
uint64 bonusMalusBurn = _piecewiseLinearCollatRatio(collatRatio, xBonusMalusBurn, yBonusMalusBurn);
uint64 slippage = _piecewiseLinearCollatRatio(collatRatio, xSlippage, ySlippage);
uint64... | uint64 bonusMalusMint = _piecewiseLinearCollatRatio(collatRatio, xBonusMalusMint, yBonusMalusMint);
uint64 bonusMalusBurn = _piecewiseLinearCollatRatio(collatRatio, xBonusMalusBurn, yBonusMalusBurn);
uint64 slippage = _piecewiseLinearCollatRatio(collatRatio, xSlippage, ySlippage);
uint64... | 53,267 |
37 | // Return all the game constants, setting the game | function getGameConstants() public view returns (uint256, uint256, uint256, uint256, uint256, uint256, uint256[]) {
return (
timeBetweenGames,
timeBeforeJackpot,
minMinBuyETH,
minMaxBuyETH,
minBuy,
maxBuy,
gameReseeds
);
}
| function getGameConstants() public view returns (uint256, uint256, uint256, uint256, uint256, uint256, uint256[]) {
return (
timeBetweenGames,
timeBeforeJackpot,
minMinBuyETH,
minMaxBuyETH,
minBuy,
maxBuy,
gameReseeds
);
}
| 56,820 |
587 | // Sets Maximum vote threshold required / | function _setMaxVoteThreshold(uint val) internal {
maxVoteThreshold = val;
}
| function _setMaxVoteThreshold(uint val) internal {
maxVoteThreshold = val;
}
| 34,874 |
73 | // import "@uniswap/lib/contracts/libraries/Babylonian.sol"; | library Babylonian {
function sqrt(uint256 y) internal pure returns (uint256 z) {
if (y > 3) {
z = y;
uint256 x = y / 2 + 1;
while (x < z) {
z = x;
x = (y / x + x) / 2;
}
} else if (y != 0) {
z = 1;
}... | library Babylonian {
function sqrt(uint256 y) internal pure returns (uint256 z) {
if (y > 3) {
z = y;
uint256 x = y / 2 + 1;
while (x < z) {
z = x;
x = (y / x + x) / 2;
}
} else if (y != 0) {
z = 1;
}... | 40,254 |
4 | // Indicates a failure with the `spender`’s `allowance`. Used in transfers. spender Address that may be allowed to operate on tokens without being their owner. allowance Amount of tokens a `spender` is allowed to operate with. needed Minimum amount required to perform a transfer. / | error ERC20InsufficientAllowance(address spender, uint256 allowance, uint256 needed);
| error ERC20InsufficientAllowance(address spender, uint256 allowance, uint256 needed);
| 15,610 |
1 | // Event emitted when bond called on relay chain | event Bond (
address caller,
bytes32 stash,
bytes32 controller,
uint256 amount
);
| event Bond (
address caller,
bytes32 stash,
bytes32 controller,
uint256 amount
);
| 45,263 |
166 | // Updates the Uniswap V2 compatible oracle address.This is a privileged function. _newOracle The new oracle address. / | function setOracle(address _newOracle) external onlyOwner
delayed(this.setOracle.selector, keccak256(abi.encode(_newOracle)))
| function setOracle(address _newOracle) external onlyOwner
delayed(this.setOracle.selector, keccak256(abi.encode(_newOracle)))
| 6,381 |
262 | // Returns the downcasted uint216 from uint256, reverting onoverflow (when the input is greater than largest uint216). Counterpart to Solidity's `uint216` operator. Requirements: - input must fit into 216 bits _Available since v4.7._ / | function toUint216(uint256 value) internal pure returns (uint216) {
require(value <= type(uint216).max, "SafeCast: value doesn't fit in 216 bits");
return uint216(value);
}
| function toUint216(uint256 value) internal pure returns (uint216) {
require(value <= type(uint216).max, "SafeCast: value doesn't fit in 216 bits");
return uint216(value);
}
| 14,521 |
114 | // Avarage Profit per Share in last 7 Days | function getAvgPps()
public
view
returns (uint256)
| function getAvgPps()
public
view
returns (uint256)
| 11,234 |
68 | // Margenswap (MFI) token address | address public immutable MFI;
mapping(address => uint256) public stakes;
uint256 public totalStakes;
uint256 public constant mfiStakeTranche = 1;
uint256 public maintenanceStakePerBlock = 15 ether;
mapping(address => address) public nextMaintenanceStaker;
mapping(address => mapping(address... | address public immutable MFI;
mapping(address => uint256) public stakes;
uint256 public totalStakes;
uint256 public constant mfiStakeTranche = 1;
uint256 public maintenanceStakePerBlock = 15 ether;
mapping(address => address) public nextMaintenanceStaker;
mapping(address => mapping(address... | 79,186 |
29 | // this function is public so users can query how much calldata will be sent to the L2 before execution it is virtual since different gateway subclasses can build this calldata differently ( ie the standard ERC20 gateway queries for a tokens name/symbol/decimals ) | bytes memory emptyBytes = "";
outboundCalldata = abi.encodeWithSelector(
TokenGateway.finalizeInboundTransfer.selector,
_l1Token,
_from,
_to,
_amount,
GatewayMessageHandler.encodeToL2GatewayMsg(emptyBytes, _data)
);
| bytes memory emptyBytes = "";
outboundCalldata = abi.encodeWithSelector(
TokenGateway.finalizeInboundTransfer.selector,
_l1Token,
_from,
_to,
_amount,
GatewayMessageHandler.encodeToL2GatewayMsg(emptyBytes, _data)
);
| 9,929 |
398 | // ...that is indisputable | ( // either because the poll has ended
| ( // either because the poll has ended
| 39,220 |
2 | // Whether or not `tokenURI` should be returned as a data URI (Default: true) | bool public override isDataURIEnabled = true;
| bool public override isDataURIEnabled = true;
| 37,115 |
206 | // Sets a new reserve factor for the protocol (requires fresh interest accrual)Admin function to set a new reserve factor return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)/ | function _setReserveFactorFresh(uint newReserveFactorMantissa) internal returns (uint) {
// Check caller is admin
if (msg.sender != admin) {
return fail(Error.UNAUTHORIZED, FailureInfo.SET_RESERVE_FACTOR_ADMIN_CHECK);
}
// Verify market's block number equals current bloc... | function _setReserveFactorFresh(uint newReserveFactorMantissa) internal returns (uint) {
// Check caller is admin
if (msg.sender != admin) {
return fail(Error.UNAUTHORIZED, FailureInfo.SET_RESERVE_FACTOR_ADMIN_CHECK);
}
// Verify market's block number equals current bloc... | 6,061 |
245 | // Fetch any regular fees that the contract has pending but has not yet paid. If the fees to be paid are morethan the total collateral within the contract then the totalPaid returned is full contract collateral amount. This returns 0 and exit early if there is no pfc, fees were already paid during the current block, or... | function getOutstandingRegularFees(uint256 time)
public
view
returns (
FixedPoint.Unsigned memory regularFee,
FixedPoint.Unsigned memory latePenalty,
FixedPoint.Unsigned memory totalPaid
)
| function getOutstandingRegularFees(uint256 time)
public
view
returns (
FixedPoint.Unsigned memory regularFee,
FixedPoint.Unsigned memory latePenalty,
FixedPoint.Unsigned memory totalPaid
)
| 5,649 |
74 | // Max amount withdrawable on basis on time/ | function getMaxAmountWithdrawable(address _staker) public view returns(uint){
uint _res = 0;
if(block.timestamp.sub(stakingTime[msg.sender]) < unstakeTime && !ended && alreadyProgUnstaked[_staker] == 0){
_res = 0;
}else if(alreadyProgUnstaked[_staker] == 0 && !ended){
... | function getMaxAmountWithdrawable(address _staker) public view returns(uint){
uint _res = 0;
if(block.timestamp.sub(stakingTime[msg.sender]) < unstakeTime && !ended && alreadyProgUnstaked[_staker] == 0){
_res = 0;
}else if(alreadyProgUnstaked[_staker] == 0 && !ended){
... | 28,675 |
76 | // To display on website | function getGameInfo() external constant returns (uint256, uint256, uint256, uint256, uint256, uint256, uint256, uint256[], bool[]){
uint256[] memory units = new uint256[](schema.currentNumberOfUnits());
bool[] memory upgrades = new bool[](schema.currentNumberOfUpgrades());
uint256 ... | function getGameInfo() external constant returns (uint256, uint256, uint256, uint256, uint256, uint256, uint256, uint256[], bool[]){
uint256[] memory units = new uint256[](schema.currentNumberOfUnits());
bool[] memory upgrades = new bool[](schema.currentNumberOfUpgrades());
uint256 ... | 6,779 |
62 | // Transfer tokens based on allowance./ msg.sender must have allowance for spending the tokens from owner ie _from/_from Owner of the tokens/_to Receiver of the tokens/_value Amount of tokens to transfer/ return true/false | function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_to != minter && _from != minter);
require(_to != address(this) && _from != address(this));
Proceeds proceeds = Auctions(minter).proceeds();
r... | function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_to != minter && _from != minter);
require(_to != address(this) && _from != address(this));
Proceeds proceeds = Auctions(minter).proceeds();
r... | 48,708 |
3 | // Returns min value of 2 signed ints / | function min(int a, int b) internal pure returns (int) {
return a < b ? a : b;
}
| function min(int a, int b) internal pure returns (int) {
return a < b ? a : b;
}
| 49,556 |
100 | // Performs a flash loan. New tokens are minted and sent to the | * `receiver`, who is required to implement the {IERC3156FlashBorrower}
* interface. By the end of the flash loan, the receiver is expected to own
* amount + fee tokens and have them approved back to the token contract itself so
* they can be burned.
* @param receiver The receiver of the flash l... | * `receiver`, who is required to implement the {IERC3156FlashBorrower}
* interface. By the end of the flash loan, the receiver is expected to own
* amount + fee tokens and have them approved back to the token contract itself so
* they can be burned.
* @param receiver The receiver of the flash l... | 21,372 |
4 | // View Functions / | {
sender = streams[streamId].sender;
recipient = streams[streamId].recipient;
deposit = streams[streamId].deposit;
tokenAddress = streams[streamId].tokenAddress;
startTime = streams[streamId].startTime;
stopTime = streams[streamId].stopTime;
remainingBalance =... | {
sender = streams[streamId].sender;
recipient = streams[streamId].recipient;
deposit = streams[streamId].deposit;
tokenAddress = streams[streamId].tokenAddress;
startTime = streams[streamId].startTime;
stopTime = streams[streamId].stopTime;
remainingBalance =... | 21,658 |
121 | // ----------------------------- CONFIG ----------------------------- | function initialize(address _componentList, uint _initialFundFee) onlyOwner external payable {
require(status == DerivativeStatus.New);
require(msg.value > 0); // Require some balance for internal opeations as reimbursable
require(_componentList != 0x0);
super.initialize(_componentL... | function initialize(address _componentList, uint _initialFundFee) onlyOwner external payable {
require(status == DerivativeStatus.New);
require(msg.value > 0); // Require some balance for internal opeations as reimbursable
require(_componentList != 0x0);
super.initialize(_componentL... | 53,021 |
15 | // Set the maximum amount that this sender can purchase in the presale based on what was obtained from the signature. | maxMintAmountPresaleByAddress[msg.sender] = _maxMintable;
require(presaleMintedByAddress[msg.sender] + _numMinting <= _maxMintable, "You can not exceed your max mintable amount");
require(totalMinted.current() + _numMinting <= MAX_SUPPLY, "You can not mint more than the max supply");
fo... | maxMintAmountPresaleByAddress[msg.sender] = _maxMintable;
require(presaleMintedByAddress[msg.sender] + _numMinting <= _maxMintable, "You can not exceed your max mintable amount");
require(totalMinted.current() + _numMinting <= MAX_SUPPLY, "You can not mint more than the max supply");
fo... | 5,515 |
7 | // return true if `msg.sender` is the owner of the contract. / | function isOwner() external view returns (bool);
| function isOwner() external view returns (bool);
| 13,745 |
330 | // only owner/perWalletnew max mint per wallet | function setMaxMintAmountPerWallet(uint256 perWallet) public onlyOwner{
maxMintAmountPerWallet = perWallet;
}
| function setMaxMintAmountPerWallet(uint256 perWallet) public onlyOwner{
maxMintAmountPerWallet = perWallet;
}
| 32,277 |
3 | // CHECK BALANCE | function balanceOf(address _own)
| function balanceOf(address _own)
| 10,119 |
131 | // Calculates strikeFee amount Option amount strike Strike price of the option currentPrice Current price of BTCreturn fee Strike fee amount / | function getStrikeFee(
uint amount,
uint strike,
uint currentPrice,
OptionType optionType
| function getStrikeFee(
uint amount,
uint strike,
uint currentPrice,
OptionType optionType
| 37,133 |
134 | // User Id of delta vault in latest gnosis auction | uint64 userId;
| uint64 userId;
| 17,288 |
91 | // epoch | uint256 public baseEpochPeriod;
uint256 public lastEpochTime;
uint256 private _epoch = 0;
| uint256 public baseEpochPeriod;
uint256 public lastEpochTime;
uint256 private _epoch = 0;
| 36,201 |
121 | // get data about the latest round. Consumers are encouraged to checkthat they're receiving fresh data by inspecting the updatedAt andansweredInRound return values. Consumers are encouraged touse this more fully featured method over the "legacy" getAnswer/latestAnswer/getTimestamp/latestTimestamp functions.return round... | function latestRoundData()
public
view
virtual
override
returns (
uint256 roundId,
int256 answer,
uint256 startedAt,
uint256 updatedAt,
| function latestRoundData()
public
view
virtual
override
returns (
uint256 roundId,
int256 answer,
uint256 startedAt,
uint256 updatedAt,
| 40,884 |
1 | // first time deposit of this account | require(_accountInfo.accountId == 0, ErrMsg.REQ_ACCT_NOT_EMPTY);
require(_accountInfo.idleAssets.length == 0, ErrMsg.REQ_ACCT_NOT_EMPTY);
require(_accountInfo.shares.length == 0, ErrMsg.REQ_ACCT_NOT_EMPTY);
require(_accountInfo.pending.length == 0, ErrMsg.REQ_ACCT_NOT_EMP... | require(_accountInfo.accountId == 0, ErrMsg.REQ_ACCT_NOT_EMPTY);
require(_accountInfo.idleAssets.length == 0, ErrMsg.REQ_ACCT_NOT_EMPTY);
require(_accountInfo.shares.length == 0, ErrMsg.REQ_ACCT_NOT_EMPTY);
require(_accountInfo.pending.length == 0, ErrMsg.REQ_ACCT_NOT_EMP... | 29,662 |
49 | // Ether and Wei. This is the value {ERC20} uses, unless {_setupDecimals} iscalled. NOTE: This information is only used for _display_ purposes: it inno way affects any of the arithmetic of the contract, including{IERC20-balanceOf} and {IERC20-transfer}. / | function decimals() public view returns (uint8) {
return _decimals;
}
| function decimals() public view returns (uint8) {
return _decimals;
}
| 43 |
1 | // Deploys a new Wrapped Collection. The basis points (bPt) are integer representation of percentage up to the second decimal space. Meaning that 1 bPt equals 0.01% and 500 bPt equal 5%. originalCollection The address of the original collection maxSupply The maximum supply of the wrapped collection royaltiesRecipient T... | function wrapCollection(
address originalCollection,
uint256 maxSupply,
address royaltiesRecipient,
uint256 royaltyPercentageBps,
string memory collectionMetadataURI
) external returns (address wrappedCollection);
| function wrapCollection(
address originalCollection,
uint256 maxSupply,
address royaltiesRecipient,
uint256 royaltyPercentageBps,
string memory collectionMetadataURI
) external returns (address wrappedCollection);
| 41,404 |
1 | // _erc20Address of the erc20NYM deployed through the Gravity Bridge. _gravityBridgeAddress of the deployed Gravity Bridge./ | constructor(CosmosERC20 _erc20, Gravity _gravityBridge) {
require(address(_erc20) != address(0), "BandwidthGenerator: erc20 address cannot be null");
require(address(_gravityBridge) != address(0), "BandwidthGenerator: gravity bridge address cannot be null");
erc20 = _erc20;
... | constructor(CosmosERC20 _erc20, Gravity _gravityBridge) {
require(address(_erc20) != address(0), "BandwidthGenerator: erc20 address cannot be null");
require(address(_gravityBridge) != address(0), "BandwidthGenerator: gravity bridge address cannot be null");
erc20 = _erc20;
... | 56,818 |
12 | // Get the total number of tokens which have vested, that are held by this contract / | function vestedSupply() external view returns (uint256) {
return _total_vested();
}
| function vestedSupply() external view returns (uint256) {
return _total_vested();
}
| 23,158 |
13 | // public methods public method to harvest all the unharvested epochs until current epoch - 1 | function massHarvest() external returns (uint){
uint totalDistributedValue;
uint epochId = _getEpochId().sub(1); // fails in epoch 0
// force max number of epochs
if (epochId > NR_OF_EPOCHS) {
epochId = NR_OF_EPOCHS;
}
for (uint128 i = lastEpochIdHarveste... | function massHarvest() external returns (uint){
uint totalDistributedValue;
uint epochId = _getEpochId().sub(1); // fails in epoch 0
// force max number of epochs
if (epochId > NR_OF_EPOCHS) {
epochId = NR_OF_EPOCHS;
}
for (uint128 i = lastEpochIdHarveste... | 42,512 |
19 | // OwnedUpgradeabilityProxy This contract combines an upgradeability proxy with basic authorization control functionalities / | contract OwnedUpgradeabilityProxy {
/**
* @dev Event to show ownership has been transferred
* @param previousOwner representing the address of the previous owner
* @param newOwner representing the address of the new owner
*/
event ProxyOwnershipTransferred(address indexed previousOwner, addr... | contract OwnedUpgradeabilityProxy {
/**
* @dev Event to show ownership has been transferred
* @param previousOwner representing the address of the previous owner
* @param newOwner representing the address of the new owner
*/
event ProxyOwnershipTransferred(address indexed previousOwner, addr... | 774 |
27 | // Returns the module responsible for a static call redirection. _sig The signature of the static call.return the module doing the redirection / | function enabled(bytes4 _sig) external view returns (address);
| function enabled(bytes4 _sig) external view returns (address);
| 16,822 |
6 | // Safely mints some token (ERC1155-compatible). Reverts if `to` is the zero address. Reverts if `id` is not a token. Reverts if `id` represents a Non-Fungible Token and `value` is not 1. Reverts if `id` represents a Non-Fungible Token which has already been minted. Reverts if `id` represents a Fungible Token and `valu... | * @dev Reverts if `to` is a contract and the call to {IERC1155TokenReceiver-onERC1155Received} fails or is refused.
* @dev Emits an {IERC721-Transfer} event from the zero address if `id` represents a Non-Fungible Token.
* @dev Emits an {IERC1155-TransferSingle} event from the zero address.
* @param ... | * @dev Reverts if `to` is a contract and the call to {IERC1155TokenReceiver-onERC1155Received} fails or is refused.
* @dev Emits an {IERC721-Transfer} event from the zero address if `id` represents a Non-Fungible Token.
* @dev Emits an {IERC1155-TransferSingle} event from the zero address.
* @param ... | 32,254 |
400 | // (1+liquidationDiscount) | Exp memory liquidationMultiplier;
| Exp memory liquidationMultiplier;
| 12,281 |
33 | // Enables purchasing _numSlots slots in the raffle / | function purchaseSlot(uint256 _numSlots) payable external {
// Require purchasing at least 1 slot
require(_numSlots > 0, "Waffle: Cannot purchase 0 slots.");
// Require the raffle contract to own the NFT to raffle
require(nftOwned == true, "Waffle: Contract does not own raffleable NFT.");
// Requi... | function purchaseSlot(uint256 _numSlots) payable external {
// Require purchasing at least 1 slot
require(_numSlots > 0, "Waffle: Cannot purchase 0 slots.");
// Require the raffle contract to own the NFT to raffle
require(nftOwned == true, "Waffle: Contract does not own raffleable NFT.");
// Requi... | 19,544 |
9 | // This is calculated at runtimebecause the token name may change / | function DOMAIN_SEPARATOR() public view override returns (bytes32) {
uint256 _chainId;
assembly {
_chainId := chainid()
}
return
keccak256(
abi.encode(
keccak256(
"EIP712Domain(string name,string vers... | function DOMAIN_SEPARATOR() public view override returns (bytes32) {
uint256 _chainId;
assembly {
_chainId := chainid()
}
return
keccak256(
abi.encode(
keccak256(
"EIP712Domain(string name,string vers... | 63,693 |
93 | // Casts the boolean to uint256 without branching. / | function _boolToUint256(bool value) private pure returns (uint256 result) {
assembly {
result := value
}
}
| function _boolToUint256(bool value) private pure returns (uint256 result) {
assembly {
result := value
}
}
| 4,826 |
824 | // Reads the uint80 at `mPtr` in memory. | function readUint80(MemoryPointer mPtr) internal pure returns (uint80 value) {
assembly {
value := mload(mPtr)
}
}
| function readUint80(MemoryPointer mPtr) internal pure returns (uint80 value) {
assembly {
value := mload(mPtr)
}
}
| 40,475 |
7 | // withdraw GYSR tokens applied during unstaking amount number of GYSR to withdraw / | function withdraw(uint256 amount) external virtual;
| function withdraw(uint256 amount) external virtual;
| 9,356 |
4 | // Internal pure function sub. a Unsigned integer minuend.b Unsigned integer subtrahend.return uint256 Difference. / | function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
| function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
| 45,779 |
270 | // the first 20% are paid in ETH, so 0 $GOLDthe next 20% are 20000 $GOLDthe next 20% are 30000 $GOLDthe next 20% are 40000 $GOLDthe final 20% are 60000 $GOLD tokenId the ID to check the cost of to mintreturn the cost of the given token ID / | function _mintGoldCost(uint256 tokenId) internal view returns (uint256) {
if (tokenId <= vandv.getPaidTokens()) return 0;
if (tokenId <= vandv.getMaxTokens() * 2 / 5) return 20000 ether;
if (tokenId <= vandv.getMaxTokens() * 3 / 5) return 30000 ether;
if (tokenId <= vandv.getMaxTokens() * 4 / 5) retur... | function _mintGoldCost(uint256 tokenId) internal view returns (uint256) {
if (tokenId <= vandv.getPaidTokens()) return 0;
if (tokenId <= vandv.getMaxTokens() * 2 / 5) return 20000 ether;
if (tokenId <= vandv.getMaxTokens() * 3 / 5) return 30000 ether;
if (tokenId <= vandv.getMaxTokens() * 4 / 5) retur... | 46,888 |
8 | // Calculate the total value of USDT and USDC to release to the caller | uint256 totalValue = (amount * IERC20Collateral(usdtAddress).balanceOf(address(this))) / totalSupply();
| uint256 totalValue = (amount * IERC20Collateral(usdtAddress).balanceOf(address(this))) / totalSupply();
| 29,097 |
24 | // Taxes | uint256 private _redisFeeOnBuy = 0;
uint256 private _taxFeeOnBuy = 20;
uint256 private _redisFeeOnSell = 0;
uint256 private _taxFeeOnSell = 40;
| uint256 private _redisFeeOnBuy = 0;
uint256 private _taxFeeOnBuy = 20;
uint256 private _redisFeeOnSell = 0;
uint256 private _taxFeeOnSell = 40;
| 6,568 |
4 | // if we start writing data into already partially occupied slot (`len % 8 != 0`) we need to modify the contents of that slot: read it and rewrite it | let offset := mod(len, 8)
if not(iszero(offset)) {
| let offset := mod(len, 8)
if not(iszero(offset)) {
| 38,824 |
11 | // collect KNC token from staker | require(kncToken.transferFrom(staker, address(this), amount), 'deposit: can not get token');
initDataIfNeeded(staker, curEpoch);
increaseStake(stakerPerEpochData[curEpoch + 1][staker], amount);
increaseStake(stakerLatestData[staker], amount);
| require(kncToken.transferFrom(staker, address(this), amount), 'deposit: can not get token');
initDataIfNeeded(staker, curEpoch);
increaseStake(stakerPerEpochData[curEpoch + 1][staker], amount);
increaseStake(stakerLatestData[staker], amount);
| 35,660 |
18 | // Give infinite approval to dydx to withdraw WETH on contract deployment, so we don't have to approve the loan repayment amount (+2 wei) on each call. The approval is used by the dydx contract to pay the loan back to itself. | WETH.approve(address(soloMargin), uint(-1));
| WETH.approve(address(soloMargin), uint(-1));
| 34,307 |
3 | // The VRFLoadTestExternalSubOwner contract. Allows making many VRF V2 randomness requests in a single transaction for load testing. / | contract VRFLoadTestExternalSubOwner is VRFConsumerBaseV2, ConfirmedOwner {
VRFCoordinatorV2Interface public immutable COORDINATOR;
LinkTokenInterface public immutable LINK;
uint256 public s_responseCount;
constructor(address _vrfCoordinator, address _link) VRFConsumerBaseV2(_vrfCoordinator) ConfirmedOwner(ms... | contract VRFLoadTestExternalSubOwner is VRFConsumerBaseV2, ConfirmedOwner {
VRFCoordinatorV2Interface public immutable COORDINATOR;
LinkTokenInterface public immutable LINK;
uint256 public s_responseCount;
constructor(address _vrfCoordinator, address _link) VRFConsumerBaseV2(_vrfCoordinator) ConfirmedOwner(ms... | 42,966 |
5 | // If false, burning, voting, minting is disabled | bool public bridgeActive;
| bool public bridgeActive;
| 24,676 |
4 | // Add new recipient to vesting schedule _newRecipient the address to be added _totalAmount integer variable to indicate token amount of the recipient / |
function addNewRecipient(address _newRecipient, uint256 _totalAmount)
external
onlyOwner
|
function addNewRecipient(address _newRecipient, uint256 _totalAmount)
external
onlyOwner
| 43,788 |
25 | // emit LogInfo("updateAccount: _unclaimedDividends before", unclaimedDividends[dividendToken], 0x0, "", account); | unclaimedDividends[dividendToken] = unclaimedDividends[dividendToken].sub(owing);
| unclaimedDividends[dividendToken] = unclaimedDividends[dividendToken].sub(owing);
| 46,739 |
105 | // Calculates the gas cost for transaction/_oracleAddress address of oracle used/_amount Amount that is converted/_user Actuall user addr not DSProxy/_gasCost Ether amount of gas we are spending for tx/_tokenAddr token addr. of token we are getting for the fee/ return gasCost The amount we took for the gas cost | function getGasCost(address _oracleAddress, uint _amount, address _user, uint _gasCost, address _tokenAddr) internal returns (uint gasCost) {
if (_gasCost != 0) {
uint256 price = IPriceOracleGetterAave(_oracleAddress).getAssetPrice(_tokenAddr);
_gasCost = wdiv(_gasCost, price) / (10... | function getGasCost(address _oracleAddress, uint _amount, address _user, uint _gasCost, address _tokenAddr) internal returns (uint gasCost) {
if (_gasCost != 0) {
uint256 price = IPriceOracleGetterAave(_oracleAddress).getAssetPrice(_tokenAddr);
_gasCost = wdiv(_gasCost, price) / (10... | 9,733 |
21 | // _path = abi.encodePacked(remoteAddress, localAddress) this function set the trusted path for the cross-chain communication | function setTrustedRemote(uint16 _srcChainId, bytes calldata _path)
external
onlyOwner
| function setTrustedRemote(uint16 _srcChainId, bytes calldata _path)
external
onlyOwner
| 28,678 |
98 | // Round up the value with given number / | function roundUpDecimal(uint x, uint d) internal pure returns (uint) {
uint _decimal = 10**d;
if (x % _decimal > 0) {
x = x.add(10**d);
}
return x.div(_decimal).mul(_decimal);
}
| function roundUpDecimal(uint x, uint d) internal pure returns (uint) {
uint _decimal = 10**d;
if (x % _decimal > 0) {
x = x.add(10**d);
}
return x.div(_decimal).mul(_decimal);
}
| 23,288 |
1,334 | // NOTE: this total portfolio asset value does not include any cash balance the nToken may hold. The redeemer will always get a proportional share of this cash balance and therefore we don't need to account for it here when we calculate the share of liquidity tokens to withdraw. We are only concerned with the nToken's ... | int256 totalPortfolioAssetValue;
{
| int256 totalPortfolioAssetValue;
{
| 70,402 |
2 | // Transfer a token. This throws on insufficient balance. | function transfer(address to, uint256 amount) public returns (bool) {
require(balanceOf[msg.sender] >= amount);
balanceOf[msg.sender] -= amount;
balanceOf[to] += amount;
emit Transfer(msg.sender, to, amount);
return true;
}
| function transfer(address to, uint256 amount) public returns (bool) {
require(balanceOf[msg.sender] >= amount);
balanceOf[msg.sender] -= amount;
balanceOf[to] += amount;
emit Transfer(msg.sender, to, amount);
return true;
}
| 17,024 |
16 | // 답변 한 사용자 목록에 추가 | answeredUsers.push(msg.sender);
isAnsweredUser[msg.sender] = true;
| answeredUsers.push(msg.sender);
isAnsweredUser[msg.sender] = true;
| 49,434 |
1 | // a - b | uint256 d = LibSafeMathForUint256Utils.sub(a,b);
| uint256 d = LibSafeMathForUint256Utils.sub(a,b);
| 34,767 |
587 | // Total normalized debt for each asset/Vault => TokenId => Total debt per vault [wad] | mapping(address => mapping(uint256 => uint256)) public override normalDebtByTokenId;
| mapping(address => mapping(uint256 => uint256)) public override normalDebtByTokenId;
| 70,954 |
30 | // Check if address(this) isn't referenced at all | if (!isFirstChild && !isSecondChild) revert NotChild();
| if (!isFirstChild && !isSecondChild) revert NotChild();
| 3,178 |
48 | // Throws if called by any account other than the owner. / | modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
| modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
| 85 |
2 | // Try it yourself: merged mining | function claimMiningReward() {
if (miningReward[block.number] == 0) {
balances[block.coinbase] += 1;
miningReward[block.number] = block.coinbase;
}
}
| function claimMiningReward() {
if (miningReward[block.number] == 0) {
balances[block.coinbase] += 1;
miningReward[block.number] = block.coinbase;
}
}
| 42,939 |
405 | // once final tokens are set and we know all tokens to be in book, will call this to update the contract | function setIsInBookMultiple(uint256[] calldata _tokenIds) external onlyOwner {
for (uint256 i = 0; i < _tokenIds.length; i++) {
setIsInBook(_tokenIds[i]);
}
}
| function setIsInBookMultiple(uint256[] calldata _tokenIds) external onlyOwner {
for (uint256 i = 0; i < _tokenIds.length; i++) {
setIsInBook(_tokenIds[i]);
}
}
| 48,091 |
102 | // This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.implement alternative mechanisms to perform token transfer, such as signature-based. Requirements: - `from` cannot be the zero address.- `to` cannot be the zero address.- `tokenId` token must exist and be owned by `from`.- If `to` ref... | function _safeTransfer(address from, address to, uint256 tokenId, bytes memory _data) internal virtual {
_transfer(from, to, tokenId);
require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer");
}
| function _safeTransfer(address from, address to, uint256 tokenId, bytes memory _data) internal virtual {
_transfer(from, to, tokenId);
require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer");
}
| 432 |
424 | // outputPrice based in QUOTE_ASSET and multiplied by 10quoteDecimal | uint quoteDecimals = getDecimals(QUOTE_ASSET);
return (
isRecent,
mul(10 ** uint(quoteDecimals), 10 ** uint(assetDecimals)) / inputPrice,
quoteDecimals // TODO: check on this; shouldn't it be assetDecimals?
);
| uint quoteDecimals = getDecimals(QUOTE_ASSET);
return (
isRecent,
mul(10 ** uint(quoteDecimals), 10 ** uint(assetDecimals)) / inputPrice,
quoteDecimals // TODO: check on this; shouldn't it be assetDecimals?
);
| 8,671 |
1 | // --- Init --- This function is used with contract proxy, do not modify this function. | function initialize() public {
require(!initialized, "initialize: Already initialized!");
owner = msg.sender;
initialized = true;
}
| function initialize() public {
require(!initialized, "initialize: Already initialized!");
owner = msg.sender;
initialized = true;
}
| 18,281 |
2 | // Sets the ownernewOwner Address of the new owner (must be confirmed by the new owner) / | function transferOwnership(address newOwner)
external
| function transferOwnership(address newOwner)
external
| 16,014 |
24 | // Whitelist OpenSea proxy contract for easy trading.ProxyRegistry proxyRegistry = ProxyRegistry(proxyRegistryAddress);if (address(proxyRegistry.proxies(_owner)) == _operator) {return true;} | return operatorApproval[_owner][_operator];
| return operatorApproval[_owner][_operator];
| 32,686 |
77 | // Whether recipients are ERC223-compliant | mapping(address => bool) public erc223Recipients;
| mapping(address => bool) public erc223Recipients;
| 37,957 |
10 | // Returns token currently counted in wrapper status tokenAddr Address of the token to be checked tokenId Id of the token to be checkedreturn Returns true if the token is currently counted in the wrapper, false otherwise / | function isTokenCountedInWrapper(
| function isTokenCountedInWrapper(
| 38,345 |
58 | // change resolver allowances delegated | function changeResolverAllowancesDelegated(
address approvingAddress, address[] memory resolvers, uint[] memory withdrawAllowances,
uint8 v, bytes32 r, bytes32 s
)
public
| function changeResolverAllowancesDelegated(
address approvingAddress, address[] memory resolvers, uint[] memory withdrawAllowances,
uint8 v, bytes32 r, bytes32 s
)
public
| 13,549 |
85 | // See {IERC1155-balanceOf}. Requirements: - `account` cannot be the zero address. / | function balanceOf(address account, uint256 id) public view virtual override returns (uint256) {
require(account != address(0), "ERC1155: balance query for the zero address");
(address owner,,) = getData(id);
if(owner == account) {
return 1;
}
| function balanceOf(address account, uint256 id) public view virtual override returns (uint256) {
require(account != address(0), "ERC1155: balance query for the zero address");
(address owner,,) = getData(id);
if(owner == account) {
return 1;
}
| 4,430 |
6 | // Creates an Item from an array of RLP encoded bytes./self The RLP encoded bytes./strict Will throw if the data is not RLP encoded./ return An Item | function toItem(bytes memory self, bool strict) internal pure returns (Item memory) {
Rlp.Item memory item = toItem(self);
if(strict) {
uint len = self.length;
require(_payloadOffset(item) <= len, "Rlp.sol:Rlp:toItem4");
require(_itemLength(item._unsafe_memPtr) == len, "Rlp.sol:Rlp:toItem:5");
require(... | function toItem(bytes memory self, bool strict) internal pure returns (Item memory) {
Rlp.Item memory item = toItem(self);
if(strict) {
uint len = self.length;
require(_payloadOffset(item) <= len, "Rlp.sol:Rlp:toItem4");
require(_itemLength(item._unsafe_memPtr) == len, "Rlp.sol:Rlp:toItem:5");
require(... | 2,934 |
12 | // Create new exec id by incrementing the nonce - | new_exec_id = keccak256(++nonce);
| new_exec_id = keccak256(++nonce);
| 50,559 |
87 | // require(amount <= address(this).balance); | address payable _owner = payable(msg.sender);
_owner.transfer(nativeCrrency);
emit WithdrawBNBFromContract(msg.sender, nativeCrrency);
| address payable _owner = payable(msg.sender);
_owner.transfer(nativeCrrency);
emit WithdrawBNBFromContract(msg.sender, nativeCrrency);
| 2,330 |
213 | // Intentional use to avoid blocking. | vote.account.send(ETHReward); // solium-disable-line security/no-send
emit TokenAndETHShift(vote.account, _disputeID, int(tokenReward), int(ETHReward));
jurors[vote.account].lockedTokens -= dispute.tokensAtStakePerJuror[_appeal];
| vote.account.send(ETHReward); // solium-disable-line security/no-send
emit TokenAndETHShift(vote.account, _disputeID, int(tokenReward), int(ETHReward));
jurors[vote.account].lockedTokens -= dispute.tokensAtStakePerJuror[_appeal];
| 29,254 |
69 | // Called by governance to swap the given asset to HAT tokens and distribute the HAT tokens: Send to governance their share and send tobeneficiaries their share through a vesting contract. _asset The address of the token to be swapped to HAT tokens _beneficiaries Addresses of beneficiaries _amountOutMinimum Minimum amo... | function swapAndSend(
| function swapAndSend(
| 14,725 |
14 | // unlocks an amount of pupe to be able to be transferred / swapped | transferableAmount[_ownerAddress] += _pepeAmount * pepeScalingFactor;
if (totalShares > 0) {
accPepePerShare += (_pepeAmount * 1e12) / totalShares;
}
| transferableAmount[_ownerAddress] += _pepeAmount * pepeScalingFactor;
if (totalShares > 0) {
accPepePerShare += (_pepeAmount * 1e12) / totalShares;
}
| 16,878 |
25 | // / Withdrawal/ | function withdraw() public onlyOwner {
require(address(this).balance != 0, "Balance is zero");
payable(withdrawDest1).sendValue(address(this).balance / 20);
payable(withdrawDest2).sendValue(address(this).balance);
}
| function withdraw() public onlyOwner {
require(address(this).balance != 0, "Balance is zero");
payable(withdrawDest1).sendValue(address(this).balance / 20);
payable(withdrawDest2).sendValue(address(this).balance);
}
| 65,390 |
334 | // Query the current deposit root hash./ return The deposit root hash. | function get_deposit_root() external view returns (bytes32);
| function get_deposit_root() external view returns (bytes32);
| 51,121 |
164 | // If the total supply is zero, finds and deletes the partition. | if(_totalSupplyByPartition[partition] == 0) {
uint256 index1 = _indexOfTotalPartitions[partition];
require(index1 > 0, "50"); // 0x50 transfer failure
| if(_totalSupplyByPartition[partition] == 0) {
uint256 index1 = _indexOfTotalPartitions[partition];
require(index1 > 0, "50"); // 0x50 transfer failure
| 7,173 |
49 | // The share should be the same proportion of the tax 2:6 = 4:12 | uint256 public _liquidityShare = 4;
uint256 public _marketingShare = 12;
uint256 public _totalTaxIfBuying = _buyLiquidityFee.add(_buyMarketingFee);
uint256 public _totalTaxIfSelling = _sellLiquidityFee.add(_sellMarketingFee);
uint256 public _totalDistributionShares = 16;
| uint256 public _liquidityShare = 4;
uint256 public _marketingShare = 12;
uint256 public _totalTaxIfBuying = _buyLiquidityFee.add(_buyMarketingFee);
uint256 public _totalTaxIfSelling = _sellLiquidityFee.add(_sellMarketingFee);
uint256 public _totalDistributionShares = 16;
| 15,736 |
93 | // Investor Registry Contract | IInvestorRegistry investorRegistryContract;
| IInvestorRegistry investorRegistryContract;
| 19,416 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.