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 |
|---|---|---|---|---|
55 | // Trasfer bonuses and adding delayed bonuses | function postBuyTokens(address _beneficiary, uint _tokens) internal {
}
| function postBuyTokens(address _beneficiary, uint _tokens) internal {
}
| 18,595 |
15 | // The EIP-712 typehash for the delegation struct used by the contract |
bytes32 public constant DELEGATION_TYPEHASH = keccak256("Delegation(address delegatee,uint256 nonce,uint256 expiry)");
|
bytes32 public constant DELEGATION_TYPEHASH = keccak256("Delegation(address delegatee,uint256 nonce,uint256 expiry)");
| 5,972 |
7 | // Sets the liquidation bonus of the reserve self The reserve configuration bonus The new liquidation bonus / | ) internal pure {
require(bonus <= MAX_VALID_LIQUIDATION_BONUS, Errors.INVALID_LIQ_BONUS);
self.data =
(self.data & LIQUIDATION_BONUS_MASK) |
(bonus << LIQUIDATION_BONUS_START_BIT_POSITION);
}
| ) internal pure {
require(bonus <= MAX_VALID_LIQUIDATION_BONUS, Errors.INVALID_LIQ_BONUS);
self.data =
(self.data & LIQUIDATION_BONUS_MASK) |
(bonus << LIQUIDATION_BONUS_START_BIT_POSITION);
}
| 32,893 |
24 | // _user users address | function getUserAccountData(address _user)
external virtual
view
returns (
uint256 totalLiquidityETH, // user aggregated deposits across all the reserves. In Wei
uint256 totalCollateralETH, // user aggregated collateral across all the reserves. In... | function getUserAccountData(address _user)
external virtual
view
returns (
uint256 totalLiquidityETH, // user aggregated deposits across all the reserves. In Wei
uint256 totalCollateralETH, // user aggregated collateral across all the reserves. In... | 28,847 |
29 | // LIBRARY FUNCTIONS | function quote(uint amountA, uint reserveA, uint reserveB) public pure virtual override returns (uint amountB) {
return TideBitSwapLibrary.quote(amountA, reserveA, reserveB);
}
| function quote(uint amountA, uint reserveA, uint reserveB) public pure virtual override returns (uint amountB) {
return TideBitSwapLibrary.quote(amountA, reserveA, reserveB);
}
| 50,465 |
13 | // Initializes this MetaSwap contract with the given parameters.MetaSwap uses an existing Swap pool to expand the available liquidity._pooledTokens array should contain the base Swap pool's LP token asthe last element. For example, if there is a Swap pool consisting of[DAI, USDC, BUSD]. Then a MetaSwap pool can be crea... | function initializeMetaSwap(
IERC20[] memory _pooledTokens,
uint8[] memory decimals,
string memory lpTokenName,
string memory lpTokenSymbol,
uint256 _a,
uint256 _fee,
uint256 _adminFee,
address lpTokenTargetAddress,
ISwap baseSwap
| function initializeMetaSwap(
IERC20[] memory _pooledTokens,
uint8[] memory decimals,
string memory lpTokenName,
string memory lpTokenSymbol,
uint256 _a,
uint256 _fee,
uint256 _adminFee,
address lpTokenTargetAddress,
ISwap baseSwap
| 12,643 |
44 | // ADVANCED TOKEN STARTS HERE / | contract GammaToken is owned, TokenERC20 {
uint256 public sellPrice;
uint256 public buyPrice;
using SafeMath for uint256;
mapping (address => bool) public frozenAccount;
/* This generates a public event on the blockchain that will notify clients */
event ... | contract GammaToken is owned, TokenERC20 {
uint256 public sellPrice;
uint256 public buyPrice;
using SafeMath for uint256;
mapping (address => bool) public frozenAccount;
/* This generates a public event on the blockchain that will notify clients */
event ... | 33,776 |
138 | // after 90 days from swapTime, devteam withdraw whole eth. | function sleep()
public
| function sleep()
public
| 15,894 |
19 | // greater than or equal to $100000, less than ${networkFeesTierCustom} | _fee = _amount.mul(networkFeesPerc[2]).div(DENOMINATOR);
| _fee = _amount.mul(networkFeesPerc[2]).div(DENOMINATOR);
| 27,424 |
5 | // Requires that a token with this id exists. | modifier tokenIdExists(uint256 tokenId) {
require(_exists(tokenId), "id does not exist");
_;
}
| modifier tokenIdExists(uint256 tokenId) {
require(_exists(tokenId), "id does not exist");
_;
}
| 8,120 |
324 | // Get deposit amount in USD | uint256 amountUsd = amount.mul(pricesInUsd[_currencyIndexes[currencyCode]]).div(10 ** _currencyDecimals[currencyCode]);
| uint256 amountUsd = amount.mul(pricesInUsd[_currencyIndexes[currencyCode]]).div(10 ** _currencyDecimals[currencyCode]);
| 10,936 |
23 | // Extract the payment token from the offer items | ISeaport.OfferItem calldata paymentItem = order.parameters.offer[0];
IERC20 paymentToken = IERC20(paymentItem.token);
| ISeaport.OfferItem calldata paymentItem = order.parameters.offer[0];
IERC20 paymentToken = IERC20(paymentItem.token);
| 3,934 |
48 | // / | uint weight = 1;
if (tag[msg.sender] == 2)
weight = 5;
| uint weight = 1;
if (tag[msg.sender] == 2)
weight = 5;
| 22,368 |
75 | // Pool reserveInit + seederFee + redeemInit + minimumCreatorRaise./ Could be calculated as a view function but that would require external/ calls to the pool contract. | uint256 public immutable successBalance;
| uint256 public immutable successBalance;
| 33,436 |
238 | // Call the loan callback | address callback = request.callback;
if (callback != address(0)) {
require(LoanCallback(callback).onLent.gas(GAS_CALLBACK)(_id, msg.sender, _callbackData), "Rejected by loan callback");
}
| address callback = request.callback;
if (callback != address(0)) {
require(LoanCallback(callback).onLent.gas(GAS_CALLBACK)(_id, msg.sender, _callbackData), "Rejected by loan callback");
}
| 16,228 |
1 | // FailingContract Always fails / | contract FailingContract {
/**
* @dev Fail this transaction just because
*/
function fail_on_purpose() public {
revert("This transaction is failing on purpose!");
}
} | contract FailingContract {
/**
* @dev Fail this transaction just because
*/
function fail_on_purpose() public {
revert("This transaction is failing on purpose!");
}
} | 9,453 |
38 | // a library for performing overflow-safe math, courtesy of DappHub (https:github.com/dapphub/ds-math) | library SafeMath {
uint256 constant WAD = 10**18;
uint256 constant RAY = 10**27;
function wad() public pure returns (uint256) {
return WAD;
}
function ray() public pure returns (uint256) {
return RAY;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
... | library SafeMath {
uint256 constant WAD = 10**18;
uint256 constant RAY = 10**27;
function wad() public pure returns (uint256) {
return WAD;
}
function ray() public pure returns (uint256) {
return RAY;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
... | 18,668 |
381 | // Compound's Comptroller Contract Compound / | contract Comptroller is ComptrollerV4Storage, ComptrollerInterface, ComptrollerErrorReporter, Exponential {
/// @notice Emitted when an admin supports a market
event MarketListed(CToken cToken);
/// @notice Emitted when an account enters a market
event MarketEntered(CToken cToken, address account);
... | contract Comptroller is ComptrollerV4Storage, ComptrollerInterface, ComptrollerErrorReporter, Exponential {
/// @notice Emitted when an admin supports a market
event MarketListed(CToken cToken);
/// @notice Emitted when an account enters a market
event MarketEntered(CToken cToken, address account);
... | 74,317 |
73 | // Updates the AddressRegistry contract address. Admin role only. addressRegistryAddressRegistry contract address. / | function setAddressRegistry(IAddressRegistry addressRegistry) public onlyRole(DEFAULT_ADMIN_ROLE) {
_addressRegistry = addressRegistry;
}
| function setAddressRegistry(IAddressRegistry addressRegistry) public onlyRole(DEFAULT_ADMIN_ROLE) {
_addressRegistry = addressRegistry;
}
| 27,242 |
54 | // cb is a circuit breaker in the for loop since there'sno said feature for inline assembly loops cb = 1 - don't breaker cb = 0 - break | let cb := 1
let mc := add(_preBytes, 0x20)
let end := add(mc, length)
for {
let cc := add(_postBytes, 0x20)
| let cb := 1
let mc := add(_preBytes, 0x20)
let end := add(mc, length)
for {
let cc := add(_postBytes, 0x20)
| 4,134 |
92 | // 1FP / FP = 1 | return (balance * accumulatorFP) / yieldQuotientFP;
| return (balance * accumulatorFP) / yieldQuotientFP;
| 74,167 |
120 | // If the total supply is zero, finds and deletes the partition. | if (_totalSupplyByPartition[partition] == 0) {
uint256 index1 = _indexOfTotalPartitions[partition];
require(index1 > 0, "50"); // 0x50 transfer failure
| if (_totalSupplyByPartition[partition] == 0) {
uint256 index1 = _indexOfTotalPartitions[partition];
require(index1 > 0, "50"); // 0x50 transfer failure
| 22,820 |
1 | // uint256[63] restockDistribution = [0,1,1,2,2,2,2,3,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,6,6,6,6,6,6,6,6,7,7,7,7,7,7,7,7,8,8,8,8,8,8,8,8,9,9,9,9,9,9,9,9]; | uint256[] restockDistribution = [1,5,5,5,9,9,9,13,13,13,13,13,13,13,13,13,13,17,17,17,17,17,17,17,17,17,17];
uint256[] availableSlice1;
uint256[] availableSlice2;
uint256[] availableSlice3;
uint256[] availableSlice4;
uint256[] availableSlice5;
uint256 private nextTokenId;
constructor(
| uint256[] restockDistribution = [1,5,5,5,9,9,9,13,13,13,13,13,13,13,13,13,13,17,17,17,17,17,17,17,17,17,17];
uint256[] availableSlice1;
uint256[] availableSlice2;
uint256[] availableSlice3;
uint256[] availableSlice4;
uint256[] availableSlice5;
uint256 private nextTokenId;
constructor(
| 29,756 |
5 | // uint[] memory emptyArray1;uint[] memory emptyArray2;Part 1 Task 2. Initialize two items with at index 1 and 2. Start code here. 2 lines approximately. / | items[1] = Item({itemId:1,itemTokens:emptyArray});
| items[1] = Item({itemId:1,itemTokens:emptyArray});
| 32,903 |
28 | // Withdraw LP tokens from GFV2./pid The index of the pool. See `poolInfo`./amount LP token amount to withdraw./to Receiver of the LP tokens. | function withdraw(uint256 pid, uint256 amount, address to) external {
require(!nonReentrant, "genericFarmV2::nonReentrant - try again");
nonReentrant = true;
PoolInfo memory pool = updatePool(pid);
UserInfo storage user = userInfo[pid][msg.sender];
// Effects
user.r... | function withdraw(uint256 pid, uint256 amount, address to) external {
require(!nonReentrant, "genericFarmV2::nonReentrant - try again");
nonReentrant = true;
PoolInfo memory pool = updatePool(pid);
UserInfo storage user = userInfo[pid][msg.sender];
// Effects
user.r... | 80,226 |
6 | // Converts a signed int256 into an unsigned uint256. Requirements: - input must be greater than or equal to 0. / | function toUint256(int256 value) internal pure returns (uint256) {
require(value >= 0, "SafeCast: value must be positive");
return uint256(value);
}
| function toUint256(int256 value) internal pure returns (uint256) {
require(value >= 0, "SafeCast: value must be positive");
return uint256(value);
}
| 2,382 |
26 | // Grants `role` to `account`. Internal function without access restriction. | * May emit a {RoleGranted} event.
*/
function _grantRole(bytes32 role, address account) internal virtual {
if (!hasRole(role, account)) {
_roles[role].members[account] = true;
emit RoleGranted(role, account, _msgSender());
}
}
| * May emit a {RoleGranted} event.
*/
function _grantRole(bytes32 role, address account) internal virtual {
if (!hasRole(role, account)) {
_roles[role].members[account] = true;
emit RoleGranted(role, account, _msgSender());
}
}
| 19,640 |
285 | // Maps Safes to their custom fees on interest taken by the protocol./A fixed point number where 1e18 represents 100% and 0 represents 0%. | mapping(TurboSafe => uint256) public getCustomFeePercentageForSafe;
| mapping(TurboSafe => uint256) public getCustomFeePercentageForSafe;
| 30,309 |
64 | // Identity is not padded with 0s | Error(8, _ids);
| Error(8, _ids);
| 56,732 |
79 | // Returns if an account is excluded from fees./account the account to check | function isExcludedFromFee(address account) public view returns (bool) {
return mappedAddresses[account]._isExcludedFromFee;
}
| function isExcludedFromFee(address account) public view returns (bool) {
return mappedAddresses[account]._isExcludedFromFee;
}
| 479 |
5 | // Constructor sets the router address and socketGateway address. anyswap 4 router is immutable. so no setter function required. / | constructor(
address _router,
address _socketGateway,
address _socketDeployFactory
| constructor(
address _router,
address _socketGateway,
address _socketDeployFactory
| 3,367 |
16 | // .at function returns a tuple of (uint256, address) | address walletAddress;
(, walletAddress) = wallets.at(_index);
return walletAddress;
| address walletAddress;
(, walletAddress) = wallets.at(_index);
return walletAddress;
| 29,714 |
29 | // Indicates whether a contract implements the `ERC1155TokenReceiver` functions and so can accept ERC1155 token types.interfaceID The ERC-165 interface ID that is queried for support.s This function MUST return true if it implements the ERC1155TokenReceiver interface and ERC-165 interface. This function MUST NOT consum... | function supportsInterface(bytes4 interfaceID) public view virtual override(AccessControl,ERC1155) returns (bool) {
return interfaceID == 0x01ffc9a7 || // ERC-165 support (i.e. `bytes4(keccak256('supportsInterface(bytes4)'))`).
interfaceID == 0x4e2312e0; // ERC-1155 `ERC1155TokenReceiver` s... | function supportsInterface(bytes4 interfaceID) public view virtual override(AccessControl,ERC1155) returns (bool) {
return interfaceID == 0x01ffc9a7 || // ERC-165 support (i.e. `bytes4(keccak256('supportsInterface(bytes4)'))`).
interfaceID == 0x4e2312e0; // ERC-1155 `ERC1155TokenReceiver` s... | 5,255 |
137 | // Transfer the received tokens to the recipient. | _transferToken(tokenReceived, msg.sender, quotedTokenAmount);
receivedAmountAfterTransferFee = tokenReceived.balanceOf(msg.sender).sub(
priorRecipientBalanceOfReceivedToken
);
| _transferToken(tokenReceived, msg.sender, quotedTokenAmount);
receivedAmountAfterTransferFee = tokenReceived.balanceOf(msg.sender).sub(
priorRecipientBalanceOfReceivedToken
);
| 29,258 |
54 | // Remove from inProgressProposals array | _removeFromInProgressProposals(_proposalId);
emit ProposalOutcomeEvaluated(
_proposalId,
outcome,
proposals[_proposalId].voteMagnitudeYes,
proposals[_proposalId].voteMagnitudeNo,
proposals[_proposalId].numVotes
);
| _removeFromInProgressProposals(_proposalId);
emit ProposalOutcomeEvaluated(
_proposalId,
outcome,
proposals[_proposalId].voteMagnitudeYes,
proposals[_proposalId].voteMagnitudeNo,
proposals[_proposalId].numVotes
);
| 26,562 |
297 | // calculate remaining amount | amount = (supply * members[sender].shareholder.shares) / 100 - members[sender].collected;
| amount = (supply * members[sender].shareholder.shares) / 100 - members[sender].collected;
| 75,129 |
13 | // USING TREASURY / Returned by .getTreasury() | interface ITreasury {
function issueDividend() external returns (uint _profits);
function profitsSendable() external view returns (uint _profits);
}
| interface ITreasury {
function issueDividend() external returns (uint _profits);
function profitsSendable() external view returns (uint _profits);
}
| 82,929 |
166 | // Cached maturity of pToken (set during intialization) | uint256 internal _maturity;
| uint256 internal _maturity;
| 61,249 |
107 | // additional function to address ether in the contract left after swap can be used by admins to buyback and burn the tokens or for other purposes related to the project | function withdrawLeftoverEther() external onlyOwner {
msg.sender.transfer(address(this).balance);
}
| function withdrawLeftoverEther() external onlyOwner {
msg.sender.transfer(address(this).balance);
}
| 64,656 |
342 | // Update the stake | lockedStakes[msg.sender][theArrayIndex] = LockedStake(
kek_id,
thisStake.start_timestamp,
new_amt,
thisStake.ending_timestamp,
thisStake.lock_multiplier
);
| lockedStakes[msg.sender][theArrayIndex] = LockedStake(
kek_id,
thisStake.start_timestamp,
new_amt,
thisStake.ending_timestamp,
thisStake.lock_multiplier
);
| 11,730 |
15 | // Partitioning a subset of outcomes for the condition in this branch. For example, for a condition with three outcomes A, B, and C, this branch allows the splitting of a position $:(A|C) to positions $:(A) and $:(C). | _burn(
msg.sender,
CTHelpers.getPositionId(collateralToken,
CTHelpers.getCollectionId(parentCollectionId, conditionId, fullIndexSet ^ freeIndexSet)),
amount
);
| _burn(
msg.sender,
CTHelpers.getPositionId(collateralToken,
CTHelpers.getCollectionId(parentCollectionId, conditionId, fullIndexSet ^ freeIndexSet)),
amount
);
| 20,982 |
125 | // Helper to check if an account is the owner of a given list | function __isListOwner(address _who, uint256 _id) private view returns (bool isListOwner_) {
address owner = getListOwner(_id);
return
_who == owner ||
(owner == getDispatcher() && _who == IDispatcher(getDispatcher()).getOwner());
}
| function __isListOwner(address _who, uint256 _id) private view returns (bool isListOwner_) {
address owner = getListOwner(_id);
return
_who == owner ||
(owner == getDispatcher() && _who == IDispatcher(getDispatcher()).getOwner());
}
| 47,835 |
295 | // Sets the next option the vault will be shorting, and closes the existing short. This allows all the users to withdraw if the next option is malicious. / | function commitAndClose(
ProtocolAdapterTypes.OptionTerms calldata optionTerms
| function commitAndClose(
ProtocolAdapterTypes.OptionTerms calldata optionTerms
| 63,617 |
136 | // View function to see pending YAXs on frontend. | function pendingYax(address _account) public view returns (uint _pending) {
UserInfo storage user = userInfo[_account];
uint _accYaxPerShare = accYaxPerShare;
uint lpSupply = balanceOf(address(this));
if (block.number > lastRewardBlock && lpSupply != 0) {
uint256 _multipl... | function pendingYax(address _account) public view returns (uint _pending) {
UserInfo storage user = userInfo[_account];
uint _accYaxPerShare = accYaxPerShare;
uint lpSupply = balanceOf(address(this));
if (block.number > lastRewardBlock && lpSupply != 0) {
uint256 _multipl... | 28,619 |
225 | // Load the returndata and compare it. | if iszero(eq(mload(m), shl(224, onERC721ReceivedSelector))) {
mstore(0x00, 0xd1a57ed6) // `TransferToNonERC721ReceiverImplementer()`.
revert(0x1c, 0x04)
}
| if iszero(eq(mload(m), shl(224, onERC721ReceivedSelector))) {
mstore(0x00, 0xd1a57ed6) // `TransferToNonERC721ReceiverImplementer()`.
revert(0x1c, 0x04)
}
| 21,932 |
206 | // Convert ETH balance to core ERC20 | uint256 ethBalance = exchangePortal.getValue(
address(ETH_TOKEN_ADDRESS),
coreFundAsset,
address(this).balance
);
| uint256 ethBalance = exchangePortal.getValue(
address(ETH_TOKEN_ADDRESS),
coreFundAsset,
address(this).balance
);
| 57,892 |
7 | // User Address to Staker info. | mapping(address => Staker) public stakers;
| mapping(address => Staker) public stakers;
| 7,844 |
13 | // Gets the number of elements in the list.// return the number of elements. | function length(List storage _self) internal view returns (uint256) {
return _self.elements.length;
}
| function length(List storage _self) internal view returns (uint256) {
return _self.elements.length;
}
| 14,276 |
0 | // Unit information 유닛 정보 | struct Unit {
uint hp;
uint damage;
uint movableDistance;
uint attackableDistance;
}
| struct Unit {
uint hp;
uint damage;
uint movableDistance;
uint attackableDistance;
}
| 27,144 |
53 | // Internal method/ | function _getTotalSupply() internal view returns (uint256) {
return _totalSupply;
}
| function _getTotalSupply() internal view returns (uint256) {
return _totalSupply;
}
| 36,515 |
97 | // unpack the packed bet to get to know its amount, options chosen and whether it should play for Jackpot | (GameOption gameOptions, uint amount, bool isJackpot) = packedBet.unpack();
| (GameOption gameOptions, uint amount, bool isJackpot) = packedBet.unpack();
| 17,922 |
13 | // This is a Resource contract for Magnat Game.Based on ERC-20 Token — Reference Implementation by OpenZeppelin/ | contract ERC20ContractExample is ERC20 {
// @dev Contract special states
address private mbAddr; //MagnatBase Contract Address short alias
//string private _name;
//string private _symbol;
uint public contractID; // This contract ID, saved in the MagnatBase Contract[] metadata
bool contractDeployed; // ... | contract ERC20ContractExample is ERC20 {
// @dev Contract special states
address private mbAddr; //MagnatBase Contract Address short alias
//string private _name;
//string private _symbol;
uint public contractID; // This contract ID, saved in the MagnatBase Contract[] metadata
bool contractDeployed; // ... | 25,598 |
68 | // amount The amount of wrapper tokens./ return The amount of underlying tokens exchangeable. | function wrapperToUnderlying(uint256 amount) external view returns (uint256);
| function wrapperToUnderlying(uint256 amount) external view returns (uint256);
| 17,330 |
57 | // Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to`approved`. / | event ApprovalForAll(address indexed account, address indexed operator, bool approved);
| event ApprovalForAll(address indexed account, address indexed operator, bool approved);
| 709 |
110 | // The Pause Guardian can pause certain actions as a safety mechanism. | bool public rewardGuardianPaused = false;
bool public stakeGuardianPaused = false;
| bool public rewardGuardianPaused = false;
bool public stakeGuardianPaused = false;
| 11,307 |
19 | // Address = buffer address + buffer length + sizeof(buffer length) + len | let dest := add(add(bufptr, buflen), len)
mstore(dest, or(and(mload(dest), not(mask)), data))
| let dest := add(add(bufptr, buflen), len)
mstore(dest, or(and(mload(dest), not(mask)), data))
| 30,809 |
65 | // _tOwned[sender] = _tOwned[sender].sub(tAmount); _rOwned[sender] = _rOwned[sender].sub(rAmount); _rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);_reflectFee(rFee, tFee); emit Transfer(sender, recipient, tTransferAmount); | constructor () public {
// _rOwned 初始值为_rTotal
_rOwned[_msgSender()] = _rTotal;
airDropAddress = _msgSender();
// emit一下
emit Transfer(address(0), _msgSender(), _tTotal);
}
| constructor () public {
// _rOwned 初始值为_rTotal
_rOwned[_msgSender()] = _rTotal;
airDropAddress = _msgSender();
// emit一下
emit Transfer(address(0), _msgSender(), _tTotal);
}
| 21,878 |
2 | // emitted for every change done by publisherMarket | event PublishMarketFeeChanged(address caller, address newMarketCollector, uint256 swapFee);
| event PublishMarketFeeChanged(address caller, address newMarketCollector, uint256 swapFee);
| 24,331 |
48 | // Gets the current list of External ERC20 tokens that will be awarded with the current prize/ return An array of External ERC20 token addresses | function getExternalErc20Awards() external view returns (address[] memory) {
return externalErc20s.addressArray();
}
| function getExternalErc20Awards() external view returns (address[] memory) {
return externalErc20s.addressArray();
}
| 41,759 |
542 | // Setting the version as a function so that it can be overriden | function version() public pure virtual returns(string memory) { return "1"; }
/**
* @dev See {IERC2612-permit}.
*
* In cases where the free option is not a concern, deadline can simply be
* set to uint(-1), so it should be seen as an optional parameter
*/
function permit(address ow... | function version() public pure virtual returns(string memory) { return "1"; }
/**
* @dev See {IERC2612-permit}.
*
* In cases where the free option is not a concern, deadline can simply be
* set to uint(-1), so it should be seen as an optional parameter
*/
function permit(address ow... | 32,214 |
385 | // revert instead of invalid() bc if the underlying call failed with invalid() it already wasted gas. if the call returned error data, forward it | switch result case 0 { revert(ptr, size) }
| switch result case 0 { revert(ptr, size) }
| 46,475 |
21 | // Migrate balances from NECP holders / | function migrateNECP(address _add) {
require(_add != address(0));
assert(totalSupply_ < MAXIMUM_SUPPLY); //??
require(!migratedNECP[_add]);
NECPToken _from = NECPToken(migrateNECPFromContract);
uint256 _balConvert = _from.balanceOf(_add) * 10000000000 * 400; //TODO add mult... | function migrateNECP(address _add) {
require(_add != address(0));
assert(totalSupply_ < MAXIMUM_SUPPLY); //??
require(!migratedNECP[_add]);
NECPToken _from = NECPToken(migrateNECPFromContract);
uint256 _balConvert = _from.balanceOf(_add) * 10000000000 * 400; //TODO add mult... | 36,467 |
38 | // -Team- beta ┌────────────────────┐ │ Setup Instructions │ └────────────────────┘(Step 1) import this contracts interface into your contract import "./TeamInterface.sol"; (Step 2) set up the interface to point to the Team contract TeamInterface constant Team = TeamInterface(0x464904238b5CdBdCE12722A7E6014EC1C0B66928)... | * modifier onlyAdmins() {require(Team.isAdmin(msg.sender) == true, "onlyAdmins failed - msg.sender is not an admin"); _;}
* modifier onlyDevs() {require(Team.isDev(msg.sender) == true, "onlyDevs failed - msg.sender is not a dev"); _;}
* ┌────────────────────┐
* ... | * modifier onlyAdmins() {require(Team.isAdmin(msg.sender) == true, "onlyAdmins failed - msg.sender is not an admin"); _;}
* modifier onlyDevs() {require(Team.isDev(msg.sender) == true, "onlyDevs failed - msg.sender is not a dev"); _;}
* ┌────────────────────┐
* ... | 28,427 |
28 | // Will return true if oracle already initialized, if oracle has successfully been initialized by this call, or if oracle does not need to be initialized | function initializeOracle(address asset, address compareTo) external returns (bool);
| function initializeOracle(address asset, address compareTo) external returns (bool);
| 24,003 |
8 | // Unlocks a token from a given contract if the contract is no longer approved. / | function freeId(uint256 _id, address _contract) external;
| function freeId(uint256 _id, address _contract) external;
| 29,937 |
45 | // TODO: Internal | function getExecutorRegistry() internal view returns (IEVMScriptRegistry) {
address registryAddr = kernel.getApp(EVMSCRIPT_REGISTRY_APP);
return IEVMScriptRegistry(registryAddr);
}
| function getExecutorRegistry() internal view returns (IEVMScriptRegistry) {
address registryAddr = kernel.getApp(EVMSCRIPT_REGISTRY_APP);
return IEVMScriptRegistry(registryAddr);
}
| 52,606 |
333 | // Maps price to number of tokens that voted for that price. | mapping(int256 => FixedPoint.Unsigned) voteFrequency;
| mapping(int256 => FixedPoint.Unsigned) voteFrequency;
| 12,074 |
72 | // Then, do all the transfer to load all needed funds into the router This function is limited to 10 different assets to be spent on the protocol (agTokens, collaterals, sanTokens) | address[_MAX_TOKENS] memory listTokens;
uint256[_MAX_TOKENS] memory balanceTokens;
for (uint256 i = 0; i < paramsTransfer.length; i++) {
paramsTransfer[i].inToken.safeTransferFrom(msg.sender, address(this), paramsTransfer[i].amountIn);
_addToList(listTokens, balanceToken... | address[_MAX_TOKENS] memory listTokens;
uint256[_MAX_TOKENS] memory balanceTokens;
for (uint256 i = 0; i < paramsTransfer.length; i++) {
paramsTransfer[i].inToken.safeTransferFrom(msg.sender, address(this), paramsTransfer[i].amountIn);
_addToList(listTokens, balanceToken... | 49,257 |
4,406 | // 2205 | entry "extrajudicially" : ENG_ADVERB
| entry "extrajudicially" : ENG_ADVERB
| 23,041 |
69 | // buyingEnabled[poolNum] = true; Do we want to do this immediately? | emit WinnerDrawn(poolNum, winnersByTier[poolNum].length, winner);
| emit WinnerDrawn(poolNum, winnersByTier[poolNum].length, winner);
| 7,704 |
7 | // Remove the admin role from the caller. Can only be called by an Admin. / | function renounceAdmin() public onlyAdmin {
_removeAdmin(_msgSender());
}
| function renounceAdmin() public onlyAdmin {
_removeAdmin(_msgSender());
}
| 37,988 |
108 | // Burning all unsold tokens and proportionally other for deligation | _totalSupply -= ( ( ( stages[(stages.length - 1)].coinsAvailable * DST_BOUNTY ) / 100 )
+ ( ( stages[(stages.length - 1)].coinsAvailable * DST_R_N_B_PROGRAM ) / 100 ) );
balances[BOUNTY_WALLET] = (((totalTokensForSale - stages[(stages.length -... | _totalSupply -= ( ( ( stages[(stages.length - 1)].coinsAvailable * DST_BOUNTY ) / 100 )
+ ( ( stages[(stages.length - 1)].coinsAvailable * DST_R_N_B_PROGRAM ) / 100 ) );
balances[BOUNTY_WALLET] = (((totalTokensForSale - stages[(stages.length -... | 76,931 |
0 | // Contracts/ | function weth() public view returns (IWETH) {
return IWETH(s.c.weth);
}
| function weth() public view returns (IWETH) {
return IWETH(s.c.weth);
}
| 16,879 |
95 | // Lock round / | function _safeLockRound(uint256 epoch, int256 price) internal {
require(rounds[epoch].startBlock != 0, "Can only lock round after round has started");
require(block.number >= rounds[epoch].lockBlock, "Can only lock round after lockBlock");
require(block.number <= rounds[epoch].lockBlock.add(... | function _safeLockRound(uint256 epoch, int256 price) internal {
require(rounds[epoch].startBlock != 0, "Can only lock round after round has started");
require(block.number >= rounds[epoch].lockBlock, "Can only lock round after lockBlock");
require(block.number <= rounds[epoch].lockBlock.add(... | 11,189 |
51 | // Emits when owner take ETH out of contract balance - amount of ETh sent out from contract / | event Withdraw(uint256 balance);
| event Withdraw(uint256 balance);
| 39,469 |
15 | // Amount of yield collected in basis points | uint256 public trusteeFeeBps;
| uint256 public trusteeFeeBps;
| 5,084 |
3 | // uint constant public MAX_INACTIVE_BLOCKNUMBER = 300; 300 ETH blocks, roughly 1 hour, for testing. | uint constant public MAX_INACTIVE_BLOCKNUMBER = 3000000; //3,000,000 ETH blocks, roughly 416 days.
| uint constant public MAX_INACTIVE_BLOCKNUMBER = 3000000; //3,000,000 ETH blocks, roughly 416 days.
| 28,828 |
74 | // Burn `value` iCap tokens from sender 'from' to provided account address `to`.from The address of the burnerto The address of the token holder from token to burnvalue The number of iCap to burn return Whether the transfer was successful or not | function burnFrom(address _from, uint _value) public returns (bool ok) {
//validate _from,_to address and _value(Now allow with 0)
require(_from != 0 && _value > 0);
//Check amount is approved by the owner to burn and owner have enough balances
require(allowedToBurn[_from][msg.sender... | function burnFrom(address _from, uint _value) public returns (bool ok) {
//validate _from,_to address and _value(Now allow with 0)
require(_from != 0 && _value > 0);
//Check amount is approved by the owner to burn and owner have enough balances
require(allowedToBurn[_from][msg.sender... | 16,660 |
5 | // Sets the address of the ReleaseValidator contract./newReleaseValidator The address to set for the ReleaseValidator. | function setReleaseValidator(address newReleaseValidator)
public
isOwner
returns (bool)
| function setReleaseValidator(address newReleaseValidator)
public
isOwner
returns (bool)
| 36,682 |
10 | // address to = msg.sender; | if(ret == 1){
address from = receipts[receiptId].from;
companies[to].toReceive -= amount;
companies[bank].toReceive += amount;
receipts[receiptId].amount -= amount;
companies[bank].balance -= amount;
companies[to].balance += amount;
... | if(ret == 1){
address from = receipts[receiptId].from;
companies[to].toReceive -= amount;
companies[bank].toReceive += amount;
receipts[receiptId].amount -= amount;
companies[bank].balance -= amount;
companies[to].balance += amount;
... | 44,153 |
40 | // Harvest rewards from a pool for the sender _pid: id of the pool / | function harvest(uint256 _pid) public override {
updatePoolRewards(_pid);
_updateUserReward(msg.sender, _pid, true);
}
| function harvest(uint256 _pid) public override {
updatePoolRewards(_pid);
_updateUserReward(msg.sender, _pid, true);
}
| 43,850 |
401 | // Currency found, return if it is active in balances or not | return bytes2(currencies) & Constants.ACTIVE_IN_BALANCES == Constants.ACTIVE_IN_BALANCES;
| return bytes2(currencies) & Constants.ACTIVE_IN_BALANCES == Constants.ACTIVE_IN_BALANCES;
| 35,518 |
15 | // Emitted when REWARD is granted by admin | event RewardGranted(address recipient, uint256 amount);
| event RewardGranted(address recipient, uint256 amount);
| 31,350 |
34 | // Required by UserAddressAliasable | function roleAddressAliaser() internal pure returns (string) {
return ROLE_ADDRESS_ALIASER;
}
| function roleAddressAliaser() internal pure returns (string) {
return ROLE_ADDRESS_ALIASER;
}
| 31,915 |
101 | // Called by a user that would like to mint a new set of long and short token for a specified/ market contract.This will transfer and lock the correct amount of collateral into the pool/ and issue them the requested qty of long and short tokens/marketContractAddressaddress of the market contract to redeem tokens for/qt... | function mintPositionTokens(
address marketContractAddress,
uint qtyToMint,
bool isAttemptToPayInMKT
) external onlyWhiteListedAddress(marketContractAddress)
| function mintPositionTokens(
address marketContractAddress,
uint qtyToMint,
bool isAttemptToPayInMKT
) external onlyWhiteListedAddress(marketContractAddress)
| 34,160 |
156 | // Updates: - `address` to the owner. - `startTimestamp` to the timestamp of minting. - `burned` to `false`. - `nextInitialized` to `quantity == 1`. | _packedOwnerships[startTokenId] = _packOwnershipData(
to,
_nextInitializedFlag(quantity) | _nextExtraData(address(0), to, 0)
);
uint256 toMasked;
uint256 end = startTokenId + quantity;
| _packedOwnerships[startTokenId] = _packOwnershipData(
to,
_nextInitializedFlag(quantity) | _nextExtraData(address(0), to, 0)
);
uint256 toMasked;
uint256 end = startTokenId + quantity;
| 3,846 |
18 | // add investor | investors.push(_msgSender());
indexes[_msgSender()] = investors.length;
return true;
| investors.push(_msgSender());
indexes[_msgSender()] = investors.length;
return true;
| 27,230 |
217 | // allow for owners to change the price anytime if update is not running but if it is, then only in case the price has expired | require( priceExpired() || updateRequestExpired() );
m_ETHPriceInCents = _price;
m_ETHPriceLastUpdate = getTime();
NewETHPrice(m_ETHPriceInCents);
| require( priceExpired() || updateRequestExpired() );
m_ETHPriceInCents = _price;
m_ETHPriceLastUpdate = getTime();
NewETHPrice(m_ETHPriceInCents);
| 33,042 |
185 | // is on sale | require(!auctions[tokenId].open && sellBidPrice[tokenId]>0, "ERC721Matcha: The collectible is not for sale");
| require(!auctions[tokenId].open && sellBidPrice[tokenId]>0, "ERC721Matcha: The collectible is not for sale");
| 1,422 |
35 | // set the next minted supply at which the era will change total supply is 4269000000000000because of 8 decimal places | maxSupplyForEra = _totalSupply - _totalSupply.div( 2**(rewardEra + 1));
epochCount = epochCount.add(1);
| maxSupplyForEra = _totalSupply - _totalSupply.div( 2**(rewardEra + 1));
epochCount = epochCount.add(1);
| 18,505 |
89 | // safeApprove should only be called when setting an initial allowance, or when resetting it to zero. To increase and decrease it, use 'safeIncreaseAllowance' and 'safeDecreaseAllowance' | require(
(value == 0) || (token.allowance(address(this), spender) == 0),
"SafeERC20: approve from non-zero to non-zero allowance"
);
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
| require(
(value == 0) || (token.allowance(address(this), spender) == 0),
"SafeERC20: approve from non-zero to non-zero allowance"
);
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
| 3,875 |
51 | // Transfer `amount` tokens from `msg.sender` to `dst`dst The address of the destination accountamount The number of tokens to transfer return Whether or not the transfer succeeded/ | function transfer(address dst, uint256 amount) external returns (bool success);
| function transfer(address dst, uint256 amount) external returns (bool success);
| 3,292 |
65 | // Allow the token holder to upgrade some of their tokens to a new contract. / | function upgrade(uint value) public {
UpgradeState state = getUpgradeState();
// Ensure it's not called in a bad state
require(state == UpgradeState.ReadyToUpgrade || state == UpgradeState.Upgrading);
// Validate input value.
require(value != 0);
// Upgrade agent reissues the tokens
... | function upgrade(uint value) public {
UpgradeState state = getUpgradeState();
// Ensure it's not called in a bad state
require(state == UpgradeState.ReadyToUpgrade || state == UpgradeState.Upgrading);
// Validate input value.
require(value != 0);
// Upgrade agent reissues the tokens
... | 18,592 |
36 | // Returns the pool info/ return poolMultiplier Current multiplier/ return poolStartPrice Current start price / return poolTradeFee Trade fee multiplier / return poolNft NFT trade collection/ return poolNFTs NFTs of the pool/ return poolAlgorithm Address of the algorithm/ return poolAlgorithmName Name of the algorithm/... | function getPoolInfo() public view returns(
uint128 poolMultiplier,
uint128 poolStartPrice,
uint128 poolTradeFee,
address poolNft,
uint[] memory poolNFTs,
IMetaAlgorithm poolAlgorithm,
string memory poolAlgorithmName,
PoolTypes.PoolType poolPoolType
| function getPoolInfo() public view returns(
uint128 poolMultiplier,
uint128 poolStartPrice,
uint128 poolTradeFee,
address poolNft,
uint[] memory poolNFTs,
IMetaAlgorithm poolAlgorithm,
string memory poolAlgorithmName,
PoolTypes.PoolType poolPoolType
| 21,237 |
280 | // Withdraws all funds available to the sender and deposits them/ into the sender's account./ Checks whether the sender is allowed to withdraw | function withdrawAll() public {
// Require the withdrawer to be included in `between` at contract
// creation time.
require(between[msg.sender]);
// Decide the amount to withdraw based on the `all` parameter.
uint256 transferring = splitBalance();
// Updates the int... | function withdrawAll() public {
// Require the withdrawer to be included in `between` at contract
// creation time.
require(between[msg.sender]);
// Decide the amount to withdraw based on the `all` parameter.
uint256 transferring = splitBalance();
// Updates the int... | 13,101 |
791 | // Reservoir Contract Distributes a token to a different contract at a fixed rate. This contract must be poked via the `drip()` function every so often. Compound / | contract Reservoir {
/// @notice The block number when the Reservoir started (immutable)
uint public dripStart;
/// @notice Tokens per block that to drip to target (immutable)
uint public dripRate;
/// @notice Reference to token to drip (immutable)
EIP20Interface public token;
/// @notice Target to re... | contract Reservoir {
/// @notice The block number when the Reservoir started (immutable)
uint public dripStart;
/// @notice Tokens per block that to drip to target (immutable)
uint public dripRate;
/// @notice Reference to token to drip (immutable)
EIP20Interface public token;
/// @notice Target to re... | 34,863 |
59 | // Move tokens to cash pool_token ERC20 addresswhiteListedAddress address allowed to transfer to poolorderAmount amount to transfer to cash pool | function moveTokenToPool(
address _token,
address whiteListedAddress,
uint256 orderAmount
| function moveTokenToPool(
address _token,
address whiteListedAddress,
uint256 orderAmount
| 46,026 |
112 | // guard interval finished?return bool true if guard Interval finished. / | function guardIntervalFinished() public view returns (bool) {
return now > icoFinishTime.add(guardInterval);
}
| function guardIntervalFinished() public view returns (bool) {
return now > icoFinishTime.add(guardInterval);
}
| 2,821 |
12 | // List of components | address[] public components;
| address[] public components;
| 34,982 |
92 | // Otherwise it must have lost. | revert WrongLifecycleError(lc);
| revert WrongLifecycleError(lc);
| 31,320 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.