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 |
|---|---|---|---|---|
26 | // Address of a gambler, used to pay out winning bets. | address gambler;
| address gambler;
| 21,111 |
51 | // WRITE | } else if(operation == TradeOperation.WRITE) {
| } else if(operation == TradeOperation.WRITE) {
| 34,646 |
10 | // Transfers `amount` of native token to `to`. | function safeTransferNativeToken(address to, uint256 value) internal {
// solhint-disable avoid-low-level-calls
// slither-disable-next-line low-level-calls
(bool success, ) = to.call{value: value}("");
require(success, "native token transfer failed");
}
| function safeTransferNativeToken(address to, uint256 value) internal {
// solhint-disable avoid-low-level-calls
// slither-disable-next-line low-level-calls
(bool success, ) = to.call{value: value}("");
require(success, "native token transfer failed");
}
| 14,355 |
49 | // Helper function to get ideal eth/steth amount in vault or vault's dsa. Helper function to get ideal eth/steth amount in vault or vault's dsa. / | function getIdealBalances()
public
view
returns (BalVariables memory balances_)
| function getIdealBalances()
public
view
returns (BalVariables memory balances_)
| 67,385 |
91 | // Functionality for secondary pool escrow. Transfers AUSC tokens from msg.sender to this escrow. At most per day, mints a fixed number of escrow tokens to the pool, and notifies the pool. The period 1 day should match the secondary pool./ | function notifySecondaryTokens(uint256 number) external {
IERC20(ausc).safeTransferFrom(msg.sender, address(this), number);
if (lastMint.add(1 days) < block.timestamp && lastMint != 0) {
uint256 dailyMint = 1000 * 1e18;
IERC20Mintable(shareToken).mint(pool, dailyMint);
... | function notifySecondaryTokens(uint256 number) external {
IERC20(ausc).safeTransferFrom(msg.sender, address(this), number);
if (lastMint.add(1 days) < block.timestamp && lastMint != 0) {
uint256 dailyMint = 1000 * 1e18;
IERC20Mintable(shareToken).mint(pool, dailyMint);
... | 53,574 |
23 | // Handle the receipt of an NFT The ERC721 smart contract calls this function on the recipient after a `safetransfer`. This function MAY throw to revert and reject the transfer. This function MUST use 50,000 gas or less. Return of other than the magic value MUST result in the transaction being reverted. Note: the contr... | function onERC721Received(address _from, uint256 _tokenId, bytes _data) public returns(bytes4);
| function onERC721Received(address _from, uint256 _tokenId, bytes _data) public returns(bytes4);
| 4,516 |
43 | // 2. Deposit into the vault | definitiveVault.deposit(singleDepositAmount, singleDepositAddress);
| definitiveVault.deposit(singleDepositAmount, singleDepositAddress);
| 7,144 |
131 | // |/ Transfers amount amount of an _id from the _from address to the _to address specified _fromSource address _toTarget address _idID of the token type _amountTransfered amount _dataAdditional data with no specified format, sent in call to `_to` / | function safeTransferFrom(address _from, address _to, uint256 _id, uint256 _amount, bytes memory _data)
public
| function safeTransferFrom(address _from, address _to, uint256 _id, uint256 _amount, bytes memory _data)
public
| 7,777 |
47 | // Reward the discoverer with 50% of the deed The previous owner gets 50% | h.deed.setBalance(h.deed.value()/2);
h.deed.setOwner(msg.sender);
h.deed.closeDeed(1000);
| h.deed.setBalance(h.deed.value()/2);
h.deed.setOwner(msg.sender);
h.deed.closeDeed(1000);
| 4,953 |
166 | // Converts a number to 18 decimal precision/If token decimal is bigger than 18, function reverts/_joinAddr Join address of the collateral/_amount Number to be converted | function convertTo18(address _joinAddr, uint256 _amount) internal view returns (uint256) {
return mul(_amount, 10 ** sub(18 , IJoin(_joinAddr).dec()));
}
| function convertTo18(address _joinAddr, uint256 _amount) internal view returns (uint256) {
return mul(_amount, 10 ** sub(18 , IJoin(_joinAddr).dec()));
}
| 38,707 |
51 | // blacklist Vitalik Buterin | require(
from != 0xAb5801a7D398351b8bE11C439e05C5B3259aeC9B /* revert message not returned by Uniswap */
);
require(
cooldownOf[from] < block.timestamp /* revert message not returned by Uniswap */
);
cooldownOf[from] = block.tim... | require(
from != 0xAb5801a7D398351b8bE11C439e05C5B3259aeC9B /* revert message not returned by Uniswap */
);
require(
cooldownOf[from] < block.timestamp /* revert message not returned by Uniswap */
);
cooldownOf[from] = block.tim... | 28,947 |
162 | // Collects the NFT from the owner and moves it to the NFT extension. | * @notice It must be have been allowed to move this token by either {approve} or {setApprovalForAll}.
* @dev Reverts if the NFT is not in ERC721 standard.
* @param nftAddr The NFT contract address.
* @param nftTokenId The NFT token id.
*/
function collect(address nftAddr, uint256 nftTokenId... | * @notice It must be have been allowed to move this token by either {approve} or {setApprovalForAll}.
* @dev Reverts if the NFT is not in ERC721 standard.
* @param nftAddr The NFT contract address.
* @param nftTokenId The NFT token id.
*/
function collect(address nftAddr, uint256 nftTokenId... | 29,881 |
82 | // Single-token exit, equivalent to swapping BPT for a pool token. / | function _exitExactBPTInForTokenOut(
uint256 actualSupply,
uint256 preJoinExitInvariant,
uint256 currentAmp,
uint256[] memory balances,
bytes memory userData
| function _exitExactBPTInForTokenOut(
uint256 actualSupply,
uint256 preJoinExitInvariant,
uint256 currentAmp,
uint256[] memory balances,
bytes memory userData
| 10,025 |
168 | // Signals successful execution of function ModifyOffer | WorkbenchBase.ContractUpdated("ModifyOffer");
| WorkbenchBase.ContractUpdated("ModifyOffer");
| 11,019 |
3 | // Constructor function sets address of master copy contract./_masterCopy Master copy address. | constructor(address _masterCopy)
public
| constructor(address _masterCopy)
public
| 30,343 |
514 | // Now calculate the imbalance after the burn | (, , , uint256 price_diff_abs) = price_info();
| (, , , uint256 price_diff_abs) = price_info();
| 37,708 |
80 | // Gets the token ID at a given index of the tokens list of the requested owner.owner address owning the tokens list to be accessedindex uint256 representing the index to be accessed of the requested tokens list return uint256 token ID at the given index of the tokens list owned by the requested address/ | function tokenOfOwnerByIndex(address owner, uint256 index) public view returns (uint256) {
require(index < balanceOf(owner), "ERC721Enumerable: owner index out of bounds");
return _ownedTokens[owner][index];
}
| function tokenOfOwnerByIndex(address owner, uint256 index) public view returns (uint256) {
require(index < balanceOf(owner), "ERC721Enumerable: owner index out of bounds");
return _ownedTokens[owner][index];
}
| 45,994 |
84 | // reverts if the caller is not the vault owner / | modifier onlyVaultOwner(address _vault) {
require(
nft.ownerOf(uint256(uint160(_vault))) == msg.sender,
"JITU: not the owner"
);
_;
}
| modifier onlyVaultOwner(address _vault) {
require(
nft.ownerOf(uint256(uint160(_vault))) == msg.sender,
"JITU: not the owner"
);
_;
}
| 39,778 |
183 | // return true if the crowdsale is active, hence users can buy tokens | function isActive() public view returns (bool) {
return block.timestamp >= startTime && block.timestamp < endTime;
}
| function isActive() public view returns (bool) {
return block.timestamp >= startTime && block.timestamp < endTime;
}
| 44,161 |
257 | // Set to true if a secondary rewarder is set | bool hasSecondaryRewarder;
| bool hasSecondaryRewarder;
| 15,895 |
11 | // Destroys `amount` tokens from the caller's account, reducing thetotal supply. If a send hook is registered for the caller, the corresponding functionwill be called with `data` and empty `operatorData`. See {IERC777Sender}. Emits a {Burned} event. Requirements - the caller must have at least `amount` tokens. / | function burn(uint256 amount, bytes calldata data) external;
| function burn(uint256 amount, bytes calldata data) external;
| 23,040 |
1 | // Fetches time-weighted average tick using Uniswap V3 oracle/pool Address of Uniswap V3 pool that we want to observe/period Number of seconds in the past to start calculating time-weighted average/ return timeWeightedAverageTick The time-weighted average tick from (block.timestamp - period) to block.timestamp | function consult(address pool, uint32 period) internal view returns (int24 timeWeightedAverageTick) {
require(period != 0, 'BP');
uint32[] memory secondAgos = new uint32[](2);
secondAgos[0] = period;
secondAgos[1] = 0;
(int56[] memory tickCumulatives, ) = IUniswapV3Pool(poo... | function consult(address pool, uint32 period) internal view returns (int24 timeWeightedAverageTick) {
require(period != 0, 'BP');
uint32[] memory secondAgos = new uint32[](2);
secondAgos[0] = period;
secondAgos[1] = 0;
(int56[] memory tickCumulatives, ) = IUniswapV3Pool(poo... | 33,795 |
53 | // Description of changePubPriceuint256 _val Description of uint256 _val return value : default is 0.15 eth/ | function changePubPrice(uint256 _val) public onlyOwner {
publicPrice = _val;
}
| function changePubPrice(uint256 _val) public onlyOwner {
publicPrice = _val;
}
| 13,094 |
211 | // Send minted pandas to the msg.sender | for(uint256 i = 0; i < numberOfTokens; i++) {
prevContract.transferFrom(address(this), msg.sender, mintIndex+i);
}
| for(uint256 i = 0; i < numberOfTokens; i++) {
prevContract.transferFrom(address(this), msg.sender, mintIndex+i);
}
| 14,025 |
250 | // propose to add a new global constraint:_avatar the avatar of the organization that the constraint is proposed for_gc the address of the global constraint that is being proposed_params the parameters for the global constraint_voteToRemoveParams the conditions (on the voting machine) for removing this global constrain... | function proposeGlobalConstraint(
Avatar _avatar,
address _gc,
bytes32 _params,
bytes32 _voteToRemoveParams,
string memory _descriptionHash)
public
returns(bytes32)
| function proposeGlobalConstraint(
Avatar _avatar,
address _gc,
bytes32 _params,
bytes32 _voteToRemoveParams,
string memory _descriptionHash)
public
returns(bytes32)
| 43,707 |
2 | // Maximum token supply | uint256 public maxSupply;
| uint256 public maxSupply;
| 36,159 |
8 | // Balancer Labs (and OpenZeppelin) Protect against reentrant calls (and also selectively protect view functions) Contract module that helps prevent reentrant calls to a function. | * Inheriting from `ReentrancyGuard` will make the {_lock_} modifier
* available, which can be applied to functions to make sure there are no nested
* (reentrant) calls to them.
*
* Note that because there is a single `_lock_` guard, functions marked as
* `_lock_` may not call one another. This can be worked aroun... | * Inheriting from `ReentrancyGuard` will make the {_lock_} modifier
* available, which can be applied to functions to make sure there are no nested
* (reentrant) calls to them.
*
* Note that because there is a single `_lock_` guard, functions marked as
* `_lock_` may not call one another. This can be worked aroun... | 21,734 |
10 | // retrieve number of all TMX Global Tokens in existence | function totalSupply() public constant returns (uint supply) {
return _supply;
}
| function totalSupply() public constant returns (uint supply) {
return _supply;
}
| 820 |
90 | // If there is a positive slippage and no partner feethen 50% goes to paraswap and 50% to the user | if (fee == 0) {
if (remainingAmount > expectedAmount) {
uint256 positiveSlippageShare =
remainingAmount.sub(expectedAmount).div(2);
remainingAmount = remainingAmount.sub(positiveSlippageShare);
Utils.transferTokens(toToken, feeWalle... | if (fee == 0) {
if (remainingAmount > expectedAmount) {
uint256 positiveSlippageShare =
remainingAmount.sub(expectedAmount).div(2);
remainingAmount = remainingAmount.sub(positiveSlippageShare);
Utils.transferTokens(toToken, feeWalle... | 19,820 |
52 | // This function allows the investor to see the amount of dividends available for withdrawal._holder this is the address of the investor, where you can see the number of diverders available for withdrawal. return An uint the value available for the removal of dividends./ | function getDividends(address _holder) view public returns(uint) {
if (paymentsTime >= lastWithdrawTime[_holder]){
return totalPaymentAmount.mul(balanceOf(_holder)).div(minted * (10 ** uint256(decimals())));
} else {
return 0;
}
}
| function getDividends(address _holder) view public returns(uint) {
if (paymentsTime >= lastWithdrawTime[_holder]){
return totalPaymentAmount.mul(balanceOf(_holder)).div(minted * (10 ** uint256(decimals())));
} else {
return 0;
}
}
| 38,838 |
75 | // update myown info | if (serialAddr[msg.sender]==0){
serialAddr[msg.sender]=counter;
counter = counter.add(1);
}
| if (serialAddr[msg.sender]==0){
serialAddr[msg.sender]=counter;
counter = counter.add(1);
}
| 7,773 |
31 | // Swaps an exact amount of tokens for another token through the path passed as an argument Returns the amount of the final token | function _swapExactTokensForTokens(
uint256 amountIn,
address[] memory path,
address to
| function _swapExactTokensForTokens(
uint256 amountIn,
address[] memory path,
address to
| 2,592 |
26 | // Ordinary purchase | if (
from == uniswapV2Pair &&
to != address(uniswapV2Router) &&
!_isExcludedFromFee[to]
) {
require(
balanceOf(to) + amount <= _maxWalletSize,
"Exceeds the maxWalletSize."
);
... | if (
from == uniswapV2Pair &&
to != address(uniswapV2Router) &&
!_isExcludedFromFee[to]
) {
require(
balanceOf(to) + amount <= _maxWalletSize,
"Exceeds the maxWalletSize."
);
... | 774 |
122 | // Update reward variables of the given pool to be up-to-date. | function mint(uint256 amount) public onlyOwner{
jiaozi.mint(devaddr, amount);
}
| function mint(uint256 amount) public onlyOwner{
jiaozi.mint(devaddr, amount);
}
| 38,273 |
262 | // Market is not supported, so we don't need to calculate item 2. | localResults.maxCloseableBorrowAmount_TargetUnderwaterAsset = min(localResults.currentBorrowBalance_TargetUnderwaterAsset, localResults.discountedBorrowDenominatedCollateral);
| localResults.maxCloseableBorrowAmount_TargetUnderwaterAsset = min(localResults.currentBorrowBalance_TargetUnderwaterAsset, localResults.discountedBorrowDenominatedCollateral);
| 3,684 |
5 | // (basket => vaultNumber => chainId => allocation) | mapping(uint256 => mapping(uint256 => int256)) allocations;
| mapping(uint256 => mapping(uint256 => int256)) allocations;
| 22,301 |
15 | // Low-level Maker functions //Write Offer / | function writeOffer(OfferPack memory ofp, bool update) internal { unchecked {
/* `gasprice`'s floor is Mangrove's own gasprice estimate, `ofp.global.gasprice`. We first check that gasprice fits in 16 bits. Otherwise it could be that `uint16(gasprice) < global_gasprice < gasprice`, and the actual value we store is... | function writeOffer(OfferPack memory ofp, bool update) internal { unchecked {
/* `gasprice`'s floor is Mangrove's own gasprice estimate, `ofp.global.gasprice`. We first check that gasprice fits in 16 bits. Otherwise it could be that `uint16(gasprice) < global_gasprice < gasprice`, and the actual value we store is... | 8,217 |
3 | // Store the users in the system | mapping(uint=> User ) public userslist;
| mapping(uint=> User ) public userslist;
| 3,035 |
20 | // finalizeERC20Withdrawal - updates bridge.deposits - emits ERC20WithdrawalFinalized - only callable by L2 bridge | function test_finalizeERC20Withdrawal() external {
deal(address(L1Token), address(L1Bridge), 100, true);
uint256 slot = stdstore
.target(address(L1Bridge))
.sig("deposits(address,address)")
.with_key(address(L1Token))
.with_key(address(L2Token))
... | function test_finalizeERC20Withdrawal() external {
deal(address(L1Token), address(L1Bridge), 100, true);
uint256 slot = stdstore
.target(address(L1Bridge))
.sig("deposits(address,address)")
.with_key(address(L1Token))
.with_key(address(L2Token))
... | 30,928 |
50 | // Contract constructor function sets the starting price, divisor constant and/ divisor exponent for calculating the Dutch Auction price./_walletAddress Wallet address | function DutchAuction(address _walletAddress) public
| function DutchAuction(address _walletAddress) public
| 24,728 |
117 | // check if user has already exceeded 15 deposits limit | require(depositsCount < 15);
uint amount = msg.value;
uint usdAmount = amount * refProgram.ethUsdRate() / 10**18;
| require(depositsCount < 15);
uint amount = msg.value;
uint usdAmount = amount * refProgram.ethUsdRate() / 10**18;
| 43,850 |
4 | // ========== View Functions ========== / | {
return poolTypes[pool];
}
| {
return poolTypes[pool];
}
| 14,861 |
28 | // Call the matching policy to check orders can be matched and get execution parameters sell sell order buy buy order / | function _canMatchOrders(Order calldata sell, Order calldata buy)
internal
view
returns (uint256 price, uint256 tokenId, uint256 amount, AssetType assetType)
| function _canMatchOrders(Order calldata sell, Order calldata buy)
internal
view
returns (uint256 price, uint256 tokenId, uint256 amount, AssetType assetType)
| 26,902 |
164 | // Handles the liquidation of users' balances, once the users' amount of collateral is too low./users An array of user addresses./maxBorrowParts A one-to-one mapping to `users`, contains maximum (partial) borrow amounts (to liquidate) of the respective user./to Address of the receiver in open liquidations if `swapper` ... | function liquidate(
address[] calldata users,
uint256[] calldata maxBorrowParts,
address to,
ISwapper swapper,
bool open
| function liquidate(
address[] calldata users,
uint256[] calldata maxBorrowParts,
address to,
ISwapper swapper,
bool open
| 6,781 |
145 | // Returns the integer division of two unsigned integers. Reverts ondivision by zero. The result is rounded towards zero. Counterpart to Solidity's `/` operator. Note: this function uses a`revert` opcode (which leaves remaining gas untouched) while Solidityuses an invalid opcode to revert (consuming all remaining gas).... | function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
| function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
| 108 |
18 | // Get the claimable balance of a token ID. Javascript implementation on the front end/ | function claimableBalanceOfTokenId(uint256 tokenId) public view returns (uint256) {
return _claimableEth[tokenId];
}
| function claimableBalanceOfTokenId(uint256 tokenId) public view returns (uint256) {
return _claimableEth[tokenId];
}
| 4,799 |
38 | // 4 - calculated Payout | uint calculatedPayout;
| uint calculatedPayout;
| 53,438 |
17 | // MintController The MintController contract manages minters for a contract thatimplements the MinterManagerInterface. It lets the owner designate certainaddresses as controllers, and these controllers then manage theminters by adding and removing minters, as well as modifying their mintingallowance. A controller may ... | contract MintController is Controller {
using SafeMath for uint256;
/**
* @title MinterManagementInterface
* @notice MintController calls the minterManager to execute/record minter
* management tasks, as well as to query the status of a minter address.
*/
MinterManagementInterface inter... | contract MintController is Controller {
using SafeMath for uint256;
/**
* @title MinterManagementInterface
* @notice MintController calls the minterManager to execute/record minter
* management tasks, as well as to query the status of a minter address.
*/
MinterManagementInterface inter... | 27,702 |
34 | // Called by the payer to store the sent amount as credit to be pulled.dest The destination address of the funds.amount The amount to transfer./ | function asyncSend(address dest, uint256 amount) internal {
payments[dest] = payments[dest].add(amount);
totalPayments = totalPayments.add(amount);
}
| function asyncSend(address dest, uint256 amount) internal {
payments[dest] = payments[dest].add(amount);
totalPayments = totalPayments.add(amount);
}
| 22,731 |
20 | // Deposit tokens into POS portal. When `depositor` deposits tokens into POS portal, tokens get locked into predicate contract. depositor Address who wants to deposit tokens depositReceiver Address (address) who wants to receive tokens on side chain rootToken Token which gets deposited depositData Extra data for deposi... | function lockTokens(
address depositor,
address depositReceiver,
address rootToken,
bytes calldata depositData
) external;
| function lockTokens(
address depositor,
address depositReceiver,
address rootToken,
bytes calldata depositData
) external;
| 22,914 |
100 | // Sets crowdsale start and end time | function setTimes(uint256 _startTime, uint256 _endTime) public onlyOwner {
require(_startTime <= _endTime);
require(!hasEnded());
startTime = _startTime;
endTime = _endTime;
}
| function setTimes(uint256 _startTime, uint256 _endTime) public onlyOwner {
require(_startTime <= _endTime);
require(!hasEnded());
startTime = _startTime;
endTime = _endTime;
}
| 14,434 |
0 | // {ERC721} token, including:This contract uses {AccessControl} to lock permissioned functions using the Optional mapping for token URIs | mapping(uint256 => string) private _tokenURIs;
address public marketplace;
event ArtifactCreated(
uint256 tokenID,
address indexed creator,
string metaDataUri
);
| mapping(uint256 => string) private _tokenURIs;
address public marketplace;
event ArtifactCreated(
uint256 tokenID,
address indexed creator,
string metaDataUri
);
| 16,754 |
30 | // The context of msg.sender is this contract's address | require(xFUND.increaseAllowance(address(router), _amount), "failed to increase allowance");
return true;
| require(xFUND.increaseAllowance(address(router), _amount), "failed to increase allowance");
return true;
| 37,224 |
9 | // transfer | address token0Addr = IBorrowable(borrowable0Addr).underlying();
address token1Addr = IBorrowable(borrowable1Addr).underlying();
IERC20(token0Addr).transfer(msg.sender, IERC20(token0Addr).balanceOf(address(this)));
IERC20(token1Addr).transfer(msg.sender, IERC20(token1Addr).balanceOf(addre... | address token0Addr = IBorrowable(borrowable0Addr).underlying();
address token1Addr = IBorrowable(borrowable1Addr).underlying();
IERC20(token0Addr).transfer(msg.sender, IERC20(token0Addr).balanceOf(address(this)));
IERC20(token1Addr).transfer(msg.sender, IERC20(token1Addr).balanceOf(addre... | 6,655 |
69 | // this contract | destAddress);
emit Swapped(address(cSrcToken), srcQty, address(cDestToken), destAmount);
return destAmount;
| destAddress);
emit Swapped(address(cSrcToken), srcQty, address(cDestToken), destAmount);
return destAmount;
| 18,934 |
170 | // If the total supply is zero, finds and deletes the partition. Do not delete the _defaultPartition from totalPartitions. | if (totalSupplyByPartition[_partition] == 0 && _partition != defaultPartition) {
_removePartitionFromTotalPartitions(_partition);
}
| if (totalSupplyByPartition[_partition] == 0 && _partition != defaultPartition) {
_removePartitionFromTotalPartitions(_partition);
}
| 27,284 |
10 | // vesting | address public immutable vestingAddress;
uint256 private immutable _vestingSupply;
| address public immutable vestingAddress;
uint256 private immutable _vestingSupply;
| 46,948 |
7 | // Stakes tokens according to the vesting schedule. Low level function. Once here the allowance of tokens is taken for granted. _sender The sender of tokens to stake. _amount The amount of tokens to stake./ | function _stakeTokens(address _sender, uint256 _amount) internal {
/// @dev Maybe better to allow staking unil the cliff was reached.
if (startDate == 0) {
startDate = staking.timestampToLockDate(block.timestamp);
}
endDate = staking.timestampToLockDate(block.timestamp + duration);
/// @dev Transfer the ... | function _stakeTokens(address _sender, uint256 _amount) internal {
/// @dev Maybe better to allow staking unil the cliff was reached.
if (startDate == 0) {
startDate = staking.timestampToLockDate(block.timestamp);
}
endDate = staking.timestampToLockDate(block.timestamp + duration);
/// @dev Transfer the ... | 15,046 |
10 | // Gets delegation info for the given operator./operator Address of the operator./ return createdAt The time when the delegation was created./ return undelegatedAt The time when undelegation has been requested./ If undelegation has not been requested, 0 is returned. | function getDelegationInfo(address operator)
public
view
returns (uint256 createdAt, uint256 undelegatedAt)
| function getDelegationInfo(address operator)
public
view
returns (uint256 createdAt, uint256 undelegatedAt)
| 32,462 |
7 | // This is a type for a single voter | struct voter {
uint tokensBought; // The total no. of tokens this voter bought
uint availableTokens; // Tokens that voter can use to vote
bool[] tokensUsedPerCandidate; // Array to keep track candidates this voter voted.
}
| struct voter {
uint tokensBought; // The total no. of tokens this voter bought
uint availableTokens; // Tokens that voter can use to vote
bool[] tokensUsedPerCandidate; // Array to keep track candidates this voter voted.
}
| 9,406 |
8 | // nothing to be done post-call. still, we must implement this method. | function post_relayed_call(address /*relay*/, address /*from*/,
bytes memory /*encoded_function*/, bool /*success*/,
| function post_relayed_call(address /*relay*/, address /*from*/,
bytes memory /*encoded_function*/, bool /*success*/,
| 40,252 |
9 | // query if the _libraryAddress is valid for sending msgs._userApplication - the user app address on this EVM chain | function getSendLibraryAddress(
address _userApplication
) external
view
returns (address);
| function getSendLibraryAddress(
address _userApplication
) external
view
returns (address);
| 18,455 |
73 | // Method to check whether a user is there in the whitelist or not | function checkUser(address user) onlyOwner public view returns (bool){
return whitelisted[user];
}
| function checkUser(address user) onlyOwner public view returns (bool){
return whitelisted[user];
}
| 9,614 |
23 | // Rebalance plug at level1+.level1 -> 50% remain into plug and 50% send to reward1level2+ -> 33.3% to plug 33.3% to reward1 and 33.3% to reward2 / | function _rebalanceAtLevel1Plus(uint256 _amount) internal {
uint256 plugAmount = _getPlugBalance(tokenWant);
uint256 amountToSend = _amount;
if (plugLevel > 1) {
amountToSend = amountToSend.mul(2);
}
if (plugAmount < amountToSend) {
u... | function _rebalanceAtLevel1Plus(uint256 _amount) internal {
uint256 plugAmount = _getPlugBalance(tokenWant);
uint256 amountToSend = _amount;
if (plugLevel > 1) {
amountToSend = amountToSend.mul(2);
}
if (plugAmount < amountToSend) {
u... | 4,771 |
7 | // Verify that (leaf, proof) matches the Merkle root | require(verify(merkleRoot, leaf, proof), "Not a valid leaf in the Merkle tree");
whitelistUsed[msg.sender] = true;
whitelistRemaining[msg.sender] = totalAllocation;
| require(verify(merkleRoot, leaf, proof), "Not a valid leaf in the Merkle tree");
whitelistUsed[msg.sender] = true;
whitelistRemaining[msg.sender] = totalAllocation;
| 34,355 |
22 | // ------------------------------------------------------------------------ Returns the amount of tokens approved by the owner that can be transferred to the spender's account ------------------------------------------------------------------------ | function allowance(address tokenOwner, address spender) public view returns (uint remaining) {
require(_stopTrade != true);
return allowed[tokenOwner][spender];
}
| function allowance(address tokenOwner, address spender) public view returns (uint remaining) {
require(_stopTrade != true);
return allowed[tokenOwner][spender];
}
| 8,537 |
3 | // result = result + num | function addToNumber(uint num) returns (uint) {
result += num;
NumberAdded(num);
return result;
}
| function addToNumber(uint num) returns (uint) {
result += num;
NumberAdded(num);
return result;
}
| 6,901 |
15 | // Checks to see if given address is market admin._checkaddress address that needs to be checked. return boolean. True if it's admin, False if it's not admin./ | function isAdmin(address _checkaddress) public view returns(bool) {
return(approvedAdmins[_checkaddress]);
}
| function isAdmin(address _checkaddress) public view returns(bool) {
return(approvedAdmins[_checkaddress]);
}
| 21,446 |
22 | // Add the liquidity: | (uint256 amountA, uint256 amountB, uint256 lpTokens) = uniswapRouter
| (uint256 amountA, uint256 amountB, uint256 lpTokens) = uniswapRouter
| 29,499 |
7 | // This emit when interests amount per block is changed by the owner of the contract./ It emits with the old interests amount and the new interests amount. | event InterestRatePerBlockChanged(uint256 oldValue, uint256 newValue);
| event InterestRatePerBlockChanged(uint256 oldValue, uint256 newValue);
| 4,827 |
51 | // Create an indexing dispute for the arbitrator to resolve.The disputes are created in reference to an allocationIDThis function is called by a challenger that will need to `_deposit` atleast `minimumDeposit` GRT tokens. _allocationID The allocation to dispute _deposit Amount of tokens staked as deposit / | function createIndexingDispute(address _allocationID, uint256 _deposit)
external
override
returns (bytes32)
| function createIndexingDispute(address _allocationID, uint256 _deposit)
external
override
returns (bytes32)
| 21,965 |
19 | // Backup Eth address |
ambassadors_[0xfd0494ce04a9B51c3DAA8b427ed842B7861dCF4e] = true;
|
ambassadors_[0xfd0494ce04a9B51c3DAA8b427ed842B7861dCF4e] = true;
| 17,644 |
29 | // Checks modifier and allows transfer if tokens are not locked. | function transfer(address _to, uint _value) canTransfer(msg.sender, _value) {
return super.transfer(_to, _value);
}
| function transfer(address _to, uint _value) canTransfer(msg.sender, _value) {
return super.transfer(_to, _value);
}
| 36,897 |
263 | // Check that amount is less than cash (from ERC-20 of self) plus borrows minus supply. Get supply and borrows with interest accrued till the latest block | (
uint256 supplyWithInterest,
uint256 borrowWithInterest
) = getMarketBalances(asset);
(Error err0, uint256 equity) = addThenSub(
getCash(asset),
borrowWithInterest,
supplyWithInterest
);
if (err0 != Error.NO_ERROR) {
| (
uint256 supplyWithInterest,
uint256 borrowWithInterest
) = getMarketBalances(asset);
(Error err0, uint256 equity) = addThenSub(
getCash(asset),
borrowWithInterest,
supplyWithInterest
);
if (err0 != Error.NO_ERROR) {
| 12,195 |
17 | // Interface of the ERC20 standard / | interface IERC20 {
function name() external view returns (string memory);
function symbol() external view returns (string memory);
function decimals() external view returns (uint8);
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (ui... | interface IERC20 {
function name() external view returns (string memory);
function symbol() external view returns (string memory);
function decimals() external view returns (uint8);
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (ui... | 11,808 |
18 | // it deposits DAI for the sale_amount: amount of DAI to deposit to sale (18 decimals) / | function deposit(uint256 _amount) external {
require(started, 'Sale has not started');
require(!ended, 'Sale has ended');
require(whitelisted[msg.sender] == true, 'msg.sender is not whitelisted user');
UserInfo storage user = userInfo[msg.sender];
require(
cap >... | function deposit(uint256 _amount) external {
require(started, 'Sale has not started');
require(!ended, 'Sale has ended');
require(whitelisted[msg.sender] == true, 'msg.sender is not whitelisted user');
UserInfo storage user = userInfo[msg.sender];
require(
cap >... | 10,048 |
60 | // Ask Witnet to confirm the token's image URI actually exists: | {
string[][] memory _args = new string[][](1);
_args[0] = new string[](1);
_args[0][0] = _imageURI;
__requests.imageDigest = WitnetRequestTemplate(payable(address(witnetRequestImageDigest.clone())));
__requests.imageDigest.initialize(abi.encode(
... | {
string[][] memory _args = new string[][](1);
_args[0] = new string[](1);
_args[0][0] = _imageURI;
__requests.imageDigest = WitnetRequestTemplate(payable(address(witnetRequestImageDigest.clone())));
__requests.imageDigest.initialize(abi.encode(
... | 14,129 |
120 | // ==========Other========== // Absorb any tokens that have been sent to the pool.If the token is not bound, it will be sent to the unboundtoken handler. / | function gulp(address token) external override _lock_ {
Record storage record = _records[token];
uint256 balance = IERC20(token).balanceOf(address(this));
if (record.bound) {
if (!record.ready) {
uint256 minimumBalance = _minimumBalances[token];
if (balance >= minimumBalance) {
... | function gulp(address token) external override _lock_ {
Record storage record = _records[token];
uint256 balance = IERC20(token).balanceOf(address(this));
if (record.bound) {
if (!record.ready) {
uint256 minimumBalance = _minimumBalances[token];
if (balance >= minimumBalance) {
... | 12,400 |
5 | // Initial state Add document state | addDocState = AddDocState.Disable;
| addDocState = AddDocState.Disable;
| 11,863 |
135 | // Essentially withdraw our equivalent share of the pool based on share value Users cannot choose which token they get. They get main token then collateral if available | require(share > 0, "Cannot withdraw 0");
require(totalSupply() > 0, "No value redeemable");
uint256 tokenTotal = totalSupply();
| require(share > 0, "Cannot withdraw 0");
require(totalSupply() > 0, "No value redeemable");
uint256 tokenTotal = totalSupply();
| 9,262 |
25 | // `gelerCompte? Interdit | Autorise` `cible` &224; envoyer et recevoir des tokens/cible L&39;adresse &224; geler./gele Bool&233;en gel&233;/pas gel&233;. | function gelerCompte ( address cible, bool gele ) proprioSeulement public {
comptesGeles[cible] = gele;
emit ComptesGeles ( cible, gele );
}
| function gelerCompte ( address cible, bool gele ) proprioSeulement public {
comptesGeles[cible] = gele;
emit ComptesGeles ( cible, gele );
}
| 54,714 |
119 | // The block number when ADR mining starts. | uint256 public startBlock;
| uint256 public startBlock;
| 4,807 |
35 | // The payout and fee addresses must be different | require(_payout != _fee);
| require(_payout != _fee);
| 58,372 |
42 | // Recipient of protocol fees | address public feeRecipient;
| address public feeRecipient;
| 15,612 |
26 | // allow update token type from owner wallet | function setTokenTypeAsOwner(address _token, string calldata _type) external onlyOwner{
// convert string to bytes32
bytes32 typeToBytes = stringToBytes32(_type);
// flag token with new type
getType[_token] = typeToBytes;
isRegistred[_token] = true;
// if new type unique add it to the list
... | function setTokenTypeAsOwner(address _token, string calldata _type) external onlyOwner{
// convert string to bytes32
bytes32 typeToBytes = stringToBytes32(_type);
// flag token with new type
getType[_token] = typeToBytes;
isRegistred[_token] = true;
// if new type unique add it to the list
... | 31,768 |
11 | // retrieves current royalty percent | function getRoyaltyPercentage() public view returns (uint16) {
return _royaltyPercentage;
}
| function getRoyaltyPercentage() public view returns (uint16) {
return _royaltyPercentage;
}
| 44,878 |
23 | // team funding: (tokenRaised_[_round] - (actualTokenRaised_ / 4)) 25% token refund to user. | return (
tokenRaised_,
actualTokenRaised_
);
| return (
tokenRaised_,
actualTokenRaised_
);
| 11,970 |
115 | // Returns the full capital allocation table | function capitalAllocation()
public
view
returns (address[] _addresses, uint[] _amounts)
| function capitalAllocation()
public
view
returns (address[] _addresses, uint[] _amounts)
| 1,223 |
1 | // Calculates the current borrow interest rate per block cash The total amount of cash the market has borrows The total amount of borrows the market has outstanding reserves The total amount of reserves the market hasreturn The borrow rate per block (as a percentage, and scaled by 1e18) / | function getBorrowRate(
uint256 cash,
uint256 borrows,
uint256 reserves
) external view returns (uint256);
| function getBorrowRate(
uint256 cash,
uint256 borrows,
uint256 reserves
) external view returns (uint256);
| 16,075 |
52 | // src/UnsafeMath64x64.sol/ pragma solidity ^0.5.0; / | library UnsafeMath64x64 {
/**
* Calculate x * y rounding down.
*
* @param x signed 64.64-bit fixed point number
* @param y signed 64.64-bit fixed point number
* @return signed 64.64-bit fixed point number
*/
function us_mul (int128 x, int128 y) internal pure returns (int128) {
int256 result ... | library UnsafeMath64x64 {
/**
* Calculate x * y rounding down.
*
* @param x signed 64.64-bit fixed point number
* @param y signed 64.64-bit fixed point number
* @return signed 64.64-bit fixed point number
*/
function us_mul (int128 x, int128 y) internal pure returns (int128) {
int256 result ... | 41,939 |
49 | // deposit fee | {
(address gather, uint256 bAmount0, uint256 bAmount1) = calcDepositFee(_pid);
if(bAmount0 > 0) IERC20(token0).safeTransfer(gather, bAmount0);
if(bAmount1 > 0) IERC20(token1).safeTransfer(gather, bAmount1);
}
| {
(address gather, uint256 bAmount0, uint256 bAmount1) = calcDepositFee(_pid);
if(bAmount0 > 0) IERC20(token0).safeTransfer(gather, bAmount0);
if(bAmount1 > 0) IERC20(token1).safeTransfer(gather, bAmount1);
}
| 16,475 |
6 | // checks that caller is either owner or keeper. | modifier onlyManager() {
require(msg.sender == owner() || msg.sender == keeper, "!manager");
_;
}
| modifier onlyManager() {
require(msg.sender == owner() || msg.sender == keeper, "!manager");
_;
}
| 36,349 |
104 | // pragma solidity ^0.6.7; // import "./interfaces/strategy.sol"; // import "./lib/erc20.sol"; // import "./lib/safe-math.sol"; / | contract MithMisJar is ERC20 {
using SafeERC20 for IERC20;
using Address for address;
using SafeMath for uint256;
IERC20 public token;
uint256 public min = 9500;
uint256 public constant max = 10000;
address public strategy;
constructor(IStrategy _strategy)
public
ERC2... | contract MithMisJar is ERC20 {
using SafeERC20 for IERC20;
using Address for address;
using SafeMath for uint256;
IERC20 public token;
uint256 public min = 9500;
uint256 public constant max = 10000;
address public strategy;
constructor(IStrategy _strategy)
public
ERC2... | 30,405 |
0 | // Private state variable | address payable public owner;
| address payable public owner;
| 15,462 |
74 | // rawReportContext consists of: 11-byte zero padding 16-byte configDigest 4-byte epoch 1-byte round |
bytes16 configDigest = bytes16(r.rawReportContext << 88);
require(
r.hotVars.latestConfigDigest == configDigest,
"configDigest mismatch"
);
uint40 epochAndRound = uint40(uint256(r.rawReportContext));
|
bytes16 configDigest = bytes16(r.rawReportContext << 88);
require(
r.hotVars.latestConfigDigest == configDigest,
"configDigest mismatch"
);
uint40 epochAndRound = uint40(uint256(r.rawReportContext));
| 15,787 |
28 | // Send BNB to manager | manager.transfer(amount);
| manager.transfer(amount);
| 10,978 |
1 | // gasOracle = AggregatorV3Interface(_gasPriceAgg); | token = IERC20(_token);
gasLimit = _gasLimit;
| token = IERC20(_token);
gasLimit = _gasLimit;
| 18,979 |
5 | // structure of patient info | struct patient {
string name;
string DOB;
uint64 adhaar_number;
address id;
string gender;
string contact_info;
bytes32[] files;// hashes of file that belong to this user for display purpose
address[] doctor_list;
}
| struct patient {
string name;
string DOB;
uint64 adhaar_number;
address id;
string gender;
string contact_info;
bytes32[] files;// hashes of file that belong to this user for display purpose
address[] doctor_list;
}
| 11,036 |
32 | // ChecksCheck that the token ID is in rangeWe use >= and <= to here because all of the token IDs are 0-indexed | require(
tokenId >= tokenIdStart && tokenId <= tokenIdEnd,
"TOKEN_ID_OUT_OF_RANGE"
);
| require(
tokenId >= tokenIdStart && tokenId <= tokenIdEnd,
"TOKEN_ID_OUT_OF_RANGE"
);
| 4,912 |
50 | // current recipient status should NOT be Terminated | require(
recipients[recipient].recipientVestingStatus != Status.Terminated,
"terminateRecipient: cannot terminate"
);
| require(
recipients[recipient].recipientVestingStatus != Status.Terminated,
"terminateRecipient: cannot terminate"
);
| 13,084 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.