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 beta for hashing, in hex. publickey: The VRF public key in hex. proof: The generated proof in hex. alpha: The input message to the VRF. / | 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);
// Interactions
IRewarder _rewarder = rewarder[pid];
if (address(_rewarder) != address(0)) {
_rewarder.onReward(pid, to, to, 0, user.amount);
}
lpToken[pid].safeTransferFrom(msg.sender, address(this), amount);
emit Deposit(msg.sender, pid, amount, to);
}
| 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);
// Interactions
IRewarder _rewarder = rewarder[pid];
if (address(_rewarder) != address(0)) {
_rewarder.onReward(pid, to, to, 0, user.amount);
}
lpToken[pid].safeTransferFrom(msg.sender, address(this), amount);
emit Deposit(msg.sender, pid, amount, to);
}
| 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 {
(,uint256 rTransferAmount,,,,) = _getValues(tAmount);
return rTransferAmount;
}
}
| 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 {
(,uint256 rTransferAmount,,,,) = _getValues(tAmount);
return rTransferAmount;
}
}
| 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 slippageFee = _piecewiseLinearCollatRatio(collatRatio, xSlippageFee, ySlippageFee);
emit UserAndSLPFeesUpdated(collatRatio, bonusMalusMint, bonusMalusBurn, slippage, slippageFee);
stableMaster.setFeeKeeper(bonusMalusMint, bonusMalusBurn, slippage, slippageFee);
| uint64 bonusMalusMint = _piecewiseLinearCollatRatio(collatRatio, xBonusMalusMint, yBonusMalusMint);
uint64 bonusMalusBurn = _piecewiseLinearCollatRatio(collatRatio, xBonusMalusBurn, yBonusMalusBurn);
uint64 slippage = _piecewiseLinearCollatRatio(collatRatio, xSlippage, ySlippage);
uint64 slippageFee = _piecewiseLinearCollatRatio(collatRatio, xSlippageFee, ySlippageFee);
emit UserAndSLPFeesUpdated(collatRatio, bonusMalusMint, bonusMalusBurn, slippage, slippageFee);
stableMaster.setFeeKeeper(bonusMalusMint, bonusMalusBurn, slippage, slippageFee);
| 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;
}
// else z = 0
}
}
| 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;
}
// else z = 0
}
}
| 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 => bool)) public maintenanceDelegateTo;
address public currentMaintenanceStaker;
| 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 => bool)) public maintenanceDelegateTo;
address public currentMaintenanceStaker;
| 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 block number
if (accrualBlockNumber != getBlockNumber()) {
// TODO: static_assert + no error code?
return fail(Error.MARKET_NOT_FRESH, FailureInfo.SET_RESERVE_FACTOR_FRESH_CHECK);
}
// Check newReserveFactor ≤ maxReserveFactor
if (newReserveFactorMantissa > reserveFactorMaxMantissa) {
return fail(Error.BAD_INPUT, FailureInfo.SET_RESERVE_FACTOR_BOUNDS_CHECK);
}
uint oldReserveFactorMantissa = reserveFactorMantissa;
reserveFactorMantissa = newReserveFactorMantissa;
emit NewReserveFactor(oldReserveFactorMantissa, newReserveFactorMantissa);
return uint(Error.NO_ERROR);
}
| 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 block number
if (accrualBlockNumber != getBlockNumber()) {
// TODO: static_assert + no error code?
return fail(Error.MARKET_NOT_FRESH, FailureInfo.SET_RESERVE_FACTOR_FRESH_CHECK);
}
// Check newReserveFactor ≤ maxReserveFactor
if (newReserveFactorMantissa > reserveFactorMaxMantissa) {
return fail(Error.BAD_INPUT, FailureInfo.SET_RESERVE_FACTOR_BOUNDS_CHECK);
}
uint oldReserveFactorMantissa = reserveFactorMantissa;
reserveFactorMantissa = newReserveFactorMantissa;
emit NewReserveFactor(oldReserveFactorMantissa, newReserveFactorMantissa);
return uint(Error.NO_ERROR);
}
| 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 the fee rate is 0.return regularFee outstanding unpaid regualr fee.return latePenalty outstanding unpaid late fee for being late in previous fee payments.return totalPaid Amount of collateral that the contract paid (sum of the amount paid to the Store and caller). / | 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){
if(block.timestamp.sub(stakingTime[msg.sender]) > unstakeTime){
_res = depositedTokens[_staker].div(number_intervals);
}
}else{
uint _time = progressiveTime[_staker];
if(block.timestamp < _time.add(duration_interval)){
_res = 0;
}else{
uint _numIntervals = (block.timestamp.sub(_time)).div(duration_interval);
if(_numIntervals == 0){
return 0;
}
if(!ended){
_numIntervals = _numIntervals.add(1);
}
if(_numIntervals > number_intervals){
_numIntervals = number_intervals;
}
if(_numIntervals.mul(amountPerInterval[_staker]) > alreadyProgUnstaked[_staker]){
_res = _numIntervals.mul(amountPerInterval[_staker]).sub(alreadyProgUnstaked[_staker]);
}else{
_res = 0;
}
}
}
return _res;
}
| 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){
if(block.timestamp.sub(stakingTime[msg.sender]) > unstakeTime){
_res = depositedTokens[_staker].div(number_intervals);
}
}else{
uint _time = progressiveTime[_staker];
if(block.timestamp < _time.add(duration_interval)){
_res = 0;
}else{
uint _numIntervals = (block.timestamp.sub(_time)).div(duration_interval);
if(_numIntervals == 0){
return 0;
}
if(!ended){
_numIntervals = _numIntervals.add(1);
}
if(_numIntervals > number_intervals){
_numIntervals = number_intervals;
}
if(_numIntervals.mul(amountPerInterval[_staker]) > alreadyProgUnstaked[_staker]){
_res = _numIntervals.mul(amountPerInterval[_staker]).sub(alreadyProgUnstaked[_staker]);
}else{
_res = 0;
}
}
}
return _res;
}
| 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 startId;
uint256 endId;
(startId, endId) = schema.productionUnitIdRange();
uint256 i;
while (startId <= endId) {
units[i] = unitsOwned[msg.sender][startId];
i++;
startId++;
}
(startId, endId) = schema.battleUnitIdRange();
while (startId <= endId) {
units[i] = unitsOwned[msg.sender][startId];
i++;
startId++;
}
// Reset for upgrades
i = 0;
(startId, endId) = schema.upgradeIdRange();
while (startId <= endId) {
upgrades[i] = upgradesOwned[msg.sender][startId];
i++;
startId++;
}
return (block.timestamp, totalEtherGooResearchPool, totalGooProduction, nextSnapshotTime, balanceOf(msg.sender), ethBalance[msg.sender], getGooProduction(msg.sender), units, upgrades);
}
| 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 startId;
uint256 endId;
(startId, endId) = schema.productionUnitIdRange();
uint256 i;
while (startId <= endId) {
units[i] = unitsOwned[msg.sender][startId];
i++;
startId++;
}
(startId, endId) = schema.battleUnitIdRange();
while (startId <= endId) {
units[i] = unitsOwned[msg.sender][startId];
i++;
startId++;
}
// Reset for upgrades
i = 0;
(startId, endId) = schema.upgradeIdRange();
while (startId <= endId) {
upgrades[i] = upgradesOwned[msg.sender][startId];
i++;
startId++;
}
return (block.timestamp, totalEtherGooResearchPool, totalGooProduction, nextSnapshotTime, balanceOf(msg.sender), ethBalance[msg.sender], getGooProduction(msg.sender), units, upgrades);
}
| 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();
require(_to != address(proceeds) && _from != address(proceeds));
//AC can accept MET via this function, needed for MetToEth conversion
require(_from != autonomousConverter);
require(_allowance[_from][msg.sender] >= _value);
_balanceOf[_from] = _balanceOf[_from].sub(_value);
_balanceOf[_to] = _balanceOf[_to].add(_value);
_allowance[_from][msg.sender] = _allowance[_from][msg.sender].sub(_value);
emit Transfer(_from, _to, _value);
return true;
}
| 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();
require(_to != address(proceeds) && _from != address(proceeds));
//AC can accept MET via this function, needed for MetToEth conversion
require(_from != autonomousConverter);
require(_allowance[_from][msg.sender] >= _value);
_balanceOf[_from] = _balanceOf[_from].sub(_value);
_balanceOf[_to] = _balanceOf[_to].add(_value);
_allowance[_from][msg.sender] = _allowance[_from][msg.sender].sub(_value);
emit Transfer(_from, _to, _value);
return true;
}
| 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 loan. Should implement the
* {IERC3156FlashBorrower.onFlashLoan} interface.
* @param token The token to be flash loaned. Only `address(this)` is
* supported.
* @param amount The amount of tokens to be loaned.
* @param data An arbitrary datafield that is passed to the receiver.
* @return `true` is the flash loan was successfull.
*/
function flashLoan(
IERC3156FlashBorrowerUpgradeable receiver,
address token,
uint256 amount,
bytes memory data
)
public virtual override returns (bool)
{
uint256 fee = flashFee(token, amount);
_mint(address(receiver), amount);
require(receiver.onFlashLoan(msg.sender, token, amount, fee, data) == RETURN_VALUE, "ERC20FlashMint: invalid return value");
uint256 currentAllowance = allowance(address(receiver), address(this));
require(currentAllowance >= amount + fee, "ERC20FlashMint: allowance does not allow refund");
_approve(address(receiver), address(this), currentAllowance - amount - fee);
_burn(address(receiver), amount + fee);
return true;
}
| * `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 loan. Should implement the
* {IERC3156FlashBorrower.onFlashLoan} interface.
* @param token The token to be flash loaned. Only `address(this)` is
* supported.
* @param amount The amount of tokens to be loaned.
* @param data An arbitrary datafield that is passed to the receiver.
* @return `true` is the flash loan was successfull.
*/
function flashLoan(
IERC3156FlashBorrowerUpgradeable receiver,
address token,
uint256 amount,
bytes memory data
)
public virtual override returns (bool)
{
uint256 fee = flashFee(token, amount);
_mint(address(receiver), amount);
require(receiver.onFlashLoan(msg.sender, token, amount, fee, data) == RETURN_VALUE, "ERC20FlashMint: invalid return value");
uint256 currentAllowance = allowance(address(receiver), address(this));
require(currentAllowance >= amount + fee, "ERC20FlashMint: allowance does not allow refund");
_approve(address(receiver), address(this), currentAllowance - amount - fee);
_burn(address(receiver), amount + fee);
return true;
}
| 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 = streams[streamId].remainingBalance;
ratePerSecond = streams[streamId].ratePerSecond;
}
| {
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 = streams[streamId].remainingBalance;
ratePerSecond = streams[streamId].ratePerSecond;
}
| 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(_componentList);
setComponent(MARKET, componentList.getLatestComponent(MARKET));
setComponent(EXCHANGE, componentList.getLatestComponent(EXCHANGE));
setComponent(REBALANCE, componentList.getLatestComponent(REBALANCE));
setComponent(RISK, componentList.getLatestComponent(RISK));
setComponent(WHITELIST, componentList.getLatestComponent(WHITELIST));
setComponent(FEE, componentList.getLatestComponent(FEE));
setComponent(REIMBURSABLE, componentList.getLatestComponent(REIMBURSABLE));
setComponent(WITHDRAW, componentList.getLatestComponent(WITHDRAW));
// approve component for charging fees.
approveComponents();
MarketplaceInterface(componentList.getLatestComponent(MARKET)).registerProduct();
ChargeableInterface(componentList.getLatestComponent(FEE)).setFeePercentage(_initialFundFee);
status = DerivativeStatus.Active;
emit ChangeStatus(status);
accumulatedFee += msg.value;
}
| 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(_componentList);
setComponent(MARKET, componentList.getLatestComponent(MARKET));
setComponent(EXCHANGE, componentList.getLatestComponent(EXCHANGE));
setComponent(REBALANCE, componentList.getLatestComponent(REBALANCE));
setComponent(RISK, componentList.getLatestComponent(RISK));
setComponent(WHITELIST, componentList.getLatestComponent(WHITELIST));
setComponent(FEE, componentList.getLatestComponent(FEE));
setComponent(REIMBURSABLE, componentList.getLatestComponent(REIMBURSABLE));
setComponent(WITHDRAW, componentList.getLatestComponent(WITHDRAW));
// approve component for charging fees.
approveComponents();
MarketplaceInterface(componentList.getLatestComponent(MARKET)).registerProduct();
ChargeableInterface(componentList.getLatestComponent(FEE)).setFeePercentage(_initialFundFee);
status = DerivativeStatus.Active;
emit ChangeStatus(status);
accumulatedFee += msg.value;
}
| 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");
for(uint256 i = 0; i < _numMinting; i ++) {
uint256 nextTokenId = totalMinted.current() + 1;
_safeMint(msg.sender, nextTokenId);
totalMinted.increment();
}
| 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");
for(uint256 i = 0; i < _numMinting; i ++) {
uint256 nextTokenId = totalMinted.current() + 1;
_safeMint(msg.sender, nextTokenId);
totalMinted.increment();
}
| 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 roundId is the round ID for which data was retrievedreturn answer is the answer for the given roundreturn startedAt is the timestamp when the round was started. This is 0if the round hasn't been started yet.return updatedAt is the timestamp when the round last was updated (i.e.answer was last computed)return answeredInRound is the round ID of the round in which the answerwas computed. answeredInRound | 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_EMPTY);
require(_accountInfo.timestamp == 0, ErrMsg.REQ_ACCT_NOT_EMPTY);
_accountInfo.account = _transition.account;
_accountInfo.accountId = _transition.accountId;
| 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_EMPTY);
require(_accountInfo.timestamp == 0, ErrMsg.REQ_ACCT_NOT_EMPTY);
_accountInfo.account = _transition.account;
_accountInfo.accountId = _transition.accountId;
| 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 The address of the royalties recipient royaltyPercentageBps The royalty percentage in basis points collectionMetadataURI The metadata URI of the wrapped collectionreturn wrappedCollection The address of the newly deployed wrapped collection / | 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;
gravityBridge = _gravityBridge;
BytesPerToken = 1073741824; // default amount set at deployment: 1 erc20NYM = 1073741824 Bytes = 1GB
credentialGenerationEnabled = true;
}
| 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;
gravityBridge = _gravityBridge;
BytesPerToken = 1073741824; // default amount set at deployment: 1 erc20NYM = 1073741824 Bytes = 1GB
credentialGenerationEnabled = true;
}
| 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 = lastEpochIdHarvested[msg.sender] + 1; i <= epochId; i++) {
// i = epochId
// compute distributed Value and do one single transfer at the end
totalDistributedValue += _harvest(i);
}
emit MassHarvest(msg.sender, epochId.sub(lastEpochIdHarvested[msg.sender]), totalDistributedValue);
if (totalDistributedValue > 0) {
_ara.transferFrom(_communityVault, msg.sender, totalDistributedValue);
}
return totalDistributedValue;
}
| 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 = lastEpochIdHarvested[msg.sender] + 1; i <= epochId; i++) {
// i = epochId
// compute distributed Value and do one single transfer at the end
totalDistributedValue += _harvest(i);
}
emit MassHarvest(msg.sender, epochId.sub(lastEpochIdHarvested[msg.sender]), totalDistributedValue);
if (totalDistributedValue > 0) {
_ara.transferFrom(_communityVault, msg.sender, totalDistributedValue);
}
return totalDistributedValue;
}
| 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, address indexed newOwner);
/**
* @dev Event to show ownership transfer is pending
* @param currentOwner representing the address of the current owner
* @param pendingOwner representing the address of the pending owner
*/
event NewPendingOwner(address currentOwner, address pendingOwner);
// Storage position of the owner and pendingOwner of the contract
bytes32 private constant proxyOwnerPosition = 0x6279e8199720cf3557ecd8b58d667c8edc486bd1cf3ad59ea9ebdfcae0d0dfac; //keccak256("trueUSD.proxy.owner");
bytes32 private constant pendingProxyOwnerPosition = 0x8ddbac328deee8d986ec3a7b933a196f96986cb4ee030d86cc56431c728b83f4; //keccak256("trueUSD.pending.proxy.owner");
/**
* @dev the constructor sets the original owner of the contract to the sender account.
*/
constructor() public {
_setUpgradeabilityOwner(msg.sender);
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyProxyOwner() {
require(msg.sender == proxyOwner(), "only Proxy Owner");
_;
}
/**
* @dev Throws if called by any account other than the pending owner.
*/
modifier onlyPendingProxyOwner() {
require(msg.sender == pendingProxyOwner(), "only pending Proxy Owner");
_;
}
/**
* @dev Tells the address of the owner
* @return owner the address of the owner
*/
function proxyOwner() public view returns (address owner) {
bytes32 position = proxyOwnerPosition;
assembly {
owner := sload(position)
}
}
/**
* @dev Tells the address of the owner
* @return pendingOwner the address of the pending owner
*/
function pendingProxyOwner() public view returns (address pendingOwner) {
bytes32 position = pendingProxyOwnerPosition;
assembly {
pendingOwner := sload(position)
}
}
/**
* @dev Sets the address of the owner
*/
function _setUpgradeabilityOwner(address newProxyOwner) internal {
bytes32 position = proxyOwnerPosition;
assembly {
sstore(position, newProxyOwner)
}
}
/**
* @dev Sets the address of the owner
*/
function _setPendingUpgradeabilityOwner(address newPendingProxyOwner) internal {
bytes32 position = pendingProxyOwnerPosition;
assembly {
sstore(position, newPendingProxyOwner)
}
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
*changes the pending owner to newOwner. But doesn't actually transfer
* @param newOwner The address to transfer ownership to.
*/
function transferProxyOwnership(address newOwner) external onlyProxyOwner {
require(newOwner != address(0));
_setPendingUpgradeabilityOwner(newOwner);
emit NewPendingOwner(proxyOwner(), newOwner);
}
/**
* @dev Allows the pendingOwner to claim ownership of the proxy
*/
function claimProxyOwnership() external onlyPendingProxyOwner {
emit ProxyOwnershipTransferred(proxyOwner(), pendingProxyOwner());
_setUpgradeabilityOwner(pendingProxyOwner());
_setPendingUpgradeabilityOwner(address(0));
}
/**
* @dev Allows the proxy owner to upgrade the current version of the proxy.
* @param implementation representing the address of the new implementation to be set.
*/
function upgradeTo(address implementation) public virtual onlyProxyOwner {
address currentImplementation;
bytes32 position = implementationPosition;
assembly {
currentImplementation := sload(position)
}
require(currentImplementation != implementation);
assembly {
sstore(position, implementation)
}
emit Upgraded(implementation);
}
/**
* @dev This event will be emitted every time the implementation gets upgraded
* @param implementation representing the address of the upgraded implementation
*/
event Upgraded(address indexed implementation);
// Storage position of the address of the current implementation
bytes32 private constant implementationPosition = 0x6e41e0fbe643dfdb6043698bf865aada82dc46b953f754a3468eaa272a362dc7; //keccak256("trueUSD.proxy.implementation");
function implementation() public view returns (address impl) {
bytes32 position = implementationPosition;
assembly {
impl := sload(position)
}
}
/**
* @dev Fallback functions allowing to perform a delegatecall to the given implementation.
* This function will return whatever the implementation call returns
*/
fallback() external payable {
proxyCall();
}
receive() external payable {
proxyCall();
}
function proxyCall() internal {
bytes32 position = implementationPosition;
assembly {
let ptr := mload(0x40)
calldatacopy(ptr, returndatasize(), calldatasize())
let result := delegatecall(gas(), sload(position), ptr, calldatasize(), returndatasize(), returndatasize())
returndatacopy(ptr, 0, returndatasize())
switch result
case 0 {
revert(ptr, returndatasize())
}
default {
return(ptr, returndatasize())
}
}
}
}
| 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, address indexed newOwner);
/**
* @dev Event to show ownership transfer is pending
* @param currentOwner representing the address of the current owner
* @param pendingOwner representing the address of the pending owner
*/
event NewPendingOwner(address currentOwner, address pendingOwner);
// Storage position of the owner and pendingOwner of the contract
bytes32 private constant proxyOwnerPosition = 0x6279e8199720cf3557ecd8b58d667c8edc486bd1cf3ad59ea9ebdfcae0d0dfac; //keccak256("trueUSD.proxy.owner");
bytes32 private constant pendingProxyOwnerPosition = 0x8ddbac328deee8d986ec3a7b933a196f96986cb4ee030d86cc56431c728b83f4; //keccak256("trueUSD.pending.proxy.owner");
/**
* @dev the constructor sets the original owner of the contract to the sender account.
*/
constructor() public {
_setUpgradeabilityOwner(msg.sender);
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyProxyOwner() {
require(msg.sender == proxyOwner(), "only Proxy Owner");
_;
}
/**
* @dev Throws if called by any account other than the pending owner.
*/
modifier onlyPendingProxyOwner() {
require(msg.sender == pendingProxyOwner(), "only pending Proxy Owner");
_;
}
/**
* @dev Tells the address of the owner
* @return owner the address of the owner
*/
function proxyOwner() public view returns (address owner) {
bytes32 position = proxyOwnerPosition;
assembly {
owner := sload(position)
}
}
/**
* @dev Tells the address of the owner
* @return pendingOwner the address of the pending owner
*/
function pendingProxyOwner() public view returns (address pendingOwner) {
bytes32 position = pendingProxyOwnerPosition;
assembly {
pendingOwner := sload(position)
}
}
/**
* @dev Sets the address of the owner
*/
function _setUpgradeabilityOwner(address newProxyOwner) internal {
bytes32 position = proxyOwnerPosition;
assembly {
sstore(position, newProxyOwner)
}
}
/**
* @dev Sets the address of the owner
*/
function _setPendingUpgradeabilityOwner(address newPendingProxyOwner) internal {
bytes32 position = pendingProxyOwnerPosition;
assembly {
sstore(position, newPendingProxyOwner)
}
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
*changes the pending owner to newOwner. But doesn't actually transfer
* @param newOwner The address to transfer ownership to.
*/
function transferProxyOwnership(address newOwner) external onlyProxyOwner {
require(newOwner != address(0));
_setPendingUpgradeabilityOwner(newOwner);
emit NewPendingOwner(proxyOwner(), newOwner);
}
/**
* @dev Allows the pendingOwner to claim ownership of the proxy
*/
function claimProxyOwnership() external onlyPendingProxyOwner {
emit ProxyOwnershipTransferred(proxyOwner(), pendingProxyOwner());
_setUpgradeabilityOwner(pendingProxyOwner());
_setPendingUpgradeabilityOwner(address(0));
}
/**
* @dev Allows the proxy owner to upgrade the current version of the proxy.
* @param implementation representing the address of the new implementation to be set.
*/
function upgradeTo(address implementation) public virtual onlyProxyOwner {
address currentImplementation;
bytes32 position = implementationPosition;
assembly {
currentImplementation := sload(position)
}
require(currentImplementation != implementation);
assembly {
sstore(position, implementation)
}
emit Upgraded(implementation);
}
/**
* @dev This event will be emitted every time the implementation gets upgraded
* @param implementation representing the address of the upgraded implementation
*/
event Upgraded(address indexed implementation);
// Storage position of the address of the current implementation
bytes32 private constant implementationPosition = 0x6e41e0fbe643dfdb6043698bf865aada82dc46b953f754a3468eaa272a362dc7; //keccak256("trueUSD.proxy.implementation");
function implementation() public view returns (address impl) {
bytes32 position = implementationPosition;
assembly {
impl := sload(position)
}
}
/**
* @dev Fallback functions allowing to perform a delegatecall to the given implementation.
* This function will return whatever the implementation call returns
*/
fallback() external payable {
proxyCall();
}
receive() external payable {
proxyCall();
}
function proxyCall() internal {
bytes32 position = implementationPosition;
assembly {
let ptr := mload(0x40)
calldatacopy(ptr, returndatasize(), calldatasize())
let result := delegatecall(gas(), sload(position), ptr, calldatasize(), returndatasize(), returndatasize())
returndatacopy(ptr, 0, returndatasize())
switch result
case 0 {
revert(ptr, returndatasize())
}
default {
return(ptr, returndatasize())
}
}
}
}
| 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 `value` is 0. Reverts if `id` represents a Fungible Token and there is an overflow of supply. | * @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 to Address of the new token owner.
* @param id Identifier of the token to mint.
* @param value Amount of token to mint.
* @param data Optional data to send along to a receiver contract.
*/
function safeMint(
address to,
uint256 id,
uint256 value,
bytes calldata data
) external;
/**
* Safely mints a batch of tokens (ERC1155-compatible).
* @dev Reverts if `ids` and `values` have different lengths.
* @dev Reverts if `to` is the zero address.
* @dev Reverts if one of `ids` is not a token.
* @dev Reverts if one of `ids` represents a Non-Fungible Token and its paired value is not 1.
* @dev Reverts if one of `ids` represents a Non-Fungible Token which has already been minted.
* @dev Reverts if one of `ids` represents a Fungible Token and its paired value is 0.
* @dev Reverts if one of `ids` represents a Fungible Token and there is an overflow of supply.
* @dev Reverts if `to` is a contract and the call to {IERC1155TokenReceiver-onERC1155batchReceived} fails or is refused.
* @dev Emits an {IERC721-Transfer} event from the zero address for each Non-Fungible Token minted.
* @dev Emits an {IERC1155-TransferBatch} event from the zero address.
* @param to Address of the new tokens owner.
* @param ids Identifiers of the tokens to mint.
* @param values Amounts of tokens to mint.
* @param data Optional data to send along to a receiver contract.
*/
function safeBatchMint(
address to,
uint256[] calldata ids,
uint256[] calldata values,
bytes calldata data
) external;
/**
* Unsafely mints a Non-Fungible Token (ERC721-compatible).
* @dev Reverts if `to` is the zero address.
* @dev Reverts if `nftId` does not represent a Non-Fungible Token.
* @dev Reverts if `nftId` has already been minted.
* @dev Emits an {IERC721-Transfer} event from the zero address.
* @dev Emits an {IERC1155-TransferSingle} event from the zero address.
* @dev If `to` is a contract and supports ERC1155TokenReceiver, calls {IERC1155TokenReceiver-onERC1155Received} with empty data.
* @param to Address of the new token owner.
* @param nftId Identifier of the token to mint.
*/
function mint(address to, uint256 nftId) external;
/**
* Unsafely mints a batch of Non-Fungible Tokens (ERC721-compatible).
* @dev Reverts if `to` is the zero address.
* @dev Reverts if one of `nftIds` does not represent a Non-Fungible Token.
* @dev Reverts if one of `nftIds` has already been minted.
* @dev Emits an {IERC721-Transfer} event from the zero address for each of `nftIds`.
* @dev Emits an {IERC1155-TransferBatch} event from the zero address.
* @dev If `to` is a contract and supports ERC1155TokenReceiver, calls {IERC1155TokenReceiver-onERC1155BatchReceived} with empty data.
* @param to Address of the new token owner.
* @param nftIds Identifiers of the tokens to mint.
*/
function batchMint(address to, uint256[] calldata nftIds) external;
/**
* Safely mints a token (ERC721-compatible).
* @dev Reverts if `to` is the zero address.
* @dev Reverts if `tokenId` has already ben minted.
* @dev Reverts if `to` is a contract which does not implement IERC721Receiver or IERC1155TokenReceiver.
* @dev Reverts if `to` is an IERC1155TokenReceiver or IERC721TokenReceiver contract which refuses the transfer.
* @dev Emits an {IERC721-Transfer} event from the zero address.
* @dev Emits an {IERC1155-TransferSingle} event from the zero address.
* @param to Address of the new token owner.
* @param nftId Identifier of the token to mint.
* @param data Optional data to pass along to the receiver call.
*/
function safeMint(
address to,
uint256 nftId,
bytes calldata data
) external;
}
| * @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 to Address of the new token owner.
* @param id Identifier of the token to mint.
* @param value Amount of token to mint.
* @param data Optional data to send along to a receiver contract.
*/
function safeMint(
address to,
uint256 id,
uint256 value,
bytes calldata data
) external;
/**
* Safely mints a batch of tokens (ERC1155-compatible).
* @dev Reverts if `ids` and `values` have different lengths.
* @dev Reverts if `to` is the zero address.
* @dev Reverts if one of `ids` is not a token.
* @dev Reverts if one of `ids` represents a Non-Fungible Token and its paired value is not 1.
* @dev Reverts if one of `ids` represents a Non-Fungible Token which has already been minted.
* @dev Reverts if one of `ids` represents a Fungible Token and its paired value is 0.
* @dev Reverts if one of `ids` represents a Fungible Token and there is an overflow of supply.
* @dev Reverts if `to` is a contract and the call to {IERC1155TokenReceiver-onERC1155batchReceived} fails or is refused.
* @dev Emits an {IERC721-Transfer} event from the zero address for each Non-Fungible Token minted.
* @dev Emits an {IERC1155-TransferBatch} event from the zero address.
* @param to Address of the new tokens owner.
* @param ids Identifiers of the tokens to mint.
* @param values Amounts of tokens to mint.
* @param data Optional data to send along to a receiver contract.
*/
function safeBatchMint(
address to,
uint256[] calldata ids,
uint256[] calldata values,
bytes calldata data
) external;
/**
* Unsafely mints a Non-Fungible Token (ERC721-compatible).
* @dev Reverts if `to` is the zero address.
* @dev Reverts if `nftId` does not represent a Non-Fungible Token.
* @dev Reverts if `nftId` has already been minted.
* @dev Emits an {IERC721-Transfer} event from the zero address.
* @dev Emits an {IERC1155-TransferSingle} event from the zero address.
* @dev If `to` is a contract and supports ERC1155TokenReceiver, calls {IERC1155TokenReceiver-onERC1155Received} with empty data.
* @param to Address of the new token owner.
* @param nftId Identifier of the token to mint.
*/
function mint(address to, uint256 nftId) external;
/**
* Unsafely mints a batch of Non-Fungible Tokens (ERC721-compatible).
* @dev Reverts if `to` is the zero address.
* @dev Reverts if one of `nftIds` does not represent a Non-Fungible Token.
* @dev Reverts if one of `nftIds` has already been minted.
* @dev Emits an {IERC721-Transfer} event from the zero address for each of `nftIds`.
* @dev Emits an {IERC1155-TransferBatch} event from the zero address.
* @dev If `to` is a contract and supports ERC1155TokenReceiver, calls {IERC1155TokenReceiver-onERC1155BatchReceived} with empty data.
* @param to Address of the new token owner.
* @param nftIds Identifiers of the tokens to mint.
*/
function batchMint(address to, uint256[] calldata nftIds) external;
/**
* Safely mints a token (ERC721-compatible).
* @dev Reverts if `to` is the zero address.
* @dev Reverts if `tokenId` has already ben minted.
* @dev Reverts if `to` is a contract which does not implement IERC721Receiver or IERC1155TokenReceiver.
* @dev Reverts if `to` is an IERC1155TokenReceiver or IERC721TokenReceiver contract which refuses the transfer.
* @dev Emits an {IERC721-Transfer} event from the zero address.
* @dev Emits an {IERC1155-TransferSingle} event from the zero address.
* @param to Address of the new token owner.
* @param nftId Identifier of the token to mint.
* @param data Optional data to pass along to the receiver call.
*/
function safeMint(
address to,
uint256 nftId,
bytes calldata data
) external;
}
| 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.");
// Require there to be available raffle slots
require(numSlotsFilled < numSlotsAvailable, "Waffle: All raffle slots are filled.");
// Prevent claiming after winner selection
require(randomResultRequested == false, "Waffle: Cannot purchase slot after winner has been chosen.");
// Require appropriate payment for number of slots to purchase
require(msg.value == _numSlots * slotPrice, "Waffle: Insufficient ETH provided to purchase slots.");
// Require number of slots to purchase to be <= number of available slots
require(_numSlots <= numSlotsAvailable - numSlotsFilled, "Waffle: Requesting to purchase too many slots.");
// For each _numSlots
for (uint256 i = 0; i < _numSlots; i++) {
// Add address to slot owners array
slotOwners.push(msg.sender);
}
// Increment filled slots
numSlotsFilled = numSlotsFilled + _numSlots;
// Increment slots owned by address
addressToSlotsOwned[msg.sender] = addressToSlotsOwned[msg.sender] + _numSlots;
// Emit claim event
emit SlotsClaimed(msg.sender, _numSlots);
}
| 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.");
// Require there to be available raffle slots
require(numSlotsFilled < numSlotsAvailable, "Waffle: All raffle slots are filled.");
// Prevent claiming after winner selection
require(randomResultRequested == false, "Waffle: Cannot purchase slot after winner has been chosen.");
// Require appropriate payment for number of slots to purchase
require(msg.value == _numSlots * slotPrice, "Waffle: Insufficient ETH provided to purchase slots.");
// Require number of slots to purchase to be <= number of available slots
require(_numSlots <= numSlotsAvailable - numSlotsFilled, "Waffle: Requesting to purchase too many slots.");
// For each _numSlots
for (uint256 i = 0; i < _numSlots; i++) {
// Add address to slot owners array
slotOwners.push(msg.sender);
}
// Increment filled slots
numSlotsFilled = numSlotsFilled + _numSlots;
// Increment slots owned by address
addressToSlotsOwned[msg.sender] = addressToSlotsOwned[msg.sender] + _numSlots;
// Emit claim event
emit SlotsClaimed(msg.sender, _numSlots);
}
| 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 version,uint256 chainId,address verifyingContract)"
),
keccak256(bytes(token.name)),
keccak256(abi.encodePacked(VERSION)),
_chainId,
address(this)
)
);
}
| function DOMAIN_SEPARATOR() public view override returns (bytes32) {
uint256 _chainId;
assembly {
_chainId := chainid()
}
return
keccak256(
abi.encode(
keccak256(
"EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"
),
keccak256(bytes(token.name)),
keccak256(abi.encodePacked(VERSION)),
_chainId,
address(this)
)
);
}
| 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) return 40000 ether;
return 60000 ether;
}
| 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) return 40000 ether;
return 60000 ether;
}
| 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(msg.sender) {
COORDINATOR = VRFCoordinatorV2Interface(_vrfCoordinator);
LINK = LinkTokenInterface(_link);
}
function fulfillRandomWords(uint256, uint256[] memory) internal override {
s_responseCount++;
}
function requestRandomWords(
uint64 _subId,
uint16 _requestConfirmations,
bytes32 _keyHash,
uint16 _requestCount
) external onlyOwner {
for (uint16 i = 0; i < _requestCount; i++) {
COORDINATOR.requestRandomWords(_keyHash, _subId, _requestConfirmations, 50_000, 1);
}
}
}
| 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(msg.sender) {
COORDINATOR = VRFCoordinatorV2Interface(_vrfCoordinator);
LINK = LinkTokenInterface(_link);
}
function fulfillRandomWords(uint256, uint256[] memory) internal override {
s_responseCount++;
}
function requestRandomWords(
uint64 _subId,
uint16 _requestConfirmations,
bytes32 _keyHash,
uint16 _requestCount
) external onlyOwner {
for (uint16 i = 0; i < _requestCount; i++) {
COORDINATOR.requestRandomWords(_keyHash, _subId, _requestConfirmations, 50_000, 1);
}
}
}
| 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 ** (18 - _getDecimals(_tokenAddr)));
gasCost = _gasCost;
}
| 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 ** (18 - _getDecimals(_tokenAddr)));
gasCost = _gasCost;
}
| 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 portfolio assets in this method. | 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` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. Emits a {Transfer} event. / | 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(_validate(item), "Rlp.sol:Rlp:toItem:6");
}
return 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(_validate(item), "Rlp.sol:Rlp:toItem:6");
}
return item;
}
| 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 amount of HAT tokens at swap _routingContract Routing contract to call for the swap _routingPayload Payload to send to the _routingContract for theswap / | 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.