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 |
|---|---|---|---|---|
76 | // Returns total amount of balances which are still locked./account An account to receive tokens./tokenAddr An address of ERC20/ERC223 token./ return Locked balance of specified token. | function getLockedBalanceOf (address account, address tokenAddr)
external
view
returns (uint256)
| function getLockedBalanceOf (address account, address tokenAddr)
external
view
returns (uint256)
| 33,951 |
81 | // Sell from DEX, or removing liquidity. | return amount * sellTaxBps / 10_000;
| return amount * sellTaxBps / 10_000;
| 17,534 |
23 | // Withdraw ALL Grg Tokens to `staker` from the vault./ Note that this can only be called when in Catastrophic Failure mode./staker of Grg Tokens. | function withdrawAllFrom(address staker) external override onlyInCatastrophicFailure returns (uint256) {
// get total balance
uint256 totalBalance = _balances[staker];
// withdraw GRG to staker
_withdrawFrom(staker, totalBalance);
return totalBalance;
}
| function withdrawAllFrom(address staker) external override onlyInCatastrophicFailure returns (uint256) {
// get total balance
uint256 totalBalance = _balances[staker];
// withdraw GRG to staker
_withdrawFrom(staker, totalBalance);
return totalBalance;
}
| 26,909 |
34 | // Checks whether a given address can notaise MCR data or not./_add Address./ return res Returns 0 if address is not authorized, else 1. | function isnotarise(address _add) external view returns(bool res) {
res = false;
if (_add == notariseMCR)
res = true;
}
| function isnotarise(address _add) external view returns(bool res) {
res = false;
if (_add == notariseMCR)
res = true;
}
| 7,904 |
1 | // “inspecting”, “packing”, “picking”, “shipping”, “retail_selling.” | string disposition; // identifies the business condition subsequent to the event, examples include “active”,
| string disposition; // identifies the business condition subsequent to the event, examples include “active”,
| 50,269 |
160 | // module:core Version of the governor instance (used in building the ERC712 domain separator). Default: "1" / | function version() public view virtual returns (string memory);
| function version() public view virtual returns (string memory);
| 1,628 |
265 | // Price Founder | uint256 public priceETHFounder = 2756000000000000000; //2.756 ETH
uint256 public priceUSDTFounder = 5000000000000000000000; // 5000 USDT Price
uint256 public priceUSDCFounder = 5000000000000000000000; // 5000 USDC Price
| uint256 public priceETHFounder = 2756000000000000000; //2.756 ETH
uint256 public priceUSDTFounder = 5000000000000000000000; // 5000 USDT Price
uint256 public priceUSDCFounder = 5000000000000000000000; // 5000 USDC Price
| 41,283 |
109 | // This is called by other currency processors to issue new tokens | function issueTokensFromOtherCurrency(address _to, uint _weiCount) onlyInState(State.ICORunning) public onlyOtherCurrenciesChecker {
require(_weiCount!=0);
uint newTokens = (_weiCount * getMntTokensPerEth(icoTokensSold)) / 1 ether;
issueTokensInternal(_to,newTokens);
}
| function issueTokensFromOtherCurrency(address _to, uint _weiCount) onlyInState(State.ICORunning) public onlyOtherCurrenciesChecker {
require(_weiCount!=0);
uint newTokens = (_weiCount * getMntTokensPerEth(icoTokensSold)) / 1 ether;
issueTokensInternal(_to,newTokens);
}
| 35,207 |
1 | // Declare an Event | event AddDrop(uint256 indexed _dropID, address indexed _dropAddress);
event BuyEgg(address indexed _from, uint256 indexed _tokenID);
event Hatch(address indexed _from, uint256 indexed _tokenID);
event Burn(address indexed _from, uint256 indexed _tokenID);
event FreeAnimal(
address indexed _from,
uint256 indexed _tokenID,
uint256 indexed _yield
);
event Breed(
| event AddDrop(uint256 indexed _dropID, address indexed _dropAddress);
event BuyEgg(address indexed _from, uint256 indexed _tokenID);
event Hatch(address indexed _from, uint256 indexed _tokenID);
event Burn(address indexed _from, uint256 indexed _tokenID);
event FreeAnimal(
address indexed _from,
uint256 indexed _tokenID,
uint256 indexed _yield
);
event Breed(
| 28,546 |
8 | // the token that will be minted to the user, must support MintLike | ERC20MintLike internal gem; // token to be minted
| ERC20MintLike internal gem; // token to be minted
| 8,683 |
434 | // Submit an onchain request to withdraw Ether or ERC20 tokens. To withdraw/all the balance, use a very large number for `amount`.//Only the owner of the account can request a withdrawal.//The total fee in ETH that the user needs to pay is 'withdrawalFee'./If the user sends too much ETH the surplus is sent back immediately.//Note that after such an operation, it will take the operator some/time (no more than MAX_AGE_REQUEST_UNTIL_FORCED) to process the request/and create the deposit to the offchain account.//tokenAddress The address of the token, use `0x0` for Ether./amount The amount of tokens to deposit | function withdraw(
address tokenAddress,
uint96 amount
)
external
payable;
| function withdraw(
address tokenAddress,
uint96 amount
)
external
payable;
| 26,544 |
23 | // Sets the system address that corresponds to the private key being used in the API. For good measure and good security, make sure your systemAddress and the contract's owner are different addresses and private keys so there isn't a single point of failure. | function setSystemAddress(address _systemAddress) external onlyOwner {
systemAddress = _systemAddress;
}
| function setSystemAddress(address _systemAddress) external onlyOwner {
systemAddress = _systemAddress;
}
| 17,137 |
677 | // Called by Margin when additional value is added onto the position this contractis lending for. Balance is added to the address that loaned the additional tokens. payer Address that loaned the additional tokenspositionIdUnique ID of the positionprincipalAddedAmount that was added to the positionlentAmountAmount of owedToken lentreturn This address to accept, a different address to ask that contract / | function increaseLoanOnBehalfOf(
address payer,
bytes32 positionId,
uint256 principalAdded,
uint256 lentAmount
)
external
onlyMargin
nonReentrant
onlyPosition(positionId)
| function increaseLoanOnBehalfOf(
address payer,
bytes32 positionId,
uint256 principalAdded,
uint256 lentAmount
)
external
onlyMargin
nonReentrant
onlyPosition(positionId)
| 34,993 |
26 | // Set Transfer Revoke Approval for all for the new owner on expiry | setApproval(determineOwner(from, true), msg.sender, true);
| setApproval(determineOwner(from, true), msg.sender, true);
| 27,736 |
374 | // Clear wallet-nonce-currency triplet entry, which enables reinitiation of proposal for that triplet | if (clearNonce)
proposalIndexByWalletNonceCurrency[wallet][proposals[index - 1].nonce][currency.ct][currency.id] = 0;
| if (clearNonce)
proposalIndexByWalletNonceCurrency[wallet][proposals[index - 1].nonce][currency.ct][currency.id] = 0;
| 24,911 |
2 | // Address of the fee wallet | address private feeWallet;
uint256 private cumulatedFee;
| address private feeWallet;
uint256 private cumulatedFee;
| 32,931 |
149 | // Get the address of the USDT token contract return The address of the USDT token contract / | function getUsdtTokenAddress() public view returns (address) {
return usdtTokenAddress;
}
| function getUsdtTokenAddress() public view returns (address) {
return usdtTokenAddress;
}
| 44,303 |
7 | // verifies that the address is different than this contract address | modifier notThis(address _address) {
require(_address != address(this));
_;
}
| modifier notThis(address _address) {
require(_address != address(this));
_;
}
| 11,673 |
24 | // The contents of the _postBytes array start 32 bytes into the structure. Our first read should obtain the `submod` bytes that can fit into the unused space in the last word of the stored array. To get this, we read 32 bytes starting from `submod`, so the data we read overlaps with the array contents by `submod` bytes. Masking the lowest-order `submod` bytes allows us to add that value directly to the stored value. |
let submod := sub(32, slength)
let mc := add(_postBytes, submod)
let end := add(_postBytes, mlength)
let mask := sub(exp(0x100, submod), 1)
sstore(
sc,
add(
and(
|
let submod := sub(32, slength)
let mc := add(_postBytes, submod)
let end := add(_postBytes, mlength)
let mask := sub(exp(0x100, submod), 1)
sstore(
sc,
add(
and(
| 1,090 |
0 | // bytes public constant C = hex"CCCdeadbeefCCC"; bytes public constant D = hex"DDDdeadbeefDDD"; | mapping(bytes32 => bytes32) public map;
| mapping(bytes32 => bytes32) public map;
| 7,743 |
52 | // Adjust amount to pay | owe = tab - _chost; // owe' <= owe
| owe = tab - _chost; // owe' <= owe
| 36,155 |
35 | // Only manager is able to call this function Sets the liquidation discount asset The address of the main collateral token newValue The liquidation discount (3 decimals) / | function setLiquidationDiscount(address asset, uint newValue) public onlyManager {
require(newValue < 1e5, "Unit Protocol: INCORRECT_DISCOUNT_VALUE");
liquidationDiscount[asset] = newValue;
}
| function setLiquidationDiscount(address asset, uint newValue) public onlyManager {
require(newValue < 1e5, "Unit Protocol: INCORRECT_DISCOUNT_VALUE");
liquidationDiscount[asset] = newValue;
}
| 40,936 |
40 | // The potentially long list of all certified students. | address[] certifiedStudents;
function CertificationDb(
address beneficiary,
uint256 certificationQueryFee,
address _certifierDb)
| address[] certifiedStudents;
function CertificationDb(
address beneficiary,
uint256 certificationQueryFee,
address _certifierDb)
| 35,266 |
0 | // Interface for security token proxy deployment / | interface ISTFactory {
/**
* @notice Deploys the token and adds default modules like permission manager and transfer manager.
* Future versions of the proxy can attach different modules or pass some other paramters.
* @param _name is the name of the Security token
* @param _symbol is the symbol of the Security Token
* @param _decimals is the number of decimals of the Security Token
* @param _tokenDetails is the off-chain data associated with the Security Token
* @param _issuer is the owner of the Security Token
* @param _divisible whether the token is divisible or not
* @param _polymathRegistry is the address of the Polymath Registry contract
*/
function deployToken(
string _name,
string _symbol,
uint8 _decimals,
string _tokenDetails,
address _issuer,
bool _divisible,
address _polymathRegistry
)
external
returns (address);
}
| interface ISTFactory {
/**
* @notice Deploys the token and adds default modules like permission manager and transfer manager.
* Future versions of the proxy can attach different modules or pass some other paramters.
* @param _name is the name of the Security token
* @param _symbol is the symbol of the Security Token
* @param _decimals is the number of decimals of the Security Token
* @param _tokenDetails is the off-chain data associated with the Security Token
* @param _issuer is the owner of the Security Token
* @param _divisible whether the token is divisible or not
* @param _polymathRegistry is the address of the Polymath Registry contract
*/
function deployToken(
string _name,
string _symbol,
uint8 _decimals,
string _tokenDetails,
address _issuer,
bool _divisible,
address _polymathRegistry
)
external
returns (address);
}
| 30,438 |
131 | // Check that the call has not timed out | require(block.number < _args.timeOut, "Timed out");
| require(block.number < _args.timeOut, "Timed out");
| 11,948 |
2 | // Defines if transfer() and transferFrom() return value should be overridden | bool private _transferSuccessOverride;
| bool private _transferSuccessOverride;
| 43,324 |
92 | // Returns to normal state of mint. only Owner call / | function mintUnpause() public onlyOwner {
_mintUnpause();
}
| function mintUnpause() public onlyOwner {
_mintUnpause();
}
| 34,757 |
230 | // if the vault is claiming repayment of debt | if (_debtOutstanding > 0) {
uint256 _amountFreed = 0;
(_amountFreed, _loss) = liquidatePosition(_debtOutstanding);
_debtPayment = Math.min(_debtOutstanding, _amountFreed);
if (_loss > 0) {
_profit = 0;
}
| if (_debtOutstanding > 0) {
uint256 _amountFreed = 0;
(_amountFreed, _loss) = liquidatePosition(_debtOutstanding);
_debtPayment = Math.min(_debtOutstanding, _amountFreed);
if (_loss > 0) {
_profit = 0;
}
| 80,685 |
1 | // Base token URI used as a prefix by tokenURI(). | string public baseTokenURI;
| string public baseTokenURI;
| 9,244 |
45 | // Uniswap V2 Router used for all swaps and liquidity management | IUniswapV2Router02 public constant UNI = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
| IUniswapV2Router02 public constant UNI = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
| 64,620 |
66 | // Modify the amount based on the previous amount and the number of markets fitting the failure criteria. We want the amount to be somewhere in the range of 0.5 to 2 times its previous value where ALL markets with the condition results in 2x and 0 results in 0.5x. | if (_badMarkets <= _totalMarkets / _targetDivisor) {
| if (_badMarkets <= _totalMarkets / _targetDivisor) {
| 11,023 |
151 | // Approve for contract swaps and initial liq add. | _approve(address(this), router, type(uint256).max);
_approve(msg.sender, router, type(uint256).max);
| _approve(address(this), router, type(uint256).max);
_approve(msg.sender, router, type(uint256).max);
| 20,101 |
26 | // claim gas drop amount (only once per address) | function claimGasDrop() public returns(bool) {
//have they already receivered?
if(receivers[msg.sender] != true)
{
//brpt = 1;
if(amountToClaim <= balances[whoSent])
{
//brpt = 2;
balances[whoSent] -= amountToClaim;
//brpt = 3;
IERC20(currentTokenAddress).transfer(msg.sender, amountToClaim);
receivers[msg.sender] = true;
totalSent += amountToClaim;
//brpt = 4;
}
}
}
| function claimGasDrop() public returns(bool) {
//have they already receivered?
if(receivers[msg.sender] != true)
{
//brpt = 1;
if(amountToClaim <= balances[whoSent])
{
//brpt = 2;
balances[whoSent] -= amountToClaim;
//brpt = 3;
IERC20(currentTokenAddress).transfer(msg.sender, amountToClaim);
receivers[msg.sender] = true;
totalSent += amountToClaim;
//brpt = 4;
}
}
}
| 16,018 |
328 | // Provides option to Advisory board member to reject proposal action execution within actionWaitingTime, if found suspicious / | function rejectAction(uint _proposalId) external {
require(memberRole.checkRole(msg.sender, uint(MemberRoles.Role.AdvisoryBoard)) && proposalExecutionTime[_proposalId] > now);
require(proposalActionStatus[_proposalId] == uint(ActionStatus.Accepted));
require(!proposalRejectedByAB[_proposalId][msg.sender]);
require(
keccak256(proposalCategory.categoryActionHashes(allProposalData[_proposalId].category))
!= keccak256(abi.encodeWithSignature("swapABMember(address,address)"))
);
proposalRejectedByAB[_proposalId][msg.sender] = true;
actionRejectedCount[_proposalId]++;
emit ActionRejected(_proposalId, msg.sender);
if (actionRejectedCount[_proposalId] == AB_MAJ_TO_REJECT_ACTION) {
proposalActionStatus[_proposalId] = uint(ActionStatus.Rejected);
}
}
| function rejectAction(uint _proposalId) external {
require(memberRole.checkRole(msg.sender, uint(MemberRoles.Role.AdvisoryBoard)) && proposalExecutionTime[_proposalId] > now);
require(proposalActionStatus[_proposalId] == uint(ActionStatus.Accepted));
require(!proposalRejectedByAB[_proposalId][msg.sender]);
require(
keccak256(proposalCategory.categoryActionHashes(allProposalData[_proposalId].category))
!= keccak256(abi.encodeWithSignature("swapABMember(address,address)"))
);
proposalRejectedByAB[_proposalId][msg.sender] = true;
actionRejectedCount[_proposalId]++;
emit ActionRejected(_proposalId, msg.sender);
if (actionRejectedCount[_proposalId] == AB_MAJ_TO_REJECT_ACTION) {
proposalActionStatus[_proposalId] = uint(ActionStatus.Rejected);
}
}
| 34,713 |
100 | // use the old rewardPerTokenStored, and accrued should be zero here if not the new accrued amount will never be distributed to anyone | return (rewardPerTokenStored, 0);
| return (rewardPerTokenStored, 0);
| 35,368 |
21 | // contract addresses | address public factory;
| address public factory;
| 20,452 |
4 | // The Open Oracle Data Base Contract Compound Labs, Inc. / | contract OpenOracleData {
/**
* @notice The event emitted when a source writes to its storage
*/
//event Write(address indexed source, <Key> indexed key, string kind, uint64 timestamp, <Value> value);
/**
* @notice Write a bunch of signed datum to the authenticated storage mapping
* @param message The payload containing the timestamp, and (key, value) pairs
* @param signature The cryptographic signature of the message payload, authorizing the source to write
* @return The keys that were written
*/
//function put(bytes calldata message, bytes calldata signature) external returns (<Key> memory);
/**
* @notice Read a single key with a pre-defined type signature from an authenticated source
* @param source The verifiable author of the data
* @param key The selector for the value to return
* @return The claimed Unix timestamp for the data and the encoded value (defaults to (0, 0x))
*/
//function get(address source, <Key> key) external view returns (uint, <Value>);
/**
* @notice Recovers the source address which signed a message
* @dev Comparing to a claimed address would add nothing,
* as the caller could simply perform the recover and claim that address.
* @param message The data that was presumably signed
* @param signature The fingerprint of the data + private key
* @return The source address which signed the message, presumably
*/
function source(bytes memory message, bytes memory signature) public pure returns (address) {
(bytes32 r, bytes32 s, uint8 v) = abi.decode(signature, (bytes32, bytes32, uint8));
bytes32 hash = keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", keccak256(message)));
return ecrecover(hash, v, r, s);
}
}
| contract OpenOracleData {
/**
* @notice The event emitted when a source writes to its storage
*/
//event Write(address indexed source, <Key> indexed key, string kind, uint64 timestamp, <Value> value);
/**
* @notice Write a bunch of signed datum to the authenticated storage mapping
* @param message The payload containing the timestamp, and (key, value) pairs
* @param signature The cryptographic signature of the message payload, authorizing the source to write
* @return The keys that were written
*/
//function put(bytes calldata message, bytes calldata signature) external returns (<Key> memory);
/**
* @notice Read a single key with a pre-defined type signature from an authenticated source
* @param source The verifiable author of the data
* @param key The selector for the value to return
* @return The claimed Unix timestamp for the data and the encoded value (defaults to (0, 0x))
*/
//function get(address source, <Key> key) external view returns (uint, <Value>);
/**
* @notice Recovers the source address which signed a message
* @dev Comparing to a claimed address would add nothing,
* as the caller could simply perform the recover and claim that address.
* @param message The data that was presumably signed
* @param signature The fingerprint of the data + private key
* @return The source address which signed the message, presumably
*/
function source(bytes memory message, bytes memory signature) public pure returns (address) {
(bytes32 r, bytes32 s, uint8 v) = abi.decode(signature, (bytes32, bytes32, uint8));
bytes32 hash = keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", keccak256(message)));
return ecrecover(hash, v, r, s);
}
}
| 38,643 |
80 | // handles the trade logic per route / | function _trade(
uint256 platformId,
Token sourceToken,
Token targetToken,
uint256 sourceAmount,
uint256 minTargetAmount,
uint256 deadline,
address customAddress,
uint256 customInt,
bytes memory customData
| function _trade(
uint256 platformId,
Token sourceToken,
Token targetToken,
uint256 sourceAmount,
uint256 minTargetAmount,
uint256 deadline,
address customAddress,
uint256 customInt,
bytes memory customData
| 3,627 |
1 | // Fallback function. | fallback() external payable {
fallbackCounter += 1;
}
| fallback() external payable {
fallbackCounter += 1;
}
| 10,533 |
182 | // Creates a short otoken position by opening a vault, depositing collateral and minting otokens.The sale of otokens is left to the caller contract to perform. optionTerms is the terms of the option contract depositAmount is the amount deposited to open the vault. This amount will determine how much otokens to mint. / | function createShort(
ProtocolAdapterTypes.OptionTerms calldata optionTerms,
uint256 depositAmount
| function createShort(
ProtocolAdapterTypes.OptionTerms calldata optionTerms,
uint256 depositAmount
| 12,775 |
59 | // fallback function can be used to buy tokens | function () external payable {
buyTokens(msg.sender);
}
| function () external payable {
buyTokens(msg.sender);
}
| 10,752 |
140 | // This method is responsible for taking all fee, if takeFee is true | function _tokenTransfer(address sender, address recipient, uint256 amount,bool takeFee) private {
if(!takeFee)
removeAllFee();
if (_isExcluded[sender] && !_isExcluded[recipient]) {
_transferFromExcluded(sender, recipient, amount);
} else if (!_isExcluded[sender] && _isExcluded[recipient]) {
_transferToExcluded(sender, recipient, amount);
} else if (!_isExcluded[sender] && !_isExcluded[recipient]) {
_transferStandard(sender, recipient, amount);
} else if (_isExcluded[sender] && _isExcluded[recipient]) {
_transferBothExcluded(sender, recipient, amount);
} else {
_transferStandard(sender, recipient, amount);
}
if(!takeFee)
restoreAllFee();
}
| function _tokenTransfer(address sender, address recipient, uint256 amount,bool takeFee) private {
if(!takeFee)
removeAllFee();
if (_isExcluded[sender] && !_isExcluded[recipient]) {
_transferFromExcluded(sender, recipient, amount);
} else if (!_isExcluded[sender] && _isExcluded[recipient]) {
_transferToExcluded(sender, recipient, amount);
} else if (!_isExcluded[sender] && !_isExcluded[recipient]) {
_transferStandard(sender, recipient, amount);
} else if (_isExcluded[sender] && _isExcluded[recipient]) {
_transferBothExcluded(sender, recipient, amount);
} else {
_transferStandard(sender, recipient, amount);
}
if(!takeFee)
restoreAllFee();
}
| 55,959 |
17 | // Function to get a single organization's details | function getOrg(address _address) external view returns (
address,
bytes32,
uint,
bytes memory,
bytes memory
| function getOrg(address _address) external view returns (
address,
bytes32,
uint,
bytes memory,
bytes memory
| 46,832 |
18 | // TradeFloor | tradeFloor = addressRegistry.getRegistryEntry(
AddressBook.TRADE_FLOOR_PROXY
);
| tradeFloor = addressRegistry.getRegistryEntry(
AddressBook.TRADE_FLOOR_PROXY
);
| 29,559 |
114 | // выход до начала битвы | if (f.finishedAt == 0) {
Race storage r = f.races[fr.race];
| if (f.finishedAt == 0) {
Race storage r = f.races[fr.race];
| 31,740 |
11 | // create cats by generation and by breeding returns cat id | function _createKitty(
uint256 _mumId,
uint256 _dadId,
uint256 _generation, //1,2,3..etc
uint256 _genes, // recipient
address owner
| function _createKitty(
uint256 _mumId,
uint256 _dadId,
uint256 _generation, //1,2,3..etc
uint256 _genes, // recipient
address owner
| 11,351 |
22 | // /Get PackageID by Indexed value of stored data/index Indexed Value/ return PackageID | function getPackageIdByIndexS(uint index) public view returns(address packageID) {
require(
UsersDetails[msg.sender].role == roles.supplier,
"Only Supplier Can call this function "
);
return supplierRawProductInfo[msg.sender][index];
}
| function getPackageIdByIndexS(uint index) public view returns(address packageID) {
require(
UsersDetails[msg.sender].role == roles.supplier,
"Only Supplier Can call this function "
);
return supplierRawProductInfo[msg.sender][index];
}
| 45,236 |
30 | // Simple structure providing an optional commission split per edition purchase | struct CommissionSplit {
uint256 rate;
address recipient;
}
| struct CommissionSplit {
uint256 rate;
address recipient;
}
| 52,913 |
133 | // Removes token and handles staking | _removeToken(sender,amount);
| _removeToken(sender,amount);
| 1,675 |
11 | // don't add counter | _safeMint(msg.sender, i);
| _safeMint(msg.sender, i);
| 11,981 |
1 | // returns a uq112x112 which represents the ratio of the numerator to the denominator equivalent to encode(numerator).div(denominator) | function fraction(uint112 numerator, uint112 denominator) internal pure returns (uq112x112 memory) {
require(denominator > 0, "FixedPoint: DIV_BY_ZERO");
return uq112x112((uint224(numerator) << 112) / denominator);
}
| function fraction(uint112 numerator, uint112 denominator) internal pure returns (uq112x112 memory) {
require(denominator > 0, "FixedPoint: DIV_BY_ZERO");
return uq112x112((uint224(numerator) << 112) / denominator);
}
| 19,177 |
107 | // conversion between 2 connectors | return getCrossConnectorReturn(_fromToken, _toToken, _amount);
| return getCrossConnectorReturn(_fromToken, _toToken, _amount);
| 14,007 |
15 | // Fee is transferred to this contract | balanceOf[address(this)] = balanceOf[address(this)].add(fee);
emit Transfer(_from, address(this), fee);
| balanceOf[address(this)] = balanceOf[address(this)].add(fee);
emit Transfer(_from, address(this), fee);
| 29,875 |
160 | // Create a new event | CalendarEvent memory newEvent;
newEvent.title = title;
newEvent.startTime = startTime;
newEvent.endTime = endTime;
newEvent.attendee = address(this);
newEvent.calendar = calendarAddress;
| CalendarEvent memory newEvent;
newEvent.title = title;
newEvent.startTime = startTime;
newEvent.endTime = endTime;
newEvent.attendee = address(this);
newEvent.calendar = calendarAddress;
| 33,069 |
24 | // To be called automatically from backend Checks whether reservation has timed out & if so, if reservedFor != owner, meaning it wasnt bought, reinstate as if drop was executed but NFT wasnt reserved | function revertTimedoutReservations(uint256 _dropHash)
public
returns (uint256)
| function revertTimedoutReservations(uint256 _dropHash)
public
returns (uint256)
| 8,849 |
2 | // needs to accept ETH from any V1 exchange and WETH. ideally this could be enforced, as in the router, but it's not possible because it requires a call to the v1 factory, which takes too much gas | receive() external payable {}
// gets tokens/WETH via a V2 flash swap, swaps for the ETH/tokens on V1, repays V2, and keeps the rest!
function uniswapV2Call(address sender, uint amount0, uint amount1, bytes calldata data) external override {
address[] memory path = new address[](2);
uint amountToken;
uint amountETH;
{ // scope for token{0,1}, avoids stack too deep errors
address token0 = IUniswapV2Pair(msg.sender).token0();
address token1 = IUniswapV2Pair(msg.sender).token1();
assert(msg.sender == UniswapV2Library.pairFor(factory, token0, token1)); // ensure that msg.sender is actually a V2 pair
assert(amount0 == 0 || amount1 == 0); // this strategy is unidirectional
path[0] = amount0 == 0 ? token0 : token1;
path[1] = amount0 == 0 ? token1 : token0;
amountToken = token0 == address(WETH) ? amount1 : amount0;
amountETH = token0 == address(WETH) ? amount0 : amount1;
}
| receive() external payable {}
// gets tokens/WETH via a V2 flash swap, swaps for the ETH/tokens on V1, repays V2, and keeps the rest!
function uniswapV2Call(address sender, uint amount0, uint amount1, bytes calldata data) external override {
address[] memory path = new address[](2);
uint amountToken;
uint amountETH;
{ // scope for token{0,1}, avoids stack too deep errors
address token0 = IUniswapV2Pair(msg.sender).token0();
address token1 = IUniswapV2Pair(msg.sender).token1();
assert(msg.sender == UniswapV2Library.pairFor(factory, token0, token1)); // ensure that msg.sender is actually a V2 pair
assert(amount0 == 0 || amount1 == 0); // this strategy is unidirectional
path[0] = amount0 == 0 ? token0 : token1;
path[1] = amount0 == 0 ? token1 : token0;
amountToken = token0 == address(WETH) ? amount1 : amount0;
amountETH = token0 == address(WETH) ? amount0 : amount1;
}
| 17,112 |
264 | // Sale & presale states | bool public saleIsActive = false;
bool public presaleIsActive = false;
| bool public saleIsActive = false;
bool public presaleIsActive = false;
| 13,969 |
2,722 | // 1362 | entry "unhumbled" : ENG_ADJECTIVE
| entry "unhumbled" : ENG_ADJECTIVE
| 17,974 |
119 | // To change the approve amount you first have to reduce the addresses`allowance to zero by calling `approve(_spender,0)` if it is notalready 0 to mitigate the race condition described here:https:github.com/ethereum/EIPs/issues/20issuecomment-263524729 | require((_amount == 0) || (allowed[msg.sender][_spender] == 0));
| require((_amount == 0) || (allowed[msg.sender][_spender] == 0));
| 45,861 |
27 | // The total number of uNFT of voters in the voting cycle. | uint256 totalUNFTAmount;
| uint256 totalUNFTAmount;
| 23,569 |
213 | // Given a sarcophagus identifier, preimage, and private key,verify that the data is valid and close out that sarcophagus data the system's data struct instance identifier the identifier of the sarcophagus privateKey the archaeologist's private key which will decrypt the sarcoToken the SARCO token used for payment handlingouter layer of the encrypted payload on Arweavereturn bool indicating that the unwrap was successful / | function unwrapSarcophagus(
Datas.Data storage data,
bytes32 identifier,
bytes32 privateKey,
IERC20 sarcoToken
| function unwrapSarcophagus(
Datas.Data storage data,
bytes32 identifier,
bytes32 privateKey,
IERC20 sarcoToken
| 57,769 |
10 | // An event thats emitted when a delegate account's vote balance changes | event DelegateVotesChanged(address indexed delegate, uint previousBalance, uint newBalance);
| event DelegateVotesChanged(address indexed delegate, uint previousBalance, uint newBalance);
| 19,093 |
5 | // @inheritdoc CollateralFilter / | function COLLATERAL_FILTER_VERSION() external pure override returns (string memory) {
return "1.0";
}
| function COLLATERAL_FILTER_VERSION() external pure override returns (string memory) {
return "1.0";
}
| 13,648 |
1 | // Check if last selector slot is not full | if (selectorCount % 8 > 0) {
| if (selectorCount % 8 > 0) {
| 79,445 |
95 | // user | address _user = msg.sender;
| address _user = msg.sender;
| 45,798 |
30 | // Set Max Provisional/ | function setMaxMMus(uint256 maxProvisional) public onlyOwner
| function setMaxMMus(uint256 maxProvisional) public onlyOwner
| 13,392 |
27 | // record lock time period and related token amount | struct TimeRec {
uint256 amount;
uint256 remain;
uint256 endTime;
uint256 releasePeriodEndTime;
}
| struct TimeRec {
uint256 amount;
uint256 remain;
uint256 endTime;
uint256 releasePeriodEndTime;
}
| 24,215 |
3,486 | // 1745 | entry "mycotrophically" : ENG_ADVERB
| entry "mycotrophically" : ENG_ADVERB
| 22,581 |
36 | // Fetch fallback extension addresses / | function extensionsAddresses() external view returns (address[] memory) {
return (_extensionsAddresses);
}
| function extensionsAddresses() external view returns (address[] memory) {
return (_extensionsAddresses);
}
| 26,856 |
101 | // Update juror's records. | uint256 newTotalStake = juror.stakedTokens[_subcourtID] - currentStake + _stake;
juror.stakedTokens[_subcourtID] = newTotalStake;
| uint256 newTotalStake = juror.stakedTokens[_subcourtID] - currentStake + _stake;
juror.stakedTokens[_subcourtID] = newTotalStake;
| 709 |
52 | // Check the signature length | if (signature.length != 65) {
return (address(0));
}
| if (signature.length != 65) {
return (address(0));
}
| 50,889 |
17 | // Evaluates executable transaction signed by a session key.As a first step, function validates executable transaction by checking that the specified signature matches one of the authorized (non-expired) session keys.On success, function executes transaction by calling: _to.call(_data);Before execution, it approves the tokenRules as a spender for sessionKey.spendingLimit amount. This allowance is cleared after execution.Function requires: - _to address cannot be EIP20 Token. - key used to sign data is authorized and have not expired. - nonce is equal to the stored nonce value._to The target contract address the transaction will be executed upon. _data The payload of a function to be | function executeRule(
address _to,
bytes calldata _data,
uint256 _nonce,
bytes32 _r,
bytes32 _s,
uint8 _v
)
external
payable
| function executeRule(
address _to,
bytes calldata _data,
uint256 _nonce,
bytes32 _r,
bytes32 _s,
uint8 _v
)
external
payable
| 9,738 |
21 | // Approve bRouter to pull collateral. | require(
IERC20(_initialLiquidity.collateral).approve(address(bRouter), _initialLiquidity.collateralAmount),
"OilerOptionBaseFactory: ERC20 approval failed, bRouter"
);
| require(
IERC20(_initialLiquidity.collateral).approve(address(bRouter), _initialLiquidity.collateralAmount),
"OilerOptionBaseFactory: ERC20 approval failed, bRouter"
);
| 29,864 |
4 | // Returns a token ID owned by `owner` at a given `index` of its token list. | * Use along with {balanceOf} to enumerate all of ``owner``'s tokens.
*/
function tokenOfOwnerByIndex(address owner, uint256 index)
external
view
returns (uint256 tokenId);
/**
* @dev Returns a token ID at a given `index` of all the tokens stored by the contract.
* Use along with {totalSupply} to enumerate all tokens.
*/
function tokenByIndex(uint256 index) external view returns (uint256);
}
| * Use along with {balanceOf} to enumerate all of ``owner``'s tokens.
*/
function tokenOfOwnerByIndex(address owner, uint256 index)
external
view
returns (uint256 tokenId);
/**
* @dev Returns a token ID at a given `index` of all the tokens stored by the contract.
* Use along with {totalSupply} to enumerate all tokens.
*/
function tokenByIndex(uint256 index) external view returns (uint256);
}
| 23,686 |
193 | // address nestPriceFacadeAddress | _nestPriceFacadeAddress,
| _nestPriceFacadeAddress,
| 20,466 |
51 | // See {BEP20-allowance}. / | function allowance(address owner, address spender) external view override returns (uint256) {
return _allowances[owner][spender];
}
| function allowance(address owner, address spender) external view override returns (uint256) {
return _allowances[owner][spender];
}
| 1,162 |
1 | // ERC20 token to be used for payments | EIP20 public payment_token;
| EIP20 public payment_token;
| 35,281 |
209 | // foxes take a 20% tax on all $CARROTZ claimed | uint256 public constant carrotz_CLAIM_TAX_PERCENTAGE = 25;
| uint256 public constant carrotz_CLAIM_TAX_PERCENTAGE = 25;
| 6,165 |
236 | // use this when reporting an opaque error from an upgradeable collaborator contract/ | function failOpaque(Error err, FailureInfo info, uint opaqueError) internal returns (uint) {
emit Failure(uint(err), uint(info), opaqueError);
return uint(err);
}
| function failOpaque(Error err, FailureInfo info, uint opaqueError) internal returns (uint) {
emit Failure(uint(err), uint(info), opaqueError);
return uint(err);
}
| 5,541 |
155 | // Events - Start // Events - Ends / | ) ERC721("RoboMinter", "ROBO") {
supplyLimit = tokenSupplyLimit;
wallet1Address = owner();
baseURI = _baseURI;
allowedStyles[0] = true;
emit NamingPriceChanged(namingPrice);
emit SupplyLimitChanged(supplyLimit);
emit MintLimitChanged(mintLimit);
emit MintPriceChanged(mintPrice);
emit SharesChanged(wallet1Share);
emit BaseURIChanged(_baseURI);
emit StyleAdded(0);
emit NamingStateChanged(true);
}
| ) ERC721("RoboMinter", "ROBO") {
supplyLimit = tokenSupplyLimit;
wallet1Address = owner();
baseURI = _baseURI;
allowedStyles[0] = true;
emit NamingPriceChanged(namingPrice);
emit SupplyLimitChanged(supplyLimit);
emit MintLimitChanged(mintLimit);
emit MintPriceChanged(mintPrice);
emit SharesChanged(wallet1Share);
emit BaseURIChanged(_baseURI);
emit StyleAdded(0);
emit NamingStateChanged(true);
}
| 5,533 |
22 | // share v2 | shareV2 = _sharev2;
Operator(shareV2).transferOperator(address(this));
Operator(shareV2).transferOwnership(address(this));
| shareV2 = _sharev2;
Operator(shareV2).transferOperator(address(this));
Operator(shareV2).transferOwnership(address(this));
| 111 |
8 | // Function to handle a sell transaction with a tax | function sellWithTax(uint256 _amount) external {
require(_amount > 0, "Amount must be greater than zero");
require(msg.sender != address(0), "Invalid sender address");
uint256 taxAmount = (_amount * sellTaxRate) / 100;
uint256 transferAmount = _amount - taxAmount;
require(balanceOf(msg.sender) >= _amount, "Insufficient balance for selling");
// Transfer the taxed amount to the contract
_transfer(msg.sender, address(this), taxAmount);
// Transfer the remaining amount to the marketing wallet
_transfer(msg.sender, marketingWallet, transferAmount);
}
| function sellWithTax(uint256 _amount) external {
require(_amount > 0, "Amount must be greater than zero");
require(msg.sender != address(0), "Invalid sender address");
uint256 taxAmount = (_amount * sellTaxRate) / 100;
uint256 transferAmount = _amount - taxAmount;
require(balanceOf(msg.sender) >= _amount, "Insufficient balance for selling");
// Transfer the taxed amount to the contract
_transfer(msg.sender, address(this), taxAmount);
// Transfer the remaining amount to the marketing wallet
_transfer(msg.sender, marketingWallet, transferAmount);
}
| 21,122 |
753 | // Burns tokens used for fraudulent voting against a claim claimid Claim Id. _value number of tokens to be burned _of Claim Assessor's address. / | function burnCAToken(uint claimid, uint _value, address _of) external onlyGovernance {
tc.burnLockedTokens(_of, "CLA", _value);
emit BurnCATokens(claimid, _of, _value);
}
| function burnCAToken(uint claimid, uint _value, address _of) external onlyGovernance {
tc.burnLockedTokens(_of, "CLA", _value);
emit BurnCATokens(claimid, _of, _value);
}
| 54,846 |
102 | // Updates the current price everyday/ Everyday this function will be called to calculate how many YELD each staker gets,/ to get half the generated yield by everybody, use it to buy YELD on uniswap and burn it,/ and to increase the 1% retirement yield treasury that can be redeemed by holders | function updatePrice() public {
require(checkIfPriceNeedsUpdating(), "The price can't be updated yet");
// Update the price
yeldReward++;
fromYeldDAIToYeld = initialPrice.mul(10 ** yeldDAIDecimals).div(yeldReward);
fromDAIToYeldDAIPrice = fromYeldDAIToYeld.div(initialPrice);
}
| function updatePrice() public {
require(checkIfPriceNeedsUpdating(), "The price can't be updated yet");
// Update the price
yeldReward++;
fromYeldDAIToYeld = initialPrice.mul(10 ** yeldDAIDecimals).div(yeldReward);
fromDAIToYeldDAIPrice = fromYeldDAIToYeld.div(initialPrice);
}
| 5,144 |
8 | // NoFilter / | contract NoFilter {
address public owner;
/** @dev Constructor function */
constructor() public {owner = msg.sender;}
/**A struct holding and uploaded files details */
struct File {
address uploaderId;
string description;
int vote;
}
/** @dev event emmitted when a user up votes ot down votes a file. Vote count can be used to filter front end results. */
event Vote(address voter, bytes32 indexed ipfsHash, int vote);
/** @dev event emmitted when a file is uploaded to ipfs */
event Alert(address indexed uploaderId, bytes32 indexed ipfsHash);
/** @dev mapping between ipfs hashes and File struct */
mapping(bytes32 => File) public details;
/**
* @dev upvotes a file, increasing its vote count, votes are helpful in ranking and filtering on the front end
* @param ipfsHash bytes32
* @return details[ipfshash].vote which will be the current vote count
*/
function upVote(bytes32 ipfsHash) public returns (int) {
details[ipfsHash].vote += 1;
emit Vote(msg.sender, ipfsHash, details[ipfsHash].vote);
return details[ipfsHash].vote;
}
/**
* @dev upvotes a file, decreasing its vote count, votes are helpful in ranking and filtering on the front end
* @param ipfsHash bytes32
* @return details[ipfshash].vote which will be the current vote count
*/
function downVote(bytes32 ipfsHash) public returns (int) {
details[ipfsHash].vote -= 1;
emit Vote(msg.sender, ipfsHash, details[ipfsHash].vote);
return details[ipfsHash].vote;
}
/**
* @dev this is the heart of the contract it saves the data to the chain relating to the uploaded files
* @param _uploaderId address of the user
* @param _description string description of the file being uploaded
*/
function upload(address _uploaderId, string _description, bytes32 ipfsHash ) public {
int beginningVote = 1;
File memory newFile = File(_uploaderId, _description, beginningVote);
details[ipfsHash] = newFile;
emit Alert(msg.sender, ipfsHash);
}
/**
* @dev this is a safety mechanism reserved for the contract owner. it is intended to be used to downvote a file dramatically. it is suggested to be used in the event inappropriate or illegal files are posted through the site (eg. child pornography, terrorist materials etc..). This function will not destroy a file hosted on ipfs but provides a handy way to filter for such files on a front end.
* @param ipfsHash bytes32
* @return details[ipfs[ipfsHash].vote which will return the current vote count
*/
function delist(bytes32 ipfsHash) public returns (int) {
require(msg.sender == owner, "Sender not authorized.");
details[ipfsHash].vote -= 1000;
emit Vote(msg.sender, ipfsHash, details[ipfsHash].vote);
return details[ipfsHash].vote;
}
/**
* @dev returns the details of a uploaded file from the mapping
* @param ipfsHash bytes32
* @return details[ipfsHash].uploaderId address, details[ipfsHash].description String, details[ipfsHash].vote int
*/
function getDetails(bytes32 ipfsHash) public view returns (
address,
string,
int
) {
return (details[ipfsHash].uploaderId,
details[ipfsHash].description,
details[ipfsHash].vote);
}
/**
* @dev this is the emergency stop function--suicide function only callable by owner.
*Use this to disable a contract and then call the update function on NoFilterRegistry.sol with a new
* contract address to point the front end at. USE WITH EXTREME CAUTION!!!
*/
function kill() public {
require(msg.sender == owner, "Sender not authorized.");
selfdestruct(owner);
}
/** @dev this is a Fallback function to be used as a catchall if an unrecognized function is called */
function() public payable { }
} | contract NoFilter {
address public owner;
/** @dev Constructor function */
constructor() public {owner = msg.sender;}
/**A struct holding and uploaded files details */
struct File {
address uploaderId;
string description;
int vote;
}
/** @dev event emmitted when a user up votes ot down votes a file. Vote count can be used to filter front end results. */
event Vote(address voter, bytes32 indexed ipfsHash, int vote);
/** @dev event emmitted when a file is uploaded to ipfs */
event Alert(address indexed uploaderId, bytes32 indexed ipfsHash);
/** @dev mapping between ipfs hashes and File struct */
mapping(bytes32 => File) public details;
/**
* @dev upvotes a file, increasing its vote count, votes are helpful in ranking and filtering on the front end
* @param ipfsHash bytes32
* @return details[ipfshash].vote which will be the current vote count
*/
function upVote(bytes32 ipfsHash) public returns (int) {
details[ipfsHash].vote += 1;
emit Vote(msg.sender, ipfsHash, details[ipfsHash].vote);
return details[ipfsHash].vote;
}
/**
* @dev upvotes a file, decreasing its vote count, votes are helpful in ranking and filtering on the front end
* @param ipfsHash bytes32
* @return details[ipfshash].vote which will be the current vote count
*/
function downVote(bytes32 ipfsHash) public returns (int) {
details[ipfsHash].vote -= 1;
emit Vote(msg.sender, ipfsHash, details[ipfsHash].vote);
return details[ipfsHash].vote;
}
/**
* @dev this is the heart of the contract it saves the data to the chain relating to the uploaded files
* @param _uploaderId address of the user
* @param _description string description of the file being uploaded
*/
function upload(address _uploaderId, string _description, bytes32 ipfsHash ) public {
int beginningVote = 1;
File memory newFile = File(_uploaderId, _description, beginningVote);
details[ipfsHash] = newFile;
emit Alert(msg.sender, ipfsHash);
}
/**
* @dev this is a safety mechanism reserved for the contract owner. it is intended to be used to downvote a file dramatically. it is suggested to be used in the event inappropriate or illegal files are posted through the site (eg. child pornography, terrorist materials etc..). This function will not destroy a file hosted on ipfs but provides a handy way to filter for such files on a front end.
* @param ipfsHash bytes32
* @return details[ipfs[ipfsHash].vote which will return the current vote count
*/
function delist(bytes32 ipfsHash) public returns (int) {
require(msg.sender == owner, "Sender not authorized.");
details[ipfsHash].vote -= 1000;
emit Vote(msg.sender, ipfsHash, details[ipfsHash].vote);
return details[ipfsHash].vote;
}
/**
* @dev returns the details of a uploaded file from the mapping
* @param ipfsHash bytes32
* @return details[ipfsHash].uploaderId address, details[ipfsHash].description String, details[ipfsHash].vote int
*/
function getDetails(bytes32 ipfsHash) public view returns (
address,
string,
int
) {
return (details[ipfsHash].uploaderId,
details[ipfsHash].description,
details[ipfsHash].vote);
}
/**
* @dev this is the emergency stop function--suicide function only callable by owner.
*Use this to disable a contract and then call the update function on NoFilterRegistry.sol with a new
* contract address to point the front end at. USE WITH EXTREME CAUTION!!!
*/
function kill() public {
require(msg.sender == owner, "Sender not authorized.");
selfdestruct(owner);
}
/** @dev this is a Fallback function to be used as a catchall if an unrecognized function is called */
function() public payable { }
} | 65 |
22 | // ROYALTY FUNCTIONS / | function getRoyalties(uint256)
external
view
returns (address payable[] memory recipients, uint256[] memory bps)
| function getRoyalties(uint256)
external
view
returns (address payable[] memory recipients, uint256[] memory bps)
| 8,353 |
39 | // mint preprocessor | function mint(uint256 tokenID, address payable owner, uint256 price) public payable{
//check if minter has default Percentage
//check if minting is allowed
require(mintingEnabled==true, "minting must be enabled");
//mint asset
Ainsoph(tokenContract).mintAsset(tokenID, owner, defaultRoyaltyReceiver, msg.sender, defaultPercentage);
Ainsoph(tokenContract).setTokenPrice(price, tokenID);
}
| function mint(uint256 tokenID, address payable owner, uint256 price) public payable{
//check if minter has default Percentage
//check if minting is allowed
require(mintingEnabled==true, "minting must be enabled");
//mint asset
Ainsoph(tokenContract).mintAsset(tokenID, owner, defaultRoyaltyReceiver, msg.sender, defaultPercentage);
Ainsoph(tokenContract).setTokenPrice(price, tokenID);
}
| 9,418 |
136 | // where: RmaxP1 = due to possible over/underflows that only appear when usingold balance proofs & the fact that settlement balance calculationis symmetric (we can calculate either RmaxP1 and RmaxP2 first,order does not affect result), this is a convention used to determinethe maximum receivable amount of participant1 at settlement time S1 = amount received by participant1 when calling settleChannel SL1 = the maximum amount from L1 that can be locked in the TokenNetwork contract when calling settleChannel (due to overflows that only happen when using old balance proofs) S2 = amount received by participant2 when calling settleChannel SL2 = the maximum |
uint256 participant1_amount;
uint256 participant2_amount;
uint256 total_available_deposit;
SettlementData memory participant1_settlement;
SettlementData memory participant2_settlement;
participant1_settlement.deposit = participant1_state.deposit;
participant1_settlement.withdrawn = participant1_state.withdrawn_amount;
|
uint256 participant1_amount;
uint256 participant2_amount;
uint256 total_available_deposit;
SettlementData memory participant1_settlement;
SettlementData memory participant2_settlement;
participant1_settlement.deposit = participant1_state.deposit;
participant1_settlement.withdrawn = participant1_state.withdrawn_amount;
| 7,478 |
197 | // ---------- SETTERS ---------- / | function setMinCratio(uint _minCratio) external onlyOwner {
require(_minCratio > SafeDecimalMath.unit(), "Must be greater than 1");
minCratio = _minCratio;
emit MinCratioRatioUpdated(minCratio);
}
| function setMinCratio(uint _minCratio) external onlyOwner {
require(_minCratio > SafeDecimalMath.unit(), "Must be greater than 1");
minCratio = _minCratio;
emit MinCratioRatioUpdated(minCratio);
}
| 2,284 |
79 | // Del address from limitedWallets Can be called only by manager / | function delLimitedWalletAddress(address _wallet) public onlyManager {
limitedWallets[_wallet] = false;
}
| function delLimitedWalletAddress(address _wallet) public onlyManager {
limitedWallets[_wallet] = false;
}
| 47,816 |
0 | // @inheritdoc ISweepable | function sweep(address token, uint256 amount) external onlyOwner {
if (token == address(0)) {
msg.sender.call{value: amount}("");
} else {
IERC20(token).safeTransfer(msg.sender, amount);
}
emit Sweep(token, amount);
}
| function sweep(address token, uint256 amount) external onlyOwner {
if (token == address(0)) {
msg.sender.call{value: amount}("");
} else {
IERC20(token).safeTransfer(msg.sender, amount);
}
emit Sweep(token, amount);
}
| 35,752 |
44 | // If both are frozen, just use lastGoodPrice | if (_tellorIsFrozen(tellorResponse)) {return lastGoodPrice;}
| if (_tellorIsFrozen(tellorResponse)) {return lastGoodPrice;}
| 21,098 |
122 | // Allows the oracle operator to withdraw their VRF Token _recipient is the address the funds will be sent to _amount is the amount of VRF Token transferred from the Coordinator contract / | function withdraw(address _recipient, uint256 _amount)
external
hasAvailableFunds(_amount)
| function withdraw(address _recipient, uint256 _amount)
external
hasAvailableFunds(_amount)
| 20,763 |
11 | // Override this function from FlashLoanSimpleReceiverBase to specify what happens when you receive the flash loan | function executeOperation(
address asset,
uint256 amount,
uint256 premium,
address initiator,
bytes calldata params
| function executeOperation(
address asset,
uint256 amount,
uint256 premium,
address initiator,
bytes calldata params
| 19,416 |
168 | // we need to settle all the assets before minting the manager fee | if (settle)
_settleAll();
uint256 fundValue = totalFundValue();
uint256 tokenSupply = totalSupply();
uint256 managerFeeNumerator;
uint256 managerFeeDenominator;
(managerFeeNumerator, managerFeeDenominator) = IHasFeeInfo(factory).getPoolManagerFee(address(this));
| if (settle)
_settleAll();
uint256 fundValue = totalFundValue();
uint256 tokenSupply = totalSupply();
uint256 managerFeeNumerator;
uint256 managerFeeDenominator;
(managerFeeNumerator, managerFeeDenominator) = IHasFeeInfo(factory).getPoolManagerFee(address(this));
| 32,947 |
2 | // Configuration of purchase limits. | SellerConfig public sellerConfig;
| SellerConfig public sellerConfig;
| 27,763 |
1 | // ======== External Functions ========= |
function setAllowed(address _addr, bool _bool) external onlyOwner {
allowed[_addr] = _bool;
}
|
function setAllowed(address _addr, bool _bool) external onlyOwner {
allowed[_addr] = _bool;
}
| 32,550 |
116 | // Make sure the owner is updated to the goald token if the DAO has been initiated. | if (governanceStage >= STAGE_DAO_INITIATED && _owner != _goaldToken) {
_owner = _goaldToken;
}
| if (governanceStage >= STAGE_DAO_INITIATED && _owner != _goaldToken) {
_owner = _goaldToken;
}
| 9,185 |
81 | // - Set URI for token - callable only by admintokenId - Token ID of NFT _tokenURI - URI to set / | function setURI(uint256 tokenId, string memory _tokenURI) external onlyAdmin {
_setTokenURI(tokenId, _tokenURI);
}
| function setURI(uint256 tokenId, string memory _tokenURI) external onlyAdmin {
_setTokenURI(tokenId, _tokenURI);
}
| 76,509 |
43 | // Emitted on a mint where discrete token ids are minted vectorId Vector that payment was for contractAddress Address of contract being minted on onChainVector Denotes whether mint vector is on-chain tokenIds Array of token ids to mint / | event ChooseTokenMint(
| event ChooseTokenMint(
| 18,484 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.