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 |
|---|---|---|---|---|
240 | // Finalizes Token sale and launches LP.return liquidity Number of LPs. / | function finalize() external nonReentrant returns (uint256 liquidity) {
// GP: Can we remove admin, let anyone can finalise and launch?
// require(hasAdminRole(msg.sender) || hasOperatorRole(msg.sender), "PostAuction: Sender must be operator");
require(marketConnected(), "PostAuction: Auction must have this launcher address set as the destination wallet");
require(!launcherInfo.launched);
if (!market.finalized()) {
market.finalize();
}
require(market.finalized());
launcherInfo.launched = true;
if (!market.auctionSuccessful() ) {
return 0;
}
/// @dev if the auction is settled in weth, wrap any contract balance
uint256 launcherBalance = address(this).balance;
if (launcherBalance > 0 ) {
IWETH(weth).deposit{value : launcherBalance}();
}
(uint256 token1Amount, uint256 token2Amount) = getTokenAmounts();
/// @dev cannot start a liquidity pool with no tokens on either side
if (token1Amount == 0 || token2Amount == 0 ) {
return 0;
}
address pair = factory.getPair(address(token1), address(token2));
if(pair == address(0)) {
createPool();
}
/// @dev add liquidity to pool via the pair directly
_safeTransfer(address(token1), tokenPair, token1Amount);
_safeTransfer(address(token2), tokenPair, token2Amount);
liquidity = IUniswapV2Pair(tokenPair).mint(address(this));
launcherInfo.liquidityAdded = BoringMath.to128(uint256(launcherInfo.liquidityAdded).add(liquidity));
/// @dev if unlock time not yet set, add it.
if (launcherInfo.unlock == 0 ) {
launcherInfo.unlock = BoringMath.to64(block.timestamp + uint256(launcherInfo.locktime));
}
emit LiquidityAdded(liquidity);
}
| function finalize() external nonReentrant returns (uint256 liquidity) {
// GP: Can we remove admin, let anyone can finalise and launch?
// require(hasAdminRole(msg.sender) || hasOperatorRole(msg.sender), "PostAuction: Sender must be operator");
require(marketConnected(), "PostAuction: Auction must have this launcher address set as the destination wallet");
require(!launcherInfo.launched);
if (!market.finalized()) {
market.finalize();
}
require(market.finalized());
launcherInfo.launched = true;
if (!market.auctionSuccessful() ) {
return 0;
}
/// @dev if the auction is settled in weth, wrap any contract balance
uint256 launcherBalance = address(this).balance;
if (launcherBalance > 0 ) {
IWETH(weth).deposit{value : launcherBalance}();
}
(uint256 token1Amount, uint256 token2Amount) = getTokenAmounts();
/// @dev cannot start a liquidity pool with no tokens on either side
if (token1Amount == 0 || token2Amount == 0 ) {
return 0;
}
address pair = factory.getPair(address(token1), address(token2));
if(pair == address(0)) {
createPool();
}
/// @dev add liquidity to pool via the pair directly
_safeTransfer(address(token1), tokenPair, token1Amount);
_safeTransfer(address(token2), tokenPair, token2Amount);
liquidity = IUniswapV2Pair(tokenPair).mint(address(this));
launcherInfo.liquidityAdded = BoringMath.to128(uint256(launcherInfo.liquidityAdded).add(liquidity));
/// @dev if unlock time not yet set, add it.
if (launcherInfo.unlock == 0 ) {
launcherInfo.unlock = BoringMath.to64(block.timestamp + uint256(launcherInfo.locktime));
}
emit LiquidityAdded(liquidity);
}
| 48,865 |
4 | // Called in `createAccount`. Initializes the account contract created in `createAccount`. | function _initializeAccount(
address _account,
address _admin,
bytes calldata _data
| function _initializeAccount(
address _account,
address _admin,
bytes calldata _data
| 27,100 |
5 | // globally and across all auctions, the amount by which a bid has to increase | uint256 public minBidIncrement;
| uint256 public minBidIncrement;
| 27,948 |
11 | // Index subscribed eventtoken Super token addresspublisher Index publisherindexId The specified indexIdsubscriber The approved subscriberuserData The user provided data/ | event IndexSubscribed(
| event IndexSubscribed(
| 21,937 |
1 | // Function to return list of all StakeHolders return returns the list/ | function append(string memory _method, string memory _contractName) pure internal returns(string memory m) {
return string(abi.encodePacked(_method, _contractName));
}
| function append(string memory _method, string memory _contractName) pure internal returns(string memory m) {
return string(abi.encodePacked(_method, _contractName));
}
| 22,641 |
24 | // The new version of the validator set | address[] memory _newValidators,
uint256[] memory _newPowers,
uint256 _newValsetNonce,
| address[] memory _newValidators,
uint256[] memory _newPowers,
uint256 _newValsetNonce,
| 40,135 |
69 | // set reward ratecallable by admin / | function setRewardRate(uint256 _rewardRate) external onlyAdmin {
require(_rewardRate <= TOTAL_RATE, "rewardRate cannot be more than 100%");
rewardRate = _rewardRate;
treasuryRate = TOTAL_RATE.sub(_rewardRate);
emit RatesUpdated(currentEpoch, rewardRate, treasuryRate);
}
| function setRewardRate(uint256 _rewardRate) external onlyAdmin {
require(_rewardRate <= TOTAL_RATE, "rewardRate cannot be more than 100%");
rewardRate = _rewardRate;
treasuryRate = TOTAL_RATE.sub(_rewardRate);
emit RatesUpdated(currentEpoch, rewardRate, treasuryRate);
}
| 38,649 |
22 | // Destroy tokens from other account 蒸发别人的tokenRemove `_value` tokens from the system irreversibly on behalf of `_from`._from the address of the sender _value the amount of money to burn / | function burnFrom(address _from, uint256 _value) public returns (bool success) {
require(balanceOf[_from] >= _value); // 检查别人的余额是否充足 Check if the targeted balance is enough
require(_value <= allowance[_from][msg.sender]); // 检查限额是否充足 Check allowance
balanceOf[_from] -= _value; // 蒸发token Subtract from the targeted balance
allowance[_from][msg.sender] -= _value; // 去除限额 Subtract from the sender's allowance
totalSupply -= _value; // 减掉总taoken数Update totalSupply
emit Burn(_from, _value); //触发Burn事件
return true;
}
| function burnFrom(address _from, uint256 _value) public returns (bool success) {
require(balanceOf[_from] >= _value); // 检查别人的余额是否充足 Check if the targeted balance is enough
require(_value <= allowance[_from][msg.sender]); // 检查限额是否充足 Check allowance
balanceOf[_from] -= _value; // 蒸发token Subtract from the targeted balance
allowance[_from][msg.sender] -= _value; // 去除限额 Subtract from the sender's allowance
totalSupply -= _value; // 减掉总taoken数Update totalSupply
emit Burn(_from, _value); //触发Burn事件
return true;
}
| 37,019 |
15 | // withdraw all x ERC20 tokens | IERC20(Token1).transfer(msg.sender, IERC20(Token1).balanceOf(address(this)));
IERC20(Token2).transfer(msg.sender, IERC20(Token2).balanceOf(address(this)));
| IERC20(Token1).transfer(msg.sender, IERC20(Token1).balanceOf(address(this)));
IERC20(Token2).transfer(msg.sender, IERC20(Token2).balanceOf(address(this)));
| 30,461 |
15 | // TODO: Is there a more gas efficient way than looping through this again and checking same condition | uint256 currentId = activeDepositIds[i];
if (_isUpkeepEligible(currentId)) {
RecipientInfo storage currentrecipientInfo = recipientInfo[currentId];
currentrecipientInfo.lastUpkeepTimestamp = uint128(block.timestamp);
currentrecipientInfo.unclaimedStreamTokens += uint128(
(amounts[1] * _redeemYield(currentId)) / totalGOHM
);
| uint256 currentId = activeDepositIds[i];
if (_isUpkeepEligible(currentId)) {
RecipientInfo storage currentrecipientInfo = recipientInfo[currentId];
currentrecipientInfo.lastUpkeepTimestamp = uint128(block.timestamp);
currentrecipientInfo.unclaimedStreamTokens += uint128(
(amounts[1] * _redeemYield(currentId)) / totalGOHM
);
| 30,516 |
74 | // ERC721 Non-Fungible Token Standard basic implementation / | contract ERC721BasicToken is SupportsInterfaceWithLookup, ERC721Basic {
using SafeMath for uint256;
using AddressUtils for address;
// Equals to `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))`
// which can be also obtained as `ERC721Receiver(0).onERC721Received.selector`
bytes4 private constant ERC721_RECEIVED = 0x150b7a02;
// Mapping from token ID to owner
mapping (uint256 => address) internal tokenOwner;
// Mapping from token ID to approved address
mapping (uint256 => address) internal tokenApprovals;
// Mapping from owner to number of owned token
mapping (address => uint256) internal ownedTokensCount;
// Mapping from owner to operator approvals
mapping (address => mapping (address => bool)) internal operatorApprovals;
constructor()
public
{
// register the supported interfaces to conform to ERC721 via ERC165
_registerInterface(InterfaceId_ERC721);
_registerInterface(InterfaceId_ERC721Exists);
}
/**
* @dev Gets the balance of the specified address
* @param _owner address to query the balance of
* @return uint256 representing the amount owned by the passed address
*/
function balanceOf(address _owner) public view returns (uint256) {
require(_owner != address(0));
return ownedTokensCount[_owner];
}
/**
* @dev Gets the owner of the specified token ID
* @param _tokenId uint256 ID of the token to query the owner of
* @return owner address currently marked as the owner of the given token ID
*/
function ownerOf(uint256 _tokenId) public view returns (address) {
address owner = tokenOwner[_tokenId];
require(owner != address(0));
return owner;
}
/**
* @dev Returns whether the specified token exists
* @param _tokenId uint256 ID of the token to query the existence of
* @return whether the token exists
*/
function exists(uint256 _tokenId) public view returns (bool) {
address owner = tokenOwner[_tokenId];
return owner != address(0);
}
/**
* @dev Approves another address to transfer the given token ID
* The zero address indicates there is no approved address.
* There can only be one approved address per token at a given time.
* Can only be called by the token owner or an approved operator.
* @param _to address to be approved for the given token ID
* @param _tokenId uint256 ID of the token to be approved
*/
function approve(address _to, uint256 _tokenId) public {
address owner = ownerOf(_tokenId);
require(_to != owner);
require(msg.sender == owner || isApprovedForAll(owner, msg.sender));
tokenApprovals[_tokenId] = _to;
emit Approval(owner, _to, _tokenId);
}
/**
* @dev Gets the approved address for a token ID, or zero if no address set
* @param _tokenId uint256 ID of the token to query the approval of
* @return address currently approved for the given token ID
*/
function getApproved(uint256 _tokenId) public view returns (address) {
return tokenApprovals[_tokenId];
}
/**
* @dev Sets or unsets the approval of a given operator
* An operator is allowed to transfer all tokens of the sender on their behalf
* @param _to operator address to set the approval
* @param _approved representing the status of the approval to be set
*/
function setApprovalForAll(address _to, bool _approved) public {
require(_to != msg.sender);
operatorApprovals[msg.sender][_to] = _approved;
emit ApprovalForAll(msg.sender, _to, _approved);
}
/**
* @dev Tells whether an operator is approved by a given owner
* @param _owner owner address which you want to query the approval of
* @param _operator operator address which you want to query the approval of
* @return bool whether the given operator is approved by the given owner
*/
function isApprovedForAll(
address _owner,
address _operator
)
public
view
returns (bool)
{
return operatorApprovals[_owner][_operator];
}
/**
* @dev Transfers the ownership of a given token ID to another address
* Usage of this method is discouraged, use `safeTransferFrom` whenever possible
* Requires the msg sender to be the owner, approved, or operator
* @param _from current owner of the token
* @param _to address to receive the ownership of the given token ID
* @param _tokenId uint256 ID of the token to be transferred
*/
function transferFrom(
address _from,
address _to,
uint256 _tokenId
)
public
{
require(isApprovedOrOwner(msg.sender, _tokenId));
require(_from != address(0));
require(_to != address(0));
clearApproval(_from, _tokenId);
removeTokenFrom(_from, _tokenId);
addTokenTo(_to, _tokenId);
emit Transfer(_from, _to, _tokenId);
}
/**
* @dev Safely transfers the ownership of a given token ID to another address
* If the target address is a contract, it must implement `onERC721Received`,
* which is called upon a safe transfer, and return the magic value
* `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))`; otherwise,
* the transfer is reverted.
*
* Requires the msg sender to be the owner, approved, or operator
* @param _from current owner of the token
* @param _to address to receive the ownership of the given token ID
* @param _tokenId uint256 ID of the token to be transferred
*/
function safeTransferFrom(
address _from,
address _to,
uint256 _tokenId
)
public
{
// solium-disable-next-line arg-overflow
safeTransferFrom(_from, _to, _tokenId, "");
}
/**
* @dev Safely transfers the ownership of a given token ID to another address
* If the target address is a contract, it must implement `onERC721Received`,
* which is called upon a safe transfer, and return the magic value
* `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))`; otherwise,
* the transfer is reverted.
* Requires the msg sender to be the owner, approved, or operator
* @param _from current owner of the token
* @param _to address to receive the ownership of the given token ID
* @param _tokenId uint256 ID of the token to be transferred
* @param _data bytes data to send along with a safe transfer check
*/
function safeTransferFrom(
address _from,
address _to,
uint256 _tokenId,
bytes memory _data
)
public
{
transferFrom(_from, _to, _tokenId);
// solium-disable-next-line arg-overflow
require(checkAndCallSafeTransfer(_from, _to, _tokenId, _data));
}
/**
* @dev Returns whether the given spender can transfer a given token ID
* @param _spender address of the spender to query
* @param _tokenId uint256 ID of the token to be transferred
* @return bool whether the msg.sender is approved for the given token ID,
* is an operator of the owner, or is the owner of the token
*/
function isApprovedOrOwner(
address _spender,
uint256 _tokenId
)
internal
view
returns (bool)
{
address owner = ownerOf(_tokenId);
// Disable solium check because of
// https://github.com/duaraghav8/Solium/issues/175
// solium-disable-next-line operator-whitespace
return (
_spender == owner ||
getApproved(_tokenId) == _spender ||
isApprovedForAll(owner, _spender)
);
}
/**
* @dev Internal function to mint a new token
* Reverts if the given token ID already exists
* @param _to The address that will own the minted token
* @param _tokenId uint256 ID of the token to be minted by the msg.sender
*/
function _mint(address _to, uint256 _tokenId) internal {
require(_to != address(0));
addTokenTo(_to, _tokenId);
emit Transfer(address(0), _to, _tokenId);
}
/**
* @dev Internal function to burn a specific token
* Reverts if the token does not exist
* @param _tokenId uint256 ID of the token being burned by the msg.sender
*/
function _burn(address _owner, uint256 _tokenId) internal {
clearApproval(_owner, _tokenId);
removeTokenFrom(_owner, _tokenId);
emit Transfer(_owner, address(0), _tokenId);
}
/**
* @dev Internal function to clear current approval of a given token ID
* Reverts if the given address is not indeed the owner of the token
* @param _owner owner of the token
* @param _tokenId uint256 ID of the token to be transferred
*/
function clearApproval(address _owner, uint256 _tokenId) internal {
require(ownerOf(_tokenId) == _owner);
if (tokenApprovals[_tokenId] != address(0)) {
tokenApprovals[_tokenId] = address(0);
}
}
/**
* @dev Internal function to add a token ID to the list of a given address
* @param _to address representing the new owner of the given token ID
* @param _tokenId uint256 ID of the token to be added to the tokens list of the given address
*/
function addTokenTo(address _to, uint256 _tokenId) internal {
require(tokenOwner[_tokenId] == address(0));
tokenOwner[_tokenId] = _to;
ownedTokensCount[_to] = ownedTokensCount[_to].add(1);
}
/**
* @dev Internal function to remove a token ID from the list of a given address
* @param _from address representing the previous owner of the given token ID
* @param _tokenId uint256 ID of the token to be removed from the tokens list of the given address
*/
function removeTokenFrom(address _from, uint256 _tokenId) internal {
require(ownerOf(_tokenId) == _from);
ownedTokensCount[_from] = ownedTokensCount[_from].sub(1);
tokenOwner[_tokenId] = address(0);
}
/**
* @dev Internal function to invoke `onERC721Received` on a target address
* The call is not executed if the target address is not a contract
* @param _from address representing the previous owner of the given token ID
* @param _to target address that will receive the tokens
* @param _tokenId uint256 ID of the token to be transferred
* @param _data bytes optional data to send along with the call
* @return whether the call correctly returned the expected magic value
*/
function checkAndCallSafeTransfer(
address _from,
address _to,
uint256 _tokenId,
bytes memory _data
)
internal
returns (bool)
{
if (!_to.isContract()) {
return true;
}
bytes4 retval = ERC721Receiver(_to).onERC721Received(
msg.sender, _from, _tokenId, _data);
return (retval == ERC721_RECEIVED);
}
}
| contract ERC721BasicToken is SupportsInterfaceWithLookup, ERC721Basic {
using SafeMath for uint256;
using AddressUtils for address;
// Equals to `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))`
// which can be also obtained as `ERC721Receiver(0).onERC721Received.selector`
bytes4 private constant ERC721_RECEIVED = 0x150b7a02;
// Mapping from token ID to owner
mapping (uint256 => address) internal tokenOwner;
// Mapping from token ID to approved address
mapping (uint256 => address) internal tokenApprovals;
// Mapping from owner to number of owned token
mapping (address => uint256) internal ownedTokensCount;
// Mapping from owner to operator approvals
mapping (address => mapping (address => bool)) internal operatorApprovals;
constructor()
public
{
// register the supported interfaces to conform to ERC721 via ERC165
_registerInterface(InterfaceId_ERC721);
_registerInterface(InterfaceId_ERC721Exists);
}
/**
* @dev Gets the balance of the specified address
* @param _owner address to query the balance of
* @return uint256 representing the amount owned by the passed address
*/
function balanceOf(address _owner) public view returns (uint256) {
require(_owner != address(0));
return ownedTokensCount[_owner];
}
/**
* @dev Gets the owner of the specified token ID
* @param _tokenId uint256 ID of the token to query the owner of
* @return owner address currently marked as the owner of the given token ID
*/
function ownerOf(uint256 _tokenId) public view returns (address) {
address owner = tokenOwner[_tokenId];
require(owner != address(0));
return owner;
}
/**
* @dev Returns whether the specified token exists
* @param _tokenId uint256 ID of the token to query the existence of
* @return whether the token exists
*/
function exists(uint256 _tokenId) public view returns (bool) {
address owner = tokenOwner[_tokenId];
return owner != address(0);
}
/**
* @dev Approves another address to transfer the given token ID
* The zero address indicates there is no approved address.
* There can only be one approved address per token at a given time.
* Can only be called by the token owner or an approved operator.
* @param _to address to be approved for the given token ID
* @param _tokenId uint256 ID of the token to be approved
*/
function approve(address _to, uint256 _tokenId) public {
address owner = ownerOf(_tokenId);
require(_to != owner);
require(msg.sender == owner || isApprovedForAll(owner, msg.sender));
tokenApprovals[_tokenId] = _to;
emit Approval(owner, _to, _tokenId);
}
/**
* @dev Gets the approved address for a token ID, or zero if no address set
* @param _tokenId uint256 ID of the token to query the approval of
* @return address currently approved for the given token ID
*/
function getApproved(uint256 _tokenId) public view returns (address) {
return tokenApprovals[_tokenId];
}
/**
* @dev Sets or unsets the approval of a given operator
* An operator is allowed to transfer all tokens of the sender on their behalf
* @param _to operator address to set the approval
* @param _approved representing the status of the approval to be set
*/
function setApprovalForAll(address _to, bool _approved) public {
require(_to != msg.sender);
operatorApprovals[msg.sender][_to] = _approved;
emit ApprovalForAll(msg.sender, _to, _approved);
}
/**
* @dev Tells whether an operator is approved by a given owner
* @param _owner owner address which you want to query the approval of
* @param _operator operator address which you want to query the approval of
* @return bool whether the given operator is approved by the given owner
*/
function isApprovedForAll(
address _owner,
address _operator
)
public
view
returns (bool)
{
return operatorApprovals[_owner][_operator];
}
/**
* @dev Transfers the ownership of a given token ID to another address
* Usage of this method is discouraged, use `safeTransferFrom` whenever possible
* Requires the msg sender to be the owner, approved, or operator
* @param _from current owner of the token
* @param _to address to receive the ownership of the given token ID
* @param _tokenId uint256 ID of the token to be transferred
*/
function transferFrom(
address _from,
address _to,
uint256 _tokenId
)
public
{
require(isApprovedOrOwner(msg.sender, _tokenId));
require(_from != address(0));
require(_to != address(0));
clearApproval(_from, _tokenId);
removeTokenFrom(_from, _tokenId);
addTokenTo(_to, _tokenId);
emit Transfer(_from, _to, _tokenId);
}
/**
* @dev Safely transfers the ownership of a given token ID to another address
* If the target address is a contract, it must implement `onERC721Received`,
* which is called upon a safe transfer, and return the magic value
* `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))`; otherwise,
* the transfer is reverted.
*
* Requires the msg sender to be the owner, approved, or operator
* @param _from current owner of the token
* @param _to address to receive the ownership of the given token ID
* @param _tokenId uint256 ID of the token to be transferred
*/
function safeTransferFrom(
address _from,
address _to,
uint256 _tokenId
)
public
{
// solium-disable-next-line arg-overflow
safeTransferFrom(_from, _to, _tokenId, "");
}
/**
* @dev Safely transfers the ownership of a given token ID to another address
* If the target address is a contract, it must implement `onERC721Received`,
* which is called upon a safe transfer, and return the magic value
* `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))`; otherwise,
* the transfer is reverted.
* Requires the msg sender to be the owner, approved, or operator
* @param _from current owner of the token
* @param _to address to receive the ownership of the given token ID
* @param _tokenId uint256 ID of the token to be transferred
* @param _data bytes data to send along with a safe transfer check
*/
function safeTransferFrom(
address _from,
address _to,
uint256 _tokenId,
bytes memory _data
)
public
{
transferFrom(_from, _to, _tokenId);
// solium-disable-next-line arg-overflow
require(checkAndCallSafeTransfer(_from, _to, _tokenId, _data));
}
/**
* @dev Returns whether the given spender can transfer a given token ID
* @param _spender address of the spender to query
* @param _tokenId uint256 ID of the token to be transferred
* @return bool whether the msg.sender is approved for the given token ID,
* is an operator of the owner, or is the owner of the token
*/
function isApprovedOrOwner(
address _spender,
uint256 _tokenId
)
internal
view
returns (bool)
{
address owner = ownerOf(_tokenId);
// Disable solium check because of
// https://github.com/duaraghav8/Solium/issues/175
// solium-disable-next-line operator-whitespace
return (
_spender == owner ||
getApproved(_tokenId) == _spender ||
isApprovedForAll(owner, _spender)
);
}
/**
* @dev Internal function to mint a new token
* Reverts if the given token ID already exists
* @param _to The address that will own the minted token
* @param _tokenId uint256 ID of the token to be minted by the msg.sender
*/
function _mint(address _to, uint256 _tokenId) internal {
require(_to != address(0));
addTokenTo(_to, _tokenId);
emit Transfer(address(0), _to, _tokenId);
}
/**
* @dev Internal function to burn a specific token
* Reverts if the token does not exist
* @param _tokenId uint256 ID of the token being burned by the msg.sender
*/
function _burn(address _owner, uint256 _tokenId) internal {
clearApproval(_owner, _tokenId);
removeTokenFrom(_owner, _tokenId);
emit Transfer(_owner, address(0), _tokenId);
}
/**
* @dev Internal function to clear current approval of a given token ID
* Reverts if the given address is not indeed the owner of the token
* @param _owner owner of the token
* @param _tokenId uint256 ID of the token to be transferred
*/
function clearApproval(address _owner, uint256 _tokenId) internal {
require(ownerOf(_tokenId) == _owner);
if (tokenApprovals[_tokenId] != address(0)) {
tokenApprovals[_tokenId] = address(0);
}
}
/**
* @dev Internal function to add a token ID to the list of a given address
* @param _to address representing the new owner of the given token ID
* @param _tokenId uint256 ID of the token to be added to the tokens list of the given address
*/
function addTokenTo(address _to, uint256 _tokenId) internal {
require(tokenOwner[_tokenId] == address(0));
tokenOwner[_tokenId] = _to;
ownedTokensCount[_to] = ownedTokensCount[_to].add(1);
}
/**
* @dev Internal function to remove a token ID from the list of a given address
* @param _from address representing the previous owner of the given token ID
* @param _tokenId uint256 ID of the token to be removed from the tokens list of the given address
*/
function removeTokenFrom(address _from, uint256 _tokenId) internal {
require(ownerOf(_tokenId) == _from);
ownedTokensCount[_from] = ownedTokensCount[_from].sub(1);
tokenOwner[_tokenId] = address(0);
}
/**
* @dev Internal function to invoke `onERC721Received` on a target address
* The call is not executed if the target address is not a contract
* @param _from address representing the previous owner of the given token ID
* @param _to target address that will receive the tokens
* @param _tokenId uint256 ID of the token to be transferred
* @param _data bytes optional data to send along with the call
* @return whether the call correctly returned the expected magic value
*/
function checkAndCallSafeTransfer(
address _from,
address _to,
uint256 _tokenId,
bytes memory _data
)
internal
returns (bool)
{
if (!_to.isContract()) {
return true;
}
bytes4 retval = ERC721Receiver(_to).onERC721Received(
msg.sender, _from, _tokenId, _data);
return (retval == ERC721_RECEIVED);
}
}
| 8,080 |
18 | // Abort if capacity on participants was reached | if (cn == n) {
curPhase = Phase.Commit;
emit PhaseChange(Phase.Commit);
}
| if (cn == n) {
curPhase = Phase.Commit;
emit PhaseChange(Phase.Commit);
}
| 18,679 |
1 | // The amount of rewards earmarked for this user, but not yet collected. | uint256 pendingReward;
| uint256 pendingReward;
| 25,153 |
31 | // get user's remaining shares after fee | uint256 remainingUserAmount = _amount.sub(stakingFeeAmount);
if(stakingFeeAmount > 0){
| uint256 remainingUserAmount = _amount.sub(stakingFeeAmount);
if(stakingFeeAmount > 0){
| 14,478 |
3 | // Fee Set | uint public constant MANAGER_MIN_FEE = 0;
uint public constant MANAGER_MAX_FEE = BONE / 10;
uint public constant ISSUE_MIN_FEE = BONE / 1000;
uint public constant ISSUE_MAX_FEE = BONE / 10;
uint public constant REDEEM_MIN_FEE = 0;
uint public constant REDEEM_MAX_FEE = BONE / 10;
uint public constant PERFERMANCE_MIN_FEE = 0;
uint public constant PERFERMANCE_MAX_FEE = BONE / 2;
| uint public constant MANAGER_MIN_FEE = 0;
uint public constant MANAGER_MAX_FEE = BONE / 10;
uint public constant ISSUE_MIN_FEE = BONE / 1000;
uint public constant ISSUE_MAX_FEE = BONE / 10;
uint public constant REDEEM_MIN_FEE = 0;
uint public constant REDEEM_MAX_FEE = BONE / 10;
uint public constant PERFERMANCE_MIN_FEE = 0;
uint public constant PERFERMANCE_MAX_FEE = BONE / 2;
| 9,268 |
6 | // return The ongoing trade for a sell token, or the zero address | function trades(IERC20 sell) external view returns (ITrade);
| function trades(IERC20 sell) external view returns (ITrade);
| 45,951 |
92 | // Note: while the call failed, the nonce will still be incremented, which will invalidate all supplied signatures. | emit CallFailure(actionID, nonce, to, data, _decodeRevertReason(returnData));
| emit CallFailure(actionID, nonce, to, data, _decodeRevertReason(returnData));
| 43,520 |
9 | // Enable or disable lock_locked Status./ | function lockSupply(bool _locked) onlyAdmin public {
locked = _locked;
LockedSupply(locked);
}
| function lockSupply(bool _locked) onlyAdmin public {
locked = _locked;
LockedSupply(locked);
}
| 54,414 |
5 | // minimum amount of token to hold to exclude fee | uint256 public discountMinimumAmount;
event Fee(address token, uint256 amount);
constructor(
address _factoryV2,
address factoryV3,
address _positionManager,
address _WETH9,
address _flush
| uint256 public discountMinimumAmount;
event Fee(address token, uint256 amount);
constructor(
address _factoryV2,
address factoryV3,
address _positionManager,
address _WETH9,
address _flush
| 19,930 |
214 | // Get last bid amount | uint256 _lastBid = (getBidCount(tokenId_) == 0) ?
saleData[tokenId_].startPrice - 1 :
auctionBids[tokenId_][getBidCount(tokenId_) - 1].amount;
require(
bidPrice_ > _lastBid &&
IERC20(saleData[tokenId_].token).allowance(msg.sender, address(this)) >= bidPrice_,
"Bid price is less than last bid price / base price"
);
| uint256 _lastBid = (getBidCount(tokenId_) == 0) ?
saleData[tokenId_].startPrice - 1 :
auctionBids[tokenId_][getBidCount(tokenId_) - 1].amount;
require(
bidPrice_ > _lastBid &&
IERC20(saleData[tokenId_].token).allowance(msg.sender, address(this)) >= bidPrice_,
"Bid price is less than last bid price / base price"
);
| 40,328 |
22 | // calling the transfer function of the base contract | super.transfer(to, tokens); // same as Cryptos.transfer(to, tokens);
return true;
| super.transfer(to, tokens); // same as Cryptos.transfer(to, tokens);
return true;
| 16,143 |
121 | // Increment the balance of `to`. | {
mstore(0x00, to)
let toBalanceSlot := keccak256(0x0c, 0x1c)
let toBalanceSlotPacked := add(sload(toBalanceSlot), 1)
if iszero(and(toBalanceSlotPacked, _MAX_ACCOUNT_BALANCE)) {
mstore(0x00, 0x01336cea) // `AccountBalanceOverflow()`.
revert(0x1c, 0x04)
}
| {
mstore(0x00, to)
let toBalanceSlot := keccak256(0x0c, 0x1c)
let toBalanceSlotPacked := add(sload(toBalanceSlot), 1)
if iszero(and(toBalanceSlotPacked, _MAX_ACCOUNT_BALANCE)) {
mstore(0x00, 0x01336cea) // `AccountBalanceOverflow()`.
revert(0x1c, 0x04)
}
| 21,881 |
90 | // honeyMint: Function to mint a specified number of bee NFTs for whitelisted users during the honeylist sale. Ensures that the sender is not a contract, the mint has started, and the transaction is authorized by checking the provided signature and custom data hash._amount uint16 - The number of bee NFTs to mint. _signature bytes - The signature to verify the caller's access to honeylist minting. Emits a MintingError event if the requested number of bee NFTs exceedsthe maximum allowed per wallet. / | function honeyMint(
uint16 _amount,
bytes calldata _signature
)
external
payable
beeCallerOnly // Ensures that the sender is not a contract
maxHoneycombSupplyMint(_amount) // Ensures that the mint has started and the transaction doesn't exceed limits
hiveBouncer(
_signature,
| function honeyMint(
uint16 _amount,
bytes calldata _signature
)
external
payable
beeCallerOnly // Ensures that the sender is not a contract
maxHoneycombSupplyMint(_amount) // Ensures that the mint has started and the transaction doesn't exceed limits
hiveBouncer(
_signature,
| 28,412 |
106 | // Returns the current balance. Ignores COMP that was not liquidated and invested./ | function investedUnderlyingBalance() public view returns (uint256) {
// NOTE: The use of virtual price is okay for appreciating assets inside IDLE,
// but would be wrong and exploitable if funds were lost by IDLE, indicated by
// the virtualPrice being greater than the token price.
if (protected) {
require(virtualPrice <= idleTokenHelper.getRedeemPrice(idleUnderlying), "virtual price is higher than needed");
}
uint256 invested = IERC20(idleUnderlying).balanceOf(address(this)).mul(virtualPrice).div(1e18);
return invested.add(IERC20(underlying).balanceOf(address(this)));
}
| function investedUnderlyingBalance() public view returns (uint256) {
// NOTE: The use of virtual price is okay for appreciating assets inside IDLE,
// but would be wrong and exploitable if funds were lost by IDLE, indicated by
// the virtualPrice being greater than the token price.
if (protected) {
require(virtualPrice <= idleTokenHelper.getRedeemPrice(idleUnderlying), "virtual price is higher than needed");
}
uint256 invested = IERC20(idleUnderlying).balanceOf(address(this)).mul(virtualPrice).div(1e18);
return invested.add(IERC20(underlying).balanceOf(address(this)));
}
| 5,792 |
35 | // MUTUAL UPGRADE & EMERGENCY ONLY: Replaces a module the operator has removed with`emergencyRemoveProtectedModule`. Operator and Methodologist must each call this function to execute the update. > Adds new module to SetToken.> Marks `_newModule` as protected and authorizes new extensions for it.> Adds `_newModule` to protectedModules list.> Decrements the emergencies counter, Used when methodologist wants to guarantee that a protection arrangement which wasremoved in an emergency is replaced with a suitable substitute. Operator's ability to add modulesor extensions is restored after invoking this method (if this is the only emergency.) NOTE: If replacing a fee module, it's necessary to set the | function emergencyReplaceProtectedModule(
address _module,
address[] memory _extensions
)
external
mutualUpgrade(operator, methodologist)
onlyEmergency
| function emergencyReplaceProtectedModule(
address _module,
address[] memory _extensions
)
external
mutualUpgrade(operator, methodologist)
onlyEmergency
| 45,562 |
22 | // To get the rewards per block. | function sdaoPerBlock(uint256 _pid) public view returns (uint256 amount) {
PoolInfo memory pool = poolInfo[_pid];
amount = pool.tokenPerBlock;
}
| function sdaoPerBlock(uint256 _pid) public view returns (uint256 amount) {
PoolInfo memory pool = poolInfo[_pid];
amount = pool.tokenPerBlock;
}
| 1,195 |
340 | // write slot `i / 8` | sstore(add(loc, div(i, 8)), v256)
| sstore(add(loc, div(i, 8)), v256)
| 50,534 |
57 | // bot fees | if(botWallets[from] == true||botWallets[to]==true){
revert("No bots can trade");
}
| if(botWallets[from] == true||botWallets[to]==true){
revert("No bots can trade");
}
| 36,223 |
21 | // only recompute funding when market has positions, this check is important for initial setup | market.recomputeFunding();
| market.recomputeFunding();
| 6,464 |
2 | // Returns the addition of two unsigned integers, reverting on overflow. / | function add(uint256 a, uint256 b) internal pure returns (uint256 c) {
c = a + b;
require(c >= a, "StableMath: addition overflow");
}
| function add(uint256 a, uint256 b) internal pure returns (uint256 c) {
c = a + b;
require(c >= a, "StableMath: addition overflow");
}
| 24,278 |
25 | // Checks if a voter has already voted. _voterAddress The address of the voter.return Voted True if the voter has voted, false otherwise. / | function hasVoted(address _voterAddress) public view returns (bool Voted) {
return voters[_voterAddress].hasVoted;
}
| function hasVoted(address _voterAddress) public view returns (bool Voted) {
return voters[_voterAddress].hasVoted;
}
| 17,738 |
244 | // Set the quantity of tokens necessary for vault access creation newdeposit deposit (in tokens) for vault access creation / | function setVaultDeposit (uint newdeposit)
public
onlyOwner
| function setVaultDeposit (uint newdeposit)
public
onlyOwner
| 13,452 |
40 | // Used to prevent overflow when converting decimal places to decimal precision values via 10decimalPlaces. This is a safe value for int256 and uint256 variables. We apply this constraint when storing decimal places in governance. | uint256 internal constant MAX_DECIMAL_PLACES = 36;
| uint256 internal constant MAX_DECIMAL_PLACES = 36;
| 29,030 |
15 | // E8 | function creamWithdraw_crFRAX(uint256 crFRAX_amount) public onlyByOwnGovCust {
require(crFRAX.redeem(crFRAX_amount) == 0, 'Redeem failed');
}
| function creamWithdraw_crFRAX(uint256 crFRAX_amount) public onlyByOwnGovCust {
require(crFRAX.redeem(crFRAX_amount) == 0, 'Redeem failed');
}
| 29,333 |
78 | // Calculate the Coins required for lock by Relayer based on requested license | uint256 requiredAmount = getFundRequiredForRelayer(
maxUsers,
maxCoins,
maxTxThroughput
);
| uint256 requiredAmount = getFundRequiredForRelayer(
maxUsers,
maxCoins,
maxTxThroughput
);
| 45,204 |
68 | // get stake | function stakeOf(address _stakeholder) public view returns (uint256) {
return stakes[_stakeholder].amount;
}
| function stakeOf(address _stakeholder) public view returns (uint256) {
return stakes[_stakeholder].amount;
}
| 5,133 |
52 | // Error if the account does not have the deployer role//account address to check | function onlyDeployer(address account)
external view
| function onlyDeployer(address account)
external view
| 35,246 |
24 | // Shift in bits from prod1 into prod0 | prod0 |= prod1 * lpotdod;
| prod0 |= prod1 * lpotdod;
| 9,924 |
23 | // (dxy0 - dyx0p) / (1 - dyfee) | uint256 invertedPriceX96 = FullMath.mulDiv(Q96, Q96, priceX96);
amountIn = FullMath.mulDiv(
FullMath.mulDiv(currentAmounts[1], targetRatioOfToken0X96, Q96) -
FullMath.mulDiv(targetRatioOfToken1X96, currentAmounts[0], invertedPriceX96),
Q96,
Q96 - FullMath.mulDiv(targetRatioOfToken1X96, feesX96, Q96)
);
| uint256 invertedPriceX96 = FullMath.mulDiv(Q96, Q96, priceX96);
amountIn = FullMath.mulDiv(
FullMath.mulDiv(currentAmounts[1], targetRatioOfToken0X96, Q96) -
FullMath.mulDiv(targetRatioOfToken1X96, currentAmounts[0], invertedPriceX96),
Q96,
Q96 - FullMath.mulDiv(targetRatioOfToken1X96, feesX96, Q96)
);
| 17,464 |
110 | // Deprecated, use {ERC721-_burn} instead. owner owner of the token to burn tokenId uint256 ID of the token being burned / | function _burn(address owner, uint256 tokenId) internal {
super._burn(owner, tokenId);
_removeTokenFromOwnerEnumeration(owner, tokenId);
| function _burn(address owner, uint256 tokenId) internal {
super._burn(owner, tokenId);
_removeTokenFromOwnerEnumeration(owner, tokenId);
| 11,479 |
188 | // get the total liquidity of this pool | uint256 totalPoolLiquidity = totalActiveLiquidity.add(totalAvailableLiquidity);
| uint256 totalPoolLiquidity = totalActiveLiquidity.add(totalAvailableLiquidity);
| 57,809 |
178 | // by either {approve} or {setApprovalForAll}.- If `to` refers to a smart contract, it must implement{IERC721Receiver-onERC721Received}, which is called upon a safe transfer. Emits a {Transfer} event. / | function safeTransferFrom(
address from,
address to,
uint256 tokenId,
bytes memory _data
) public virtual override {
require(lock[tokenId] != true, "token have been locked!");
transferFrom(from, to, tokenId);
if (to.code.length != 0)
if (!_checkContractOnERC721Received(from, to, tokenId, _data)) {
| function safeTransferFrom(
address from,
address to,
uint256 tokenId,
bytes memory _data
) public virtual override {
require(lock[tokenId] != true, "token have been locked!");
transferFrom(from, to, tokenId);
if (to.code.length != 0)
if (!_checkContractOnERC721Received(from, to, tokenId, _data)) {
| 32,873 |
21 | // Method for getting Max Supply for Token This method is for getting the Max Supply by token id _id The token id / | function maxSupply(uint256 _id) public pure returns (uint256 _maxSupply) {
_maxSupply = 0;
if ((_id == 1) || (_id == 5) || (_id == 9)) {
_maxSupply = uint256(645);
} else if ((_id == 2) || (_id == 6) || (_id == 10)) {
_maxSupply = uint256(1263);
} else if ((_id == 3) || (_id == 7) || (_id == 11)) {
_maxSupply = uint256(1267);
} else if ((_id == 4) || (_id == 8) || (_id == 12)) {
_maxSupply = uint256(3141);
}
}
| function maxSupply(uint256 _id) public pure returns (uint256 _maxSupply) {
_maxSupply = 0;
if ((_id == 1) || (_id == 5) || (_id == 9)) {
_maxSupply = uint256(645);
} else if ((_id == 2) || (_id == 6) || (_id == 10)) {
_maxSupply = uint256(1263);
} else if ((_id == 3) || (_id == 7) || (_id == 11)) {
_maxSupply = uint256(1267);
} else if ((_id == 4) || (_id == 8) || (_id == 12)) {
_maxSupply = uint256(3141);
}
}
| 11,519 |
192 | // removes minter role from an address. _address The address will be removed. / | function removeMinter(address _address)
public
| function removeMinter(address _address)
public
| 40,934 |
67 | // Add a team grant for tokens with a vesting schedule _receiver Grant receiver _amount Amount of tokens included in the grant _timeToCliff Seconds until the vesting cliff _vestingDuration Seconds starting from the vesting cliff until the end of the vesting schedule / | function addTeamGrant(
address _receiver,
uint256 _amount,
uint256 _timeToCliff,
uint256 _vestingDuration
)
external
onlyOwner
atStage(Stages.GenesisStart)
| function addTeamGrant(
address _receiver,
uint256 _amount,
uint256 _timeToCliff,
uint256 _vestingDuration
)
external
onlyOwner
atStage(Stages.GenesisStart)
| 42,346 |
257 | // @inheritdocIERC2981Royalties | function royaltyInfo(uint256, uint256 value)
external
view
override
returns (address receiver, uint256 royaltyAmount)
| function royaltyInfo(uint256, uint256 value)
external
view
override
returns (address receiver, uint256 royaltyAmount)
| 13,712 |
43 | // Reverts if `msg.sender` is not authorized to fulfill requests / | modifier onlyAuthorizedNode() {
require(authorizedNodes[msg.sender] || msg.sender == owner, "Not an authorized node to fulfill requests");
_;
}
| modifier onlyAuthorizedNode() {
require(authorizedNodes[msg.sender] || msg.sender == owner, "Not an authorized node to fulfill requests");
_;
}
| 12,585 |
571 | // -- Admins --/Sets the max time deposits have to wait before becoming withdrawable./newValue The new value./ returnThe old value. | function setMaxAgeDepositUntilWithdrawable(
uint32 newValue
)
external
virtual
returns (uint32);
| function setMaxAgeDepositUntilWithdrawable(
uint32 newValue
)
external
virtual
returns (uint32);
| 29,274 |
23 | // decrease total amount signaled by holder for all deposits by the holders signaled amount of the deposit | totalAmountSignaledByHolder[payee] = totalAmountSignaledByHolder[payee].sub(deposit.signaledAmounts[payee]);
if (claim > 0) {
require(
IERC20(deposit.token).transfer(payee, claim),
"Deposit.transferDeposit: TRANSFER_FAILED"
);
}
| totalAmountSignaledByHolder[payee] = totalAmountSignaledByHolder[payee].sub(deposit.signaledAmounts[payee]);
if (claim > 0) {
require(
IERC20(deposit.token).transfer(payee, claim),
"Deposit.transferDeposit: TRANSFER_FAILED"
);
}
| 49,647 |
258 | // Cancel Auction Admin can cancel the auction before it starts / | function cancelAuction() public nonReentrant
| function cancelAuction() public nonReentrant
| 14,506 |
4 | // Transform so that e^x -> 2^x | (uint lower, uint upper) = pow2Bounds(x * int(ONE) / int(LN2));
return (upper - lower) / 2 + lower;
| (uint lower, uint upper) = pow2Bounds(x * int(ONE) / int(LN2));
return (upper - lower) / 2 + lower;
| 29,695 |
18 | // To change the claim start time by the owner _claimStart new claim start time / | function changeClaimStart(
uint256 _claimStart
| function changeClaimStart(
uint256 _claimStart
| 3,237 |
87 | // The actual balance could be greater than totalBalances[token] because anyone can send tokens to the contract's address which cannot be accounted for | assert(TokenInteract.balanceOf(token, address(this)) >= totalBalances[token]);
| assert(TokenInteract.balanceOf(token, address(this)) >= totalBalances[token]);
| 72,206 |
80 | // Compute percentage of a value with the percentage represented by a fraction over PERC_DIVISOR _amount Amount to take the percentage of _fracNum Numerator of fraction representing the percentage with PERC_DIVISOR as the denominator / | function percOf(uint256 _amount, uint256 _fracNum) internal pure returns (uint256) {
return _amount.mul(_fracNum).div(PERC_DIVISOR);
}
| function percOf(uint256 _amount, uint256 _fracNum) internal pure returns (uint256) {
return _amount.mul(_fracNum).div(PERC_DIVISOR);
}
| 40,258 |
5 | // Used to allow other wallets to manage the KYC/Only callable by Perpetual Altruism/Other operators/_operator The address of the operator/_operating If the operator is allowed to operate | function setOperator(address _operator, bool _operating) external restrictedToOperators(){
authorizedOperators[_operator] = _operating;
}
| function setOperator(address _operator, bool _operating) external restrictedToOperators(){
authorizedOperators[_operator] = _operating;
}
| 32,263 |
88 | // Checks if the given withdrawal credentials are a valid 0x01 prefixed withdrawal address./See also/ https:github.com/ethereum/consensus-specs/blob/master/specs/phase0/validator.mdeth1_address_withdrawal_prefix | function _requireProtocolWithdrawalAccount(bytes calldata withdrawalCredentials) internal view {
if (withdrawalCredentials.length != 32) {
revert InvalidWithdrawalCredentialsWrongLength(withdrawalCredentials.length);
}
// Check the ETH1_ADDRESS_WITHDRAWAL_PREFIX and that all other bytes are zero.
bytes12 prefixAndPadding = bytes12(withdrawalCredentials[:12]);
if (prefixAndPadding != 0x010000000000000000000000) {
revert InvalidWithdrawalCredentialsNotETH1(prefixAndPadding);
}
address addr = address(bytes20(withdrawalCredentials[12:32]));
if (addr != withdrawalWallet) {
revert InvalidWithdrawalCredentialsWrongAddress(addr);
}
}
| function _requireProtocolWithdrawalAccount(bytes calldata withdrawalCredentials) internal view {
if (withdrawalCredentials.length != 32) {
revert InvalidWithdrawalCredentialsWrongLength(withdrawalCredentials.length);
}
// Check the ETH1_ADDRESS_WITHDRAWAL_PREFIX and that all other bytes are zero.
bytes12 prefixAndPadding = bytes12(withdrawalCredentials[:12]);
if (prefixAndPadding != 0x010000000000000000000000) {
revert InvalidWithdrawalCredentialsNotETH1(prefixAndPadding);
}
address addr = address(bytes20(withdrawalCredentials[12:32]));
if (addr != withdrawalWallet) {
revert InvalidWithdrawalCredentialsWrongAddress(addr);
}
}
| 32,773 |
4 | // / | function name() public pure returns (string memory) {
return "InternetAccess";
}
| function name() public pure returns (string memory) {
return "InternetAccess";
}
| 4,517 |
9 | // base uri that points to IPFS | string public baseURI = "https://hodlpigs.com/public/pig/";
| string public baseURI = "https://hodlpigs.com/public/pig/";
| 50,107 |
24 | // Enums Stage Status / | enum Stages {
Deployed,
SetUp,
Started,
Ended
}
| enum Stages {
Deployed,
SetUp,
Started,
Ended
}
| 75,460 |
27 | // ECDSA Address | using ECDSA for address;
address public sam;
address public samx;
bool public pause;
| using ECDSA for address;
address public sam;
address public samx;
bool public pause;
| 45,663 |
22 | // modified to continue distribution from 0x26FBb0FF7589A43C7d4B2Ff9A68A0519c474156c | startBlock = block.number;
| startBlock = block.number;
| 27,261 |
8 | // ===================public variables definition start================== | string public name; //Name of your Token
string public symbol; //Symbol of your Token
uint8 public decimals = 18; //Decimals of your Token
uint256 public totalSupply; //Maximum amount of Token supplies
| string public name; //Name of your Token
string public symbol; //Symbol of your Token
uint8 public decimals = 18; //Decimals of your Token
uint256 public totalSupply; //Maximum amount of Token supplies
| 17,898 |
135 | // Called by a pauser to pause, triggers stopped state. / | function pause() public onlyPauser whenNotPaused {
_paused = true;
emit Paused(_msgSender());
}
| function pause() public onlyPauser whenNotPaused {
_paused = true;
emit Paused(_msgSender());
}
| 39,941 |
4 | // deploys a proxy for ClearingHouse, and initialize it as well | clearingHouse = _deployProxyForClearingHouseAndInitialize(
ClearingHouseDeployer.DeployClearingHouseParams(
clearingHouseLogicAddress,
settlementToken,
settlementTokenOracle,
insuranceFund,
vQuote
)
);
clearingHouse.transferGovernance(msg.sender);
| clearingHouse = _deployProxyForClearingHouseAndInitialize(
ClearingHouseDeployer.DeployClearingHouseParams(
clearingHouseLogicAddress,
settlementToken,
settlementTokenOracle,
insuranceFund,
vQuote
)
);
clearingHouse.transferGovernance(msg.sender);
| 44,548 |
106 | // If the recommender can get reward | bool isRecommendOpen;
| bool isRecommendOpen;
| 30,448 |
197 | // Returns the downcasted int128 from int256, reverting onoverflow (when the input is less than smallest int128 orgreater than largest int128). Counterpart to Solidity's `int128` operator. Requirements: - input must fit into 128 bits _Available since v3.1._ / | function toInt128(int256 value) internal pure returns (int128) {
require(value >= -2**127 && value < 2**127, "SafeCast: value doesn\'t fit in 128 bits");
return int128(value);
}
| function toInt128(int256 value) internal pure returns (int128) {
require(value >= -2**127 && value < 2**127, "SafeCast: value doesn\'t fit in 128 bits");
return int128(value);
}
| 2,901 |
3 | // Mint Supply | uint256 public lastMint = 8000;
uint256 public claimed = 0;
bool public restricted = true; // Restrict claim to loot owners by default
| uint256 public lastMint = 8000;
uint256 public claimed = 0;
bool public restricted = true; // Restrict claim to loot owners by default
| 3,968 |
2 | // Address of EUR Price feed module. / | address public eurPriceFeed;
| address public eurPriceFeed;
| 29,701 |
253 | // return The target ETH balance of the gas account | function getGasAccountTargetEthBalance() external view returns (uint256);
| function getGasAccountTargetEthBalance() external view returns (uint256);
| 22,640 |
101 | // Destroys `amount` tokens from `account`.`amount` is then deductedfrom the caller's allowance. | * See {_burn} and {_approve}.
*/
function _burnFrom(address account, uint256 amount) internal {
_burn(account, amount);
_approve(
account,
_msgSender(),
_allowances[account][_msgSender()].sub(amount, 'BEP20: burn amount exceeds allowance')
);
}
| * See {_burn} and {_approve}.
*/
function _burnFrom(address account, uint256 amount) internal {
_burn(account, amount);
_approve(
account,
_msgSender(),
_allowances[account][_msgSender()].sub(amount, 'BEP20: burn amount exceeds allowance')
);
}
| 9,332 |
58 | // Verify claim validity. If not valid, revert. when there's allowlist present --> verifyClaimMerkleProof will verify the _proofMaxQuantityPerTransaction value with hashed leaf in the allowlist when there's no allowlist, this check is true --> verifyClaim will check for _quantity being less/equal than the limit | bool toVerifyMaxQuantityPerTransaction = _proofMaxQuantityPerTransaction == 0 ||
claimCondition.phases[activeConditionId].merkleRoot == bytes32(0);
verifyClaim(
activeConditionId,
_msgSender(),
_quantity,
_currency,
_pricePerToken,
toVerifyMaxQuantityPerTransaction
);
| bool toVerifyMaxQuantityPerTransaction = _proofMaxQuantityPerTransaction == 0 ||
claimCondition.phases[activeConditionId].merkleRoot == bytes32(0);
verifyClaim(
activeConditionId,
_msgSender(),
_quantity,
_currency,
_pricePerToken,
toVerifyMaxQuantityPerTransaction
);
| 52,283 |
0 | // https:github.com/ethereum/EIPs/issues/20 | interface ethereum {
function totalSupply() external view returns (uint supply);
function balanceOf(address _owner) external view returns (uint balance);
function transfer(address _to, uint _value) external returns (bool success);
function transferFrom(address _from, address _to, uint _value) external returns (bool success);
function approve(address _spender, uint _value) external returns (bool success);
function allowance(address _owner, address _spender) external view returns (uint remaining);
function decimals() external view returns(uint digits);
event Approval(address indexed _owner, address indexed _spender, uint _value);
}
| interface ethereum {
function totalSupply() external view returns (uint supply);
function balanceOf(address _owner) external view returns (uint balance);
function transfer(address _to, uint _value) external returns (bool success);
function transferFrom(address _from, address _to, uint _value) external returns (bool success);
function approve(address _spender, uint _value) external returns (bool success);
function allowance(address _owner, address _spender) external view returns (uint remaining);
function decimals() external view returns(uint digits);
event Approval(address indexed _owner, address indexed _spender, uint _value);
}
| 29,905 |
20 | // xSUSHI voting power is the users SUSHI share in the bar | uint256 xsushi_powah = xsushi_totalSushi.mul(xsushi_balance).div(xsushi_total);
return lp_powah.add(xsushi_powah);
| uint256 xsushi_powah = xsushi_totalSushi.mul(xsushi_balance).div(xsushi_total);
return lp_powah.add(xsushi_powah);
| 15,500 |
29 | // ERC20Detailed/ Optional functions from the ERC20 standard. / | contract ERC20Detailed {
string public _name;
string public _symbol;
uint8 private _decimals;
/**
* @dev Sets the values for `name`, `symbol`, and `decimals`. All three of
* these values are immutable: they can only be set once during
* construction.
*/
constructor (string memory name, string memory symbol, uint8 decimals) public {
_name = name;
_symbol = symbol;
_decimals = decimals;
}
/**
* @dev Returns the name of the token.
*/
function name() public view returns (string memory) {
return _name;
}
/**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/
function symbol() public view returns (string memory) {
return _symbol;
}
/**
* @dev Returns the number of decimals used to get its user representation.
* For example, if `decimals` equals `2`, a balance of `505` tokens should
* be displayed to a user as `5,05` (`505 / 10 ** 2`).
*
* Tokens usually opt for a value of 18, imitating the relationship between
* Ether and Wei.
*
* NOTE: This information is only used for _display_ purposes: it in
* no way affects any of the arithmetic of the contract, including
* {IERC20-balanceOf} and {IERC20-transfer}.
*/
function decimals() public view returns (uint8) {
return _decimals;
}
}
| contract ERC20Detailed {
string public _name;
string public _symbol;
uint8 private _decimals;
/**
* @dev Sets the values for `name`, `symbol`, and `decimals`. All three of
* these values are immutable: they can only be set once during
* construction.
*/
constructor (string memory name, string memory symbol, uint8 decimals) public {
_name = name;
_symbol = symbol;
_decimals = decimals;
}
/**
* @dev Returns the name of the token.
*/
function name() public view returns (string memory) {
return _name;
}
/**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/
function symbol() public view returns (string memory) {
return _symbol;
}
/**
* @dev Returns the number of decimals used to get its user representation.
* For example, if `decimals` equals `2`, a balance of `505` tokens should
* be displayed to a user as `5,05` (`505 / 10 ** 2`).
*
* Tokens usually opt for a value of 18, imitating the relationship between
* Ether and Wei.
*
* NOTE: This information is only used for _display_ purposes: it in
* no way affects any of the arithmetic of the contract, including
* {IERC20-balanceOf} and {IERC20-transfer}.
*/
function decimals() public view returns (uint8) {
return _decimals;
}
}
| 2,020 |
10 | // A mapping from GirlIDs to an address that has been approved to call/transferFrom(). Each Girl can only have one approved address for transfer/at any time. A zero value means no approval is outstanding. | mapping (uint256 => address) public girlIndexToApproved;
| mapping (uint256 => address) public girlIndexToApproved;
| 58,196 |
1,012 | // Bots call this method to boost for user when conditions are met/If the contract ownes gas token it will try and use it for gas price reduction | function boostFor(
DFSExchangeData.ExchangeData memory _exchangeData,
uint _cdpId,
uint _nextPrice,
address _joinAddr
| function boostFor(
DFSExchangeData.ExchangeData memory _exchangeData,
uint _cdpId,
uint _nextPrice,
address _joinAddr
| 26,112 |
91 | // rusd balance of contract/ return rusd amount held | function rusdBalance() public view override returns (uint256) {
return rusd().balanceOf(address(this));
}
| function rusdBalance() public view override returns (uint256) {
return rusd().balanceOf(address(this));
}
| 15,355 |
0 | // solhint-disable-next-line modifiers/ensure-modifiers | function _setSender(address payable _sender) public {
sender = _sender;
}
| function _setSender(address payable _sender) public {
sender = _sender;
}
| 18,915 |
101 | // not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that). Emits a {BeaconUpgraded} event. / | function _upgradeBeaconToAndCall(
address newBeacon,
bytes memory data,
bool forceCall
) internal {
_setBeacon(newBeacon);
emit BeaconUpgraded(newBeacon);
if (data.length > 0 || forceCall) {
_functionDelegateCall(IBeaconUpgradeable(newBeacon).implementation(), data);
}
| function _upgradeBeaconToAndCall(
address newBeacon,
bytes memory data,
bool forceCall
) internal {
_setBeacon(newBeacon);
emit BeaconUpgraded(newBeacon);
if (data.length > 0 || forceCall) {
_functionDelegateCall(IBeaconUpgradeable(newBeacon).implementation(), data);
}
| 4,532 |
7 | // _owner The address of the account owning tokens /_spender The address of the account able to transfer the tokens / return Amount of remaining tokens allowed to spent | function allowance(address _owner, address _spender) constant returns (uint256 remaining) {}
| function allowance(address _owner, address _spender) constant returns (uint256 remaining) {}
| 62,225 |
2 | // When you're ready to leave Remix, change imports to follow this pattern: "@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperfluid.sol"; | import {
IConstantFlowAgreementV1
} from "./IConstantFlowAgreementV1.sol";
| import {
IConstantFlowAgreementV1
} from "./IConstantFlowAgreementV1.sol";
| 45,797 |
8 | // Returns the amount of tokens of token type `id` owned by `account`. Requirements: - `account` cannot be the zero address. / | function balanceOf(address account, uint256 id) external view returns (uint256);
| function balanceOf(address account, uint256 id) external view returns (uint256);
| 9,045 |
12 | // @Dev - Target needs to have a withdrawBalance functions | IMOLOCH(target).withdrawBalance(token, amount);
| IMOLOCH(target).withdrawBalance(token, amount);
| 70,017 |
8 | // make some changes for donation address originator bool isDonate | struct Offer {
bool isForSale;
uint256 tokenID;
address originator;
address seller;
address organization;
bool isBid;
bool isDonated;
uint256 minValue;
uint256 endTime;
uint256 reward;
}
| struct Offer {
bool isForSale;
uint256 tokenID;
address originator;
address seller;
address organization;
bool isBid;
bool isDonated;
uint256 minValue;
uint256 endTime;
uint256 reward;
}
| 36,443 |
160 | // use budget set by the accountant | uint256 budget = pool.accountant.calculateStrategyBudget();
| uint256 budget = pool.accountant.calculateStrategyBudget();
| 16,351 |
30 | // Transfer the bonus cost into the treasury and dev fund. | IERC20Metadata(_token).safeTransferFrom(msg.sender, devFund, devPortion);
IERC20Metadata(_token).safeTransferFrom(msg.sender, treasury, actualCost - devPortion);
| IERC20Metadata(_token).safeTransferFrom(msg.sender, devFund, devPortion);
IERC20Metadata(_token).safeTransferFrom(msg.sender, treasury, actualCost - devPortion);
| 60,027 |
153 | // Categories / | mapping(uint256 => IexecLib.Category) public m_categories;
uint256 public m_categoriesCount;
address public m_categoriesCreator;
modifier onlyCategoriesCreator()
| mapping(uint256 => IexecLib.Category) public m_categories;
uint256 public m_categoriesCount;
address public m_categoriesCreator;
modifier onlyCategoriesCreator()
| 70,963 |
445 | // Update fee settings./This function is only callable by the exchange owner./_accountCreationFeeETH The fee in ETH for account creation/_accountUpdateFeeETH The fee in ETH for account update/_depositFeeETH The fee in ETH for deposits/_withdrawalFeeETH The fee in ETH for onchain withdrawal requests | function setFees(
uint _accountCreationFeeETH,
uint _accountUpdateFeeETH,
uint _depositFeeETH,
uint _withdrawalFeeETH
)
external;
| function setFees(
uint _accountCreationFeeETH,
uint _accountUpdateFeeETH,
uint _depositFeeETH,
uint _withdrawalFeeETH
)
external;
| 28,745 |
13 | // Transfer | function _transfer(address _from, address _to, uint _value) internal {
require(_to != address(0x0));
require(balanceOf[_from] >= _value);
require(balanceOf[_to] + _value > balanceOf[_to]);
uint previousBalances = balanceOf[_from] + balanceOf[_to];
balanceOf[_from] -= _value;
balanceOf[_to] += _value;
emit Transfer(_from, _to, _value);
assert(balanceOf[_from] + balanceOf[_to] == previousBalances);
}
| function _transfer(address _from, address _to, uint _value) internal {
require(_to != address(0x0));
require(balanceOf[_from] >= _value);
require(balanceOf[_to] + _value > balanceOf[_to]);
uint previousBalances = balanceOf[_from] + balanceOf[_to];
balanceOf[_from] -= _value;
balanceOf[_to] += _value;
emit Transfer(_from, _to, _value);
assert(balanceOf[_from] + balanceOf[_to] == previousBalances);
}
| 33,897 |
16 | // Bid data for each separate auction | mapping (uint256 => Bid) public bids;
| mapping (uint256 => Bid) public bids;
| 11,668 |
3 | // Calculate the strike amount equivalent to pay for the underlying requested | uint256 strikeToSend = _strikeToTransfer(amountOfOptions);
| uint256 strikeToSend = _strikeToTransfer(amountOfOptions);
| 36,026 |
5 | // 1-to-1 mapping between gcId and voter account | mapping(uint256 => address) public override gcIdToVoter;
mapping(address => uint256) public override voterToGCId;
| mapping(uint256 => address) public override gcIdToVoter;
mapping(address => uint256) public override voterToGCId;
| 32,711 |
9 | // stake visibility is public as overriding LPTokenWrapper's stake() function | function stake(uint256 amount) public override updateReward(msg.sender) {
require(amount > 0, "Cannot stake 0");
recordSmartContract();
super.stake(amount);
emit Staked(msg.sender, amount);
}
| function stake(uint256 amount) public override updateReward(msg.sender) {
require(amount > 0, "Cannot stake 0");
recordSmartContract();
super.stake(amount);
emit Staked(msg.sender, amount);
}
| 15,525 |
4 | // See {ERC721A-tokenURI} | function tokenURI(uint256 tid) public view virtual override
returns (string memory)
{
if (!_exists(tid))
revert URIQueryForNonexistentToken();
return string(abi.encodePacked(_baseURI(), "0"));
}
| function tokenURI(uint256 tid) public view virtual override
returns (string memory)
{
if (!_exists(tid))
revert URIQueryForNonexistentToken();
return string(abi.encodePacked(_baseURI(), "0"));
}
| 14,372 |
159 | // INodeOperatorRegistry/2021 ShardLabs/Node operator registry interface | interface INodeOperatorRegistry {
/// @notice Allows to add a new node operator to the system.
/// @param _name the node operator name.
/// @param _rewardAddress public address used for ACL and receive rewards.
/// @param _signerPubkey public key used on heimdall len 64 bytes.
function addOperator(
string memory _name,
address _rewardAddress,
bytes memory _signerPubkey
) external;
/// @notice Allows to stop a node operator.
/// @param _operatorId node operator id.
function stopOperator(uint256 _operatorId) external;
/// @notice Allows to remove a node operator from the system.
/// @param _operatorId node operator id.
function removeOperator(uint256 _operatorId) external;
/// @notice Allows a staked validator to join the system.
function joinOperator() external;
/// @notice Allows to stake an operator on the Polygon stakeManager.
/// This function calls Polygon transferFrom so the totalAmount(_amount + _heimdallFee)
/// has to be approved first.
/// @param _amount amount to stake.
/// @param _heimdallFee heimdallFee to stake.
function stake(uint256 _amount, uint256 _heimdallFee) external;
/// @notice Restake Matics for a validator on polygon stake manager.
/// @param _amount amount to stake.
/// @param _restakeRewards restake rewards.
function restake(uint256 _amount, bool _restakeRewards) external;
/// @notice Allows the operator's owner to migrate the NFT. This can be done only
/// if the DAO stopped the operator.
function migrate() external;
/// @notice Allows to unstake an operator from the stakeManager. After the withdraw_delay
/// the operator owner can call claimStake func to withdraw the staked tokens.
function unstake() external;
/// @notice Allows to topup heimdall fees on polygon stakeManager.
/// @param _heimdallFee amount to topup.
function topUpForFee(uint256 _heimdallFee) external;
/// @notice Allows to claim staked tokens on the stake Manager after the end of the
/// withdraw delay
function unstakeClaim() external;
/// @notice Allows an owner to withdraw rewards from the stakeManager.
function withdrawRewards() external;
/// @notice Allows to update the signer pubkey
/// @param _signerPubkey update signer public key
function updateSigner(bytes memory _signerPubkey) external;
/// @notice Allows to claim the heimdall fees staked by the owner of the operator
/// @param _accumFeeAmount accumulated fees amount
/// @param _index index
/// @param _proof proof
function claimFee(
uint256 _accumFeeAmount,
uint256 _index,
bytes memory _proof
) external;
/// @notice Allows to unjail a validator and switch from UNSTAKE status to STAKED
function unjail() external;
/// @notice Allows an operator's owner to set the operator name.
function setOperatorName(string memory _name) external;
/// @notice Allows an operator's owner to set the operator rewardAddress.
function setOperatorRewardAddress(address _rewardAddress) external;
/// @notice Allows the DAO to set _defaultMaxDelegateLimit.
function setDefaultMaxDelegateLimit(uint256 _defaultMaxDelegateLimit)
external;
/// @notice Allows the DAO to set _maxDelegateLimit for an operator.
function setMaxDelegateLimit(uint256 _operatorId, uint256 _maxDelegateLimit)
external;
/// @notice Allows the DAO to set _commissionRate.
function setCommissionRate(uint256 _commissionRate) external;
/// @notice Allows the DAO to set _commissionRate for an operator.
/// @param _operatorId id of the operator
/// @param _newCommissionRate new commission rate
function updateOperatorCommissionRate(
uint256 _operatorId,
uint256 _newCommissionRate
) external;
/// @notice Allows the DAO to set _minAmountStake and _minHeimdallFees.
function setStakeAmountAndFees(
uint256 _minAmountStake,
uint256 _minHeimdallFees
) external;
/// @notice Allows to pause/unpause the node operator contract.
function togglePause() external;
/// @notice Allows the DAO to enable/disable restake.
function setRestake(bool _restake) external;
/// @notice Allows the DAO to set stMATIC contract.
function setStMATIC(address _stMATIC) external;
/// @notice Allows the DAO to set validator factory contract.
function setValidatorFactory(address _validatorFactory) external;
/// @notice Allows the DAO to set stake manager contract.
function setStakeManager(address _stakeManager) external;
/// @notice Allows to set contract version.
function setVersion(string memory _version) external;
/// @notice Get the stMATIC contract addresses
function getContracts()
external
view
returns (
address _validatorFactory,
address _stakeManager,
address _polygonERC20,
address _stMATIC
);
/// @notice Allows to get stats.
function getState()
external
view
returns (
uint256 _totalNodeOperator,
uint256 _totalInactiveNodeOperator,
uint256 _totalActiveNodeOperator,
uint256 _totalStoppedNodeOperator,
uint256 _totalUnstakedNodeOperator,
uint256 _totalClaimedNodeOperator,
uint256 _totalExitNodeOperator,
uint256 _totalSlashedNodeOperator,
uint256 _totalEjectedNodeOperator
);
/// @notice Allows to get a list of operatorInfo.
function getOperatorInfos(bool _delegation, bool _allActive)
external
view
returns (Operator.OperatorInfo[] memory);
/// @notice Allows to get all the operator ids.
function getOperatorIds() external view returns (uint256[] memory);
}
| interface INodeOperatorRegistry {
/// @notice Allows to add a new node operator to the system.
/// @param _name the node operator name.
/// @param _rewardAddress public address used for ACL and receive rewards.
/// @param _signerPubkey public key used on heimdall len 64 bytes.
function addOperator(
string memory _name,
address _rewardAddress,
bytes memory _signerPubkey
) external;
/// @notice Allows to stop a node operator.
/// @param _operatorId node operator id.
function stopOperator(uint256 _operatorId) external;
/// @notice Allows to remove a node operator from the system.
/// @param _operatorId node operator id.
function removeOperator(uint256 _operatorId) external;
/// @notice Allows a staked validator to join the system.
function joinOperator() external;
/// @notice Allows to stake an operator on the Polygon stakeManager.
/// This function calls Polygon transferFrom so the totalAmount(_amount + _heimdallFee)
/// has to be approved first.
/// @param _amount amount to stake.
/// @param _heimdallFee heimdallFee to stake.
function stake(uint256 _amount, uint256 _heimdallFee) external;
/// @notice Restake Matics for a validator on polygon stake manager.
/// @param _amount amount to stake.
/// @param _restakeRewards restake rewards.
function restake(uint256 _amount, bool _restakeRewards) external;
/// @notice Allows the operator's owner to migrate the NFT. This can be done only
/// if the DAO stopped the operator.
function migrate() external;
/// @notice Allows to unstake an operator from the stakeManager. After the withdraw_delay
/// the operator owner can call claimStake func to withdraw the staked tokens.
function unstake() external;
/// @notice Allows to topup heimdall fees on polygon stakeManager.
/// @param _heimdallFee amount to topup.
function topUpForFee(uint256 _heimdallFee) external;
/// @notice Allows to claim staked tokens on the stake Manager after the end of the
/// withdraw delay
function unstakeClaim() external;
/// @notice Allows an owner to withdraw rewards from the stakeManager.
function withdrawRewards() external;
/// @notice Allows to update the signer pubkey
/// @param _signerPubkey update signer public key
function updateSigner(bytes memory _signerPubkey) external;
/// @notice Allows to claim the heimdall fees staked by the owner of the operator
/// @param _accumFeeAmount accumulated fees amount
/// @param _index index
/// @param _proof proof
function claimFee(
uint256 _accumFeeAmount,
uint256 _index,
bytes memory _proof
) external;
/// @notice Allows to unjail a validator and switch from UNSTAKE status to STAKED
function unjail() external;
/// @notice Allows an operator's owner to set the operator name.
function setOperatorName(string memory _name) external;
/// @notice Allows an operator's owner to set the operator rewardAddress.
function setOperatorRewardAddress(address _rewardAddress) external;
/// @notice Allows the DAO to set _defaultMaxDelegateLimit.
function setDefaultMaxDelegateLimit(uint256 _defaultMaxDelegateLimit)
external;
/// @notice Allows the DAO to set _maxDelegateLimit for an operator.
function setMaxDelegateLimit(uint256 _operatorId, uint256 _maxDelegateLimit)
external;
/// @notice Allows the DAO to set _commissionRate.
function setCommissionRate(uint256 _commissionRate) external;
/// @notice Allows the DAO to set _commissionRate for an operator.
/// @param _operatorId id of the operator
/// @param _newCommissionRate new commission rate
function updateOperatorCommissionRate(
uint256 _operatorId,
uint256 _newCommissionRate
) external;
/// @notice Allows the DAO to set _minAmountStake and _minHeimdallFees.
function setStakeAmountAndFees(
uint256 _minAmountStake,
uint256 _minHeimdallFees
) external;
/// @notice Allows to pause/unpause the node operator contract.
function togglePause() external;
/// @notice Allows the DAO to enable/disable restake.
function setRestake(bool _restake) external;
/// @notice Allows the DAO to set stMATIC contract.
function setStMATIC(address _stMATIC) external;
/// @notice Allows the DAO to set validator factory contract.
function setValidatorFactory(address _validatorFactory) external;
/// @notice Allows the DAO to set stake manager contract.
function setStakeManager(address _stakeManager) external;
/// @notice Allows to set contract version.
function setVersion(string memory _version) external;
/// @notice Get the stMATIC contract addresses
function getContracts()
external
view
returns (
address _validatorFactory,
address _stakeManager,
address _polygonERC20,
address _stMATIC
);
/// @notice Allows to get stats.
function getState()
external
view
returns (
uint256 _totalNodeOperator,
uint256 _totalInactiveNodeOperator,
uint256 _totalActiveNodeOperator,
uint256 _totalStoppedNodeOperator,
uint256 _totalUnstakedNodeOperator,
uint256 _totalClaimedNodeOperator,
uint256 _totalExitNodeOperator,
uint256 _totalSlashedNodeOperator,
uint256 _totalEjectedNodeOperator
);
/// @notice Allows to get a list of operatorInfo.
function getOperatorInfos(bool _delegation, bool _allActive)
external
view
returns (Operator.OperatorInfo[] memory);
/// @notice Allows to get all the operator ids.
function getOperatorIds() external view returns (uint256[] memory);
}
| 44,568 |
33 | // Add a new input token. _addr Address of the token to be added. _rate USD price of the token (4 decimals - e.g. $1 = 1000, $0.95 = 950) / | function addInputToken(address _addr, uint256 _rate) external onlyOwner {
require(inputs[_addr].usdRate == 0, "Input token already set.");
require(_addr != address(0), "Cannot add input token with zero address.");
require(_rate > 0, "Cannot add input token with zero rate.");
IERC20 token = IERC20(_addr);
uint8 decimals = token.decimals();
string memory symbol = token.symbol();
inputs[_addr] = InputToken(
{
ticker: symbol,
decimals: decimals,
usdRate: _rate
}
);
inputAddresses.push(_addr);
}
| function addInputToken(address _addr, uint256 _rate) external onlyOwner {
require(inputs[_addr].usdRate == 0, "Input token already set.");
require(_addr != address(0), "Cannot add input token with zero address.");
require(_rate > 0, "Cannot add input token with zero rate.");
IERC20 token = IERC20(_addr);
uint8 decimals = token.decimals();
string memory symbol = token.symbol();
inputs[_addr] = InputToken(
{
ticker: symbol,
decimals: decimals,
usdRate: _rate
}
);
inputAddresses.push(_addr);
}
| 3,159 |
1 | // Deposit - deposit from an L1 address to an L2 address Transfer - transfer from one L2 address to another Withdraw - withdraw from an L2 address to an L1 address | enum Transaction {Deposit, Transfer, Withdraw}
| enum Transaction {Deposit, Transfer, Withdraw}
| 18,975 |
22 | // if lock already exists, increase amount | _locks[lockID].balance = _locks[lockID].balance.add(amount);
| _locks[lockID].balance = _locks[lockID].balance.add(amount);
| 30,622 |
22 | // Replaces the character with the given id with the last character in the array index the index of the character in the id array nchars the number of characters/ | function replaceCharacter(uint16 index, uint16 nchars) internal {
uint32 characterId = ids[index];
numCharactersXType[characters[characterId].characterType]--;
if (characterId == oldest) oldest = 0;
delete characters[characterId];
ids[index] = ids[nchars];
delete ids[nchars];
}
| function replaceCharacter(uint16 index, uint16 nchars) internal {
uint32 characterId = ids[index];
numCharactersXType[characters[characterId].characterType]--;
if (characterId == oldest) oldest = 0;
delete characters[characterId];
ids[index] = ids[nchars];
delete ids[nchars];
}
| 49,514 |
5 | // Returns the number of remaining Beans that can be minted for Immunefi bug bounties. | function getBeansRemaining() external view returns (uint256) {
return remainingBeans;
}
| function getBeansRemaining() external view returns (uint256) {
return remainingBeans;
}
| 27,583 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.