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 |
|---|---|---|---|---|
20 | // ========== MUTATIVE FUNCTIONS ========== // initialize contract _stake address of stake token _reward address of reward token _start epoch seconds of mining starts _end epoch seconds of mining complete _totalReward totalReward / | function initialize(
address _stake,
address _reward,
uint256 _start,
uint256 _end,
uint256 _totalReward
) external override {
require(!initialized, "initialized = true");
| function initialize(
address _stake,
address _reward,
uint256 _start,
uint256 _end,
uint256 _totalReward
) external override {
require(!initialized, "initialized = true");
| 13,075 |
34 | // atEditionId is one-indexed hence the need to remove one here | return editionSize + 1 - atEditionId.current();
| return editionSize + 1 - atEditionId.current();
| 15,110 |
54 | // Default fallback function | function() payable
| function() payable
| 36,640 |
1 | // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature unique. Appendix F in the Ethereum Yellow paper (https:ethereum.github.io/yellowpaper/paper.pdf), defines | // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most
// signatures from current libraries generate a unique signature with an s-value in the lower half order.
//
// If your library generates malleable signatures, such as s-values in the upper range, calcu... | // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most
// signatures from current libraries generate a unique signature with an s-value in the lower half order.
//
// If your library generates malleable signatures, such as s-values in the upper range, calcu... | 25,919 |
282 | // concatenate storage byte array with the new l1Tx | _concatStorage(mapL1TxQueue[nextL1FillingQueue], l1Tx);
emit L1UserTxEvent(nextL1FillingQueue, uint8(currentPosition), l1Tx);
if (currentPosition + 1 >= _MAX_L1_USER_TX) {
nextL1FillingQueue++;
}
| _concatStorage(mapL1TxQueue[nextL1FillingQueue], l1Tx);
emit L1UserTxEvent(nextL1FillingQueue, uint8(currentPosition), l1Tx);
if (currentPosition + 1 >= _MAX_L1_USER_TX) {
nextL1FillingQueue++;
}
| 79,290 |
17 | // Override this to implement your module! | function _checkIfEligible(uint256 _tokenId) internal view virtual returns (bool);
| function _checkIfEligible(uint256 _tokenId) internal view virtual returns (bool);
| 58,582 |
5 | // Zethr main contract interface | contract ZethrInterface{
function withdraw() public;
}
| contract ZethrInterface{
function withdraw() public;
}
| 13,764 |
238 | // user has to have at least equal amount of tokens which he's willing to buy | require(getCurrentUserMaxPurchase() >= tokenAmount);
| require(getCurrentUserMaxPurchase() >= tokenAmount);
| 18,506 |
24 | // ========== ADDRESS RESOLVER CONFIGURATION ========== / ========== CONSTRUCTOR ========== | constructor(address _owner, address _resolver) public Owned(_owner) Pausable() MixinResolver(_resolver) {
liquidationDeadline = now + 92 days; // Time before loans can be liquidated
}
| constructor(address _owner, address _resolver) public Owned(_owner) Pausable() MixinResolver(_resolver) {
liquidationDeadline = now + 92 days; // Time before loans can be liquidated
}
| 36,245 |
281 | // Tests equality of two byte arrays./lhs First byte array to compare./rhs Second byte array to compare./ return True if arrays are the same. False otherwise. | function equals(
bytes memory lhs,
bytes memory rhs
)
internal
pure
returns (bool equal)
| function equals(
bytes memory lhs,
bytes memory rhs
)
internal
pure
returns (bool equal)
| 42,197 |
9 | // solhint-disable avoid-low-level-calls slither-disable-next-line low-level-calls | (bool success, ) = to.call{ value: value }("");
| (bool success, ) = to.call{ value: value }("");
| 25,150 |
78 | // Finalise the crowdsale funds | assert(!salesAgents[msg.sender].finalised);
| assert(!salesAgents[msg.sender].finalised);
| 33,478 |
29 | // Converting fromToken to WETH | path[0] = address(_fromToken);
path[1] = address(WETH);
uint256[] memory amounts = router.swapExactTokensForTokens({
amountIn: _amountGet,
amountOutMin: 0,
path: path,
to: address(this),
deadline: uint(-1)
});
| path[0] = address(_fromToken);
path[1] = address(WETH);
uint256[] memory amounts = router.swapExactTokensForTokens({
amountIn: _amountGet,
amountOutMin: 0,
path: path,
to: address(this),
deadline: uint(-1)
});
| 54,386 |
7 | // called when user wants to withdraw tokens back to root chain Should burn user's tokens. This transaction will be verified when exiting on root chain amount amount of tokens to withdraw / | function withdraw(uint256 amount) external virtual {
_burn(_msgSender(), amount);
}
| function withdraw(uint256 amount) external virtual {
_burn(_msgSender(), amount);
}
| 139 |
22 | // total reward token | _balances[msg.sender][stakingToken_].totalInReward = _balances[
msg.sender
][stakingToken_].totalInReward.add(_amountReward);
emit Stake(msg.sender, amount_);
| _balances[msg.sender][stakingToken_].totalInReward = _balances[
msg.sender
][stakingToken_].totalInReward.add(_amountReward);
emit Stake(msg.sender, amount_);
| 12,862 |
241 | // calculate the service fee | serviceFee = askingPrice[_tokenId] * serviceFeeNum / 10000;
ILoyaltyToken LoyaltyTokenContract = ILoyaltyToken(loyaltyTokenAddress);
if(loyaltyTokenAddress==address(0) || LoyaltyTokenContract.userTotalStake(msg.sender)<loyaltyTokenLimit){
require(msg.value == askingPrice[_tokenId], ... | serviceFee = askingPrice[_tokenId] * serviceFeeNum / 10000;
ILoyaltyToken LoyaltyTokenContract = ILoyaltyToken(loyaltyTokenAddress);
if(loyaltyTokenAddress==address(0) || LoyaltyTokenContract.userTotalStake(msg.sender)<loyaltyTokenLimit){
require(msg.value == askingPrice[_tokenId], ... | 4,735 |
33 | // The stack TOKEN! | StackToken public stack;
| StackToken public stack;
| 14,255 |
7 | // Deposits `amount` into the sender's escrow balance and updates the global depositbalance. Sender should ensure that this contract has a transfer allowance of at least `amount` of REVV from their account before calling this function. Reverts if the contract is paused. Reverts if the sale has started. Reverts if the s... | function deposit(
uint256 amount
| function deposit(
uint256 amount
| 13,426 |
104 | // Returns the token id of the next minted token | function nextTokenId() external view returns(uint256){
return _nextTokenId;
}
| function nextTokenId() external view returns(uint256){
return _nextTokenId;
}
| 26,179 |
148 | // Unstake an amount from each protocol on Nxm (takes 30 days to unstake). _lastId The ID of the last unstake request on Nexus Mutual (needed for unstaking).return unstakeAmount The amount of each token that we're unstaking./ | {
IPooledStaking pool = IPooledStaking( _getPool() );
for(uint256 i = 0; i < bucketSize; i++) {
uint256 index = (startProtocol + i) % protocols.length;
if(index < checkpointProtocol) index = index + checkpointProtocol;
uint256 unstakePercent = unstakePercents[ind... | {
IPooledStaking pool = IPooledStaking( _getPool() );
for(uint256 i = 0; i < bucketSize; i++) {
uint256 index = (startProtocol + i) % protocols.length;
if(index < checkpointProtocol) index = index + checkpointProtocol;
uint256 unstakePercent = unstakePercents[ind... | 62,703 |
13 | // Signing address for the s_oracles[a].index'th oracle. I.e., report signatures from this oracle should ecrecover back to address a. | Signer,
| Signer,
| 22,807 |
1 | // IAssetProvider is the interface each asset provider implements.We assume there are three types of asset providers.1. Static asset provider, which has a collection of assets (either in the storage or the code) and returns them.2. Generative provider, which dynamically (but deterministically from the seed) generates a... | interface IAssetProvider {
struct ProviderInfo {
string key; // short and unique identifier of this provider (e.g., "asset")
string name; // human readable display name (e.g., "Asset Store")
IAssetProvider provider;
}
function getProviderInfo() external view returns(ProviderInfo memory);
/**
* ... | interface IAssetProvider {
struct ProviderInfo {
string key; // short and unique identifier of this provider (e.g., "asset")
string name; // human readable display name (e.g., "Asset Store")
IAssetProvider provider;
}
function getProviderInfo() external view returns(ProviderInfo memory);
/**
* ... | 8,708 |
5 | // Returns the balance of the user | function getMyHoldings() external view returns(uint256 amountToken1, uint256 amountToken2/*, uint256 myShare*/) {
amountToken1 = token1Balance[msg.sender];
amountToken2 = token2Balance[msg.sender];
//myShare = shares[msg.sender];
}
| function getMyHoldings() external view returns(uint256 amountToken1, uint256 amountToken2/*, uint256 myShare*/) {
amountToken1 = token1Balance[msg.sender];
amountToken2 = token2Balance[msg.sender];
//myShare = shares[msg.sender];
}
| 5,317 |
28 | // Revokes `role` from the calling account. | * Roles are often managed via {grantRole} and {revokeRole}: this function's
* purpose is to provide a mechanism for accounts to lose their privileges
* if they are compromised (such as when a trusted device is misplaced).
*
* If the calling account had been granted `role`, emits a {RoleRevoked}
* even... | * Roles are often managed via {grantRole} and {revokeRole}: this function's
* purpose is to provide a mechanism for accounts to lose their privileges
* if they are compromised (such as when a trusted device is misplaced).
*
* If the calling account had been granted `role`, emits a {RoleRevoked}
* even... | 26,355 |
26 | // pauses or unpauses all the actions of the protocol, including aToken transfers val true if protocol needs to be paused, false otherwise / | function setPoolPause(bool val) external onlyEmergencyAdmin {
pool.setPause(val);
}
| function setPoolPause(bool val) external onlyEmergencyAdmin {
pool.setPause(val);
}
| 19,756 |
1 | // set entry, overwrite value if name already exists/name entry name, unique in index/value entry value as bytes32 | function setEntry(string name, bytes32 value, DigitalTwinLibrary.EntryType entryType) public auth {
DigitalTwinLibrary.setEntry(iclData, name, value, entryType);
}
| function setEntry(string name, bytes32 value, DigitalTwinLibrary.EntryType entryType) public auth {
DigitalTwinLibrary.setEntry(iclData, name, value, entryType);
}
| 5,636 |
56 | // Additional features and functions assigned to the/ Base721 contract for hooks and overrides | interface IBaseERC721Interface {
/*
Exposing common NFT internal functionality for base contract overrides
To save gas and make API cleaner this is only for new functionality not exposed in
the core ERC721 contract
*/
/// Mint an NFT. Allowed to mint by owner, approval or by the parent contr... | interface IBaseERC721Interface {
/*
Exposing common NFT internal functionality for base contract overrides
To save gas and make API cleaner this is only for new functionality not exposed in
the core ERC721 contract
*/
/// Mint an NFT. Allowed to mint by owner, approval or by the parent contr... | 7,344 |
75 | // Check that proposal creator is allowed to create a proposal. | uint256 balance = _governingToken.stakedOf(msg.sender);
uint256 weight = voteWeight();
require(balance >= weight);
| uint256 balance = _governingToken.stakedOf(msg.sender);
uint256 weight = voteWeight();
require(balance >= weight);
| 10,798 |
4 | // get the current balance of the swaped tokens | tokensSwaped = getBalance(destAddr) - tokensBefore;
require(tokensSwaped > 0, ERR_TOKENS_SWAPED_ZERO);
| tokensSwaped = getBalance(destAddr) - tokensBefore;
require(tokensSwaped > 0, ERR_TOKENS_SWAPED_ZERO);
| 24,341 |
41 | // this is to retry a failed message on LayerZero_srcChainId - the source chain identifier_srcAddress - the source chain contract address_nonce - the ordered message nonce_payload - the payload to be retried | function retryMessage(
uint16 _srcChainId
, bytes memory _srcAddress
, uint64 _nonce
, bytes calldata _payload
) external
| function retryMessage(
uint16 _srcChainId
, bytes memory _srcAddress
, uint64 _nonce
, bytes calldata _payload
) external
| 18,404 |
18 | // Destroy tokens Remove `_value` tokens from the system irreversibly _value The amount of money will be burnedreturn True if `_value` is burned successfully / | function burn(uint256 _value) public returns(bool) {
balances[msg.sender] = balances[msg.sender].sub(_value);
totalSupply = totalSupply.sub(_value);
emit Burn(msg.sender, _value);
return true;
}
| function burn(uint256 _value) public returns(bool) {
balances[msg.sender] = balances[msg.sender].sub(_value);
totalSupply = totalSupply.sub(_value);
emit Burn(msg.sender, _value);
return true;
}
| 26,725 |
45 | // Returns all rpc urls and their aliases as structs. | function rpcUrlStructs() external view returns (Rpc[] memory);
| function rpcUrlStructs() external view returns (Rpc[] memory);
| 26,085 |
38 | // Add a new role/only owner can call this function, the role has to be a new role./On success, `RoleAdded` event will be fired/role the role to be added | function addRole(bytes32 role) public onlyOwner {
require(!roleSet.contains(role), "role exists");
roleSet.add(role);
emit RoleAdded(role, _msgSender());
}
| function addRole(bytes32 role) public onlyOwner {
require(!roleSet.contains(role), "role exists");
roleSet.add(role);
emit RoleAdded(role, _msgSender());
}
| 2,952 |
166 | // event of exchange WRC-20 token with original chain token request/event invoked by storeman group/smgIDID of storemanGroup/tokenPairIDtoken pair ID of cross chain token/tokenAccount Rapidity shadow token account/valueRapidity value/userAccountaccount of shadow chain, used to receive token | event UserBurnLogger(bytes32 indexed smgID, uint indexed tokenPairID, address indexed tokenAccount, uint value, uint serviceFee, uint fee, bytes userAccount);
| event UserBurnLogger(bytes32 indexed smgID, uint indexed tokenPairID, address indexed tokenAccount, uint value, uint serviceFee, uint fee, bytes userAccount);
| 36,178 |
115 | // swap | bool canSwap = contractTokenBalance >= swapTokensAtAmount;
if (!swapping && canSwap && swapEnabled && recipient == pair) {
swapping = true;
swapBack();
swapping = false;
}
| bool canSwap = contractTokenBalance >= swapTokensAtAmount;
if (!swapping && canSwap && swapEnabled && recipient == pair) {
swapping = true;
swapBack();
swapping = false;
}
| 21,335 |
4 | // Keeping track | uint256 public totalMinted = 0;
uint256 public totalUnplugged = 0;
| uint256 public totalMinted = 0;
uint256 public totalUnplugged = 0;
| 19,659 |
18 | // Sets the configuration of the LayerZero messaging library of the specified version/version New messaging library version | function setSendVersion(uint16 version) external onlyOwner {
lzEndpoint.setSendVersion(version);
}
| function setSendVersion(uint16 version) external onlyOwner {
lzEndpoint.setSendVersion(version);
}
| 35,845 |
13 | // |/|/ Creates a NiftySwap Exchange for given token contract _tokenThe address of the ERC-1155 token contract _currency The address of the currency token contract _lpFeeFee that will go to LPs Number between 0 and 1000, where 10 is 1.0% and 100 is 10%. _instance Instancethat allows to deploy new instances of an exchan... | function createExchange(address _token, address _currency, uint256 _lpFee, uint256 _instance) external;
| function createExchange(address _token, address _currency, uint256 _lpFee, uint256 _instance) external;
| 34,891 |
109 | // Returns the instructions associated with the module / | function getInstructions() external view returns (string);
| function getInstructions() external view returns (string);
| 6,696 |
2,236 | // 1119 | entry "bowered" : ENG_ADJECTIVE
| entry "bowered" : ENG_ADJECTIVE
| 17,731 |
18 | // calculate earned reflection minus claimed reflections / | function _allEarnedReflection(address tokenOwner) internal view returns (uint) {
uint[] memory _tokens = _tokensByOwner(tokenOwner);
if (_tokens.length == 0) {
return 0;
}
uint _allEarned;
uint _tEarned;
for (uint i = 0; i < _tokens.length; i++) {
... | function _allEarnedReflection(address tokenOwner) internal view returns (uint) {
uint[] memory _tokens = _tokensByOwner(tokenOwner);
if (_tokens.length == 0) {
return 0;
}
uint _allEarned;
uint _tEarned;
for (uint i = 0; i < _tokens.length; i++) {
... | 4,997 |
4 | // Intermediate Logic, confirm amount of tokens received, approve next exchange to sell | uint256 tokensReceived = IERC20(_tokenAddress).balanceOf(address(this));
IERC20(_tokenAddress).approve(address(SUSHISWAP_ROUTER_ADDRESS), 2**256 - 1);
sushiswapRouter.swapExactTokensForETH(tokensReceived, estimatedETH, _pathOut, address(this), _deadline);
| uint256 tokensReceived = IERC20(_tokenAddress).balanceOf(address(this));
IERC20(_tokenAddress).approve(address(SUSHISWAP_ROUTER_ADDRESS), 2**256 - 1);
sushiswapRouter.swapExactTokensForETH(tokensReceived, estimatedETH, _pathOut, address(this), _deadline);
| 9,721 |
101 | // Init the RwaLiquidationOracle | RwaLiquidationLike_1(MIP21_LIQUIDATION_ORACLE).init(ilk, RWA015_A_INITIAL_PRICE, RWA015_A_DOC, RWA015_A_TAU);
(, address pip, , ) = RwaLiquidationLike_1(MIP21_LIQUIDATION_ORACLE).ilks(ilk);
| RwaLiquidationLike_1(MIP21_LIQUIDATION_ORACLE).init(ilk, RWA015_A_INITIAL_PRICE, RWA015_A_DOC, RWA015_A_TAU);
(, address pip, , ) = RwaLiquidationLike_1(MIP21_LIQUIDATION_ORACLE).ilks(ilk);
| 10,556 |
11 | // Convert remaining WETH to ETH | ETHER_TOKEN.withdraw(wethRemaining);
| ETHER_TOKEN.withdraw(wethRemaining);
| 38,496 |
593 | // Submits an onchain request to withdraw Ether or ERC20 tokens from the/protocol fees account. The complete balance is always withdrawn.//Anyone can request a withdrawal of the protocol fees.//Note that after such an operation, it will take the owner some/time (no more than MAX_AGE_FORCED_REQUEST_UNTIL_WITHDRAW_MODE) ... | function withdrawProtocolFees(
address tokenAddress
)
external
virtual
payable;
| function withdrawProtocolFees(
address tokenAddress
)
external
virtual
payable;
| 48,795 |
76 | // There shouldn't be a company that is already registered with same name! | require(registredCompanyNames[companyNameHash] == false);
| require(registredCompanyNames[companyNameHash] == false);
| 43,013 |
18 | // Checkpoint for a user_addr User addressThis function does, 1. Calculate Iis for All: Calc and add Iis for every week. Iis only increses over time. 2. Calculate Iu for _addr: Calc by (defferece between Iis(last time) and Iis(this time)) LP deposit amount of _addr(include INSURE locking boost) working_supply & working... | function _checkpoint(address _addr) internal {
CheckPointParameters memory _st;
_st.period = period;
_st.period_time = period_timestamp[_st.period];
_st.integrate_inv_supply = integrate_inv_supply[_st.period];
_st.rate = inflation_rate;
_st.new_rate = _st.rate;
... | function _checkpoint(address _addr) internal {
CheckPointParameters memory _st;
_st.period = period;
_st.period_time = period_timestamp[_st.period];
_st.integrate_inv_supply = integrate_inv_supply[_st.period];
_st.rate = inflation_rate;
_st.new_rate = _st.rate;
... | 2,656 |
28 | // The official record of all proposals ever proposed | mapping (uint => Proposal) public proposals;
| mapping (uint => Proposal) public proposals;
| 13,029 |
4 | // --- V3 VARIABLES --- |
ILssStaking override public losslessStaking;
ILssReporting override public losslessReporting;
ILssGovernance override public losslessGovernance;
|
ILssStaking override public losslessStaking;
ILssReporting override public losslessReporting;
ILssGovernance override public losslessGovernance;
| 41,826 |
197 | // The Arbitrum One Bridge needs _maxGas and _gasPriceBid parameters | uint256 public maxGas = 275000;
uint256 public gasPriceBid = 1632346222;
function setGasVariables(uint256 _maxGas, uint256 _gasPriceBid) external onlyByOwnGov {
maxGas = _maxGas;
gasPriceBid = _gasPriceBid;
}
| uint256 public maxGas = 275000;
uint256 public gasPriceBid = 1632346222;
function setGasVariables(uint256 _maxGas, uint256 _gasPriceBid) external onlyByOwnGov {
maxGas = _maxGas;
gasPriceBid = _gasPriceBid;
}
| 9,609 |
354 | // Token mint contract | address public _tokenMintAddress = address(0);
TokenMint public _tokenMintContract;
| address public _tokenMintAddress = address(0);
TokenMint public _tokenMintContract;
| 4,066 |
19 | // return the total amount (in wei) of Ether controlled by the protocol. This is used for calaulating tokens from shares and vice versa. This function is required to be implemented in a derived contract. / | function _getTotalPooledEther() internal view returns (uint256);
| function _getTotalPooledEther() internal view returns (uint256);
| 13,784 |
21 | // ------------------------------------------------------------------------ transferToSideChain(uint256 _tokens) Transfer token to Morpher's side chain to trade without fees and near instant settlement. - Owner's account must have sufficient balance to transfer - 0 value transfers are not supported Token are burned on ... | function transferToSideChain(uint256 _tokens) public {
require(_tokens >= 0, "MorpherBridge: Amount of tokens must be positive.");
require(state.balanceOf(msg.sender) >= _tokens, "MorpherBridge: Insufficient balance.");
state.burn(msg.sender, _tokens);
uint256 _newTokenSentToLinkedCh... | function transferToSideChain(uint256 _tokens) public {
require(_tokens >= 0, "MorpherBridge: Amount of tokens must be positive.");
require(state.balanceOf(msg.sender) >= _tokens, "MorpherBridge: Insufficient balance.");
state.burn(msg.sender, _tokens);
uint256 _newTokenSentToLinkedCh... | 1,994 |
11 | // Calculate xy rounding towards zero, where x is signed 64.64 fixed pointnumber and y is signed 256-bit integer number.Revert on overflow.x signed 64.64 fixed point number y signed 256-bit integer numberreturn signed 256-bit integer number / | function muli(int128 x, int256 y) internal pure returns (int256) {
if (x == MIN_64x64) {
require(
y >= -0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF &&
y <= 0x1000000000000000000000000000000000000000000000000
);
return -y << 63;
... | function muli(int128 x, int256 y) internal pure returns (int256) {
if (x == MIN_64x64) {
require(
y >= -0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF &&
y <= 0x1000000000000000000000000000000000000000000000000
);
return -y << 63;
... | 8,617 |
82 | // return profile info by string key / | function profile(string key) external constant returns (string) {
return profileMap[key];
}
| function profile(string key) external constant returns (string) {
return profileMap[key];
}
| 16,836 |
29 | // Compute inflation for total inflation intervals elapsed | for (uint256 i = 0; i < _intervalsSinceLastMint; i++) {
newTotalSupply = newTotalSupply.mul(inflationRate).div(10**18);
}
| for (uint256 i = 0; i < _intervalsSinceLastMint; i++) {
newTotalSupply = newTotalSupply.mul(inflationRate).div(10**18);
}
| 44,719 |
30 | // winnerInColumn returns the player that wins in any column. To win in a column, all cells in the column must belong to the same player and that player must not be the `None` player. | function winnerInColumn(Players[3][3] memory _board) private pure returns (Players winner) {
for (uint8 y = 0; y < 3; y++) {
if (_board[0][y] == _board[1][y] && _board[1][y] == _board[2][y] && _board[0][y] != Players.None) {
return _board[0][y];
}
}
r... | function winnerInColumn(Players[3][3] memory _board) private pure returns (Players winner) {
for (uint8 y = 0; y < 3; y++) {
if (_board[0][y] == _board[1][y] && _board[1][y] == _board[2][y] && _board[0][y] != Players.None) {
return _board[0][y];
}
}
r... | 22,418 |
286 | // The {withdraw} method can be used in the event of this attack. @custom:warning===============Forwarding all gas opens the door to reentrancy vulnerabilities. Makesure you trust the recipient, or are either following thechecks-effects-interactions pattern or using {ReentrancyGuard}. / | function disperse() external onlyOwner {
for (uint256 i = 0; i < _recipientCount; i++) {
address payable recipient = _recipientsById[i];
withdraw(recipient);
}
| function disperse() external onlyOwner {
for (uint256 i = 0; i < _recipientCount; i++) {
address payable recipient = _recipientsById[i];
withdraw(recipient);
}
| 70,078 |
1 | // mapping of `classId` to total fees (could be problematic if not synced) | mapping(uint256 => uint96) private _fees;
| mapping(uint256 => uint96) private _fees;
| 52,863 |
6 | // Return an empty array | return new uint[](0);
| return new uint[](0);
| 13,616 |
14 | // Return position information for the given position id. | function getPositionInfo(uint positionId)
external
view
returns (
address owner,
address collToken,
uint collId,
uint collateralSize
);
| function getPositionInfo(uint positionId)
external
view
returns (
address owner,
address collToken,
uint collId,
uint collateralSize
);
| 32,772 |
0 | // Timestamp (in UNIX time) that releasing begins. | uint256 releaseStartTime;
| uint256 releaseStartTime;
| 33,308 |
121 | // Update price oracle with the pre-join balances | _updateOracle(lastChangeBlock, balances[0], balances[1]);
(bptAmountOut, amountsIn, dueProtocolFeeAmounts) = _onJoinPool(
poolId,
sender,
recipient,
balances,
lastChangeBlock,
protocolSwapFeePercenta... | _updateOracle(lastChangeBlock, balances[0], balances[1]);
(bptAmountOut, amountsIn, dueProtocolFeeAmounts) = _onJoinPool(
poolId,
sender,
recipient,
balances,
lastChangeBlock,
protocolSwapFeePercenta... | 11,039 |
336 | // Get the Manager address/ return The current Manager address | function manager() public view override returns (address) {
return IRegistry(registry()).manager();
}
| function manager() public view override returns (address) {
return IRegistry(registry()).manager();
}
| 6,249 |
227 | // Balance on higher reserve side is the sum of what can be minted (collateralTokenBalance) plus existing balance of the token | uint256 bTokenVirtualBalance;
uint256 wTokenVirtualBalance;
if (bTokenPrice <= wTokenPrice) {
| uint256 bTokenVirtualBalance;
uint256 wTokenVirtualBalance;
if (bTokenPrice <= wTokenPrice) {
| 7,171 |
28 | // Get royalty info see {IERC2981} / | function royaltyInfo(uint256, uint256 salePrice_)
external
view
virtual
override
returns (address, uint256)
{
return (
_royaltyReceiver,
((
| function royaltyInfo(uint256, uint256 salePrice_)
external
view
virtual
override
returns (address, uint256)
{
return (
_royaltyReceiver,
((
| 15,009 |
239 | // Sale durations | uint256 public constant CLOSED_PRESALE_DURATION = 1 days;
uint256 public constant PRESALE_DURATION = 1 days;
uint256 public constant AUCTION_DURATION = 1 days;
uint256 public constant AUCTION_PRICE_CHANGE = 1 hours;
uint256 public constant DURATION_BETWEEN_TIERS = 1 days;
| uint256 public constant CLOSED_PRESALE_DURATION = 1 days;
uint256 public constant PRESALE_DURATION = 1 days;
uint256 public constant AUCTION_DURATION = 1 days;
uint256 public constant AUCTION_PRICE_CHANGE = 1 hours;
uint256 public constant DURATION_BETWEEN_TIERS = 1 days;
| 53,849 |
1 | // Default royalty for all tokens without a specific royalty. / | function defaultRoyalty() external view returns (TokenRoyalty memory);
| function defaultRoyalty() external view returns (TokenRoyalty memory);
| 10,382 |
275 | // ===== Token Registry ===== | address public constant wbtc = 0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599;
address public constant weth = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2;
address public constant crv = 0xD533a949740bb3306d119CC777fa900bA034cd52;
address public constant cvx = 0x4e3FBD56CD56c3e72c1403e103b45Db9da5B9D2B;
ad... | address public constant wbtc = 0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599;
address public constant weth = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2;
address public constant crv = 0xD533a949740bb3306d119CC777fa900bA034cd52;
address public constant cvx = 0x4e3FBD56CD56c3e72c1403e103b45Db9da5B9D2B;
ad... | 32,140 |
9 | // Retrieve this contract's balance of tokenToRetrieve Helper method to retrieve stuck tokens. Should only be called once the drip is over. tokenToRetrieve The address for the token whose balance you want to retrieve. / | function retrieve(address tokenToRetrieve) public onlyOwner {
require(dripStatus == DripStatus.DONE, ERROR_DRIP_NOT_DONE);
OZIERC20 token = OZIERC20(tokenToRetrieve);
uint256 myBalance = token.balanceOf(address(this));
if (myBalance > 0) {
require(token.transfer(
... | function retrieve(address tokenToRetrieve) public onlyOwner {
require(dripStatus == DripStatus.DONE, ERROR_DRIP_NOT_DONE);
OZIERC20 token = OZIERC20(tokenToRetrieve);
uint256 myBalance = token.balanceOf(address(this));
if (myBalance > 0) {
require(token.transfer(
... | 17,379 |
35 | // remember which token has the biggest difference from its target value | if (_tokenDaiValues[biggestMcapIndex] < targetValue && targetValue - _tokenDaiValues[biggestMcapIndex] > biggestDifference) {
biggestDifference = targetValue - _tokenDaiValues[biggestMcapIndex];
biggestDifferenceIndex = biggestMcapIndex;
... | if (_tokenDaiValues[biggestMcapIndex] < targetValue && targetValue - _tokenDaiValues[biggestMcapIndex] > biggestDifference) {
biggestDifference = targetValue - _tokenDaiValues[biggestMcapIndex];
biggestDifferenceIndex = biggestMcapIndex;
... | 15,645 |
301 | // ERC1363 InterfaceInterface defining a ERC1363 Payable Token contract. Implementing contracts MUST implement the ERC1363 interface as well as the ERC20 and ERC165 interfaces. / | interface ERC1363 is ERC20, ERC165 {
/*
* Note: the ERC-165 identifier for this interface is 0xb0202a11.
* 0xb0202a11 ===
* bytes4(keccak256('transferAndCall(address,uint256)')) ^
* bytes4(keccak256('transferAndCall(address,uint256,bytes)')) ^
* bytes4(keccak256('transferFromAndCall(address,address,ui... | interface ERC1363 is ERC20, ERC165 {
/*
* Note: the ERC-165 identifier for this interface is 0xb0202a11.
* 0xb0202a11 ===
* bytes4(keccak256('transferAndCall(address,uint256)')) ^
* bytes4(keccak256('transferAndCall(address,uint256,bytes)')) ^
* bytes4(keccak256('transferFromAndCall(address,address,ui... | 50,194 |
75 | // This function allows stakers to request to withdraw their stake (no longer stake) once they lock for withdraw(stakes.currentStatus = 2) they are locked for 7 days before they can withdraw the deposit/ | function requestStakingWithdraw(TellorStorage.TellorStorageStruct storage self) public {
TellorStorage.StakeInfo storage stakes = self.stakerDetails[msg.sender];
//Require that the miner is staked
require(stakes.currentStatus == 1, "Miner is not staked");
//Change the miner staked t... | function requestStakingWithdraw(TellorStorage.TellorStorageStruct storage self) public {
TellorStorage.StakeInfo storage stakes = self.stakerDetails[msg.sender];
//Require that the miner is staked
require(stakes.currentStatus == 1, "Miner is not staked");
//Change the miner staked t... | 15,341 |
39 | // Gets the reward status of the staking position. _tokenId The ID of the staking positionreturn uint256 The reward amount of adding the cumulative withdrawn amountreturn uint256 The cumulative withdrawn reward amountreturn uint256 The withdrawable reward amount / | function rewards(uint256 _tokenId)
| function rewards(uint256 _tokenId)
| 23,282 |
14 | // Forces this contract to convert some of its own fWETH to ETH | function internalSwapToETH(uint256 amount) public {
// redeem fWETH for ETH via the FlashWETH contract
IFlashWETH(fWETH).withdraw(amount);
}
| function internalSwapToETH(uint256 amount) public {
// redeem fWETH for ETH via the FlashWETH contract
IFlashWETH(fWETH).withdraw(amount);
}
| 22,684 |
67 | // Internal view function to get the amount of LP tokens staked in the specified pool | function _getPoolSupply(uint256 _pid) internal view returns (uint256 lpSupply) {
PoolInfo memory pool = poolInfo[_pid];
if (pool.uniStakeContract != address(0)) {
lpSupply = IStakingRewards(pool.uniStakeContract).balanceOf(address(this));
} else {
lpSupply = pool.lpT... | function _getPoolSupply(uint256 _pid) internal view returns (uint256 lpSupply) {
PoolInfo memory pool = poolInfo[_pid];
if (pool.uniStakeContract != address(0)) {
lpSupply = IStakingRewards(pool.uniStakeContract).balanceOf(address(this));
} else {
lpSupply = pool.lpT... | 5,815 |
53 | // The bit position of `startTimestamp` in packed ownership. | uint256 private constant _BITPOS_START_TIMESTAMP = 160;
| uint256 private constant _BITPOS_START_TIMESTAMP = 160;
| 1,112 |
11 | // Make sure event displayed on chain | emit RevokedLicense(to_revoke, true);
| emit RevokedLicense(to_revoke, true);
| 1,605 |
3 | // Sets a new base uri/ Only callable by owner/ newBaseURI The new base uri | function setBaseURI(string memory newBaseURI) external onlyOwner {
baseURI = newBaseURI;
}
| function setBaseURI(string memory newBaseURI) external onlyOwner {
baseURI = newBaseURI;
}
| 36,463 |
49 | // Since the strings on bytes32 are encoded left-right, check the first zero in the data | uint256 nonZeroBytes;
unchecked {
while (nonZeroBytes < 32 && _data[nonZeroBytes] != 0) {
nonZeroBytes++;
}
| uint256 nonZeroBytes;
unchecked {
while (nonZeroBytes < 32 && _data[nonZeroBytes] != 0) {
nonZeroBytes++;
}
| 18,102 |
21 | // Code To Burn the token starts from here. | function _burn(address account, uint256 value) internal {
require(account != address(0));
totalSupply = totalSupply - value;
balances[account] = balances[account] - value;
emit Transfer(account, address(0), value);
}
| function _burn(address account, uint256 value) internal {
require(account != address(0));
totalSupply = totalSupply - value;
balances[account] = balances[account] - value;
emit Transfer(account, address(0), value);
}
| 3,297 |
44 | // Make sure market is listed | if (!markets[cToken].isListed) {
return uint256(Error.MARKET_NOT_LISTED);
}
| if (!markets[cToken].isListed) {
return uint256(Error.MARKET_NOT_LISTED);
}
| 23,435 |
17 | // Get auction duration 24 auctions = 1st day, 12 auctions = 2nd day, 6 auctions = 3rd day, 3 auctions = 4th day, 2 auction = 5th day, then use duration (initialised at 24 hours per) / | function _getAuctionDuration(uint256 snoopDAONFTId)
internal
view
returns (uint256)
| function _getAuctionDuration(uint256 snoopDAONFTId)
internal
view
returns (uint256)
| 33,457 |
1 | // Returns the reserve data asset The address of the underlying asset of the reservereturn unbacked The amount of unbacked tokensreturn accruedToTreasuryScaled The scaled amount of tokens accrued to treasury that is to be mintedreturn totalAToken The total supply of the aTokenreturn totalStableDebt The total stable deb... | function getReserveTokensAddresses(address asset)
external
view
returns (
address aTokenAddress,
address stableDebtTokenAddress,
address variableDebtTokenAddress
);
| function getReserveTokensAddresses(address asset)
external
view
returns (
address aTokenAddress,
address stableDebtTokenAddress,
address variableDebtTokenAddress
);
| 23,226 |
15 | // See {IERC20-approve}. Requirements: - `spender` cannot be the zero address. / | function approve(address spender, uint256 amount) public virtual override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
| function approve(address spender, uint256 amount) public virtual override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
| 12 |
78 | // returns balance in the rSpace.This value is always converted to tOwned for practical use/ | function rOwned(address account) public view returns (uint256) {
return _rOwned[account];
}
| function rOwned(address account) public view returns (uint256) {
return _rOwned[account];
}
| 31,673 |
2 | // Timestamp of the start of the unlock | uint32 start;
| uint32 start;
| 1,134 |
63 | // once the kitten is transferred also clear sire allowances | delete sireAllowedToAddress[_tokenId];
| delete sireAllowedToAddress[_tokenId];
| 58,463 |
79 | // Whitelist OSM to read the Median data (only necessary if it is the first time the token is being added to an ilk) | addReaderToMedianWhitelist(address(OracleLike(co.pip).src()), co.pip);
| addReaderToMedianWhitelist(address(OracleLike(co.pip).src()), co.pip);
| 36,970 |
55 | // bps - basic rate steps. one step is 1 / 10000 of the rate. | struct StepFunction {
int[] x; // quantity for each step. Quantity of each step includes previous steps.
int[] y; // rate change per quantity step in bps.
}
| struct StepFunction {
int[] x; // quantity for each step. Quantity of each step includes previous steps.
int[] y; // rate change per quantity step in bps.
}
| 17,071 |
119 | // buy pool via pool portal_amount For Bancor amount it's relay, for Uniswap amount it's ETH, for Bancor and Uniswap v2 can be 0_type type of pool (0 - Bancor, 1 - Uniswap)_poolTokenaddress of relay for Bancor and exchange for Uniswap_connectorsAddressaddress of pool connectors_connectorsAmount amount of pool connector... | function buyPool(
uint256 _amount,
uint _type,
address _poolToken,
address[] calldata _connectorsAddress,
uint256[] memory _connectorsAmount, // WARNING: this array rewrite from buyPool return (details below)
bytes32[] calldata _additionalArgs,
bytes calldat... | function buyPool(
uint256 _amount,
uint _type,
address _poolToken,
address[] calldata _connectorsAddress,
uint256[] memory _connectorsAmount, // WARNING: this array rewrite from buyPool return (details below)
bytes32[] calldata _additionalArgs,
bytes calldat... | 11,949 |
70 | // prevent sig malleability from ecrecover() | require(uint256(s) <= 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0, "signature incorrect");
require(v == 27 || v == 28, "signature incorrect");
| require(uint256(s) <= 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0, "signature incorrect");
require(v == 27 || v == 28, "signature incorrect");
| 15,959 |
505 | // Connects credit account to credit account address. Restricted to account factory (owner) only/_creditManager Credit manager address | function connectTo(
address _creditManager,
uint256 _borrowedAmount,
uint256 _cumulativeIndexAtOpen
| function connectTo(
address _creditManager,
uint256 _borrowedAmount,
uint256 _cumulativeIndexAtOpen
| 34,542 |
4 | // uint256 DrawLimit;uint256 SignUpPrice; | address Contract;
| address Contract;
| 46,533 |
0 | // variables that are set up once and never change | string public label;
address internal ETH = address(0);
address private owner;
uint256 public startDate;
uint256 public endDate;
uint256 public minAmountBCY;
uint256 public maxAmountBCY;
uint256 public expirationTime = 7776000; // default: 60 * 60 * 24 * 90 = ~3months
address public ... | string public label;
address internal ETH = address(0);
address private owner;
uint256 public startDate;
uint256 public endDate;
uint256 public minAmountBCY;
uint256 public maxAmountBCY;
uint256 public expirationTime = 7776000; // default: 60 * 60 * 24 * 90 = ~3months
address public ... | 30,463 |
12 | // scope to avoid stack too deep errors | (uint256 reserve0, uint256 reserve1) = Library.getReserves(
factory,
token0,
token1
);
uint256 totalSupplyLP = IPair(pair).getTotalSupply();
amountIn0 = (lpTokenAmount * reserve0) / totalSupplyLP;
amountIn1 = (lp... | (uint256 reserve0, uint256 reserve1) = Library.getReserves(
factory,
token0,
token1
);
uint256 totalSupplyLP = IPair(pair).getTotalSupply();
amountIn0 = (lpTokenAmount * reserve0) / totalSupplyLP;
amountIn1 = (lp... | 24,911 |
0 | // This function encodes a function signature and returns it.There are no spaces between the parameters types, and the parameters names are not included when encoding. return bytes4 : The encoded function signature./ | function encodingFunctionSignature()
public pure
returns(bytes4)
| function encodingFunctionSignature()
public pure
returns(bytes4)
| 8,104 |
17 | // square root of a UQ112x112 lossy between 0/1 and 40 bits | function sqrt(uq112x112 memory self)
internal
pure
returns (uq112x112 memory)
| function sqrt(uq112x112 memory self)
internal
pure
returns (uq112x112 memory)
| 21,353 |
18 | // Go from wad (1018) to ray (1027) | function wadToRay(uint256 _wad) internal pure returns (uint256) {
return mul(_wad, 10 ** 9);
}
| function wadToRay(uint256 _wad) internal pure returns (uint256) {
return mul(_wad, 10 ** 9);
}
| 19,053 |
207 | // Hook that is called before any token transfer. This includes mintingand burning. Calling conditions: - when `from` and `to` are both non-zero, ``from``'s `tokenId` will betransferred to `to`.- when `from` is zero, `tokenId` will be minted for `to`.- when `to` is zero, ``from``'s `tokenId` will be burned.- `from` and... | function _beforeTokenTransfer(address from, address to, uint256 tokenId) internal virtual { }
}
| function _beforeTokenTransfer(address from, address to, uint256 tokenId) internal virtual { }
}
| 7,090 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.