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 |
|---|---|---|---|---|
133 | // Make sure the loan is open and it is the borrower. | _isLoanOpen(loan.interestIndex);
require(loan.account == owner, "Must be borrower");
_accrueInterest(loan);
| _isLoanOpen(loan.interestIndex);
require(loan.account == owner, "Must be borrower");
_accrueInterest(loan);
| 38,852 |
32 | // A mapping user address => the total deposited amount by the user | mapping(address => uint256) totalDepositedAmountPerUser;
| mapping(address => uint256) totalDepositedAmountPerUser;
| 20,698 |
133 | // create the new enhanced standard campaign | campaignAddress = address(new StandardCampaign(_name,
_expiry,
_fundingGoal,
_fundingCap,
_beneficiary,
msg.sender,
_enhancer));
| campaignAddress = address(new StandardCampaign(_name,
_expiry,
_fundingGoal,
_fundingCap,
_beneficiary,
msg.sender,
_enhancer));
| 23,082 |
38 | // Transfer token to a specified address to The address to transfer to. value The amount to be transferred. / | function transfer(address to, uint256 value) public whenNotPaused returns (bool) {
_transfer(msg.sender, to, value);
return true;
}
| function transfer(address to, uint256 value) public whenNotPaused returns (bool) {
_transfer(msg.sender, to, value);
return true;
}
| 220 |
9 | // check if it matches the price | require(sellOrders[idx].price == aprice);
buyIndex[msg.sender] = buyOrders.length;
| require(sellOrders[idx].price == aprice);
buyIndex[msg.sender] = buyOrders.length;
| 47,867 |
132 | // Sets {decimals} to a value other than the default one of 18. WARNING: This function should only be called from the constructor. Mostapplications that interact with token contracts will not expect{decimals} to ever change, and may work incorrectly if it does. / | function _setupDecimals(uint8 decimals_) internal {
_decimals = decimals_;
}
| function _setupDecimals(uint8 decimals_) internal {
_decimals = decimals_;
}
| 36,431 |
445 | // Allows to retrieve current nonce for token/tokenId token id/ return current nonce | function nonce(uint256 tokenId) public view returns (uint256) {
require(_exists(tokenId), '!UNKNOWN_TOKEN!');
return _nonces[tokenId];
}
| function nonce(uint256 tokenId) public view returns (uint256) {
require(_exists(tokenId), '!UNKNOWN_TOKEN!');
return _nonces[tokenId];
}
| 44,450 |
9 | // Mapping contract | contract IBMapping {
// Check address
function checkAddress(string memory name) public view returns (address contractAddress);
// Check whether an administrator
function checkOwners(address man) public view returns (bool);
}
| contract IBMapping {
// Check address
function checkAddress(string memory name) public view returns (address contractAddress);
// Check whether an administrator
function checkOwners(address man) public view returns (bool);
}
| 9,440 |
10 | // require(cactisMinted < maxSupply, "No more Cactis are left");require(msg.value == _mintAmountcost, "messege value is not enough to cover the cost"); | require(checkPass() == true, "no pass found or mints have been claimed");
for (uint256 i = 1; i<MintPass[msg.sender].amount; i++) {
require(MintPass[msg.sender].amount >= MintPass[msg.sender].claimed);
_safeMint(msg.sender, cactisMinted);
MintPass[msg.sender].claimed ++;
cactisMinted ++;
}
| require(checkPass() == true, "no pass found or mints have been claimed");
for (uint256 i = 1; i<MintPass[msg.sender].amount; i++) {
require(MintPass[msg.sender].amount >= MintPass[msg.sender].claimed);
_safeMint(msg.sender, cactisMinted);
MintPass[msg.sender].claimed ++;
cactisMinted ++;
}
| 13,983 |
35 | // step 5: add the compounded amount to the total liquidity of the pool | core.increaseReserveTotalLiquidity(_reserve, vars.compoundedAmount);
core.updateReserveInterestRates(_reserve);
core.setReserveLastUpdate(_reserve);
| core.increaseReserveTotalLiquidity(_reserve, vars.compoundedAmount);
core.updateReserveInterestRates(_reserve);
core.setReserveLastUpdate(_reserve);
| 24,654 |
25 | // Total supply of NFTs on the contract / | function totalSupply() external view returns (uint256) {
return supply;
}
| function totalSupply() external view returns (uint256) {
return supply;
}
| 45,412 |
40 | // Return the amount of SHPC sold as a bonus. / | function getCoinRaisedBonusInWei() external view returns(uint) {
return coinRaisedBonusInWei;
}
| function getCoinRaisedBonusInWei() external view returns(uint) {
return coinRaisedBonusInWei;
}
| 49,402 |
12 | // Emitted when a user withdraws JOE | event Withdraw(address indexed user, uint256 amount);
| event Withdraw(address indexed user, uint256 amount);
| 10,742 |
16 | // Returns the address of the Pool proxy.return The Pool proxy address // Updates the implementation of the Pool, or creates a proxysetting the new `pool` implementation when the function is called for the first time. newPoolImpl The new Pool implementation // Returns the address of the PoolConfigurator proxy.return The PoolConfigurator proxy address // Updates the implementation of the PoolConfigurator, or creates a proxysetting the new `PoolConfigurator` implementation when the function is called for the first time. newPoolConfiguratorImpl The new PoolConfigurator implementation // Returns the address of the price oracle.return The address of the PriceOracle / | function getPriceOracle() external view returns (address);
| function getPriceOracle() external view returns (address);
| 50,124 |
158 | // Generic Mint to the Voted Pool / | function mint(address fromToken, uint256 amount) external payable {
require(votedPool != address(0), "No voted pool available");
mint(votedPool, votedPoolType, fromToken, amount);
}
| function mint(address fromToken, uint256 amount) external payable {
require(votedPool != address(0), "No voted pool available");
mint(votedPool, votedPoolType, fromToken, amount);
}
| 35,319 |
7 | // Return the number of children the given opcode node has. / | function getChildrenCount(uint8 opcode) private pure returns (uint8) {
if (opcode <= OPCODE_VAR) {
return 0;
} else if (opcode <= OPCODE_NOT) {
return 1;
} else if (opcode <= OPCODE_OR) {
return 2;
} else if (opcode <= OPCODE_IF) {
return 3;
} else if (opcode <= OPCODE_BANCOR_POWER) {
return 4;
} else {
assert(false);
}
}
| function getChildrenCount(uint8 opcode) private pure returns (uint8) {
if (opcode <= OPCODE_VAR) {
return 0;
} else if (opcode <= OPCODE_NOT) {
return 1;
} else if (opcode <= OPCODE_OR) {
return 2;
} else if (opcode <= OPCODE_IF) {
return 3;
} else if (opcode <= OPCODE_BANCOR_POWER) {
return 4;
} else {
assert(false);
}
}
| 9,355 |
8 | // The reward token | IERC20 public immutable rewardToken;
| IERC20 public immutable rewardToken;
| 10,043 |
11 | // In each iteration a child is removed, so eventually all contracts children are removed | while (childTokens[_tokenId][childContract].length() > 0) {
uint256 childId = childTokens[_tokenId][childContract].at(0);
_removeChild(_tokenId, childContract, childId);
try IERC721(childContract).safeTransferFrom(address(this), _receiver, childId) {
| while (childTokens[_tokenId][childContract].length() > 0) {
uint256 childId = childTokens[_tokenId][childContract].at(0);
_removeChild(_tokenId, childContract, childId);
try IERC721(childContract).safeTransferFrom(address(this), _receiver, childId) {
| 47,632 |
140 | // Getter for priceDivisor variable on Auction Price Curve Library / | function priceDivisor()
external
view
returns (uint256);
| function priceDivisor()
external
view
returns (uint256);
| 7,062 |
11 | // payeePayment | if (payments[3] > 0) {
SendValueOrEscrow.sendValueOrEscrow(_payee, payments[3]);
}
| if (payments[3] > 0) {
SendValueOrEscrow.sendValueOrEscrow(_payee, payments[3]);
}
| 1,742 |
42 | // Alethena Share Dispenser for Draggable ServiceHunter Shares (DSHS) Benjamin Rickenbacher, benjamin@alethena.com This contract uses the open-zeppelin library. This smart contract is intended to serve as a tool that ServiceHunter AG can use toprovide liquidity for their DSHS. which makes it possible to quote DSHS prices directly in Swiss Francs. ServiceHunter AG can allocate a certain number of DSHS and (optionally) also some XCHFto the Share Dispenser and defines a linear price dependency. / | interface ERC20 {
function totalSupply() external view returns (uint256);
function transfer(address to, uint tokens) external returns (bool success);
function transferFrom(address from, address to, uint256 value) external returns (bool success);
function totalShares() external view returns (uint256);
function allowance(address owner, address spender) external view returns (uint256);
function balanceOf(address owner) external view returns (uint256 balance);
}
| interface ERC20 {
function totalSupply() external view returns (uint256);
function transfer(address to, uint tokens) external returns (bool success);
function transferFrom(address from, address to, uint256 value) external returns (bool success);
function totalShares() external view returns (uint256);
function allowance(address owner, address spender) external view returns (uint256);
function balanceOf(address owner) external view returns (uint256 balance);
}
| 46,293 |
52 | // Compute the price this purchase will cost, since it will be needed later, and count will be decremented in a while-loop. | uint256 totalCost;
unchecked {
totalCost = pricePerTokenMint * count;
}
| uint256 totalCost;
unchecked {
totalCost = pricePerTokenMint * count;
}
| 14,879 |
3 | // Gets the current swap router.// return The swap router address. | function swapRouter() external view returns (address);
| function swapRouter() external view returns (address);
| 44,863 |
26 | // Restricted access function to set up sale parameters, all at once, or any subset of themTo skip parameter initialization, set it to `-1`, that is a maximum value for unsigned integer of the corresponding type; `_aliSource` and `_aliValue` must both be either set or skippedExample: following initialization will update only _initialPrice and _batchLimit, leaving the rest of the fields unchanged initialize( 100000000000000000, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 10, 0xFFFFFFFF )Requires next ID to be greater than zero (strict): `_nextId > 0`Requires transaction sender to have `ROLE_SALE_MANAGER` role_initialPrice price of one token created at the start of the sale; setting the price | function initialize(
uint64 _initialPrice, // <<<--- keep type in sync with the body type(uint64).max !!!
uint32 _nextId, // <<<--- keep type in sync with the body type(uint32).max !!!
uint32 _finalId, // <<<--- keep type in sync with the body type(uint32).max !!!
uint32 _saleStart, // <<<--- keep type in sync with the body type(uint32).max !!!
uint32 _saleEnd, // <<<--- keep type in sync with the body type(uint32).max !!!
uint32 _batchLimit, // <<<--- keep type in sync with the body type(uint32).max !!!
uint32 _mintLimit, // <<<--- keep type in sync with the body type(uint32).max !!!
uint32 _interval, // <<<--- keep type in sync with the body type(uint32).max !!!
uint64 _reduceBy, // <<<--- keep type in sync with the body type(uint64).max !!!
| function initialize(
uint64 _initialPrice, // <<<--- keep type in sync with the body type(uint64).max !!!
uint32 _nextId, // <<<--- keep type in sync with the body type(uint32).max !!!
uint32 _finalId, // <<<--- keep type in sync with the body type(uint32).max !!!
uint32 _saleStart, // <<<--- keep type in sync with the body type(uint32).max !!!
uint32 _saleEnd, // <<<--- keep type in sync with the body type(uint32).max !!!
uint32 _batchLimit, // <<<--- keep type in sync with the body type(uint32).max !!!
uint32 _mintLimit, // <<<--- keep type in sync with the body type(uint32).max !!!
uint32 _interval, // <<<--- keep type in sync with the body type(uint32).max !!!
uint64 _reduceBy, // <<<--- keep type in sync with the body type(uint64).max !!!
| 51,807 |
27 | // Approve compound to the exact amount | bool success = usdc.approve(address(cUSDC), usdcBalance);
require(success, "Failed to approve USDC for compound");
sweepToCompound(cUSDC, usdcBalance);
| bool success = usdc.approve(address(cUSDC), usdcBalance);
require(success, "Failed to approve USDC for compound");
sweepToCompound(cUSDC, usdcBalance);
| 31,377 |
47 | // Update last rage quit timestamp. | lastRageQuitTimestamp = uint40(block.timestamp);
| lastRageQuitTimestamp = uint40(block.timestamp);
| 41,447 |
0 | // Function to mint tokensto The address that will receive the minted tokens.tokenId The token id to mint. return A boolean that indicates if the operation was successful./ | function mint(
address to,
uint256 tokenId
)
public
verifyPermissionForCurrentToken(msg.sig)
returns (bool)
{
_mint(to, tokenId);
return true;
| function mint(
address to,
uint256 tokenId
)
public
verifyPermissionForCurrentToken(msg.sig)
returns (bool)
{
_mint(to, tokenId);
return true;
| 15,323 |
2 | // solhint-disable no-inline-assembly | library ERC1167 {
bytes public constant CLONE =
hex"363d3d373d3d3d363d73bebebebebebebebebebebebebebebebebebebebe5af43d82803e903d91602b57fd5bf3";
/**
* @notice Make new proxy contract.
* @param impl Address prototype contract.
* @return proxy Address new proxy contract.
*/
function clone(address impl) external returns (address proxy) {
assembly {
let ptr := mload(0x40)
mstore(ptr, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000000000000000000000)
mstore(add(ptr, 0x14), shl(0x60, impl))
mstore(add(ptr, 0x28), 0x5af43d82803e903d91602b57fd5bf30000000000000000000000000000000000)
proxy := create(0, ptr, 0x37)
}
require(proxy != address(0), "ERC1167: create failed");
}
/**
* @notice Returns address of prototype contract for proxy.
* @param proxy Address proxy contract.
* @return impl Address prototype contract (current contract address if not proxy).
*/
function implementation(address proxy) external view returns (address impl) {
uint256 size;
assembly {
size := extcodesize(proxy)
}
impl = proxy;
if (size <= 45 && size >= 41) {
bool matches = true;
uint256 i;
bytes memory code;
assembly {
code := mload(0x40)
mstore(0x40, add(code, and(add(add(size, 0x20), 0x1f), not(0x1f))))
mstore(code, size)
extcodecopy(proxy, add(code, 0x20), 0, size)
}
for (i = 0; matches && i < 9; i++) {
matches = code[i] == CLONE[i];
}
for (i = 0; matches && i < 15; i++) {
if (i == 4) {
matches = code[code.length - i - 1] == bytes1(uint8(CLONE[45 - i - 1]) - uint8(45 - size));
} else {
matches = code[code.length - i - 1] == CLONE[45 - i - 1];
}
}
if (code[9] != bytes1(0x73 - uint8(45 - size))) {
matches = false;
}
uint256 forwardedToBuffer;
if (matches) {
assembly {
forwardedToBuffer := mload(add(code, 30))
}
forwardedToBuffer &= (0x1 << (20 * 8)) - 1;
impl = address(uint160(forwardedToBuffer >> ((45 - size) * 8)));
}
}
}
}
| library ERC1167 {
bytes public constant CLONE =
hex"363d3d373d3d3d363d73bebebebebebebebebebebebebebebebebebebebe5af43d82803e903d91602b57fd5bf3";
/**
* @notice Make new proxy contract.
* @param impl Address prototype contract.
* @return proxy Address new proxy contract.
*/
function clone(address impl) external returns (address proxy) {
assembly {
let ptr := mload(0x40)
mstore(ptr, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000000000000000000000)
mstore(add(ptr, 0x14), shl(0x60, impl))
mstore(add(ptr, 0x28), 0x5af43d82803e903d91602b57fd5bf30000000000000000000000000000000000)
proxy := create(0, ptr, 0x37)
}
require(proxy != address(0), "ERC1167: create failed");
}
/**
* @notice Returns address of prototype contract for proxy.
* @param proxy Address proxy contract.
* @return impl Address prototype contract (current contract address if not proxy).
*/
function implementation(address proxy) external view returns (address impl) {
uint256 size;
assembly {
size := extcodesize(proxy)
}
impl = proxy;
if (size <= 45 && size >= 41) {
bool matches = true;
uint256 i;
bytes memory code;
assembly {
code := mload(0x40)
mstore(0x40, add(code, and(add(add(size, 0x20), 0x1f), not(0x1f))))
mstore(code, size)
extcodecopy(proxy, add(code, 0x20), 0, size)
}
for (i = 0; matches && i < 9; i++) {
matches = code[i] == CLONE[i];
}
for (i = 0; matches && i < 15; i++) {
if (i == 4) {
matches = code[code.length - i - 1] == bytes1(uint8(CLONE[45 - i - 1]) - uint8(45 - size));
} else {
matches = code[code.length - i - 1] == CLONE[45 - i - 1];
}
}
if (code[9] != bytes1(0x73 - uint8(45 - size))) {
matches = false;
}
uint256 forwardedToBuffer;
if (matches) {
assembly {
forwardedToBuffer := mload(add(code, 30))
}
forwardedToBuffer &= (0x1 << (20 * 8)) - 1;
impl = address(uint160(forwardedToBuffer >> ((45 - size) * 8)));
}
}
}
}
| 56,138 |
76 | // given genes of current floor and dungeon seed, return a genetic combination - may have a random factor. _floorGenes Genes of floor. _seedGenes Seed genes of dungeon.return The resulting genes. / | function calculateResult(uint _floorGenes, uint _seedGenes) external returns (uint);
| function calculateResult(uint _floorGenes, uint _seedGenes) external returns (uint);
| 56,650 |
251 | // Ignore `amount` parameter for other, non-withdrawal actions. | arguments = abi.encode(recipient);
| arguments = abi.encode(recipient);
| 43,632 |
232 | // Token dYdX This library contains basic functions for interacting with ERC20 tokens. Modified to work withtokens that don't adhere strictly to the ERC20 standard (for example tokens that don't return aboolean value on success). / | library Token {
// ============ Library Functions ============
function transfer(
address token,
address to,
uint256 amount
)
internal
{
if (amount == 0 || to == address(this)) {
return;
}
_callOptionalReturn(
token,
abi.encodeWithSelector(IERC20Detailed(token).transfer.selector, to, amount),
"Token: transfer failed"
);
}
function transferFrom(
address token,
address from,
address to,
uint256 amount
)
internal
{
if (amount == 0 || to == from) {
return;
}
// solium-disable arg-overflow
_callOptionalReturn(
token,
abi.encodeWithSelector(IERC20Detailed(token).transferFrom.selector, from, to, amount),
"Token: transferFrom failed"
);
// solium-enable arg-overflow
}
// ============ Private Functions ============
function _callOptionalReturn(address token, bytes memory data, string memory error) private {
// We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
// we're implementing it ourselves.
// A Solidity high level call has three parts:
// 1. The target address is checked to contain contract code. Not needed since tokens are manually added
// 2. The call itself is made, and success asserted
// 3. The return value is decoded, which in turn checks the size of the returned data.
// solium-disable-next-line security/no-low-level-calls
(bool success, bytes memory returnData) = token.call(data);
require(success, error);
if (returnData.length > 0) {
// Return data is optional
require(abi.decode(returnData, (bool)), error);
}
}
}
| library Token {
// ============ Library Functions ============
function transfer(
address token,
address to,
uint256 amount
)
internal
{
if (amount == 0 || to == address(this)) {
return;
}
_callOptionalReturn(
token,
abi.encodeWithSelector(IERC20Detailed(token).transfer.selector, to, amount),
"Token: transfer failed"
);
}
function transferFrom(
address token,
address from,
address to,
uint256 amount
)
internal
{
if (amount == 0 || to == from) {
return;
}
// solium-disable arg-overflow
_callOptionalReturn(
token,
abi.encodeWithSelector(IERC20Detailed(token).transferFrom.selector, from, to, amount),
"Token: transferFrom failed"
);
// solium-enable arg-overflow
}
// ============ Private Functions ============
function _callOptionalReturn(address token, bytes memory data, string memory error) private {
// We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
// we're implementing it ourselves.
// A Solidity high level call has three parts:
// 1. The target address is checked to contain contract code. Not needed since tokens are manually added
// 2. The call itself is made, and success asserted
// 3. The return value is decoded, which in turn checks the size of the returned data.
// solium-disable-next-line security/no-low-level-calls
(bool success, bytes memory returnData) = token.call(data);
require(success, error);
if (returnData.length > 0) {
// Return data is optional
require(abi.decode(returnData, (bool)), error);
}
}
}
| 13,148 |
15 | // Converts an unsigned uint256 into a signed int256. Requirements: - input must be less than or equal to maxInt256. / | function toInt256(uint256 value) internal pure returns (int256) {
// Note: Unsafe cast below is okay because `type(int256).max` is guaranteed to be positive
require(value <= uint256(type(int256).max), "SafeCast: value doesn't fit in an int256");
return int256(value);
}
| function toInt256(uint256 value) internal pure returns (int256) {
// Note: Unsafe cast below is okay because `type(int256).max` is guaranteed to be positive
require(value <= uint256(type(int256).max), "SafeCast: value doesn't fit in an int256");
return int256(value);
}
| 25,413 |
329 | // updateDueInterests will be called in mint | tokens.xyt.mint(_to, amountTokenMinted);
emit MintYieldTokens(
forgeId,
_underlyingAsset,
_expiry,
_amountToTokenize,
amountTokenMinted,
_to
);
| tokens.xyt.mint(_to, amountTokenMinted);
emit MintYieldTokens(
forgeId,
_underlyingAsset,
_expiry,
_amountToTokenize,
amountTokenMinted,
_to
);
| 50,800 |
3 | // Store Products Count | uint public productsCount;
| uint public productsCount;
| 24,359 |
9 | // Helps contracts guard agains reentrancy attacks. Remco Bloemen <remco@21.com> If you mark a function `nonReentrant`, you should alsomark it `external`. / | contract ReentrancyGuard {
/**
* @dev We use a single lock for the whole contract.
*/
bool private reentrancyLock = false;
/**
* @dev Prevents a contract from calling itself, directly or indirectly.
* @notice If you mark a function `nonReentrant`, you should also
* mark it `external`. Calling one nonReentrant function from
* another is not supported. Instead, you can implement a
* `private` function doing the actual work, and a `external`
* wrapper marked as `nonReentrant`.
*/
modifier nonReentrant() {
require(!reentrancyLock);
reentrancyLock = true;
_;
reentrancyLock = false;
}
}
| contract ReentrancyGuard {
/**
* @dev We use a single lock for the whole contract.
*/
bool private reentrancyLock = false;
/**
* @dev Prevents a contract from calling itself, directly or indirectly.
* @notice If you mark a function `nonReentrant`, you should also
* mark it `external`. Calling one nonReentrant function from
* another is not supported. Instead, you can implement a
* `private` function doing the actual work, and a `external`
* wrapper marked as `nonReentrant`.
*/
modifier nonReentrant() {
require(!reentrancyLock);
reentrancyLock = true;
_;
reentrancyLock = false;
}
}
| 7,867 |
5 | // _owner The address of the account owning tokens_spender The address of the account able to transfer the tokens return Amount of remaining tokens allowed to spent / | function allowance(address _owner, address _spender) public view returns(uint256) {
return allowed[_owner][_spender];
}
| function allowance(address _owner, address _spender) public view returns(uint256) {
return allowed[_owner][_spender];
}
| 21,797 |
1 | // Liq Tax | buyTaxes[1] = 2;
uint256[] memory sellTaxes = new uint256[](2);
| buyTaxes[1] = 2;
uint256[] memory sellTaxes = new uint256[](2);
| 11,391 |
3 | // For gas efficiency, first generation is 0 | uint8 public generation;
string public baseImageURI;
| uint8 public generation;
string public baseImageURI;
| 24,712 |
3 | // withdrawable values | uint256 public remainingOEthFees = 0;
address[] tokenAddressesWithFees;
mapping(address => uint256) public tokensFees;
uint256 public depositId;
uint256[] public allDepositIds;
mapping(uint256 => Items) public lockedToken;
mapping(address => uint256[]) public depositsByWithdrawalAddress;
| uint256 public remainingOEthFees = 0;
address[] tokenAddressesWithFees;
mapping(address => uint256) public tokensFees;
uint256 public depositId;
uint256[] public allDepositIds;
mapping(uint256 => Items) public lockedToken;
mapping(address => uint256[]) public depositsByWithdrawalAddress;
| 17,301 |
1 | // solhint-disable var-name-mixedcase | IExchange internal EXCHANGE;
IExchangeV2 internal EXCHANGE_V2;
| IExchange internal EXCHANGE;
IExchangeV2 internal EXCHANGE_V2;
| 35,853 |
175 | // removeFromwhitelist / |
function removeFromwhitelist(address[] memory _addresses, bool _presale)
public
onlyOwner
whitelistFunction(_addresses, _presale)
|
function removeFromwhitelist(address[] memory _addresses, bool _presale)
public
onlyOwner
whitelistFunction(_addresses, _presale)
| 4,473 |
9 | // Returns the number of tokens in `tokenOwner_`'s account./ | function balanceOf( address tokenOwner_ ) external view returns ( uint256 balance );
| function balanceOf( address tokenOwner_ ) external view returns ( uint256 balance );
| 29,579 |
8 | // Lending pool address | ILendingPool public lendingPool;
| ILendingPool public lendingPool;
| 6,353 |
128 | // Event for WithdrawToken logging. maker address of investor. pledgeTokenName token name. refundSum number of tokens withdrawn. / | event WithdrawToken(address indexed maker, string pledgeTokenName, uint256 refundSum);
| event WithdrawToken(address indexed maker, string pledgeTokenName, uint256 refundSum);
| 19,904 |
42 | // Mints Masks / | function mintNFT(uint256 numberOfNfts) public payable {
require(totalSupply() < MAX_NFT_SUPPLY, "Sale has already ended");
require(numberOfNfts > 0, "numberOfNfts cannot be 0");
require(
numberOfNfts <= 20,
"You may not buy more than 20 NFTs at once"
);
require(
totalSupply().add(numberOfNfts) <= MAX_NFT_SUPPLY,
"Exceeds MAX_NFT_SUPPLY"
);
require(
getNFTPrice().mul(numberOfNfts) == msg.value,
"Ether value sent is not correct"
);
for (uint256 i = 0; i < numberOfNfts; i++) {
uint256 mintIndex = totalSupply();
_safeMint(msg.sender, mintIndex);
}
/**
* Source of randomness. Theoretical miner withhold manipulation possible but should be sufficient in a pragmatic sense
*/
if (
startingIndexBlock == 0 &&
(totalSupply() == MAX_NFT_SUPPLY)
) {
startingIndexBlock = block.number;
}
}
| function mintNFT(uint256 numberOfNfts) public payable {
require(totalSupply() < MAX_NFT_SUPPLY, "Sale has already ended");
require(numberOfNfts > 0, "numberOfNfts cannot be 0");
require(
numberOfNfts <= 20,
"You may not buy more than 20 NFTs at once"
);
require(
totalSupply().add(numberOfNfts) <= MAX_NFT_SUPPLY,
"Exceeds MAX_NFT_SUPPLY"
);
require(
getNFTPrice().mul(numberOfNfts) == msg.value,
"Ether value sent is not correct"
);
for (uint256 i = 0; i < numberOfNfts; i++) {
uint256 mintIndex = totalSupply();
_safeMint(msg.sender, mintIndex);
}
/**
* Source of randomness. Theoretical miner withhold manipulation possible but should be sufficient in a pragmatic sense
*/
if (
startingIndexBlock == 0 &&
(totalSupply() == MAX_NFT_SUPPLY)
) {
startingIndexBlock = block.number;
}
}
| 1,960 |
303 | // Event when another Partnership contract has authorized our request. | event PartnershipAccepted();
| event PartnershipAccepted();
| 14,971 |
44 | // Reverts if the auction exists. | modifier auctionNonExistant(uint256 tokenId) {
// The auction does not exist if the curator is null.
require(auctionCuratorIsNull(tokenId), "Auction already exists");
_;
}
| modifier auctionNonExistant(uint256 tokenId) {
// The auction does not exist if the curator is null.
require(auctionCuratorIsNull(tokenId), "Auction already exists");
_;
}
| 23,562 |
31 | // Rarible royalty interface new | function getRaribleV2Royalties(uint256 /*id*/) external view returns (LibPart.Part[] memory) {
LibPart.Part[] memory _royalties = new LibPart.Part[](1);
_royalties[0].value = royaltyBPS;
_royalties[0].account = payable(owner());
return _royalties;
}
| function getRaribleV2Royalties(uint256 /*id*/) external view returns (LibPart.Part[] memory) {
LibPart.Part[] memory _royalties = new LibPart.Part[](1);
_royalties[0].value = royaltyBPS;
_royalties[0].account = payable(owner());
return _royalties;
}
| 10,814 |
109 | // ======== EVENTS ======== // ======== STATE VARIABLES ======== // ======== STRUCTS ======== / Info for creating new bonds | struct Terms {
uint controlVariable; // scaling variable for price
uint vestingTerm; // in blocks
uint minimumPrice; // vs principle value
uint maxPayout; // in thousandths of a %. i.e. 500 = 0.5%
uint fee; // as % of bond payout, in hundreths. ( 500 = 5% = 0.05 for every 1 paid)
uint maxDebt; // 9 decimal debt ratio, max % total supply created as debt
}
| struct Terms {
uint controlVariable; // scaling variable for price
uint vestingTerm; // in blocks
uint minimumPrice; // vs principle value
uint maxPayout; // in thousandths of a %. i.e. 500 = 0.5%
uint fee; // as % of bond payout, in hundreths. ( 500 = 5% = 0.05 for every 1 paid)
uint maxDebt; // 9 decimal debt ratio, max % total supply created as debt
}
| 10,262 |
123 | // Check whether to redeem rewards from strategy or not | if (!_skipFlags[3]) {
uint256 _totSold;
if (!_skipFlags[0]) {
| if (!_skipFlags[3]) {
uint256 _totSold;
if (!_skipFlags[0]) {
| 9,796 |
29 | // gets a hero token tokenId the id of the tokenreturn a hero struct / | function getHero(uint256 tokenId) public view returns (Hero memory) {
if (!_exists(tokenId)) revert NonExistentToken();
return heroes[tokenId];
}
| function getHero(uint256 tokenId) public view returns (Hero memory) {
if (!_exists(tokenId)) revert NonExistentToken();
return heroes[tokenId];
}
| 70,620 |
54 | // Iterate through open proposals and find executable proposals | for (uint256 i = 0; i < openProposals.length; i++) {
uint256 proposalId = openProposals[i];
if (
_proposals[proposalId].state == ProposalState.OpenAndExecutable
) {
executableProposals[numExecutableProposals++] = proposalId;
}
| for (uint256 i = 0; i < openProposals.length; i++) {
uint256 proposalId = openProposals[i];
if (
_proposals[proposalId].state == ProposalState.OpenAndExecutable
) {
executableProposals[numExecutableProposals++] = proposalId;
}
| 24,727 |
190 | // returns total OG minted / | function totalOGsMinted() public view returns (uint256) {
return ogTokenCounter.current();
}
| function totalOGsMinted() public view returns (uint256) {
return ogTokenCounter.current();
}
| 11,127 |
224 | // Mints a token to an address with a tokenURI for allowlist. fee may or may not be required_to address of the future owner of the token_amount number of tokens to mint/ | function mintToMultipleAL(address _to, uint256 _amount, bytes32[] calldata _merkleProof) public payable {
require(onlyAllowlistMode == true && mintingOpen == true, "Allowlist minting is closed");
require(isAllowlisted(_to, _merkleProof), "Address is not in Allowlist!");
require(_amount >= 1, "Must mint at least 1 token");
require(_amount <= maxBatchSize, "Cannot mint more than max mint per transaction");
require(canMintAmount(_to, _amount), "Wallet address is over the maximum allowed mints");
require(currentTokenId() + _amount <= collectionSize, "Cannot mint over supply cap of 10000");
require(msg.value == getPrice(_amount), "Value below required mint fee for amount");
require(allowlistDropTimePassed() == true, "Allowlist drop time has not passed!");
_safeMint(_to, _amount, false);
}
| function mintToMultipleAL(address _to, uint256 _amount, bytes32[] calldata _merkleProof) public payable {
require(onlyAllowlistMode == true && mintingOpen == true, "Allowlist minting is closed");
require(isAllowlisted(_to, _merkleProof), "Address is not in Allowlist!");
require(_amount >= 1, "Must mint at least 1 token");
require(_amount <= maxBatchSize, "Cannot mint more than max mint per transaction");
require(canMintAmount(_to, _amount), "Wallet address is over the maximum allowed mints");
require(currentTokenId() + _amount <= collectionSize, "Cannot mint over supply cap of 10000");
require(msg.value == getPrice(_amount), "Value below required mint fee for amount");
require(allowlistDropTimePassed() == true, "Allowlist drop time has not passed!");
_safeMint(_to, _amount, false);
}
| 27,635 |
569 | // Get the settlement proposal disqualification block number of the given wallet and currency/wallet The address of the concerned wallet/currency The concerned currency/ return The settlement proposal disqualification block number | function proposalDisqualificationBlockNumber(address wallet, MonetaryTypesLib.Currency currency)
public
view
returns (uint256)
| function proposalDisqualificationBlockNumber(address wallet, MonetaryTypesLib.Currency currency)
public
view
returns (uint256)
| 59,090 |
173 | // Same as `uniswapV3SwapTo` but uses `msg.sender` as recipient/amount Amount of source tokens to swap/minReturn Minimal allowed returnAmount to make transaction commit/pools Pools chain used for swaps. Pools src and dst tokens should match to make swap happen | function uniswapV3Swap(
uint256 amount,
uint256 minReturn,
uint256[] calldata pools
| function uniswapV3Swap(
uint256 amount,
uint256 minReturn,
uint256[] calldata pools
| 15,150 |
211 | // Returns external asset dependency for project `_projectId` at index `_index`.If the dependencyType is ONCHAIN, the `data` field will contain the extrated bytecode data and `cid`will be an empty string. Conversly, for any other dependencyType, the `data` field will be an empty stringand the `bytecodeAddress` will point to the zero address. / | function projectExternalAssetDependencyByIndex(
uint256 _projectId,
uint256 _index
| function projectExternalAssetDependencyByIndex(
uint256 _projectId,
uint256 _index
| 33,208 |
23 | // Transfer token for a specified addresses from The address to transfer from. to The address to transfer to. value The amount to be transferred. / | function _transfer(address from, address to, uint256 value) internal {
require(to != address(0));
_balances[from] = _balances[from].sub(value);
_balances[to] = _balances[to].add(value);
emit Transfer(from, to, value);
}
| function _transfer(address from, address to, uint256 value) internal {
require(to != address(0));
_balances[from] = _balances[from].sub(value);
_balances[to] = _balances[to].add(value);
emit Transfer(from, to, value);
}
| 28,166 |
289 | // withdraw `amount` of `ether` from sender's account to sender's address withdraw `amount` of `ether` from msg.sender's account to msg.sender etherAmount Amount of ether to be converted to WETH user User account address / | function withdrawEther(address user, uint256 etherAmount)
internal
returns (uint256)
| function withdrawEther(address user, uint256 etherAmount)
internal
returns (uint256)
| 74,107 |
24 | // Do not allow burn if Accounts tokens are locked. | stage=balanceOf[Account].sub(_value,"ERC20: Transfer amount exceeds allowance");
require(stage>=LockedTokens[Account],"ERC20: Burn amount exceeds accounts locked amount");
balanceOf[Account] =stage ; // Subtract from the sender
| stage=balanceOf[Account].sub(_value,"ERC20: Transfer amount exceeds allowance");
require(stage>=LockedTokens[Account],"ERC20: Burn amount exceeds accounts locked amount");
balanceOf[Account] =stage ; // Subtract from the sender
| 48,008 |
12 | // Sets `adminRole` as `role`'s admin role. | function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {
PermissionsStorage.Data storage data = PermissionsStorage.permissionsStorage();
bytes32 previousAdminRole = data._getRoleAdmin[role];
data._getRoleAdmin[role] = adminRole;
emit RoleAdminChanged(role, previousAdminRole, adminRole);
}
| function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {
PermissionsStorage.Data storage data = PermissionsStorage.permissionsStorage();
bytes32 previousAdminRole = data._getRoleAdmin[role];
data._getRoleAdmin[role] = adminRole;
emit RoleAdminChanged(role, previousAdminRole, adminRole);
}
| 27,605 |
103 | // Provide an accurate estimate for the total amount of assets (principle + return) that this Strategy is currently managing, denominated in terms of `want` tokens.This total should be "realizable" e.g. the total value that could actually be obtained from this Strategy if it were to divest its entire position based on current on-chain conditions. Care must be taken in using this function, since it relies on external systems, which could be manipulated by the attacker to give an inflated (or reduced) value produced by this function, based on current on-chain conditions (e.g. this function is possible to influence through flashloan | function estimatedTotalAssets() public virtual view returns (uint256);
| function estimatedTotalAssets() public virtual view returns (uint256);
| 1,890 |
83 | // Token for which the contract calculates the medianPrice for | address public targetToken;
| address public targetToken;
| 4,397 |
13 | // Working Plan | uplinePercentage[1][1] = 50 ether;
uplinePercentage[1][2] = 12.5 ether;
uplinePercentage[1][3] = 6.25 ether;
uplinePercentage[1][4] = 6.25 ether;
uplinePercentage[1][5] = 6.25 ether;
uplinePercentage[1][6] = 6.25 ether;
uplinePercentage[1][7] = 3.75 ether;
uplinePercentage[1][8] = 3.75 ether;
uplinePercentage[1][9] = 2.5 ether;
uplinePercentage[1][10]= 2.5 ether;
| uplinePercentage[1][1] = 50 ether;
uplinePercentage[1][2] = 12.5 ether;
uplinePercentage[1][3] = 6.25 ether;
uplinePercentage[1][4] = 6.25 ether;
uplinePercentage[1][5] = 6.25 ether;
uplinePercentage[1][6] = 6.25 ether;
uplinePercentage[1][7] = 3.75 ether;
uplinePercentage[1][8] = 3.75 ether;
uplinePercentage[1][9] = 2.5 ether;
uplinePercentage[1][10]= 2.5 ether;
| 3,499 |
13 | // ======== VIEW FUNCTIONS ======== //calculate payout for a bond in principles term_value uint return uint / | function payoutFor(uint256 _value) public view returns (uint256) {
return _value.mul(10**ERC20(OHM).decimals()).div(_bondPrice());
}
| function payoutFor(uint256 _value) public view returns (uint256) {
return _value.mul(10**ERC20(OHM).decimals()).div(_bondPrice());
}
| 16,906 |
65 | // Returns true if the contract is paused, and false otherwise. / | function paused() public view virtual returns (bool) {
return _paused;
}
| function paused() public view virtual returns (bool) {
return _paused;
}
| 19,831 |
4 | // paused[implementation()] = false; | boolStorage[keccak256(abi.encodePacked(implementation(), "paused"))] = false;
emit Unpause();
| boolStorage[keccak256(abi.encodePacked(implementation(), "paused"))] = false;
emit Unpause();
| 47,177 |
6 | // reference to the $WOOL contract for minting $WOOL earnings | WOOL wool;
| WOOL wool;
| 28,545 |
40 | // The function used to withdraw funds to the Collection creator and HashesDAO addresses.The balance of the contract is equal to the royalties and gifts owed to the creator and HashesDAO. / | function withdraw() external override initialized {
// The contract balance is equal to the royalties or gifts which need to be allocated
// to both the creator and HashesDAO.
uint256 _contractBalance = address(this).balance;
// The amount owed to the DAO will be the total royalties times the royalty
// fee percent value (in bps).
uint256 _daoRoyaltiesOwed = (_contractBalance.mul(_hashesDAORoyaltyFeePercent)).div(10000);
// The amount owed to the creator will then be the total balance of the contract minus the DAO
// royalties owed.
uint256 _creatorRoyaltiesOwed = _contractBalance.sub(_daoRoyaltiesOwed);
if (_creatorRoyaltiesOwed > 0) {
(bool sent, ) = creatorAddress.call{ value: _creatorRoyaltiesOwed }("");
require(sent, "CollectionNFTCloneableV1: failed to send ETH to creator address");
}
if (_daoRoyaltiesOwed > 0) {
(bool sent, ) = IOwnable(address(hashesToken)).owner().call{ value: _daoRoyaltiesOwed }("");
require(sent, "CollectionNFTCloneableV1: failed to send ETH to HashesDAO");
}
emit Withdraw(_creatorRoyaltiesOwed, _daoRoyaltiesOwed);
}
| function withdraw() external override initialized {
// The contract balance is equal to the royalties or gifts which need to be allocated
// to both the creator and HashesDAO.
uint256 _contractBalance = address(this).balance;
// The amount owed to the DAO will be the total royalties times the royalty
// fee percent value (in bps).
uint256 _daoRoyaltiesOwed = (_contractBalance.mul(_hashesDAORoyaltyFeePercent)).div(10000);
// The amount owed to the creator will then be the total balance of the contract minus the DAO
// royalties owed.
uint256 _creatorRoyaltiesOwed = _contractBalance.sub(_daoRoyaltiesOwed);
if (_creatorRoyaltiesOwed > 0) {
(bool sent, ) = creatorAddress.call{ value: _creatorRoyaltiesOwed }("");
require(sent, "CollectionNFTCloneableV1: failed to send ETH to creator address");
}
if (_daoRoyaltiesOwed > 0) {
(bool sent, ) = IOwnable(address(hashesToken)).owner().call{ value: _daoRoyaltiesOwed }("");
require(sent, "CollectionNFTCloneableV1: failed to send ETH to HashesDAO");
}
emit Withdraw(_creatorRoyaltiesOwed, _daoRoyaltiesOwed);
}
| 33,827 |
0 | // ========== EVENTS=================== |
event OrgCreated(address indexed newAddress);
event OrgStatusChanged(address indexed orgAddress, bool indexed isAllowed);
event OrgLogicDeployed(address logicAddress);
|
event OrgCreated(address indexed newAddress);
event OrgStatusChanged(address indexed orgAddress, bool indexed isAllowed);
event OrgLogicDeployed(address logicAddress);
| 46,280 |
0 | // Share of formerly restricted tokens among all tokens in percent | uint public restrictedShare;
| uint public restrictedShare;
| 37,288 |
82 | // Unset a Trading Ruleonly callable by the owner of the contract, removes from a mappingsenderToken address Address of an ERC-20 token the delegate would sendsignerToken address Address of an ERC-20 token the consumer would send/ | function unsetRule(
address senderToken,
address signerToken
| function unsetRule(
address senderToken,
address signerToken
| 26,218 |
53 | // set tokenOwnerAddress as owner of initial supply, more tokens can be minted later | _mint(tokenOwnerAddress, initialSupply);
| _mint(tokenOwnerAddress, initialSupply);
| 71,096 |
1 | // The voting power that a user has based on their stake and the portion that they have voted yes with / | mapping(address => VotePartial) public votePartials;
| mapping(address => VotePartial) public votePartials;
| 9,978 |
157 | // See {IAdminControl-isAdmin}. / | function isAdmin(address admin) public override view returns (bool) {
return (owner() == admin || _admins.contains(admin));
}
| function isAdmin(address admin) public override view returns (bool) {
return (owner() == admin || _admins.contains(admin));
}
| 1,694 |
211 | // The NokuCustomERC20AdvancedToken contract is a custom ERC20AdvancedLite, a security token ERC20-compliant, token available in the Noku Service Platform (NSP). The Noku customer is able to choose the token name, symbol, decimals, initial supply and to administer its lifecycle by minting or burning tokens in order to increase or decrease the token supply./ | contract NokuCustomERC20AdvancedLite is NokuCustomTokenLite, BasicSecurityTokenWithDecimals {
event LogNokuCustomERC20AdvancedLiteCreated(
address indexed caller,
string indexed name,
string indexed symbol,
uint8 decimals
);
constructor(
string memory _name,
string memory _symbol,
uint8 _decimals,
bool _enableWhitelist
)
NokuCustomTokenLite()
BasicSecurityTokenWithDecimals(_name, _symbol, _decimals, _enableWhitelist) {
emit LogNokuCustomERC20AdvancedLiteCreated(
_msgSender(),
_name,
_symbol,
_decimals
);
}
}
| contract NokuCustomERC20AdvancedLite is NokuCustomTokenLite, BasicSecurityTokenWithDecimals {
event LogNokuCustomERC20AdvancedLiteCreated(
address indexed caller,
string indexed name,
string indexed symbol,
uint8 decimals
);
constructor(
string memory _name,
string memory _symbol,
uint8 _decimals,
bool _enableWhitelist
)
NokuCustomTokenLite()
BasicSecurityTokenWithDecimals(_name, _symbol, _decimals, _enableWhitelist) {
emit LogNokuCustomERC20AdvancedLiteCreated(
_msgSender(),
_name,
_symbol,
_decimals
);
}
}
| 5,372 |
4 | // DisapproveRequest would be emitted when the `disapprove` function is called | event DisapproveRequest(uint request_id, uint token_id);
| event DisapproveRequest(uint request_id, uint token_id);
| 24,415 |
0 | // An address who has permissions to mint Oasis tokens | address public minter;
| address public minter;
| 35,222 |
40 | // Declaring publicstate variable | uint public num = 10;
| uint public num = 10;
| 13,613 |
57 | // Initializer _pauser: the address of the account granted with PAUSER_ROLE / | function __Suspendable_init(address _pauser) internal onlyInitializing {
__Context_init_unchained();
__ERC165_init_unchained();
__AccessControl_init_unchained();
__Pausable_init_unchained();
__Suspendable_init_unchained(_pauser);
}
| function __Suspendable_init(address _pauser) internal onlyInitializing {
__Context_init_unchained();
__ERC165_init_unchained();
__AccessControl_init_unchained();
__Pausable_init_unchained();
__Suspendable_init_unchained(_pauser);
}
| 37,112 |
35 | // Burn tokens | _burn(_msgSender(), peAmount);
| _burn(_msgSender(), peAmount);
| 22,825 |
4 | // ILiquidity Getters //@inheritdoc ILiquidity / | function liquidityNodes(uint128 startTick, uint128 endTick) external view returns (ILiquidity.NodeInfo[] memory) {
return _liquidity.liquidityNodes(startTick, endTick);
}
| function liquidityNodes(uint128 startTick, uint128 endTick) external view returns (ILiquidity.NodeInfo[] memory) {
return _liquidity.liquidityNodes(startTick, endTick);
}
| 1,779 |
121 | // Perform any adjustments to the core position(s) of this Strategy givenwhat change the Vault made in the "investable capital" available to theStrategy. Note that all "free capital" in the Strategy after the reportwas made is available for reinvestment. Also note that this numbercould be 0, and you should handle that scenario accordingly. See comments regarding `_debtOutstanding` on `prepareReturn()`. / | function adjustPosition(uint256 _debtOutstanding) internal virtual;
| function adjustPosition(uint256 _debtOutstanding) internal virtual;
| 1,487 |
0 | // emit the event based on the contract integer | emit ElectionLog(deployedElections[electionId]);
| emit ElectionLog(deployedElections[electionId]);
| 41,839 |
61 | // Converts ETH to cETH needed to liquidate. Amount is Eth to supply cEth minted will be ETH supplied/Exchange rate | cToken.deposit{value: _LqdtAmount}( );
| cToken.deposit{value: _LqdtAmount}( );
| 37,392 |
319 | // Internal function to fetch the address of the DisputeManager module return Address of the DisputeManager module/ | function _disputeManager() internal view returns (IDisputeManager) {
return IDisputeManager(_getLinkedModule(MODULE_ID_DISPUTE_MANAGER));
}
| function _disputeManager() internal view returns (IDisputeManager) {
return IDisputeManager(_getLinkedModule(MODULE_ID_DISPUTE_MANAGER));
}
| 12,929 |
148 | // ShowPlayers (private_rooms[roomid].player1,private_rooms[roomid].player2); | update_private_room (roomid);
| update_private_room (roomid);
| 43,358 |
140 | // There was a malicious account that acquired over 400 eggs via referral codes, which breaks the terms of use. The acquired egg numbers ranged from identifier 1247 up until 1688, excluding 1296, 1297, 1479, 1492, 1550, 1551, and 1555. This was found by looking at activity on the pick-up contract, and tracing it back to the following address:`0c7a911ac29ea1e3b1d438f98f8bc053131dcaf52` | if (_isExcluded(i)) {
tokenOwner = address(0);
} else {
| if (_isExcluded(i)) {
tokenOwner = address(0);
} else {
| 6,437 |
38 | // Creates a new SantaSwapNFT contract/baseURI of ERC-1155 compatible metadata | constructor(string memory baseURI) {
// Update owner to deployer
owner = msg.sender;
// Update URI
_updateURI(baseURI);
}
| constructor(string memory baseURI) {
// Update owner to deployer
owner = msg.sender;
// Update URI
_updateURI(baseURI);
}
| 7,514 |
142 | // uint256 lpSupply = pool.lpToken.balanceOf(address(this)); | uint256 lpSupply = pool.totalLPAmount;
if (lpSupply == 0) {
pool.lastRewardBlock = block.number;
return;
}
| uint256 lpSupply = pool.totalLPAmount;
if (lpSupply == 0) {
pool.lastRewardBlock = block.number;
return;
}
| 69,106 |
31 | // 1. We can only issue certain synths. | require(synthsByKey[currency] > 0, "Not allowed to issue");
| require(synthsByKey[currency] > 0, "Not allowed to issue");
| 38,775 |
233 | // Virtual value of loan assets in the poolWill return cached value if inSyncreturn Value of loans in pool / | function loansValue() public view returns (uint256) {
if (inSync) {
return loansValueCache;
}
if (address(_lender2) != address(0)) {
return _lender.value().add(_lender2.value(ITrueFiPool2(address(this))));
}
return _lender.value();
}
| function loansValue() public view returns (uint256) {
if (inSync) {
return loansValueCache;
}
if (address(_lender2) != address(0)) {
return _lender.value().add(_lender2.value(ITrueFiPool2(address(this))));
}
return _lender.value();
}
| 80,830 |
30 | // require isAccountLocked() return true | function isAccountLocked(address _from,address _to) public returns (bool){
if(_from == 0x0 || _to == 0x0)
{
return true;
}
if (Locker[_from] == true || Locker[_to] == true)
{
return true;
}
return false;
}
| function isAccountLocked(address _from,address _to) public returns (bool){
if(_from == 0x0 || _to == 0x0)
{
return true;
}
if (Locker[_from] == true || Locker[_to] == true)
{
return true;
}
return false;
}
| 36,645 |
40 | // Get minter allowance for an account minter The address of the minter/ | function minterAllowance(address minter) public view returns (uint256) {
return minterAllowed[minter];
}
| function minterAllowance(address minter) public view returns (uint256) {
return minterAllowed[minter];
}
| 26,471 |
30 | // get the reserve token associated with the pool token and its balance / staked balance | IERC20Token reserveToken = poolTokensToReserves[_poolToken];
uint256 balance = reserveBalance(reserveToken);
uint256 stakedBalance = stakedBalances[reserveToken];
| IERC20Token reserveToken = poolTokensToReserves[_poolToken];
uint256 balance = reserveBalance(reserveToken);
uint256 stakedBalance = stakedBalances[reserveToken];
| 45,443 |
24 | // updates the assignment in the set given a specific index/s set containing proposals/index index in the list of elements of the set to update/assignment the assignment to be stored | function updateAssignment(Set storage s, uint index, uint[] memory assignment) public checkIndex(s, index) {
s.elements[index].assignment = assignment;
}
| function updateAssignment(Set storage s, uint index, uint[] memory assignment) public checkIndex(s, index) {
s.elements[index].assignment = assignment;
}
| 41,278 |
222 | // View function to see pending CHERRYs on frontend. | function pendingReward(uint256 _pid, address _user) external view returns (uint256) {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][_user];
uint256 accCHERRYPerShare = pool.accCHERRYPerShare;
uint256 lpSupply = pool.lpToken.balanceOf(address(this));
if (block.number > pool.lastRewardBlock && lpSupply > 0) {
uint256 cherryForFarmer;
(, , cherryForFarmer) = getPoolReward(pool.lastRewardBlock, block.number, pool.allocPoint);
accCHERRYPerShare = accCHERRYPerShare.add(cherryForFarmer.mul(1e12).div(lpSupply));
}
return user.amount.mul(accCHERRYPerShare).div(1e12).sub(user.rewardDebt);
}
| function pendingReward(uint256 _pid, address _user) external view returns (uint256) {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][_user];
uint256 accCHERRYPerShare = pool.accCHERRYPerShare;
uint256 lpSupply = pool.lpToken.balanceOf(address(this));
if (block.number > pool.lastRewardBlock && lpSupply > 0) {
uint256 cherryForFarmer;
(, , cherryForFarmer) = getPoolReward(pool.lastRewardBlock, block.number, pool.allocPoint);
accCHERRYPerShare = accCHERRYPerShare.add(cherryForFarmer.mul(1e12).div(lpSupply));
}
return user.amount.mul(accCHERRYPerShare).div(1e12).sub(user.rewardDebt);
}
| 25,308 |
149 | // onlyAuthorized 是否已授权?target 期望判断的目标地址;/ | modifier onlyAuthorized(address target) {
require(isOwner()||isManager(target),"Only for manager or owner!");
_;
}
| modifier onlyAuthorized(address target) {
require(isOwner()||isManager(target),"Only for manager or owner!");
_;
}
| 63,494 |
58 | // Withdraw tokens from earnings and unlocked. First withdraws unlocked tokens, then earned tokens. Withdrawing earned tokens incurs a 50% penalty which is distributed based on locked balances. amount for withdraw / | function withdraw(uint256 amount) external {
address _address = msg.sender;
if (amount == 0) revert AmountZero();
uint256 penaltyAmount;
uint256 burnAmount;
Balances storage bal = _balances[_address];
if (amount <= bal.unlocked) {
bal.unlocked = bal.unlocked - amount;
} else {
uint256 remaining = amount - bal.unlocked;
if (bal.earned < remaining) revert InvalidEarned();
bal.unlocked = 0;
uint256 sumEarned = bal.earned;
uint256 i;
for (i = 0; ; ) {
uint256 earnedAmount = _userEarnings[_address][i].amount;
if (earnedAmount == 0) continue;
(
uint256 withdrawAmount,
uint256 penaltyFactor,
uint256 newPenaltyAmount,
uint256 newBurnAmount
) = _penaltyInfo(_userEarnings[_address][i]);
uint256 requiredAmount = earnedAmount;
if (remaining >= withdrawAmount) {
remaining = remaining - withdrawAmount;
if (remaining == 0) i++;
} else {
requiredAmount = (remaining * WHOLE) / (WHOLE - penaltyFactor);
_userEarnings[_address][i].amount = earnedAmount - requiredAmount;
remaining = 0;
newPenaltyAmount = (requiredAmount * penaltyFactor) / WHOLE;
newBurnAmount = (newPenaltyAmount * burn) / WHOLE;
}
sumEarned = sumEarned - requiredAmount;
penaltyAmount = penaltyAmount + newPenaltyAmount;
burnAmount = burnAmount + newBurnAmount;
if (remaining == 0) {
break;
} else {
if (sumEarned == 0) revert InvalidEarned();
}
unchecked {
i++;
}
}
if (i > 0) {
uint256 length = _userEarnings[_address].length;
for (uint256 j = i; j < length; ) {
_userEarnings[_address][j - i] = _userEarnings[_address][j];
unchecked {
j++;
}
}
for (uint256 j = 0; j < i; ) {
_userEarnings[_address].pop();
unchecked {
j++;
}
}
}
bal.earned = sumEarned;
}
// Update values
bal.total = bal.total - amount - penaltyAmount;
_withdrawTokens(_address, amount, penaltyAmount, burnAmount, false);
}
| function withdraw(uint256 amount) external {
address _address = msg.sender;
if (amount == 0) revert AmountZero();
uint256 penaltyAmount;
uint256 burnAmount;
Balances storage bal = _balances[_address];
if (amount <= bal.unlocked) {
bal.unlocked = bal.unlocked - amount;
} else {
uint256 remaining = amount - bal.unlocked;
if (bal.earned < remaining) revert InvalidEarned();
bal.unlocked = 0;
uint256 sumEarned = bal.earned;
uint256 i;
for (i = 0; ; ) {
uint256 earnedAmount = _userEarnings[_address][i].amount;
if (earnedAmount == 0) continue;
(
uint256 withdrawAmount,
uint256 penaltyFactor,
uint256 newPenaltyAmount,
uint256 newBurnAmount
) = _penaltyInfo(_userEarnings[_address][i]);
uint256 requiredAmount = earnedAmount;
if (remaining >= withdrawAmount) {
remaining = remaining - withdrawAmount;
if (remaining == 0) i++;
} else {
requiredAmount = (remaining * WHOLE) / (WHOLE - penaltyFactor);
_userEarnings[_address][i].amount = earnedAmount - requiredAmount;
remaining = 0;
newPenaltyAmount = (requiredAmount * penaltyFactor) / WHOLE;
newBurnAmount = (newPenaltyAmount * burn) / WHOLE;
}
sumEarned = sumEarned - requiredAmount;
penaltyAmount = penaltyAmount + newPenaltyAmount;
burnAmount = burnAmount + newBurnAmount;
if (remaining == 0) {
break;
} else {
if (sumEarned == 0) revert InvalidEarned();
}
unchecked {
i++;
}
}
if (i > 0) {
uint256 length = _userEarnings[_address].length;
for (uint256 j = i; j < length; ) {
_userEarnings[_address][j - i] = _userEarnings[_address][j];
unchecked {
j++;
}
}
for (uint256 j = 0; j < i; ) {
_userEarnings[_address].pop();
unchecked {
j++;
}
}
}
bal.earned = sumEarned;
}
// Update values
bal.total = bal.total - amount - penaltyAmount;
_withdrawTokens(_address, amount, penaltyAmount, burnAmount, false);
}
| 28,896 |
22 | // complex input is dynamic and more difficult to decode than simple input. | struct ComplexOutput {
ComplexInput input;
bytes lorem;
bytes ipsum;
string dolor;
}
| struct ComplexOutput {
ComplexInput input;
bytes lorem;
bytes ipsum;
string dolor;
}
| 41,846 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.