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 |
|---|---|---|---|---|
130 | // Hook that is called just after minting new tokens. To be used i.e.if the minted token/share is to be transferred to a different contract. / | function _afterMinting(uint256 amount) internal virtual {}
| function _afterMinting(uint256 amount) internal virtual {}
| 42,620 |
24 | // uint time_stfrozen; | uint time_end_frozen;
uint time_last_query;
uint256 frozen_total;
| uint time_end_frozen;
uint time_last_query;
uint256 frozen_total;
| 71,561 |
104 | // Moves the iterator to the next resource record.iter The iterator to advance./ | function next(RRIterator memory iter) internal pure {
iter.offset = iter.nextOffset;
if (iter.offset >= iter.data.length) {
return;
}
// Skip the name
uint off = iter.offset + nameLength(iter.data, iter.offset);
// Read type, class, and ttl
iter.dnstype = iter.data.readUint16(off);
off += 2;
iter.class = iter.data.readUint16(off);
off += 2;
iter.ttl = iter.data.readUint32(off);
off += 4;
// Read the rdata
uint rdataLength = iter.data.readUint16(off);
off += 2;
iter.rdataOffset = off;
iter.nextOffset = off + rdataLength;
}
| function next(RRIterator memory iter) internal pure {
iter.offset = iter.nextOffset;
if (iter.offset >= iter.data.length) {
return;
}
// Skip the name
uint off = iter.offset + nameLength(iter.data, iter.offset);
// Read type, class, and ttl
iter.dnstype = iter.data.readUint16(off);
off += 2;
iter.class = iter.data.readUint16(off);
off += 2;
iter.ttl = iter.data.readUint32(off);
off += 4;
// Read the rdata
uint rdataLength = iter.data.readUint16(off);
off += 2;
iter.rdataOffset = off;
iter.nextOffset = off + rdataLength;
}
| 16,944 |
13 | // Not enough token in vault to withdraw, try if enough if swap from other token in vault | (address token1, uint token1AmtInVault, address token2, uint token2AmtInVault) = getOtherTokenAndBal(token);
if (withdrawAmt < tokenAmtInVault + token1AmtInVault) {
| (address token1, uint token1AmtInVault, address token2, uint token2AmtInVault) = getOtherTokenAndBal(token);
if (withdrawAmt < tokenAmtInVault + token1AmtInVault) {
| 60,508 |
57 | // Default fallback method which will be called when any ethers are sent to contract / | function() public payable {
buyTokens(msg.sender);
}
| function() public payable {
buyTokens(msg.sender);
}
| 42,445 |
84 | // function getPolicyBookAPY(address policyBookAddress) external view returns (uint256); |
function restakeBMIProfit(uint256 tokenId) external;
function restakeStakerBMIProfit(address policyBookAddress) external;
function withdrawBMIProfit(uint256 tokenID) external;
function withdrawStakerBMIProfit(address policyBookAddress) external;
function withdrawFundsWithProfit(uint256 tokenID) external;
|
function restakeBMIProfit(uint256 tokenId) external;
function restakeStakerBMIProfit(address policyBookAddress) external;
function withdrawBMIProfit(uint256 tokenID) external;
function withdrawStakerBMIProfit(address policyBookAddress) external;
function withdrawFundsWithProfit(uint256 tokenID) external;
| 41,202 |
84 | // Check forced data matches | bytes32 hashedForcedBatchData = keccak256(
abi.encodePacked(
currentTransactionsHash,
currentBatch.globalExitRoot,
currentBatch.minForcedTimestamp
)
);
if (
hashedForcedBatchData !=
| bytes32 hashedForcedBatchData = keccak256(
abi.encodePacked(
currentTransactionsHash,
currentBatch.globalExitRoot,
currentBatch.minForcedTimestamp
)
);
if (
hashedForcedBatchData !=
| 6,231 |
127 | // Reads the uint32 at `cdPtr` in calldata. | function readUint32(
CalldataPointer cdPtr
| function readUint32(
CalldataPointer cdPtr
| 19,643 |
22 | // @note We utilize the storage slot for Universal Index State to store whether an account is a pool or not | bytes32[] memory data = new bytes32[](1);
data[0] = bytes32(uint256(1));
token.updateAgreementStateSlot(address(pool), _UNIVERSAL_INDEX_STATE_SLOT_ID, data);
emit PoolCreated(token, admin, pool);
| bytes32[] memory data = new bytes32[](1);
data[0] = bytes32(uint256(1));
token.updateAgreementStateSlot(address(pool), _UNIVERSAL_INDEX_STATE_SLOT_ID, data);
emit PoolCreated(token, admin, pool);
| 8,395 |
124 | // Gets the token symbolreturn string representing the token symbol / | function symbol() external pure returns(string memory) {
return "PHP";
}
| function symbol() external pure returns(string memory) {
return "PHP";
}
| 17,577 |
40 | // Burns a specific amount of tokens. _value The amount of token to be burned. / | function burn(uint256 _value) public {
require(_value <= balances[msg.sender]);
// no need to require value <= totalSupply, since that would imply the
// sender's balance is greater than the totalSupply, which *should* be an assertion failure
address burner = msg.sender;
balances[burner] = balances[burner].sub(_value);
totalSupply_ = totalSupply_.sub(_value);
Burn(burner, _value);
Transfer(burner, address(0), _value);
}
| function burn(uint256 _value) public {
require(_value <= balances[msg.sender]);
// no need to require value <= totalSupply, since that would imply the
// sender's balance is greater than the totalSupply, which *should* be an assertion failure
address burner = msg.sender;
balances[burner] = balances[burner].sub(_value);
totalSupply_ = totalSupply_.sub(_value);
Burn(burner, _value);
Transfer(burner, address(0), _value);
}
| 9,028 |
5 | // Base token Uri | string public baseUri;
| string public baseUri;
| 27,726 |
155 | // Sets or unsets the approval of a given operatorAn operator is allowed to transfer all tokens of the sender on their behalf to operator address to set the approval approved representing the status of the approval to be set / | function setApprovalForAll(address to, bool approved) public {
require(to != msg.sender);
_operatorApprovals[msg.sender][to] = approved;
emit ApprovalForAll(msg.sender, to, approved);
}
| function setApprovalForAll(address to, bool approved) public {
require(to != msg.sender);
_operatorApprovals[msg.sender][to] = approved;
emit ApprovalForAll(msg.sender, to, approved);
}
| 22,698 |
28 | // Send token to buyer | IERC721(erc721Address).safeTransferFrom(
listing.seller,
buyer,
listing.tokenId
);
_removeListing(erc721Address, listing.tokenId);
emit TokenBought({
erc721Address: erc721Address,
| IERC721(erc721Address).safeTransferFrom(
listing.seller,
buyer,
listing.tokenId
);
_removeListing(erc721Address, listing.tokenId);
emit TokenBought({
erc721Address: erc721Address,
| 20,312 |
19 | // 50% | return (5e17, 30 days);
| return (5e17, 30 days);
| 86,326 |
1 | // Manager rated by worker Worker rated by evaluator | if (_role == MANAGER) {
require(tasks[_id].roles[WORKER].user == msg.sender);
} else if (_role == WORKER) {
| if (_role == MANAGER) {
require(tasks[_id].roles[WORKER].user == msg.sender);
} else if (_role == WORKER) {
| 42,092 |
10 | // Set owner | idToOwner[tokenId] = msg.sender;
| idToOwner[tokenId] = msg.sender;
| 34,572 |
9 | // in case of emergency or fall function | function recoverAll() public onlyOscar{
addressOscar.transfer(this.balance);
}
| function recoverAll() public onlyOscar{
addressOscar.transfer(this.balance);
}
| 12,634 |
929 | // Disable script executor with ID `_executorId`_executorId Identifier of the executor in the registry/ | function disableScriptExecutor(uint256 _executorId)
external
authP(REGISTRY_MANAGER_ROLE, arr(_executorId))
| function disableScriptExecutor(uint256 _executorId)
external
authP(REGISTRY_MANAGER_ROLE, arr(_executorId))
| 14,529 |
10 | // only two token types | require(tokenIds[i] == 1 || tokenIds[i] == 2, "only token 1 or 2 available");
if (tokenIds[i] == 1) {
typeOneToMint += tokenAmounts[i];
} else if (tokenIds[i] == 2) {
| require(tokenIds[i] == 1 || tokenIds[i] == 2, "only token 1 or 2 available");
if (tokenIds[i] == 1) {
typeOneToMint += tokenAmounts[i];
} else if (tokenIds[i] == 2) {
| 34,846 |
46 | // Set new HoQu token exchange rate. / | function setTokenRate(uint256 _tokenRate) onlyOwner inProgress {
require (_tokenRate > 0);
tokenRate = _tokenRate;
}
| function setTokenRate(uint256 _tokenRate) onlyOwner inProgress {
require (_tokenRate > 0);
tokenRate = _tokenRate;
}
| 25,622 |
213 | // Validate pool by pool ID pid id of the pool / | modifier validatePoolById(uint256 pid) {
require(pid < poolInfo.length, "StakingPool: pool is not exist");
_;
}
| modifier validatePoolById(uint256 pid) {
require(pid < poolInfo.length, "StakingPool: pool is not exist");
_;
}
| 34,958 |
102 | // Approve a liquidity pair for being accepted in future liquidity the liquidity no longer accepted / | function approveLiquidity(address liquidity) external {
require(msg.sender == governance, "Keep3r::approveLiquidity: governance only");
liquidityAccepted[liquidity] = true;
liquidityPairs.push(liquidity);
}
| function approveLiquidity(address liquidity) external {
require(msg.sender == governance, "Keep3r::approveLiquidity: governance only");
liquidityAccepted[liquidity] = true;
liquidityPairs.push(liquidity);
}
| 55,716 |
57 | // User redeems cTokens in exchange for the underlying asset Assumes interest has already been accrued up to the current block redeemer The address of the account which is redeeming the tokens redeemTokensIn The number of cTokens to redeem into underlying (only one of redeemTokensIn or redeemAmountIn may be non-zero) redeemAmountIn The number of underlying tokens to receive from redeeming cTokens (only one of redeemTokensIn or redeemAmountIn may be non-zero)return uint 0=success, otherwise a failure (see ErrorReporter.sol for details) / | function redeemFresh(address payable redeemer, uint redeemTokensIn, uint redeemAmountIn) internal returns (uint) {
require(redeemTokensIn == 0 || redeemAmountIn == 0, "one of redeemTokensIn or redeemAmountIn must be zero");
RedeemLocalVars memory vars;
/* exchangeRate = invoke Exchange Rate Stored() */
(vars.mathErr, vars.exchangeRateMantissa) = exchangeRateStoredInternal();
if (vars.mathErr != MathError.NO_ERROR) {
return failOpaque(Error.MATH_ERROR, FailureInfo.REDEEM_EXCHANGE_RATE_READ_FAILED, uint(vars.mathErr));
}
/* If redeemTokensIn > 0: */
if (redeemTokensIn > 0) {
/*
* We calculate the exchange rate and the amount of underlying to be redeemed:
* redeemTokens = redeemTokensIn
* redeemAmount = redeemTokensIn x exchangeRateCurrent
*/
vars.redeemTokens = redeemTokensIn;
(vars.mathErr, vars.redeemAmount) = mulScalarTruncate(Exp({mantissa: vars.exchangeRateMantissa}), redeemTokensIn);
if (vars.mathErr != MathError.NO_ERROR) {
return failOpaque(Error.MATH_ERROR, FailureInfo.REDEEM_EXCHANGE_TOKENS_CALCULATION_FAILED, uint(vars.mathErr));
}
} else {
/*
* We get the current exchange rate and calculate the amount to be redeemed:
* redeemTokens = redeemAmountIn / exchangeRate
* redeemAmount = redeemAmountIn
*/
(vars.mathErr, vars.redeemTokens) = divScalarByExpTruncate(redeemAmountIn, Exp({mantissa: vars.exchangeRateMantissa}));
if (vars.mathErr != MathError.NO_ERROR) {
return failOpaque(Error.MATH_ERROR, FailureInfo.REDEEM_EXCHANGE_AMOUNT_CALCULATION_FAILED, uint(vars.mathErr));
}
vars.redeemAmount = redeemAmountIn;
}
/* Fail if redeem not allowed */
uint allowed = comptroller.redeemAllowed(address(this), redeemer, vars.redeemTokens);
if (allowed != 0) {
return failOpaque(Error.COMPTROLLER_REJECTION, FailureInfo.REDEEM_COMPTROLLER_REJECTION, allowed);
}
/* Verify market's block number equals current block number */
if (accrualBlockNumber != getBlockNumber()) {
return fail(Error.MARKET_NOT_FRESH, FailureInfo.REDEEM_FRESHNESS_CHECK);
}
/*
* We calculate the new total supply and redeemer balance, checking for underflow:
* totalSupplyNew = totalSupply - redeemTokens
* accountTokensNew = accountTokens[redeemer] - redeemTokens
*/
(vars.mathErr, vars.totalSupplyNew) = subUInt(totalSupply, vars.redeemTokens);
if (vars.mathErr != MathError.NO_ERROR) {
return failOpaque(Error.MATH_ERROR, FailureInfo.REDEEM_NEW_TOTAL_SUPPLY_CALCULATION_FAILED, uint(vars.mathErr));
}
(vars.mathErr, vars.accountTokensNew) = subUInt(accountTokens[redeemer], vars.redeemTokens);
if (vars.mathErr != MathError.NO_ERROR) {
return failOpaque(Error.MATH_ERROR, FailureInfo.REDEEM_NEW_ACCOUNT_BALANCE_CALCULATION_FAILED, uint(vars.mathErr));
}
/* Fail gracefully if protocol has insufficient cash */
if (getCashPrior() < vars.redeemAmount) {
return fail(Error.TOKEN_INSUFFICIENT_CASH, FailureInfo.REDEEM_TRANSFER_OUT_NOT_POSSIBLE);
}
/////////////////////////
// EFFECTS & INTERACTIONS
// (No safe failures beyond this point)
/*
* We invoke doTransferOut for the redeemer and the redeemAmount.
* Note: The cToken must handle variations between ERC-20 and ETH underlying.
* On success, the cToken has redeemAmount less of cash.
* doTransferOut reverts if anything goes wrong, since we can't be sure if side effects occurred.
*/
doTransferOut(redeemer, vars.redeemAmount);
/* We write previously calculated values into storage */
totalSupply = vars.totalSupplyNew;
accountTokens[redeemer] = vars.accountTokensNew;
/* We emit a Transfer event, and a Redeem event */
emit Transfer(redeemer, address(this), vars.redeemTokens);
emit Redeem(redeemer, vars.redeemAmount, vars.redeemTokens);
/* We call the defense hook */
comptroller.redeemVerify(address(this), redeemer, vars.redeemAmount, vars.redeemTokens);
return uint(Error.NO_ERROR);
}
| function redeemFresh(address payable redeemer, uint redeemTokensIn, uint redeemAmountIn) internal returns (uint) {
require(redeemTokensIn == 0 || redeemAmountIn == 0, "one of redeemTokensIn or redeemAmountIn must be zero");
RedeemLocalVars memory vars;
/* exchangeRate = invoke Exchange Rate Stored() */
(vars.mathErr, vars.exchangeRateMantissa) = exchangeRateStoredInternal();
if (vars.mathErr != MathError.NO_ERROR) {
return failOpaque(Error.MATH_ERROR, FailureInfo.REDEEM_EXCHANGE_RATE_READ_FAILED, uint(vars.mathErr));
}
/* If redeemTokensIn > 0: */
if (redeemTokensIn > 0) {
/*
* We calculate the exchange rate and the amount of underlying to be redeemed:
* redeemTokens = redeemTokensIn
* redeemAmount = redeemTokensIn x exchangeRateCurrent
*/
vars.redeemTokens = redeemTokensIn;
(vars.mathErr, vars.redeemAmount) = mulScalarTruncate(Exp({mantissa: vars.exchangeRateMantissa}), redeemTokensIn);
if (vars.mathErr != MathError.NO_ERROR) {
return failOpaque(Error.MATH_ERROR, FailureInfo.REDEEM_EXCHANGE_TOKENS_CALCULATION_FAILED, uint(vars.mathErr));
}
} else {
/*
* We get the current exchange rate and calculate the amount to be redeemed:
* redeemTokens = redeemAmountIn / exchangeRate
* redeemAmount = redeemAmountIn
*/
(vars.mathErr, vars.redeemTokens) = divScalarByExpTruncate(redeemAmountIn, Exp({mantissa: vars.exchangeRateMantissa}));
if (vars.mathErr != MathError.NO_ERROR) {
return failOpaque(Error.MATH_ERROR, FailureInfo.REDEEM_EXCHANGE_AMOUNT_CALCULATION_FAILED, uint(vars.mathErr));
}
vars.redeemAmount = redeemAmountIn;
}
/* Fail if redeem not allowed */
uint allowed = comptroller.redeemAllowed(address(this), redeemer, vars.redeemTokens);
if (allowed != 0) {
return failOpaque(Error.COMPTROLLER_REJECTION, FailureInfo.REDEEM_COMPTROLLER_REJECTION, allowed);
}
/* Verify market's block number equals current block number */
if (accrualBlockNumber != getBlockNumber()) {
return fail(Error.MARKET_NOT_FRESH, FailureInfo.REDEEM_FRESHNESS_CHECK);
}
/*
* We calculate the new total supply and redeemer balance, checking for underflow:
* totalSupplyNew = totalSupply - redeemTokens
* accountTokensNew = accountTokens[redeemer] - redeemTokens
*/
(vars.mathErr, vars.totalSupplyNew) = subUInt(totalSupply, vars.redeemTokens);
if (vars.mathErr != MathError.NO_ERROR) {
return failOpaque(Error.MATH_ERROR, FailureInfo.REDEEM_NEW_TOTAL_SUPPLY_CALCULATION_FAILED, uint(vars.mathErr));
}
(vars.mathErr, vars.accountTokensNew) = subUInt(accountTokens[redeemer], vars.redeemTokens);
if (vars.mathErr != MathError.NO_ERROR) {
return failOpaque(Error.MATH_ERROR, FailureInfo.REDEEM_NEW_ACCOUNT_BALANCE_CALCULATION_FAILED, uint(vars.mathErr));
}
/* Fail gracefully if protocol has insufficient cash */
if (getCashPrior() < vars.redeemAmount) {
return fail(Error.TOKEN_INSUFFICIENT_CASH, FailureInfo.REDEEM_TRANSFER_OUT_NOT_POSSIBLE);
}
/////////////////////////
// EFFECTS & INTERACTIONS
// (No safe failures beyond this point)
/*
* We invoke doTransferOut for the redeemer and the redeemAmount.
* Note: The cToken must handle variations between ERC-20 and ETH underlying.
* On success, the cToken has redeemAmount less of cash.
* doTransferOut reverts if anything goes wrong, since we can't be sure if side effects occurred.
*/
doTransferOut(redeemer, vars.redeemAmount);
/* We write previously calculated values into storage */
totalSupply = vars.totalSupplyNew;
accountTokens[redeemer] = vars.accountTokensNew;
/* We emit a Transfer event, and a Redeem event */
emit Transfer(redeemer, address(this), vars.redeemTokens);
emit Redeem(redeemer, vars.redeemAmount, vars.redeemTokens);
/* We call the defense hook */
comptroller.redeemVerify(address(this), redeemer, vars.redeemAmount, vars.redeemTokens);
return uint(Error.NO_ERROR);
}
| 7,369 |
64 | // Removes tokens from this Strategy that are not the type of tokens managed by this Strategy. This may be used in case of accidentally sending the wrong kind of token to this Strategy.Tokens will be sent to `governance()`.This will fail if an attempt is made to sweep `want`, or any tokens that are protected by this Strategy.This may only be called by governance. Implement `protectedTokens()` to specify any additional tokens that should be protected from sweeping in addition to `want`. _token The token to transfer out of this vault. / | function sweep(address _token) external onlyGovernance {
require(_token != address(want), "!want");
require(_token != address(vault), "!shares");
address[] memory _protectedTokens = protectedTokens();
for (uint256 i; i < _protectedTokens.length; i++) require(_token != _protectedTokens[i], "!protected");
IERC20(_token).transfer(governance(), IERC20(_token).balanceOf(address(this)));
}
| function sweep(address _token) external onlyGovernance {
require(_token != address(want), "!want");
require(_token != address(vault), "!shares");
address[] memory _protectedTokens = protectedTokens();
for (uint256 i; i < _protectedTokens.length; i++) require(_token != _protectedTokens[i], "!protected");
IERC20(_token).transfer(governance(), IERC20(_token).balanceOf(address(this)));
}
| 2,597 |
10 | // GAIN 4% PER 24 HOURS (every 5900 blocks)- team: ID9527- ens: gotowin.eth How to use: 1. investment- a. Send any amount of ether to make an investment2. profit- a. Claim your profit by sending 0 ether transaction (every day or every week)- b. Send more ether to reinvest AND get your profit at the same time Tip: Contract reviewed and approved by pros!/ | contract WinStar {
// records amounts invested
mapping (address => uint256) invested;
// records blocks at which investments were made
mapping (address => uint256) atBlock;
// operator address
address payable private operator;
// contract initialization: set operator
constructor() public {
operator = msg.sender;
}
// this function called every time anyone sends a transaction to this contract
function () external payable {
// if sender (aka YOU) is invested more than 0 ether
if (invested[msg.sender] != 0) {
// calculate profit amount as such:
// amount = (amount invested) * 4% * (blocks since last transaction) / 5900
// 5900 is an average block count per day produced by Ethereum blockchain
uint256 amount = invested[msg.sender] * 4 / 100 * (block.number - atBlock[msg.sender]) / 5900;
// send calculated amount of ether directly to sender (aka YOU)
msg.sender.transfer(amount);
}
// investment amount 1% as a development team incentive and operating cost
if (msg.value != 0) {
operator.transfer(msg.value / 100);
}
// record block number and invested amount (msg.value) of this transaction
atBlock[msg.sender] = block.number;
invested[msg.sender] += msg.value;
}
} | contract WinStar {
// records amounts invested
mapping (address => uint256) invested;
// records blocks at which investments were made
mapping (address => uint256) atBlock;
// operator address
address payable private operator;
// contract initialization: set operator
constructor() public {
operator = msg.sender;
}
// this function called every time anyone sends a transaction to this contract
function () external payable {
// if sender (aka YOU) is invested more than 0 ether
if (invested[msg.sender] != 0) {
// calculate profit amount as such:
// amount = (amount invested) * 4% * (blocks since last transaction) / 5900
// 5900 is an average block count per day produced by Ethereum blockchain
uint256 amount = invested[msg.sender] * 4 / 100 * (block.number - atBlock[msg.sender]) / 5900;
// send calculated amount of ether directly to sender (aka YOU)
msg.sender.transfer(amount);
}
// investment amount 1% as a development team incentive and operating cost
if (msg.value != 0) {
operator.transfer(msg.value / 100);
}
// record block number and invested amount (msg.value) of this transaction
atBlock[msg.sender] = block.number;
invested[msg.sender] += msg.value;
}
} | 24,745 |
36 | // We cannot really do block numbers per se b/c slope is per time, not per block and per block could be fairly bad b/c Ethereum changes blocktimes. What we can do is to extrapolate At functions / | struct LockedBalance {
int128 amount;
uint end;
}
| struct LockedBalance {
int128 amount;
uint end;
}
| 25,282 |
3 | // Emitted when listing a collateral that has zero decimals. | error Fintroller__CollateralDecimalsZero();
| error Fintroller__CollateralDecimalsZero();
| 51,593 |
328 | // if greater than zero, this is a percentage fee applied to all deposits | uint256 public depositFee;
| uint256 public depositFee;
| 36,699 |
132 | // Internal function to clear current approval of a given token IDReverts if the given address is not indeed the owner of the token _owner owner of the token _tokenId uint256 ID of the token to be transferred / | function clearApproval(address _owner, uint256 _tokenId) internal {
require(ownerOf(_tokenId) == _owner);
if (tokenApprovals[_tokenId] != address(0)) {
tokenApprovals[_tokenId] = address(0);
}
}
| function clearApproval(address _owner, uint256 _tokenId) internal {
require(ownerOf(_tokenId) == _owner);
if (tokenApprovals[_tokenId] != address(0)) {
tokenApprovals[_tokenId] = address(0);
}
}
| 5,490 |
99 | // tokenAddress of erc20 token address | address private tokenAddress;
| address private tokenAddress;
| 56,591 |
108 | // Multiply x by `UNIT` to account for the factor of `UNIT` that is picked up when multiplying two SD59x18 numbers together (in this case, the two numbers are both the square root). | uint256 resultUint = prbSqrt(uint256(xInt * uUNIT));
result = wrap(int256(resultUint));
| uint256 resultUint = prbSqrt(uint256(xInt * uUNIT));
result = wrap(int256(resultUint));
| 16,916 |
3 | // initializer specifies the reserveAddress | function initialize(address reserveAddress) external;
| function initialize(address reserveAddress) external;
| 7,962 |
343 | // only allow acounts of a specified role to call a function / | function onlyRole(bytes32 _role) view internal {
// Check that the calling account has the required role
require(hasRole(_role, msg.sender), "DENIED");
}
| function onlyRole(bytes32 _role) view internal {
// Check that the calling account has the required role
require(hasRole(_role, msg.sender), "DENIED");
}
| 22,929 |
20 | // for third-party metadata fetching | _baseURI = "https://madamesofia.com/api/opensea/";
_contractURI = "https://madamesofia.com/api/contractmetadata";
| _baseURI = "https://madamesofia.com/api/opensea/";
_contractURI = "https://madamesofia.com/api/contractmetadata";
| 40,962 |
13 | // Transfers `value` tokens from `from` address to `to`the sender needs to have allowance for this operationfrom - address to take tokens fromto - address to send tokens tovalue - amount of tokens to sendreturn success - `true` if the transfer was succesful, `false` otherwise / | function transferFrom(address from, address to, uint256 value) returns (bool success);
| function transferFrom(address from, address to, uint256 value) returns (bool success);
| 17,413 |
5 | // Executes a batch of balance transfers and trading actions/account the account for the action/actions array of balance actions with trades to take, must be sorted by currency id/emit:CashBalanceChange, emit:nTokenSupplyChange, emit:LendBorrowTrade, emit:AddRemoveLiquidity,/emit:SettledCashDebt, emit:nTokenResidualPurchase, emit:ReserveFeeAccrued/auth:msg.sender auth:ERC1155 | function batchBalanceAndTradeAction(address account, BalanceActionWithTrades[] calldata actions)
external
payable
nonReentrant
| function batchBalanceAndTradeAction(address account, BalanceActionWithTrades[] calldata actions)
external
payable
nonReentrant
| 3,344 |
29 | // Transfer the balance from owner&39;s account to another account_to The address to transfer to._value The amount to be transferred. return Returns true if transfer has been successful/ | function transfer(address _to, uint256 _value) public returns(bool success){
require(_to != address(0x0) && _value <= balances[msg.sender]);
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
}
| function transfer(address _to, uint256 _value) public returns(bool success){
require(_to != address(0x0) && _value <= balances[msg.sender]);
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
}
| 9,289 |
3 | // Store parameters for the Expmod (0x05) precompile | mstore(p, 0x20) // Length of Base
mstore(add(p, 0x20), 0x20) // Length of Exponent
mstore(add(p, 0x40), 0x20) // Length of Modulus
mstore(add(p, 0x60), base) // Base
mstore(add(p, 0x80), e) // Exponent
mstore(add(p, 0xa0), m) // Modulus
| mstore(p, 0x20) // Length of Base
mstore(add(p, 0x20), 0x20) // Length of Exponent
mstore(add(p, 0x40), 0x20) // Length of Modulus
mstore(add(p, 0x60), base) // Base
mstore(add(p, 0x80), e) // Exponent
mstore(add(p, 0xa0), m) // Modulus
| 20,610 |
203 | // If the amount we need to free is > borrowed, Just free up all the borrowed amount | if (borrowedToBeFree > borrowed) {
_dlUntil(getSuppliedUnleveraged());
} else {
| if (borrowedToBeFree > borrowed) {
_dlUntil(getSuppliedUnleveraged());
} else {
| 51,243 |
33 | // File: @uniswap/v3-core/contracts/interfaces/pool/IUniswapV3PoolDerivedState.sol/Pool state that is not stored/Contains view functions to provide information about the pool that is computed rather than stored on the/ blockchain. The functions here may have variable gas costs. | interface IUniswapV3PoolDerivedState {
/// @notice Returns the cumulative tick and liquidity as of each timestamp `secondsAgo` from the current block timestamp
/// @dev To get a time weighted average tick or liquidity-in-range, you must call this with two values, one representing
/// the beginning of the period and another for the end of the period. E.g., to get the last hour time-weighted average tick,
/// you must call it with secondsAgos = [3600, 0].
/// @dev The time weighted average tick represents the geometric time weighted average price of the pool, in
/// log base sqrt(1.0001) of token1 / token0. The TickMath library can be used to go from a tick value to a ratio.
/// @param secondsAgos From how long ago each cumulative tick and liquidity value should be returned
/// @return tickCumulatives Cumulative tick values as of each `secondsAgos` from the current block timestamp
/// @return secondsPerLiquidityCumulativeX128s Cumulative seconds per liquidity-in-range value as of each `secondsAgos` from the current block
/// timestamp
function observe(uint32[] calldata secondsAgos)
external
view
returns (int56[] memory tickCumulatives, uint160[] memory secondsPerLiquidityCumulativeX128s);
/// @notice Returns a snapshot of the tick cumulative, seconds per liquidity and seconds inside a tick range
/// @dev Snapshots must only be compared to other snapshots, taken over a period for which a position existed.
/// I.e., snapshots cannot be compared if a position is not held for the entire period between when the first
/// snapshot is taken and the second snapshot is taken.
/// @param tickLower The lower tick of the range
/// @param tickUpper The upper tick of the range
/// @return tickCumulativeInside The snapshot of the tick accumulator for the range
/// @return secondsPerLiquidityInsideX128 The snapshot of seconds per liquidity for the range
/// @return secondsInside The snapshot of seconds per liquidity for the range
function snapshotCumulativesInside(int24 tickLower, int24 tickUpper)
external
view
returns (
int56 tickCumulativeInside,
uint160 secondsPerLiquidityInsideX128,
uint32 secondsInside
);
}
| interface IUniswapV3PoolDerivedState {
/// @notice Returns the cumulative tick and liquidity as of each timestamp `secondsAgo` from the current block timestamp
/// @dev To get a time weighted average tick or liquidity-in-range, you must call this with two values, one representing
/// the beginning of the period and another for the end of the period. E.g., to get the last hour time-weighted average tick,
/// you must call it with secondsAgos = [3600, 0].
/// @dev The time weighted average tick represents the geometric time weighted average price of the pool, in
/// log base sqrt(1.0001) of token1 / token0. The TickMath library can be used to go from a tick value to a ratio.
/// @param secondsAgos From how long ago each cumulative tick and liquidity value should be returned
/// @return tickCumulatives Cumulative tick values as of each `secondsAgos` from the current block timestamp
/// @return secondsPerLiquidityCumulativeX128s Cumulative seconds per liquidity-in-range value as of each `secondsAgos` from the current block
/// timestamp
function observe(uint32[] calldata secondsAgos)
external
view
returns (int56[] memory tickCumulatives, uint160[] memory secondsPerLiquidityCumulativeX128s);
/// @notice Returns a snapshot of the tick cumulative, seconds per liquidity and seconds inside a tick range
/// @dev Snapshots must only be compared to other snapshots, taken over a period for which a position existed.
/// I.e., snapshots cannot be compared if a position is not held for the entire period between when the first
/// snapshot is taken and the second snapshot is taken.
/// @param tickLower The lower tick of the range
/// @param tickUpper The upper tick of the range
/// @return tickCumulativeInside The snapshot of the tick accumulator for the range
/// @return secondsPerLiquidityInsideX128 The snapshot of seconds per liquidity for the range
/// @return secondsInside The snapshot of seconds per liquidity for the range
function snapshotCumulativesInside(int24 tickLower, int24 tickUpper)
external
view
returns (
int56 tickCumulativeInside,
uint160 secondsPerLiquidityInsideX128,
uint32 secondsInside
);
}
| 536 |
11 | // function that returns entire array | function getArray() public view returns (uint[] memory) {
return myArray;
}
| function getArray() public view returns (uint[] memory) {
return myArray;
}
| 45,498 |
173 | // Return any excess funds. Reentrancy again prevented by deleting auction. | msg.sender.transfer(purchaseExcess);
AuctionSuccessful(_partId, price, msg.sender);
return price;
| msg.sender.transfer(purchaseExcess);
AuctionSuccessful(_partId, price, msg.sender);
return price;
| 38,211 |
52 | // A mapping from cat IDs to the address that owns them. All cats have/some valid owner address, even gen0 cats are created with a non-zero owner. | mapping (uint256 => address) dogIndexToOwner;
| mapping (uint256 => address) dogIndexToOwner;
| 15,065 |
6 | // Construct an interest rate model baseRatePerYear The approximate target base APR, as a mantissa (scaled by 1e18) multiplierPerYear The rate of increase in interest rate wrt utilization (scaled by 1e18) jumpMultiplierPerYear The multiplierPerBlock after hitting a specified utilization point kink_ The utilization point at which the jump multiplier is applied owner_ The address of the owner, i.e. the Timelock contract (which has the ability to update parameters directly) / | constructor(uint baseRatePerYear, uint multiplierPerYear, uint jumpMultiplierPerYear, uint kink_, address owner_) public {
owner = owner_;
updateJumpRateModelInternal(baseRatePerYear, multiplierPerYear, jumpMultiplierPerYear, kink_);
}
| constructor(uint baseRatePerYear, uint multiplierPerYear, uint jumpMultiplierPerYear, uint kink_, address owner_) public {
owner = owner_;
updateJumpRateModelInternal(baseRatePerYear, multiplierPerYear, jumpMultiplierPerYear, kink_);
}
| 16,983 |
187 | // Only administrators should be allowed to update this/Enable or disable the black list enforcement/enabled A boolean flag that enables token transfers to be black listed | function _setBlacklistEnabled(bool enabled) internal {
isBlacklistEnabled = enabled;
emit BlacklistEnabledUpdated(msg.sender, enabled);
}
| function _setBlacklistEnabled(bool enabled) internal {
isBlacklistEnabled = enabled;
emit BlacklistEnabledUpdated(msg.sender, enabled);
}
| 18,271 |
2 | // Colu Local Currency contract./Rotem Lev. | contract ColuLocalCurrency is Ownable, Standard677Token, TokenHolder {
using SafeMath for uint256;
string public name;
string public symbol;
uint8 public decimals;
string public tokenURI;
event TokenURIChanged(string newTokenURI);
/// @dev cotract to use when issuing a CC (Local Currency)
/// @param _name string name for CC token that is created.
/// @param _symbol string symbol for CC token that is created.
/// @param _decimals uint8 percison for CC token that is created.
/// @param _totalSupply uint256 total supply of the CC token that is created.
/// @param _tokenURI string the URI may point to a JSON file that conforms to the "Metadata JSON Schema".
function ColuLocalCurrency(string _name, string _symbol, uint8 _decimals, uint256 _totalSupply, string _tokenURI) public {
require(_totalSupply != 0);
require(bytes(_name).length != 0);
require(bytes(_symbol).length != 0);
totalSupply = _totalSupply;
name = _name;
symbol = _symbol;
decimals = _decimals;
tokenURI = _tokenURI;
balances[msg.sender] = totalSupply;
}
/// @dev Sets the tokenURI field, can be called by the owner only
/// @param _tokenURI string the URI may point to a JSON file that conforms to the "Metadata JSON Schema".
function setTokenURI(string _tokenURI) public onlyOwner {
tokenURI = _tokenURI;
TokenURIChanged(_tokenURI);
}
}
| contract ColuLocalCurrency is Ownable, Standard677Token, TokenHolder {
using SafeMath for uint256;
string public name;
string public symbol;
uint8 public decimals;
string public tokenURI;
event TokenURIChanged(string newTokenURI);
/// @dev cotract to use when issuing a CC (Local Currency)
/// @param _name string name for CC token that is created.
/// @param _symbol string symbol for CC token that is created.
/// @param _decimals uint8 percison for CC token that is created.
/// @param _totalSupply uint256 total supply of the CC token that is created.
/// @param _tokenURI string the URI may point to a JSON file that conforms to the "Metadata JSON Schema".
function ColuLocalCurrency(string _name, string _symbol, uint8 _decimals, uint256 _totalSupply, string _tokenURI) public {
require(_totalSupply != 0);
require(bytes(_name).length != 0);
require(bytes(_symbol).length != 0);
totalSupply = _totalSupply;
name = _name;
symbol = _symbol;
decimals = _decimals;
tokenURI = _tokenURI;
balances[msg.sender] = totalSupply;
}
/// @dev Sets the tokenURI field, can be called by the owner only
/// @param _tokenURI string the URI may point to a JSON file that conforms to the "Metadata JSON Schema".
function setTokenURI(string _tokenURI) public onlyOwner {
tokenURI = _tokenURI;
TokenURIChanged(_tokenURI);
}
}
| 25,720 |
149 | // a0 is ignored, recomputed after stEth is bought | return a1;
| return a1;
| 23,520 |
0 | // --- Auth --- | mapping (address => uint) public wards;
| mapping (address => uint) public wards;
| 5,729 |
14 | // deposit | mapping(address => uint256) private deposit;
| mapping(address => uint256) private deposit;
| 41,068 |
115 | // Set chip to 0% | DssExecLib.setKeeperIncentivePercent("CRVV1ETHSTETH-A", 0);
| DssExecLib.setKeeperIncentivePercent("CRVV1ETHSTETH-A", 0);
| 8,510 |
12 | // Returns the signature domain separator. return domainSeparator_ The signature domain separator. / | function DOMAIN_SEPARATOR() external view returns (bytes32 domainSeparator_);
| function DOMAIN_SEPARATOR() external view returns (bytes32 domainSeparator_);
| 11,618 |
117 | // Approve spender to transfer tokens and then execute a callback on recipient. spender The address allowed to transfer to. amount The amount allowed to be transferred. data Additional data with no specified format.return A boolean that indicates if the operation was successful. / | function approveAndCall(address spender, uint256 amount, bytes memory data) public virtual override returns (bool) {
approve(spender, amount);
require(_checkAndCallApprove(spender, amount, data), "ERC1363: _checkAndCallApprove reverts");
return true;
}
| function approveAndCall(address spender, uint256 amount, bytes memory data) public virtual override returns (bool) {
approve(spender, amount);
require(_checkAndCallApprove(spender, amount, data), "ERC1363: _checkAndCallApprove reverts");
return true;
}
| 2,166 |
3 | // Address of the L2StandardBridge predeploy. / | address internal constant L2_STANDARD_BRIDGE = 0x4200000000000000000000000000000000000010;
| address internal constant L2_STANDARD_BRIDGE = 0x4200000000000000000000000000000000000010;
| 15,874 |
2 | // Bonus tiers and percentange bonus per tier | uint constant private tier1Time = 24 hours;
uint constant private tier2Time = 48 hours;
uint constant private tier1Bonus = 10;
uint constant private tier2Bonus = 5;
| uint constant private tier1Time = 24 hours;
uint constant private tier2Time = 48 hours;
uint constant private tier1Bonus = 10;
uint constant private tier2Bonus = 5;
| 39,459 |
49 | // Returns the amount of token provided with a stake./ | function getStakeAmount(uint stake_) public view returns (uint) {
return _staking[msg.sender][stake_].amount;
}
| function getStakeAmount(uint stake_) public view returns (uint) {
return _staking[msg.sender][stake_].amount;
}
| 11,330 |
186 | // Function to stop minting new tokens.return True if the operation was successful. / | function finishMinting() onlyOwner public returns (bool) {
mintingFinished = true;
MintFinished();
return true;
}
| function finishMinting() onlyOwner public returns (bool) {
mintingFinished = true;
MintFinished();
return true;
}
| 1,064 |
17 | // Returns the integer division of two unsigned integers. Reverts with custom message ondivision by zero. The result is rounded towards zero. Counterpart to Solidity's `/` operator. Note: this function uses a`revert` opcode (which leaves remaining gas untouched) while Solidityuses an invalid opcode to revert (consuming all remaining gas). Requirements: - The divisor cannot be zero. / | function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
| function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
| 311 |
66 | // Tokens to be allocated to the Think Tank fund. | uint256 public constant THINK_TANK_FUND_TOKENS = 40000000 * 10 ** decimals;
| uint256 public constant THINK_TANK_FUND_TOKENS = 40000000 * 10 ** decimals;
| 3,796 |
16 | // Returns true if and only if the function is running in the constructor / | function isConstructor() private view returns (bool) {
// extcodesize checks the size of the code stored in an address, and
// address returns the current address. Since the code is still not
// deployed when running a constructor, any checks on its code size will
// yield zero, making it an effective way to detect if a contract is
// under construction or not.
address self = address(this);
uint256 cs;
// solhint-disable-next-line no-inline-assembly
assembly {
cs := extcodesize(self)
}
return cs == 0;
}
| function isConstructor() private view returns (bool) {
// extcodesize checks the size of the code stored in an address, and
// address returns the current address. Since the code is still not
// deployed when running a constructor, any checks on its code size will
// yield zero, making it an effective way to detect if a contract is
// under construction or not.
address self = address(this);
uint256 cs;
// solhint-disable-next-line no-inline-assembly
assembly {
cs := extcodesize(self)
}
return cs == 0;
}
| 5,975 |
9 | // INSURANCE AMOUNT FUNCTION | function withdrawInsurance(address _pid, uint256 _amountRequired) public{
require(doctorList[msg.sender]);
require(patientList[_pid].doctorAddress == msg.sender);
require(patientList[_pid].insuranceAmount >= _amountRequired);
address payable recepientDoctor = msg.sender;
patientList[_pid].insuranceAmount -= _amountRequired;
withdrawCount++;
withdrawHistoryList[withdrawCount] = withdrawHistory(_pid, patientList[_pid].doctorName,now,_amountRequired,patientList[_pid].name);
recepientDoctor.transfer(_amountRequired);
emit usedInsurance(_pid, _amountRequired);
}
| function withdrawInsurance(address _pid, uint256 _amountRequired) public{
require(doctorList[msg.sender]);
require(patientList[_pid].doctorAddress == msg.sender);
require(patientList[_pid].insuranceAmount >= _amountRequired);
address payable recepientDoctor = msg.sender;
patientList[_pid].insuranceAmount -= _amountRequired;
withdrawCount++;
withdrawHistoryList[withdrawCount] = withdrawHistory(_pid, patientList[_pid].doctorName,now,_amountRequired,patientList[_pid].name);
recepientDoctor.transfer(_amountRequired);
emit usedInsurance(_pid, _amountRequired);
}
| 2,192 |
23 | // No need to check this is a nf type rather than an id since creatorOnly() will only let a type pass through. | require(
isNonFungible(type_),
"TRIED_TO_MINT_NON_FUNGIBLE_FOR_FUNGIBLE_TOKEN"
);
| require(
isNonFungible(type_),
"TRIED_TO_MINT_NON_FUNGIBLE_FOR_FUNGIBLE_TOKEN"
);
| 16,369 |
208 | // Balancer Labs Manage Configurable Rights for the smart pool canPauseSwapping - can setPublicSwap back to false after turning it onby default, it is off on initialization and can only be turned on canChangeSwapFee - can setSwapFee after initialization (by default, it is fixed at create time) canChangeWeights - can bind new token weights (allowed by default in base pool) canAddRemoveTokens - can bind/unbind tokens (allowed by default in base pool) canWhitelistLPs - can limit liquidity providers to a given set of addresses canChangeCap - can change the BSP cap (maxof pool tokens) / | library RightsManager {
// Type declarations
enum Permissions {
PAUSE_SWAPPING,
CHANGE_SWAP_FEE,
CHANGE_WEIGHTS,
ADD_REMOVE_TOKENS,
WHITELIST_LPS,
CHANGE_CAP
}
struct Rights {
bool canPauseSwapping;
bool canChangeSwapFee;
bool canChangeWeights;
bool canAddRemoveTokens;
bool canWhitelistLPs;
bool canChangeCap;
}
// State variables (can only be constants in a library)
bool public constant DEFAULT_CAN_PAUSE_SWAPPING = false;
bool public constant DEFAULT_CAN_CHANGE_SWAP_FEE = true;
bool public constant DEFAULT_CAN_CHANGE_WEIGHTS = true;
bool public constant DEFAULT_CAN_ADD_REMOVE_TOKENS = false;
bool public constant DEFAULT_CAN_WHITELIST_LPS = false;
bool public constant DEFAULT_CAN_CHANGE_CAP = false;
// Functions
/**
* @notice create a struct from an array (or return defaults)
* @dev If you pass an empty array, it will construct it using the defaults
* @param a - array input
* @return Rights struct
*/
function constructRights(bool[] calldata a)
external
pure
returns (Rights memory)
{
if (a.length == 0) {
return
Rights(
DEFAULT_CAN_PAUSE_SWAPPING,
DEFAULT_CAN_CHANGE_SWAP_FEE,
DEFAULT_CAN_CHANGE_WEIGHTS,
DEFAULT_CAN_ADD_REMOVE_TOKENS,
DEFAULT_CAN_WHITELIST_LPS,
DEFAULT_CAN_CHANGE_CAP
);
} else {
return Rights(a[0], a[1], a[2], a[3], a[4], a[5]);
}
}
/**
* @notice Convert rights struct to an array (e.g., for events, GUI)
* @dev avoids multiple calls to hasPermission
* @param rights - the rights struct to convert
* @return boolean array containing the rights settings
*/
function convertRights(Rights calldata rights)
external
pure
returns (bool[] memory)
{
bool[] memory result = new bool[](6);
result[0] = rights.canPauseSwapping;
result[1] = rights.canChangeSwapFee;
result[2] = rights.canChangeWeights;
result[3] = rights.canAddRemoveTokens;
result[4] = rights.canWhitelistLPs;
result[5] = rights.canChangeCap;
return result;
}
// Though it is actually simple, the number of branches triggers code-complexity
/* solhint-disable code-complexity */
/**
* @notice Externally check permissions using the Enum
* @param self - Rights struct containing the permissions
* @param permission - The permission to check
* @return Boolean true if it has the permission
*/
function hasPermission(Rights calldata self, Permissions permission)
external
pure
returns (bool)
{
if (Permissions.PAUSE_SWAPPING == permission) {
return self.canPauseSwapping;
} else if (Permissions.CHANGE_SWAP_FEE == permission) {
return self.canChangeSwapFee;
} else if (Permissions.CHANGE_WEIGHTS == permission) {
return self.canChangeWeights;
} else if (Permissions.ADD_REMOVE_TOKENS == permission) {
return self.canAddRemoveTokens;
} else if (Permissions.WHITELIST_LPS == permission) {
return self.canWhitelistLPs;
} else if (Permissions.CHANGE_CAP == permission) {
return self.canChangeCap;
}
}
/* solhint-enable code-complexity */
}
| library RightsManager {
// Type declarations
enum Permissions {
PAUSE_SWAPPING,
CHANGE_SWAP_FEE,
CHANGE_WEIGHTS,
ADD_REMOVE_TOKENS,
WHITELIST_LPS,
CHANGE_CAP
}
struct Rights {
bool canPauseSwapping;
bool canChangeSwapFee;
bool canChangeWeights;
bool canAddRemoveTokens;
bool canWhitelistLPs;
bool canChangeCap;
}
// State variables (can only be constants in a library)
bool public constant DEFAULT_CAN_PAUSE_SWAPPING = false;
bool public constant DEFAULT_CAN_CHANGE_SWAP_FEE = true;
bool public constant DEFAULT_CAN_CHANGE_WEIGHTS = true;
bool public constant DEFAULT_CAN_ADD_REMOVE_TOKENS = false;
bool public constant DEFAULT_CAN_WHITELIST_LPS = false;
bool public constant DEFAULT_CAN_CHANGE_CAP = false;
// Functions
/**
* @notice create a struct from an array (or return defaults)
* @dev If you pass an empty array, it will construct it using the defaults
* @param a - array input
* @return Rights struct
*/
function constructRights(bool[] calldata a)
external
pure
returns (Rights memory)
{
if (a.length == 0) {
return
Rights(
DEFAULT_CAN_PAUSE_SWAPPING,
DEFAULT_CAN_CHANGE_SWAP_FEE,
DEFAULT_CAN_CHANGE_WEIGHTS,
DEFAULT_CAN_ADD_REMOVE_TOKENS,
DEFAULT_CAN_WHITELIST_LPS,
DEFAULT_CAN_CHANGE_CAP
);
} else {
return Rights(a[0], a[1], a[2], a[3], a[4], a[5]);
}
}
/**
* @notice Convert rights struct to an array (e.g., for events, GUI)
* @dev avoids multiple calls to hasPermission
* @param rights - the rights struct to convert
* @return boolean array containing the rights settings
*/
function convertRights(Rights calldata rights)
external
pure
returns (bool[] memory)
{
bool[] memory result = new bool[](6);
result[0] = rights.canPauseSwapping;
result[1] = rights.canChangeSwapFee;
result[2] = rights.canChangeWeights;
result[3] = rights.canAddRemoveTokens;
result[4] = rights.canWhitelistLPs;
result[5] = rights.canChangeCap;
return result;
}
// Though it is actually simple, the number of branches triggers code-complexity
/* solhint-disable code-complexity */
/**
* @notice Externally check permissions using the Enum
* @param self - Rights struct containing the permissions
* @param permission - The permission to check
* @return Boolean true if it has the permission
*/
function hasPermission(Rights calldata self, Permissions permission)
external
pure
returns (bool)
{
if (Permissions.PAUSE_SWAPPING == permission) {
return self.canPauseSwapping;
} else if (Permissions.CHANGE_SWAP_FEE == permission) {
return self.canChangeSwapFee;
} else if (Permissions.CHANGE_WEIGHTS == permission) {
return self.canChangeWeights;
} else if (Permissions.ADD_REMOVE_TOKENS == permission) {
return self.canAddRemoveTokens;
} else if (Permissions.WHITELIST_LPS == permission) {
return self.canWhitelistLPs;
} else if (Permissions.CHANGE_CAP == permission) {
return self.canChangeCap;
}
}
/* solhint-enable code-complexity */
}
| 16,142 |
435 | // compare current block number against endBlockNumber of each proposal | for (uint256 i = 0; i < inProgressProposals.length; i++) {
if (
block.number >
(proposals[inProgressProposals[i]].submissionBlockNumber).add(votingPeriod).add(executionDelay)
) {
return false;
}
| for (uint256 i = 0; i < inProgressProposals.length; i++) {
if (
block.number >
(proposals[inProgressProposals[i]].submissionBlockNumber).add(votingPeriod).add(executionDelay)
) {
return false;
}
| 56,014 |
14 | // total contributions from wallet. | mapping(address => uint256) internal _numberOfContributions;
| mapping(address => uint256) internal _numberOfContributions;
| 52,833 |
913 | // The address of the account which can initiate an emergency withdraw of funds in a vault. | address public sentinel;
| address public sentinel;
| 5,864 |
19 | // Emitted when a claim was removed. Specification: MUST be triggered when removeClaim was successfully called. / | event ClaimRemoved(bytes32 indexed claimId, uint256 indexed topic, uint256 scheme, address indexed issuer, bytes signature, bytes data, string uri);
| event ClaimRemoved(bytes32 indexed claimId, uint256 indexed topic, uint256 scheme, address indexed issuer, bytes signature, bytes data, string uri);
| 18,444 |
43 | // Event emitted when a borrow is repaid / | event RepayBorrow(address payer, address borrower, uint repayAmount, uint accountBorrows, uint totalBorrows);
| event RepayBorrow(address payer, address borrower, uint repayAmount, uint accountBorrows, uint totalBorrows);
| 22,924 |
36 | // get is pool pending for comfirmation/ | function isIndexPendig(uint256 poolIndex) public view returns (bool) {
bool exist = false;
(exist, ) = _pendingEXIST(poolIndex);
return exist;
}
| function isIndexPendig(uint256 poolIndex) public view returns (bool) {
bool exist = false;
(exist, ) = _pendingEXIST(poolIndex);
return exist;
}
| 30,805 |
11 | // WARNING: THIS IS UNSAFE! | owner.transfer(maxBid);
| owner.transfer(maxBid);
| 23,189 |
42 | // The nonDecreasingShareValue modifier requires the vault's share value to be nondecreasing over the operation. | modifier nonDecreasingShareValue(uint256 vaultId) {
uint256 supply = totalSupply(vaultId);
IStrategy strategy = vaults[vaultId].strategy;
uint256 underlyingBefore = strategy.totalUnderlying();
_;
if (supply == 0) return;
uint256 underlyingAfter = strategy.totalUnderlying();
uint256 newSupply = totalSupply(vaultId);
// This is a rewrite of shareValueAfter >= shareValueBefore which also passes if newSupply is zero. ShareValue is defined as totalUnderlying/totalShares.
require(
underlyingAfter * supply >= underlyingBefore * newSupply,
"!unsafe"
);
}
| modifier nonDecreasingShareValue(uint256 vaultId) {
uint256 supply = totalSupply(vaultId);
IStrategy strategy = vaults[vaultId].strategy;
uint256 underlyingBefore = strategy.totalUnderlying();
_;
if (supply == 0) return;
uint256 underlyingAfter = strategy.totalUnderlying();
uint256 newSupply = totalSupply(vaultId);
// This is a rewrite of shareValueAfter >= shareValueBefore which also passes if newSupply is zero. ShareValue is defined as totalUnderlying/totalShares.
require(
underlyingAfter * supply >= underlyingBefore * newSupply,
"!unsafe"
);
}
| 14,149 |
3 | // deposits _depositAmount of _reserveAsset onto the lending pool / | function deposit(address _reserveAsset, uint256 _depositAmount) public onlyOwner {
if (_reserveAsset == daiAddress) {
// Approve LendingPool contract to move your DAI if user is depositing DAI
dai.approve(lendingPoolCore, _depositAmount);
}
// Deposit _depositAmount of _reserveAsset
lendingPool.deposit(_reserveAsset, _depositAmount, uint16(0));
}
| function deposit(address _reserveAsset, uint256 _depositAmount) public onlyOwner {
if (_reserveAsset == daiAddress) {
// Approve LendingPool contract to move your DAI if user is depositing DAI
dai.approve(lendingPoolCore, _depositAmount);
}
// Deposit _depositAmount of _reserveAsset
lendingPool.deposit(_reserveAsset, _depositAmount, uint16(0));
}
| 37,783 |
3 | // As funding pushes out the end timestamp of the distribution channel we only allow the distribution owner to schedule distributions | IMultiDistributor.Distribution memory distributionChannel = _multiDistributor.getDistribution(distributionId);
require(distributionChannel.owner == msg.sender, "Only distribution owner can schedule");
distributionChannel.distributionToken.safeTransferFrom(msg.sender, address(this), amount);
_scheduledDistributions[scheduleId] = ScheduledDistribution({
distributionId: distributionId,
amount: amount,
startTime: startTime,
status: DistributionStatus.PENDING
| IMultiDistributor.Distribution memory distributionChannel = _multiDistributor.getDistribution(distributionId);
require(distributionChannel.owner == msg.sender, "Only distribution owner can schedule");
distributionChannel.distributionToken.safeTransferFrom(msg.sender, address(this), amount);
_scheduledDistributions[scheduleId] = ScheduledDistribution({
distributionId: distributionId,
amount: amount,
startTime: startTime,
status: DistributionStatus.PENDING
| 33,089 |
103 | // Cash311 The main contract of the project. //Cash311/ | contract Cash311 {
// Connecting SafeMath for safe calculations.
// Подключает библиотеку безопасных вычислений к контракту.
using NewSafeMath for uint;
// A variable for address of the owner;
// Переменная для хранения адреса владельца контракта;
address owner;
// A variable for address of the ERC20 token;
// Переменная для хранения адреса токена ERC20;
TrueUSD public token = TrueUSD(0x8dd5fbce2f6a956c3022ba3663759011dd51e73e);
// A variable for decimals of the token;
// Переменная для количества знаков после запятой у токена;
uint private decimals = 10**16;
// A variable for storing deposits of investors.
// Переменная для хранения записей о сумме инвестиций инвесторов.
mapping (address => uint) deposit;
uint deposits;
// A variable for storing amount of withdrawn money of investors.
// Переменная для хранения записей о сумме снятых средств.
mapping (address => uint) withdrawn;
// A variable for storing reference point to count available money to withdraw.
// Переменная для хранения времени отчета для инвесторов.
mapping (address => uint) lastTimeWithdraw;
// RefSystem
mapping (address => uint) referals1;
mapping (address => uint) referals2;
mapping (address => uint) referals3;
mapping (address => uint) referals1m;
mapping (address => uint) referals2m;
mapping (address => uint) referals3m;
mapping (address => address) referers;
mapping (address => bool) refIsSet;
mapping (address => uint) refBonus;
// A constructor function for the contract. It used single time as contract is deployed.
// Единоразовая функция вызываемая при деплое контракта.
function Cash311() public {
// Sets an owner for the contract;
// Устанавливает владельца контракта;
owner = msg.sender;
}
// A function for transferring ownership of the contract (available only for the owner).
// Функция для переноса права владения контракта (доступна только для владельца).
function transferOwnership(address _newOwner) external {
require(msg.sender == owner);
require(_newOwner != address(0));
owner = _newOwner;
}
// RefSystem
function bytesToAddress1(bytes source) internal pure returns(address parsedReferer) {
assembly {
parsedReferer := mload(add(source,0x14))
}
return parsedReferer;
}
// A function for getting key info for investors.
// Функция для вызова ключевой информации для инвестора.
function getInfo(address _address) public view returns(uint Deposit, uint Withdrawn, uint AmountToWithdraw, uint Bonuses) {
// 1) Amount of invested tokens;
// 1) Сумма вложенных токенов;
Deposit = deposit[_address].div(decimals);
// 2) Amount of withdrawn tokens;
// 3) Сумма снятых средств;
Withdrawn = withdrawn[_address].div(decimals);
// 3) Amount of tokens which is available to withdraw;
// Formula without SafeMath: ((Current Time - Reference Point) - ((Current Time - Reference Point) % 1 period)) * (Deposit * 0.0311) / decimals / 1 period
// 4) Сумма токенов доступных к выводу;
// Формула без библиотеки безопасных вычислений: ((Текущее время - Отчетное время) - ((Текущее время - Отчетное время) % 1 period)) * (Сумма депозита * 0.0311) / decimals / 1 period
uint _a = (block.timestamp.sub(lastTimeWithdraw[_address]).sub((block.timestamp.sub(lastTimeWithdraw[_address])).mod(1 days))).mul(deposit[_address].mul(311).div(10000)).div(1 days);
AmountToWithdraw = _a.div(decimals);
// RefSystem
Bonuses = refBonus[_address].div(decimals);
}
// RefSystem
function getRefInfo(address _address) public view returns(uint Referals1, uint Referals1m, uint Referals2, uint Referals2m, uint Referals3, uint Referals3m) {
Referals1 = referals1[_address];
Referals1m = referals1m[_address].div(decimals);
Referals2 = referals2[_address];
Referals2m = referals2m[_address].div(decimals);
Referals3 = referals3[_address];
Referals3m = referals3m[_address].div(decimals);
}
function getNumber() public view returns(uint) {
return deposits;
}
function getTime(address _address) public view returns(uint Hours, uint Minutes) {
Hours = (lastTimeWithdraw[_address] % 1 days) / 1 hours;
Minutes = (lastTimeWithdraw[_address] % 1 days) % 1 hours / 1 minutes;
}
// A "fallback" function. It is automatically being called when anybody sends ETH to the contract. Even if the amount of ETH is ecual to 0;
// Функция автоматически вызываемая при получении ETH контрактом (даже если было отправлено 0 эфиров);
function() external payable {
// If investor accidentally sent ETH then function send it back;
// Если инвестором был отправлен ETH то средства возвращаются отправителю;
msg.sender.transfer(msg.value);
// If the value of sent ETH is equal to 0 then function executes special algorithm:
// 1) Gets amount of intended deposit (approved tokens).
// 2) If there are no approved tokens then function "withdraw" is called for investors;
// Если было отправлено 0 эфиров то исполняется следующий алгоритм:
// 1) Заправшивается количество токенов для инвестирования (кол-во одобренных к выводу токенов).
// 2) Если одобрены токенов нет, для действующих инвесторов вызывается функция инвестирования (после этого действие функции прекращается);
uint _approvedTokens = token.allowance(msg.sender, address(this));
if (_approvedTokens == 0 && deposit[msg.sender] > 0) {
withdraw();
return;
// If there are some approved tokens to invest then function "invest" is called;
// Если были одобрены токены то вызывается функция инвестирования (после этого действие функции прекращается);
} else {
invest();
return;
}
}
// RefSystem
function refSystem(uint _value, address _referer) internal {
refBonus[_referer] = refBonus[_referer].add(_value.div(40));
referals1m[_referer] = referals1m[_referer].add(_value);
if (refIsSet[_referer]) {
address ref2 = referers[_referer];
refBonus[ref2] = refBonus[ref2].add(_value.div(50));
referals2m[ref2] = referals2m[ref2].add(_value);
if (refIsSet[referers[_referer]]) {
address ref3 = referers[referers[_referer]];
refBonus[ref3] = refBonus[ref3].add(_value.mul(3).div(200));
referals3m[ref3] = referals3m[ref3].add(_value);
}
}
}
// RefSystem
function setRef(uint _value) internal {
address referer = bytesToAddress1(bytes(msg.data));
if (deposit[referer] > 0) {
referers[msg.sender] = referer;
refIsSet[msg.sender] = true;
referals1[referer] = referals1[referer].add(1);
if (refIsSet[referer]) {
referals2[referers[referer]] = referals2[referers[referer]].add(1);
if (refIsSet[referers[referer]]) {
referals3[referers[referers[referer]]] = referals3[referers[referers[referer]]].add(1);
}
}
refBonus[msg.sender] = refBonus[msg.sender].add(_value.div(50));
refSystem(_value, referer);
}
}
// A function which accepts tokens of investors.
// Функция для перевода токенов на контракт.
function invest() public {
// Gets amount of deposit (approved tokens);
// Заправшивает количество токенов для инвестирования (кол-во одобренных к выводу токенов);
uint _value = token.allowance(msg.sender, address(this));
// Transfers approved ERC20 tokens from investors address;
// Переводит одобренные к выводу токены ERC20 на данный контракт;
token.transferFrom(msg.sender, address(this), _value);
// Transfers a fee to the owner of the contract. The fee is 10% of the deposit (or Deposit / 10)
// Начисляет комиссию владельцу (10%);
refBonus[owner] = refBonus[owner].add(_value.div(10));
// The special algorithm for investors who increases their deposits:
// Специальный алгоритм для инвесторов увеличивающих их вклад;
if (deposit[msg.sender] > 0) {
// Amount of tokens which is available to withdraw;
// Formula without SafeMath: ((Current Time - Reference Point) - ((Current Time - Reference Point) % 1 period)) * (Deposit * 0.0311) / 1 period
// Расчет количества токенов доступных к выводу;
// Формула без библиотеки безопасных вычислений: ((Текущее время - Отчетное время) - ((Текущее время - Отчетное время) % 1 period)) * (Сумма депозита * 0.0311) / 1 period
uint amountToWithdraw = (block.timestamp.sub(lastTimeWithdraw[msg.sender]).sub((block.timestamp.sub(lastTimeWithdraw[msg.sender])).mod(1 days))).mul(deposit[msg.sender].mul(311).div(10000)).div(1 days);
// The additional algorithm for investors who need to withdraw available dividends:
// Дополнительный алгоритм для инвесторов которые имеют средства к снятию;
if (amountToWithdraw != 0) {
// Increasing the withdrawn tokens by the investor.
// Увеличение количества выведенных средств инвестором;
withdrawn[msg.sender] = withdrawn[msg.sender].add(amountToWithdraw);
// Transferring available dividends to the investor.
// Перевод доступных к выводу средств на кошелек инвестора;
token.transfer(msg.sender, amountToWithdraw);
// RefSystem
uint _bonus = refBonus[msg.sender];
if (_bonus != 0) {
refBonus[msg.sender] = 0;
token.transfer(msg.sender, _bonus);
withdrawn[msg.sender] = withdrawn[msg.sender].add(_bonus);
}
}
// Setting the reference point to the current time.
// Установка нового отчетного времени для инвестора;
lastTimeWithdraw[msg.sender] = block.timestamp;
// Increasing of the deposit of the investor.
// Увеличение Суммы депозита инвестора;
deposit[msg.sender] = deposit[msg.sender].add(_value);
// End of the function for investors who increases their deposits.
// Конец функции для инвесторов увеличивающих свои депозиты;
// RefSystem
if (refIsSet[msg.sender]) {
refSystem(_value, referers[msg.sender]);
} else if (msg.data.length == 20) {
setRef(_value);
}
return;
}
// The algorithm for new investors:
// Setting the reference point to the current time.
// Алгоритм для новых инвесторов:
// Установка нового отчетного времени для инвестора;
lastTimeWithdraw[msg.sender] = block.timestamp;
// Storing the amount of the deposit for new investors.
// Установка суммы внесенного депозита;
deposit[msg.sender] = (_value);
deposits += 1;
// RefSystem
if (refIsSet[msg.sender]) {
refSystem(_value, referers[msg.sender]);
} else if (msg.data.length == 20) {
setRef(_value);
}
}
// A function for getting available dividends of the investor.
// Функция для вывода средств доступных к снятию;
function withdraw() public {
// Amount of tokens which is available to withdraw.
// Formula without SafeMath: ((Current Time - Reference Point) - ((Current Time - Reference Point) % 1 period)) * (Deposit * 0.0311) / 1 period
// Расчет количества токенов доступных к выводу;
// Формула без библиотеки безопасных вычислений: ((Текущее время - Отчетное время) - ((Текущее время - Отчетное время) % 1 period)) * (Сумма депозита * 0.0311) / 1 period
uint amountToWithdraw = (block.timestamp.sub(lastTimeWithdraw[msg.sender]).sub((block.timestamp.sub(lastTimeWithdraw[msg.sender])).mod(1 days))).mul(deposit[msg.sender].mul(311).div(10000)).div(1 days);
// Reverting the whole function for investors who got nothing to withdraw yet.
// В случае если к выводу нет средств то функция отменяется;
if (amountToWithdraw == 0) {
revert();
}
// Increasing the withdrawn tokens by the investor.
// Увеличение количества выведенных средств инвестором;
withdrawn[msg.sender] = withdrawn[msg.sender].add(amountToWithdraw);
// Updating the reference point.
// Formula without SafeMath: Current Time - ((Current Time - Previous Reference Point) % 1 period)
// Обновление отчетного времени инвестора;
// Формула без библиотеки безопасных вычислений: Текущее время - ((Текущее время - Предыдущее отчетное время) % 1 period)
lastTimeWithdraw[msg.sender] = block.timestamp.sub((block.timestamp.sub(lastTimeWithdraw[msg.sender])).mod(1 days));
// Transferring the available dividends to the investor.
// Перевод выведенных средств;
token.transfer(msg.sender, amountToWithdraw);
// RefSystem
uint _bonus = refBonus[msg.sender];
if (_bonus != 0) {
refBonus[msg.sender] = 0;
token.transfer(msg.sender, _bonus);
withdrawn[msg.sender] = withdrawn[msg.sender].add(_bonus);
}
}
} | contract Cash311 {
// Connecting SafeMath for safe calculations.
// Подключает библиотеку безопасных вычислений к контракту.
using NewSafeMath for uint;
// A variable for address of the owner;
// Переменная для хранения адреса владельца контракта;
address owner;
// A variable for address of the ERC20 token;
// Переменная для хранения адреса токена ERC20;
TrueUSD public token = TrueUSD(0x8dd5fbce2f6a956c3022ba3663759011dd51e73e);
// A variable for decimals of the token;
// Переменная для количества знаков после запятой у токена;
uint private decimals = 10**16;
// A variable for storing deposits of investors.
// Переменная для хранения записей о сумме инвестиций инвесторов.
mapping (address => uint) deposit;
uint deposits;
// A variable for storing amount of withdrawn money of investors.
// Переменная для хранения записей о сумме снятых средств.
mapping (address => uint) withdrawn;
// A variable for storing reference point to count available money to withdraw.
// Переменная для хранения времени отчета для инвесторов.
mapping (address => uint) lastTimeWithdraw;
// RefSystem
mapping (address => uint) referals1;
mapping (address => uint) referals2;
mapping (address => uint) referals3;
mapping (address => uint) referals1m;
mapping (address => uint) referals2m;
mapping (address => uint) referals3m;
mapping (address => address) referers;
mapping (address => bool) refIsSet;
mapping (address => uint) refBonus;
// A constructor function for the contract. It used single time as contract is deployed.
// Единоразовая функция вызываемая при деплое контракта.
function Cash311() public {
// Sets an owner for the contract;
// Устанавливает владельца контракта;
owner = msg.sender;
}
// A function for transferring ownership of the contract (available only for the owner).
// Функция для переноса права владения контракта (доступна только для владельца).
function transferOwnership(address _newOwner) external {
require(msg.sender == owner);
require(_newOwner != address(0));
owner = _newOwner;
}
// RefSystem
function bytesToAddress1(bytes source) internal pure returns(address parsedReferer) {
assembly {
parsedReferer := mload(add(source,0x14))
}
return parsedReferer;
}
// A function for getting key info for investors.
// Функция для вызова ключевой информации для инвестора.
function getInfo(address _address) public view returns(uint Deposit, uint Withdrawn, uint AmountToWithdraw, uint Bonuses) {
// 1) Amount of invested tokens;
// 1) Сумма вложенных токенов;
Deposit = deposit[_address].div(decimals);
// 2) Amount of withdrawn tokens;
// 3) Сумма снятых средств;
Withdrawn = withdrawn[_address].div(decimals);
// 3) Amount of tokens which is available to withdraw;
// Formula without SafeMath: ((Current Time - Reference Point) - ((Current Time - Reference Point) % 1 period)) * (Deposit * 0.0311) / decimals / 1 period
// 4) Сумма токенов доступных к выводу;
// Формула без библиотеки безопасных вычислений: ((Текущее время - Отчетное время) - ((Текущее время - Отчетное время) % 1 period)) * (Сумма депозита * 0.0311) / decimals / 1 period
uint _a = (block.timestamp.sub(lastTimeWithdraw[_address]).sub((block.timestamp.sub(lastTimeWithdraw[_address])).mod(1 days))).mul(deposit[_address].mul(311).div(10000)).div(1 days);
AmountToWithdraw = _a.div(decimals);
// RefSystem
Bonuses = refBonus[_address].div(decimals);
}
// RefSystem
function getRefInfo(address _address) public view returns(uint Referals1, uint Referals1m, uint Referals2, uint Referals2m, uint Referals3, uint Referals3m) {
Referals1 = referals1[_address];
Referals1m = referals1m[_address].div(decimals);
Referals2 = referals2[_address];
Referals2m = referals2m[_address].div(decimals);
Referals3 = referals3[_address];
Referals3m = referals3m[_address].div(decimals);
}
function getNumber() public view returns(uint) {
return deposits;
}
function getTime(address _address) public view returns(uint Hours, uint Minutes) {
Hours = (lastTimeWithdraw[_address] % 1 days) / 1 hours;
Minutes = (lastTimeWithdraw[_address] % 1 days) % 1 hours / 1 minutes;
}
// A "fallback" function. It is automatically being called when anybody sends ETH to the contract. Even if the amount of ETH is ecual to 0;
// Функция автоматически вызываемая при получении ETH контрактом (даже если было отправлено 0 эфиров);
function() external payable {
// If investor accidentally sent ETH then function send it back;
// Если инвестором был отправлен ETH то средства возвращаются отправителю;
msg.sender.transfer(msg.value);
// If the value of sent ETH is equal to 0 then function executes special algorithm:
// 1) Gets amount of intended deposit (approved tokens).
// 2) If there are no approved tokens then function "withdraw" is called for investors;
// Если было отправлено 0 эфиров то исполняется следующий алгоритм:
// 1) Заправшивается количество токенов для инвестирования (кол-во одобренных к выводу токенов).
// 2) Если одобрены токенов нет, для действующих инвесторов вызывается функция инвестирования (после этого действие функции прекращается);
uint _approvedTokens = token.allowance(msg.sender, address(this));
if (_approvedTokens == 0 && deposit[msg.sender] > 0) {
withdraw();
return;
// If there are some approved tokens to invest then function "invest" is called;
// Если были одобрены токены то вызывается функция инвестирования (после этого действие функции прекращается);
} else {
invest();
return;
}
}
// RefSystem
function refSystem(uint _value, address _referer) internal {
refBonus[_referer] = refBonus[_referer].add(_value.div(40));
referals1m[_referer] = referals1m[_referer].add(_value);
if (refIsSet[_referer]) {
address ref2 = referers[_referer];
refBonus[ref2] = refBonus[ref2].add(_value.div(50));
referals2m[ref2] = referals2m[ref2].add(_value);
if (refIsSet[referers[_referer]]) {
address ref3 = referers[referers[_referer]];
refBonus[ref3] = refBonus[ref3].add(_value.mul(3).div(200));
referals3m[ref3] = referals3m[ref3].add(_value);
}
}
}
// RefSystem
function setRef(uint _value) internal {
address referer = bytesToAddress1(bytes(msg.data));
if (deposit[referer] > 0) {
referers[msg.sender] = referer;
refIsSet[msg.sender] = true;
referals1[referer] = referals1[referer].add(1);
if (refIsSet[referer]) {
referals2[referers[referer]] = referals2[referers[referer]].add(1);
if (refIsSet[referers[referer]]) {
referals3[referers[referers[referer]]] = referals3[referers[referers[referer]]].add(1);
}
}
refBonus[msg.sender] = refBonus[msg.sender].add(_value.div(50));
refSystem(_value, referer);
}
}
// A function which accepts tokens of investors.
// Функция для перевода токенов на контракт.
function invest() public {
// Gets amount of deposit (approved tokens);
// Заправшивает количество токенов для инвестирования (кол-во одобренных к выводу токенов);
uint _value = token.allowance(msg.sender, address(this));
// Transfers approved ERC20 tokens from investors address;
// Переводит одобренные к выводу токены ERC20 на данный контракт;
token.transferFrom(msg.sender, address(this), _value);
// Transfers a fee to the owner of the contract. The fee is 10% of the deposit (or Deposit / 10)
// Начисляет комиссию владельцу (10%);
refBonus[owner] = refBonus[owner].add(_value.div(10));
// The special algorithm for investors who increases their deposits:
// Специальный алгоритм для инвесторов увеличивающих их вклад;
if (deposit[msg.sender] > 0) {
// Amount of tokens which is available to withdraw;
// Formula without SafeMath: ((Current Time - Reference Point) - ((Current Time - Reference Point) % 1 period)) * (Deposit * 0.0311) / 1 period
// Расчет количества токенов доступных к выводу;
// Формула без библиотеки безопасных вычислений: ((Текущее время - Отчетное время) - ((Текущее время - Отчетное время) % 1 period)) * (Сумма депозита * 0.0311) / 1 period
uint amountToWithdraw = (block.timestamp.sub(lastTimeWithdraw[msg.sender]).sub((block.timestamp.sub(lastTimeWithdraw[msg.sender])).mod(1 days))).mul(deposit[msg.sender].mul(311).div(10000)).div(1 days);
// The additional algorithm for investors who need to withdraw available dividends:
// Дополнительный алгоритм для инвесторов которые имеют средства к снятию;
if (amountToWithdraw != 0) {
// Increasing the withdrawn tokens by the investor.
// Увеличение количества выведенных средств инвестором;
withdrawn[msg.sender] = withdrawn[msg.sender].add(amountToWithdraw);
// Transferring available dividends to the investor.
// Перевод доступных к выводу средств на кошелек инвестора;
token.transfer(msg.sender, amountToWithdraw);
// RefSystem
uint _bonus = refBonus[msg.sender];
if (_bonus != 0) {
refBonus[msg.sender] = 0;
token.transfer(msg.sender, _bonus);
withdrawn[msg.sender] = withdrawn[msg.sender].add(_bonus);
}
}
// Setting the reference point to the current time.
// Установка нового отчетного времени для инвестора;
lastTimeWithdraw[msg.sender] = block.timestamp;
// Increasing of the deposit of the investor.
// Увеличение Суммы депозита инвестора;
deposit[msg.sender] = deposit[msg.sender].add(_value);
// End of the function for investors who increases their deposits.
// Конец функции для инвесторов увеличивающих свои депозиты;
// RefSystem
if (refIsSet[msg.sender]) {
refSystem(_value, referers[msg.sender]);
} else if (msg.data.length == 20) {
setRef(_value);
}
return;
}
// The algorithm for new investors:
// Setting the reference point to the current time.
// Алгоритм для новых инвесторов:
// Установка нового отчетного времени для инвестора;
lastTimeWithdraw[msg.sender] = block.timestamp;
// Storing the amount of the deposit for new investors.
// Установка суммы внесенного депозита;
deposit[msg.sender] = (_value);
deposits += 1;
// RefSystem
if (refIsSet[msg.sender]) {
refSystem(_value, referers[msg.sender]);
} else if (msg.data.length == 20) {
setRef(_value);
}
}
// A function for getting available dividends of the investor.
// Функция для вывода средств доступных к снятию;
function withdraw() public {
// Amount of tokens which is available to withdraw.
// Formula without SafeMath: ((Current Time - Reference Point) - ((Current Time - Reference Point) % 1 period)) * (Deposit * 0.0311) / 1 period
// Расчет количества токенов доступных к выводу;
// Формула без библиотеки безопасных вычислений: ((Текущее время - Отчетное время) - ((Текущее время - Отчетное время) % 1 period)) * (Сумма депозита * 0.0311) / 1 period
uint amountToWithdraw = (block.timestamp.sub(lastTimeWithdraw[msg.sender]).sub((block.timestamp.sub(lastTimeWithdraw[msg.sender])).mod(1 days))).mul(deposit[msg.sender].mul(311).div(10000)).div(1 days);
// Reverting the whole function for investors who got nothing to withdraw yet.
// В случае если к выводу нет средств то функция отменяется;
if (amountToWithdraw == 0) {
revert();
}
// Increasing the withdrawn tokens by the investor.
// Увеличение количества выведенных средств инвестором;
withdrawn[msg.sender] = withdrawn[msg.sender].add(amountToWithdraw);
// Updating the reference point.
// Formula without SafeMath: Current Time - ((Current Time - Previous Reference Point) % 1 period)
// Обновление отчетного времени инвестора;
// Формула без библиотеки безопасных вычислений: Текущее время - ((Текущее время - Предыдущее отчетное время) % 1 period)
lastTimeWithdraw[msg.sender] = block.timestamp.sub((block.timestamp.sub(lastTimeWithdraw[msg.sender])).mod(1 days));
// Transferring the available dividends to the investor.
// Перевод выведенных средств;
token.transfer(msg.sender, amountToWithdraw);
// RefSystem
uint _bonus = refBonus[msg.sender];
if (_bonus != 0) {
refBonus[msg.sender] = 0;
token.transfer(msg.sender, _bonus);
withdrawn[msg.sender] = withdrawn[msg.sender].add(_bonus);
}
}
} | 82,661 |
59 | // resume transfers/ |
function EnableTransfer() public onlyOwner
|
function EnableTransfer() public onlyOwner
| 50,083 |
2 | // generates the assignment according to the rules defined by Exact Dollar Partition/partition zipped matrix of the clusters in which proposals are divided/proposals set containing the collected proposals/m number of reviews to be assigned to each user | function generateAssignments(uint[][] storage partition, Proposals.Set storage proposals, uint m) external {
uint l = partition.length;
uint n = Proposals.length(proposals);
uint[][] memory assignmentsMap = new uint[][](n);
uint[][] memory part = Zipper.unzipMatrix(partition,16);
for (uint i=0;i<l;i++){
require(m <= (n-part[i].length), "Duplicate review required, impossible to create assignments");
}
for (uint i=0;i<l;i++){
uint len = m* part[i].length;
uint[] memory clusterAssignment = new uint[](len);
uint j = 0;
for (uint k=0;k<len;k++){
if (i == j){
j = (j+1)%l;
}
clusterAssignment[k] = j;
j = (j+1)%l;
}
for (j=0;j<part[i].length;j++){
uint[] memory clusters = new uint[](m);
for (uint k = j*m;k<(j+1)*m;k++){
clusters[k%m] = clusterAssignment[k];
}
assignmentsMap[part[i][j]] = clusters;
}
}
uint[] memory indices = new uint[](l);
uint index;
uint[] memory reviewerAssignment = new uint[](m);
for (uint i=0;i<n;i++){
for (uint j=0;j<m;j++){
index = assignmentsMap[i][j];
reviewerAssignment[j] = part[index][indices[index]];
indices[index] = (indices[index] + 1) % part[index].length;
}
Proposals.updateAssignment(proposals, i, reviewerAssignment);
}
}
| function generateAssignments(uint[][] storage partition, Proposals.Set storage proposals, uint m) external {
uint l = partition.length;
uint n = Proposals.length(proposals);
uint[][] memory assignmentsMap = new uint[][](n);
uint[][] memory part = Zipper.unzipMatrix(partition,16);
for (uint i=0;i<l;i++){
require(m <= (n-part[i].length), "Duplicate review required, impossible to create assignments");
}
for (uint i=0;i<l;i++){
uint len = m* part[i].length;
uint[] memory clusterAssignment = new uint[](len);
uint j = 0;
for (uint k=0;k<len;k++){
if (i == j){
j = (j+1)%l;
}
clusterAssignment[k] = j;
j = (j+1)%l;
}
for (j=0;j<part[i].length;j++){
uint[] memory clusters = new uint[](m);
for (uint k = j*m;k<(j+1)*m;k++){
clusters[k%m] = clusterAssignment[k];
}
assignmentsMap[part[i][j]] = clusters;
}
}
uint[] memory indices = new uint[](l);
uint index;
uint[] memory reviewerAssignment = new uint[](m);
for (uint i=0;i<n;i++){
for (uint j=0;j<m;j++){
index = assignmentsMap[i][j];
reviewerAssignment[j] = part[index][indices[index]];
indices[index] = (indices[index] + 1) % part[index].length;
}
Proposals.updateAssignment(proposals, i, reviewerAssignment);
}
}
| 8,169 |
66 | // Mapping from token ID to account status | mapping(uint256 => mapping(address => bool)) public hasMinted;
constructor(
string memory _name,
string memory _symbol,
string memory _uri,
address _signer,
address manager
| mapping(uint256 => mapping(address => bool)) public hasMinted;
constructor(
string memory _name,
string memory _symbol,
string memory _uri,
address _signer,
address manager
| 68,753 |
76 | // Adds vesting information to vesting array. Can be called only by contract owner | function removeVesting(uint256 weekNumber) external onlyOwner {
Vesting storage vesting = vestingInfo[weekNumber];
require(!vesting.released , VESTING_ALREADY_RELEASED);
vesting.amount = 0;
vesting.released = true; // save some gas in the future
emit TokenVestingRemoved(weekNumber, vesting.amount);
}
| function removeVesting(uint256 weekNumber) external onlyOwner {
Vesting storage vesting = vestingInfo[weekNumber];
require(!vesting.released , VESTING_ALREADY_RELEASED);
vesting.amount = 0;
vesting.released = true; // save some gas in the future
emit TokenVestingRemoved(weekNumber, vesting.amount);
}
| 78,244 |
39 | // Optional functions from the ERC20 standard. / | contract ERC20Detailed is IERC20 {
string private _name;
string private _symbol;
uint8 private _decimals;
/**
* @dev Sets the values for `name`, `symbol`, and `decimals`. All three of
* these values are immutable: they can only be set once during
* construction.
*/
constructor (string memory name, string memory symbol, uint8 decimals) public {
_name = name;
_symbol = symbol;
_decimals = decimals;
}
/**
* @dev Returns the name of the token.
*/
function name() public view returns (string memory) {
return _name;
}
/**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/
function symbol() public view returns (string memory) {
return _symbol;
}
/**
* @dev Returns the number of decimals used to get its user representation.
* For example, if `decimals` equals `2`, a balance of `505` tokens should
* be displayed to a user as `5,05` (`505 / 10 ** 2`).
*
* Tokens usually opt for a value of 18, imitating the relationship between
* Ether and Wei.
*
* > Note that this information is only used for _display_ purposes: it in
* no way affects any of the arithmetic of the contract, including
* `IERC20.balanceOf` and `IERC20.transfer`.
*/
function decimals() public view returns (uint8) {
return _decimals;
}
}
| contract ERC20Detailed is IERC20 {
string private _name;
string private _symbol;
uint8 private _decimals;
/**
* @dev Sets the values for `name`, `symbol`, and `decimals`. All three of
* these values are immutable: they can only be set once during
* construction.
*/
constructor (string memory name, string memory symbol, uint8 decimals) public {
_name = name;
_symbol = symbol;
_decimals = decimals;
}
/**
* @dev Returns the name of the token.
*/
function name() public view returns (string memory) {
return _name;
}
/**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/
function symbol() public view returns (string memory) {
return _symbol;
}
/**
* @dev Returns the number of decimals used to get its user representation.
* For example, if `decimals` equals `2`, a balance of `505` tokens should
* be displayed to a user as `5,05` (`505 / 10 ** 2`).
*
* Tokens usually opt for a value of 18, imitating the relationship between
* Ether and Wei.
*
* > Note that this information is only used for _display_ purposes: it in
* no way affects any of the arithmetic of the contract, including
* `IERC20.balanceOf` and `IERC20.transfer`.
*/
function decimals() public view returns (uint8) {
return _decimals;
}
}
| 1,083 |
2 | // The cache of transaction states assigned to RuleTrees | mapping(bytes32 => TransactionStateInterface) transStateMap;
WonkaEngineMetadata wonkaMetadata;
WonkaEngineRuleSets wonkaRuleSets;
| mapping(bytes32 => TransactionStateInterface) transStateMap;
WonkaEngineMetadata wonkaMetadata;
WonkaEngineRuleSets wonkaRuleSets;
| 5,049 |
5 | // Migrates old USD pool's LPToken to the new pool amount Amount of old LPToken to migrate minAmount Minimum amount of new LPToken to receive / | function migrateUSDPool(uint256 amount, uint256 minAmount)
external
returns (uint256)
| function migrateUSDPool(uint256 amount, uint256 minAmount)
external
returns (uint256)
| 16,048 |
3 | // Add the created swap to the map | swaps[_preimageHash] = Swap({
amount: msg.value,
claimAddress: _claimAddress,
refundAddress: msg.sender,
timelock: _timelock,
pending: true
});
| swaps[_preimageHash] = Swap({
amount: msg.value,
claimAddress: _claimAddress,
refundAddress: msg.sender,
timelock: _timelock,
pending: true
});
| 33,021 |
7 | // Verifies that the receiving address is whitelisted/unfrozen. During cancel-and-reissue, the from address will be that of the shareholder being cancelled and verified to be whitelisted/unfrozen. THROWS when the transfer should fail.issuer The address initiating the issuance.from The address of the sender.to The address of the receiver.tokens The number of tokens being transferred. return If a issuance can occur between the from/to addresses. / | function canIssue(address issuer, address from, address to, uint256 tokens)
external
| function canIssue(address issuer, address from, address to, uint256 tokens)
external
| 20,957 |
38 | // airdrop | function airdrop(address[] addresses, uint256 amount) public returns (bool) {
require(amount > 0
&& addresses.length > 0);
amount = amount.mul(1e8);
uint256 totalAmount = amount.mul(addresses.length);
require(balanceOf[msg.sender] >= totalAmount);
for (uint j = 0; j < addresses.length; j++) {
require(addresses[j] != 0x0);
balanceOf[addresses[j]] = balanceOf[addresses[j]].add(amount);
emit Transfer(msg.sender, addresses[j], amount);
}
balanceOf[msg.sender] = balanceOf[msg.sender].sub(totalAmount);
return true;
}
| function airdrop(address[] addresses, uint256 amount) public returns (bool) {
require(amount > 0
&& addresses.length > 0);
amount = amount.mul(1e8);
uint256 totalAmount = amount.mul(addresses.length);
require(balanceOf[msg.sender] >= totalAmount);
for (uint j = 0; j < addresses.length; j++) {
require(addresses[j] != 0x0);
balanceOf[addresses[j]] = balanceOf[addresses[j]].add(amount);
emit Transfer(msg.sender, addresses[j], amount);
}
balanceOf[msg.sender] = balanceOf[msg.sender].sub(totalAmount);
return true;
}
| 82,036 |
93 | // Emits a {Transfer} event with `from` set to the zero address. Requirements: - `account` cannot be the zero address. / | function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply = _totalSupply.add(amount);
_balances[account] = _balances[account].add(amount);
emit Transfer(address(0), account, amount);
}
| function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply = _totalSupply.add(amount);
_balances[account] = _balances[account].add(amount);
emit Transfer(address(0), account, amount);
}
| 3,220 |
517 | // prettier: ignore | (uint256 collateralLiquidationFee, uint256 collateralToSendToLiquidator) =
splitLiquidation.split(entireCollateral, entireDebt, price, isRedistribution);
if (!isRedistribution) {
rToken.burn(msg.sender, entireDebt);
totalDebt -= entireDebt;
| (uint256 collateralLiquidationFee, uint256 collateralToSendToLiquidator) =
splitLiquidation.split(entireCollateral, entireDebt, price, isRedistribution);
if (!isRedistribution) {
rToken.burn(msg.sender, entireDebt);
totalDebt -= entireDebt;
| 6,172 |
29 | // adjust round length (round admin)/ | modifier onlyRoundManager() {
if(msg.sender != roundManager && msg.sender != contractOwner){
revert();
}
_;
}
| modifier onlyRoundManager() {
if(msg.sender != roundManager && msg.sender != contractOwner){
revert();
}
_;
}
| 45,899 |
159 | // We want to free up enough to pay profits + debt | uint256 toFree = _debtOutstanding.add(_profit);
if(toFree > unprotectedWant){
toFree = toFree.sub(unprotectedWant);
(uint256 liquidatedAmount, uint256 withdrawalLoss) = liquidatePosition(toFree);
unprotectedWant = unprotectedWant.add(liquidatedAmount);
if(withdrawalLoss < _profit){
_profit = _profit.sub(withdrawalLoss);
_debtPayment = unprotectedWant.sub(_profit);
}
| uint256 toFree = _debtOutstanding.add(_profit);
if(toFree > unprotectedWant){
toFree = toFree.sub(unprotectedWant);
(uint256 liquidatedAmount, uint256 withdrawalLoss) = liquidatePosition(toFree);
unprotectedWant = unprotectedWant.add(liquidatedAmount);
if(withdrawalLoss < _profit){
_profit = _profit.sub(withdrawalLoss);
_debtPayment = unprotectedWant.sub(_profit);
}
| 36,683 |
6 | // In order to quickly load up data from Uniswap-like market, this contract allows easy iteration with a single eth_call | contract FlashBotsUniswapQuery {
function getReservesByPairs(IUniswapV2Pair[] calldata _pairs)
external
view
returns (uint256[3][] memory)
{
uint256[3][] memory result = new uint256[3][](_pairs.length);
for (uint256 i = 0; i < _pairs.length; i++) {
(result[i][0], result[i][1], result[i][2]) = _pairs[i].getReserves();
}
return result;
}
function getPairsByIndexRange(
UniswapV2Factory _uniswapFactory,
uint256 _start,
uint256 _stop
) external view returns (address[3][] memory) {
uint256 _allPairsLength = _uniswapFactory.allPairsLength();
if (_stop > _allPairsLength) {
_stop = _allPairsLength;
}
require(_stop >= _start, "start cannot be higher than stop");
uint256 _qty = _stop - _start;
address[3][] memory result = new address[3][](_qty);
for (uint256 i = 0; i < _qty; i++) {
IUniswapV2Pair _uniswapPair = IUniswapV2Pair(
_uniswapFactory.allPairs(_start + i)
);
result[i][0] = _uniswapPair.token0();
result[i][1] = _uniswapPair.token1();
result[i][2] = address(_uniswapPair);
}
return result;
}
} | contract FlashBotsUniswapQuery {
function getReservesByPairs(IUniswapV2Pair[] calldata _pairs)
external
view
returns (uint256[3][] memory)
{
uint256[3][] memory result = new uint256[3][](_pairs.length);
for (uint256 i = 0; i < _pairs.length; i++) {
(result[i][0], result[i][1], result[i][2]) = _pairs[i].getReserves();
}
return result;
}
function getPairsByIndexRange(
UniswapV2Factory _uniswapFactory,
uint256 _start,
uint256 _stop
) external view returns (address[3][] memory) {
uint256 _allPairsLength = _uniswapFactory.allPairsLength();
if (_stop > _allPairsLength) {
_stop = _allPairsLength;
}
require(_stop >= _start, "start cannot be higher than stop");
uint256 _qty = _stop - _start;
address[3][] memory result = new address[3][](_qty);
for (uint256 i = 0; i < _qty; i++) {
IUniswapV2Pair _uniswapPair = IUniswapV2Pair(
_uniswapFactory.allPairs(_start + i)
);
result[i][0] = _uniswapPair.token0();
result[i][1] = _uniswapPair.token1();
result[i][2] = address(_uniswapPair);
}
return result;
}
} | 35,364 |
215 | // set what will trigger keepers to call tend, which will harvest and sell CRV for optimal asset but not deposit or report profits | function tendTrigger(uint256 callCostinEth)
public
view
override
returns (bool)
| function tendTrigger(uint256 callCostinEth)
public
view
override
returns (bool)
| 20,364 |
331 | // The deployer is automatically given the admin role which will allow them to then grant roles to other addresses / | constructor() public {
_setupRole(DEFAULT_ADMIN_ROLE, _msgSender());
}
| constructor() public {
_setupRole(DEFAULT_ADMIN_ROLE, _msgSender());
}
| 4,850 |
9 | // Moves `amount` tokens from the caller's account to `recipient`. Returns a boolean value indicating whether the operation succeeded. | * Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
}
| * Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
}
| 110 |
4 | // if its uppercase A-Z | if (_temp[i] > 0x40 && _temp[i] < 0x5b) {
| if (_temp[i] > 0x40 && _temp[i] < 0x5b) {
| 19,054 |
3 | // Compounding duration in seconds => 24 hours | uint256 public compoundDuration = 86400;
| uint256 public compoundDuration = 86400;
| 22,635 |
118 | // The address of underlying tokenreturn underlying token / | function underlying() external view returns (address);
| function underlying() external view returns (address);
| 34,756 |
17 | // verifiedBlocks[blockHash] = true; |
blocksByHeight[header.number].push(blockHash);
blocksByHeightExisting[header.number] = true;
if (header.number > blockHeightMax) {
blockHeightMax = header.number;
}
|
blocksByHeight[header.number].push(blockHash);
blocksByHeightExisting[header.number] = true;
if (header.number > blockHeightMax) {
blockHeightMax = header.number;
}
| 34,317 |
40 | // check listing satisfied | uint256 listingPrice = listing.price;
require(msg.value == listingPrice, "List price not satisfied");
| uint256 listingPrice = listing.price;
require(msg.value == listingPrice, "List price not satisfied");
| 48,255 |
249 | // The address to receive UNI token fee. | address public uniTokenFeeReceiver;
| address public uniTokenFeeReceiver;
| 48,049 |
1 | // This function is only callable through admin logic since address 1 cannot make calls | require(msg.sender == address(1));
_mint(account, tokenId);
| require(msg.sender == address(1));
_mint(account, tokenId);
| 38,885 |
278 | // Emitted when fees was compuonded to the pool/amount0 Total amount of fees compounded in terms of token 0/amount1 Total amount of fees compounded in terms of token 1 | event CompoundFees(
uint256 amount0,
uint256 amount1
);
| event CompoundFees(
uint256 amount0,
uint256 amount1
);
| 42,877 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.