contract_name stringlengths 1 61 | file_path stringlengths 5 50.4k | contract_address stringlengths 42 42 | language stringclasses 1
value | class_name stringlengths 1 61 | class_code stringlengths 4 330k | class_documentation stringlengths 0 29.1k | class_documentation_type stringclasses 6
values | func_name stringlengths 0 62 | func_code stringlengths 1 303k | func_documentation stringlengths 2 14.9k | func_documentation_type stringclasses 4
values | compiler_version stringlengths 15 42 | license_type stringclasses 14
values | swarm_source stringlengths 0 71 | meta dict | __index_level_0__ int64 0 60.4k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
SimplePriceOracle | SimplePriceOracle.sol | 0x624128c9f71dc9ca6876f2f75d6e8f64899209d7 | Solidity | BToken | contract BToken is BTokenInterface, Exponential, TokenErrorReporter {
/**
* @notice Initialize the money market
* @param bController_ The address of the BController
* @param interestRateModel_ The address of the interest rate model
* @param initialExchangeRateMantissa_ The initial exchange rate... | /**
* @title Bird's BToken Contract
* @notice Abstract base for BTokens
*/ | NatSpecMultiLine | repayBorrowInternal | function repayBorrowInternal(uint repayAmount) internal nonReentrant returns (uint, uint) {
uint error = accrueInterest();
if (error != uint(Error.NO_ERROR)) {
// accrueInterest emits logs on errors, but we still want to log the fact that an attempted borrow failed
return (fail(Error(error), Fai... | /**
* @notice Sender repays their own borrow
* @param repayAmount The amount to repay
* @return (uint, uint) An error code (0=success, otherwise a failure, see ErrorReporter.sol), and the actual repayment amount.
*/ | NatSpecMultiLine | v0.5.16+commit.9c3226ce | {
"func_code_index": [
35154,
35722
]
} | 6,400 | ||
SimplePriceOracle | SimplePriceOracle.sol | 0x624128c9f71dc9ca6876f2f75d6e8f64899209d7 | Solidity | BToken | contract BToken is BTokenInterface, Exponential, TokenErrorReporter {
/**
* @notice Initialize the money market
* @param bController_ The address of the BController
* @param interestRateModel_ The address of the interest rate model
* @param initialExchangeRateMantissa_ The initial exchange rate... | /**
* @title Bird's BToken Contract
* @notice Abstract base for BTokens
*/ | NatSpecMultiLine | repayBorrowBehalfInternal | function repayBorrowBehalfInternal(address borrower, uint repayAmount) internal nonReentrant returns (uint, uint) {
uint error = accrueInterest();
if (error != uint(Error.NO_ERROR)) {
// accrueInterest emits logs on errors, but we still want to log the fact that an attempted borrow failed
return... | /**
* @notice Sender repays a borrow belonging to borrower
* @param borrower the account with the debt being payed off
* @param repayAmount The amount to repay
* @return (uint, uint) An error code (0=success, otherwise a failure, see ErrorReporter.sol), and the actual repayment amount.
*/ | NatSpecMultiLine | v0.5.16+commit.9c3226ce | {
"func_code_index": [
36043,
36633
]
} | 6,401 | ||
SimplePriceOracle | SimplePriceOracle.sol | 0x624128c9f71dc9ca6876f2f75d6e8f64899209d7 | Solidity | BToken | contract BToken is BTokenInterface, Exponential, TokenErrorReporter {
/**
* @notice Initialize the money market
* @param bController_ The address of the BController
* @param interestRateModel_ The address of the interest rate model
* @param initialExchangeRateMantissa_ The initial exchange rate... | /**
* @title Bird's BToken Contract
* @notice Abstract base for BTokens
*/ | NatSpecMultiLine | repayBorrowFresh | function repayBorrowFresh(address payer, address borrower, uint repayAmount) internal returns (uint, uint) {
/* Fail if repayBorrow not allowed */
uint allowed = bController.repayBorrowAllowed(address(this), payer, borrower, repayAmount);
if (allowed != 0) {
return (failOpaque(Error.BCONTROLLER_REJE... | /**
* @notice Borrows are repaid by another user (possibly the borrower).
* @param payer the account paying off the borrow
* @param borrower the account with the debt being payed off
* @param repayAmount the amount of undelrying tokens being returned
* @return (uint, uint) An error code (0=success, otherwise a fai... | NatSpecMultiLine | v0.5.16+commit.9c3226ce | {
"func_code_index": [
37314,
40671
]
} | 6,402 | ||
SimplePriceOracle | SimplePriceOracle.sol | 0x624128c9f71dc9ca6876f2f75d6e8f64899209d7 | Solidity | BToken | contract BToken is BTokenInterface, Exponential, TokenErrorReporter {
/**
* @notice Initialize the money market
* @param bController_ The address of the BController
* @param interestRateModel_ The address of the interest rate model
* @param initialExchangeRateMantissa_ The initial exchange rate... | /**
* @title Bird's BToken Contract
* @notice Abstract base for BTokens
*/ | NatSpecMultiLine | liquidateBorrowInternal | function liquidateBorrowInternal(address borrower, uint repayAmount, BTokenInterface bTokenCollateral) internal nonReentrant returns (uint, uint) {
uint error = accrueInterest();
if (error != uint(Error.NO_ERROR)) {
// accrueInterest emits logs on errors, but we still want to log the fact that an attemp... | /**
* @notice The sender liquidates the borrowers collateral.
* The collateral seized is transferred to the liquidator.
* @param borrower The borrower of this bToken to be liquidated
* @param bTokenCollateral The market in which to seize collateral from the borrower
* @param repayAmount The amount of the underlyi... | NatSpecMultiLine | v0.5.16+commit.9c3226ce | {
"func_code_index": [
41184,
42167
]
} | 6,403 | ||
SimplePriceOracle | SimplePriceOracle.sol | 0x624128c9f71dc9ca6876f2f75d6e8f64899209d7 | Solidity | BToken | contract BToken is BTokenInterface, Exponential, TokenErrorReporter {
/**
* @notice Initialize the money market
* @param bController_ The address of the BController
* @param interestRateModel_ The address of the interest rate model
* @param initialExchangeRateMantissa_ The initial exchange rate... | /**
* @title Bird's BToken Contract
* @notice Abstract base for BTokens
*/ | NatSpecMultiLine | liquidateBorrowFresh | function liquidateBorrowFresh(address liquidator, address borrower, uint repayAmount, BTokenInterface bTokenCollateral) internal returns (uint, uint) {
/* Fail if liquidate not allowed */
uint allowed = bController.liquidateBorrowAllowed(address(this), address(bTokenCollateral), liquidator, borrower, repayAmoun... | /**
* @notice The liquidator liquidates the borrowers collateral.
* The collateral seized is transferred to the liquidator.
* @param borrower The borrower of this bToken to be liquidated
* @param liquidator The address repaying the borrow and seizing collateral
* @param bTokenCollateral The market in which to sei... | NatSpecMultiLine | v0.5.16+commit.9c3226ce | {
"func_code_index": [
42764,
46292
]
} | 6,404 | ||
SimplePriceOracle | SimplePriceOracle.sol | 0x624128c9f71dc9ca6876f2f75d6e8f64899209d7 | Solidity | BToken | contract BToken is BTokenInterface, Exponential, TokenErrorReporter {
/**
* @notice Initialize the money market
* @param bController_ The address of the BController
* @param interestRateModel_ The address of the interest rate model
* @param initialExchangeRateMantissa_ The initial exchange rate... | /**
* @title Bird's BToken Contract
* @notice Abstract base for BTokens
*/ | NatSpecMultiLine | seize | function seize(address liquidator, address borrower, uint seizeTokens) external nonReentrant returns (uint) {
return seizeInternal(msg.sender, liquidator, borrower, seizeTokens);
}
| /**
* @notice Transfers collateral tokens (this market) to the liquidator.
* @dev Will fail unless called by another bToken during the process of liquidation.
* Its absolutely critical to use msg.sender as the borrowed bToken and not a parameter.
* @param liquidator The account receiving seized collateral
* @para... | NatSpecMultiLine | v0.5.16+commit.9c3226ce | {
"func_code_index": [
46838,
47034
]
} | 6,405 | ||
SimplePriceOracle | SimplePriceOracle.sol | 0x624128c9f71dc9ca6876f2f75d6e8f64899209d7 | Solidity | BToken | contract BToken is BTokenInterface, Exponential, TokenErrorReporter {
/**
* @notice Initialize the money market
* @param bController_ The address of the BController
* @param interestRateModel_ The address of the interest rate model
* @param initialExchangeRateMantissa_ The initial exchange rate... | /**
* @title Bird's BToken Contract
* @notice Abstract base for BTokens
*/ | NatSpecMultiLine | seizeInternal | function seizeInternal(address seizerToken, address liquidator, address borrower, uint seizeTokens) internal returns (uint) {
/* Fail if seize not allowed */
uint allowed = bController.seizeAllowed(address(this), seizerToken, liquidator, borrower, seizeTokens);
if (allowed != 0) {
return failOpaque(... | /**
* @notice Transfers collateral tokens (this market) to the liquidator.
* @dev Called only during an in-kind liquidation, or by liquidateBorrow during the liquidation of another BToken.
* Its absolutely critical to use msg.sender as the seizer bToken and not a parameter.
* @param seizerToken The contract seizin... | NatSpecMultiLine | v0.5.16+commit.9c3226ce | {
"func_code_index": [
47693,
49790
]
} | 6,406 | ||
SimplePriceOracle | SimplePriceOracle.sol | 0x624128c9f71dc9ca6876f2f75d6e8f64899209d7 | Solidity | BToken | contract BToken is BTokenInterface, Exponential, TokenErrorReporter {
/**
* @notice Initialize the money market
* @param bController_ The address of the BController
* @param interestRateModel_ The address of the interest rate model
* @param initialExchangeRateMantissa_ The initial exchange rate... | /**
* @title Bird's BToken Contract
* @notice Abstract base for BTokens
*/ | NatSpecMultiLine | _setPendingAdmin | function _setPendingAdmin(address payable newPendingAdmin) external returns (uint) {
// Check caller = admin
if (msg.sender != admin) {
return fail(Error.UNAUTHORIZED, FailureInfo.SET_PENDING_ADMIN_OWNER_CHECK);
}
// Save current value, if any, for inclusion in log
address oldPendingAdmin =... | /**
* @notice Begins transfer of admin rights. The newPendingAdmin must call `_acceptAdmin` to finalize the transfer.
* @dev Admin function to begin change of admin. The newPendingAdmin must call `_acceptAdmin` to finalize the transfer.
* @param newPendingAdmin New pending admin.
* @return uint 0=success, otherwise... | NatSpecMultiLine | v0.5.16+commit.9c3226ce | {
"func_code_index": [
50224,
50859
]
} | 6,407 | ||
SimplePriceOracle | SimplePriceOracle.sol | 0x624128c9f71dc9ca6876f2f75d6e8f64899209d7 | Solidity | BToken | contract BToken is BTokenInterface, Exponential, TokenErrorReporter {
/**
* @notice Initialize the money market
* @param bController_ The address of the BController
* @param interestRateModel_ The address of the interest rate model
* @param initialExchangeRateMantissa_ The initial exchange rate... | /**
* @title Bird's BToken Contract
* @notice Abstract base for BTokens
*/ | NatSpecMultiLine | _acceptAdmin | function _acceptAdmin() external returns (uint) {
// Check caller is pendingAdmin and pendingAdmin ≠ address(0)
if (msg.sender != pendingAdmin || msg.sender == address(0)) {
return fail(Error.UNAUTHORIZED, FailureInfo.ACCEPT_ADMIN_PENDING_ADMIN_CHECK);
}
// Save current values for inclusion in ... | /**
* @notice Accepts transfer of admin rights. msg.sender must be pendingAdmin
* @dev Admin function for pending admin to accept role and update admin
* @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)
*/ | NatSpecMultiLine | v0.5.16+commit.9c3226ce | {
"func_code_index": [
51126,
51850
]
} | 6,408 | ||
SimplePriceOracle | SimplePriceOracle.sol | 0x624128c9f71dc9ca6876f2f75d6e8f64899209d7 | Solidity | BToken | contract BToken is BTokenInterface, Exponential, TokenErrorReporter {
/**
* @notice Initialize the money market
* @param bController_ The address of the BController
* @param interestRateModel_ The address of the interest rate model
* @param initialExchangeRateMantissa_ The initial exchange rate... | /**
* @title Bird's BToken Contract
* @notice Abstract base for BTokens
*/ | NatSpecMultiLine | _setBController | function _setBController(BControllerInterface newBController) public returns (uint) {
// Check caller is admin
if (msg.sender != admin) {
return fail(Error.UNAUTHORIZED, FailureInfo.SET_BCONTROLLER_OWNER_CHECK);
}
BControllerInterface oldBController = bController;
// Ensure invoke bControll... | /**
* @notice Sets a new bController for the market
* @dev Admin function to set a new bController
* @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)
*/ | NatSpecMultiLine | v0.5.16+commit.9c3226ce | {
"func_code_index": [
52064,
52786
]
} | 6,409 | ||
SimplePriceOracle | SimplePriceOracle.sol | 0x624128c9f71dc9ca6876f2f75d6e8f64899209d7 | Solidity | BToken | contract BToken is BTokenInterface, Exponential, TokenErrorReporter {
/**
* @notice Initialize the money market
* @param bController_ The address of the BController
* @param interestRateModel_ The address of the interest rate model
* @param initialExchangeRateMantissa_ The initial exchange rate... | /**
* @title Bird's BToken Contract
* @notice Abstract base for BTokens
*/ | NatSpecMultiLine | _setReserveFactor | function _setReserveFactor(uint newReserveFactorMantissa) external nonReentrant returns (uint) {
uint error = accrueInterest();
if (error != uint(Error.NO_ERROR)) {
// accrueInterest emits logs on errors, but on top of that we want to log the fact that an attempted reserve factor change failed.
... | /**
* @notice accrues interest and sets a new reserve factor for the protocol using _setReserveFactorFresh
* @dev Admin function to accrue interest and set a new reserve factor
* @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)
*/ | NatSpecMultiLine | v0.5.16+commit.9c3226ce | {
"func_code_index": [
53078,
53681
]
} | 6,410 | ||
SimplePriceOracle | SimplePriceOracle.sol | 0x624128c9f71dc9ca6876f2f75d6e8f64899209d7 | Solidity | BToken | contract BToken is BTokenInterface, Exponential, TokenErrorReporter {
/**
* @notice Initialize the money market
* @param bController_ The address of the BController
* @param interestRateModel_ The address of the interest rate model
* @param initialExchangeRateMantissa_ The initial exchange rate... | /**
* @title Bird's BToken Contract
* @notice Abstract base for BTokens
*/ | NatSpecMultiLine | _setReserveFactorFresh | function _setReserveFactorFresh(uint newReserveFactorMantissa) internal returns (uint) {
// Check caller is admin
if (msg.sender != admin) {
return fail(Error.UNAUTHORIZED, FailureInfo.SET_RESERVE_FACTOR_ADMIN_CHECK);
}
// Verify market's block number equals current block number
if (accrual... | /**
* @notice Sets a new reserve factor for the protocol (*requires fresh interest accrual)
* @dev Admin function to set a new reserve factor
* @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)
*/ | NatSpecMultiLine | v0.5.16+commit.9c3226ce | {
"func_code_index": [
53938,
54896
]
} | 6,411 | ||
SimplePriceOracle | SimplePriceOracle.sol | 0x624128c9f71dc9ca6876f2f75d6e8f64899209d7 | Solidity | BToken | contract BToken is BTokenInterface, Exponential, TokenErrorReporter {
/**
* @notice Initialize the money market
* @param bController_ The address of the BController
* @param interestRateModel_ The address of the interest rate model
* @param initialExchangeRateMantissa_ The initial exchange rate... | /**
* @title Bird's BToken Contract
* @notice Abstract base for BTokens
*/ | NatSpecMultiLine | _addReservesInternal | function _addReservesInternal(uint addAmount) internal nonReentrant returns (uint) {
uint error = accrueInterest();
if (error != uint(Error.NO_ERROR)) {
// accrueInterest emits logs on errors, but on top of that we want to log the fact that an attempted reduce reserves failed.
return fail(Error(... | /**
* @notice Accrues interest and reduces reserves by transferring from msg.sender
* @param addAmount Amount of addition to reserves
* @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)
*/ | NatSpecMultiLine | v0.5.16+commit.9c3226ce | {
"func_code_index": [
55141,
55725
]
} | 6,412 | ||
SimplePriceOracle | SimplePriceOracle.sol | 0x624128c9f71dc9ca6876f2f75d6e8f64899209d7 | Solidity | BToken | contract BToken is BTokenInterface, Exponential, TokenErrorReporter {
/**
* @notice Initialize the money market
* @param bController_ The address of the BController
* @param interestRateModel_ The address of the interest rate model
* @param initialExchangeRateMantissa_ The initial exchange rate... | /**
* @title Bird's BToken Contract
* @notice Abstract base for BTokens
*/ | NatSpecMultiLine | _addReservesFresh | function _addReservesFresh(uint addAmount) internal returns (uint, uint) {
// totalReserves + actualAddAmount
uint totalReservesNew;
uint actualAddAmount;
// We fail gracefully unless market's block number equals current block number
if (accrualBlockNumber != getBlockNumber()) {
return (fai... | /**
* @notice Add reserves by transferring from caller
* @dev Requires fresh interest accrual
* @param addAmount Amount of addition to reserves
* @return (uint, uint) An error code (0=success, otherwise a failure (see ErrorReporter.sol for details)) and the actual amount added, net token fees
*/ | NatSpecMultiLine | v0.5.16+commit.9c3226ce | {
"func_code_index": [
56053,
57651
]
} | 6,413 | ||
SimplePriceOracle | SimplePriceOracle.sol | 0x624128c9f71dc9ca6876f2f75d6e8f64899209d7 | Solidity | BToken | contract BToken is BTokenInterface, Exponential, TokenErrorReporter {
/**
* @notice Initialize the money market
* @param bController_ The address of the BController
* @param interestRateModel_ The address of the interest rate model
* @param initialExchangeRateMantissa_ The initial exchange rate... | /**
* @title Bird's BToken Contract
* @notice Abstract base for BTokens
*/ | NatSpecMultiLine | _reduceReserves | function _reduceReserves(uint reduceAmount) external nonReentrant returns (uint) {
uint error = accrueInterest();
if (error != uint(Error.NO_ERROR)) {
// accrueInterest emits logs on errors, but on top of that we want to log the fact that an attempted reduce reserves failed.
return fail(Error(er... | /**
* @notice Accrues interest and reduces reserves by transferring to admin
* @param reduceAmount Amount of reduction to reserves
* @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)
*/ | NatSpecMultiLine | v0.5.16+commit.9c3226ce | {
"func_code_index": [
57894,
58461
]
} | 6,414 | ||
SimplePriceOracle | SimplePriceOracle.sol | 0x624128c9f71dc9ca6876f2f75d6e8f64899209d7 | Solidity | BToken | contract BToken is BTokenInterface, Exponential, TokenErrorReporter {
/**
* @notice Initialize the money market
* @param bController_ The address of the BController
* @param interestRateModel_ The address of the interest rate model
* @param initialExchangeRateMantissa_ The initial exchange rate... | /**
* @title Bird's BToken Contract
* @notice Abstract base for BTokens
*/ | NatSpecMultiLine | _reduceReservesFresh | function _reduceReservesFresh(uint reduceAmount) internal returns (uint) {
// totalReserves - reduceAmount
uint totalReservesNew;
// Check caller is admin
if (msg.sender != admin) {
return fail(Error.UNAUTHORIZED, FailureInfo.REDUCE_RESERVES_ADMIN_CHECK);
}
// We fail gracefully unless... | /**
* @notice Reduces reserves by transferring to admin
* @dev Requires fresh interest accrual
* @param reduceAmount Amount of reduction to reserves
* @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)
*/ | NatSpecMultiLine | v0.5.16+commit.9c3226ce | {
"func_code_index": [
58726,
60434
]
} | 6,415 | ||
SimplePriceOracle | SimplePriceOracle.sol | 0x624128c9f71dc9ca6876f2f75d6e8f64899209d7 | Solidity | BToken | contract BToken is BTokenInterface, Exponential, TokenErrorReporter {
/**
* @notice Initialize the money market
* @param bController_ The address of the BController
* @param interestRateModel_ The address of the interest rate model
* @param initialExchangeRateMantissa_ The initial exchange rate... | /**
* @title Bird's BToken Contract
* @notice Abstract base for BTokens
*/ | NatSpecMultiLine | _setInterestRateModel | function _setInterestRateModel(InterestRateModel newInterestRateModel) public returns (uint) {
uint error = accrueInterest();
if (error != uint(Error.NO_ERROR)) {
// accrueInterest emits logs on errors, but on top of that we want to log the fact that an attempted change of interest rate model failed
... | /**
* @notice accrues interest and updates the interest rate model using _setInterestRateModelFresh
* @dev Admin function to accrue interest and update the interest rate model
* @param newInterestRateModel the new interest rate model to use
* @return uint 0=success, otherwise a failure (see ErrorReporter.sol for de... | NatSpecMultiLine | v0.5.16+commit.9c3226ce | {
"func_code_index": [
60791,
61420
]
} | 6,416 | ||
SimplePriceOracle | SimplePriceOracle.sol | 0x624128c9f71dc9ca6876f2f75d6e8f64899209d7 | Solidity | BToken | contract BToken is BTokenInterface, Exponential, TokenErrorReporter {
/**
* @notice Initialize the money market
* @param bController_ The address of the BController
* @param interestRateModel_ The address of the interest rate model
* @param initialExchangeRateMantissa_ The initial exchange rate... | /**
* @title Bird's BToken Contract
* @notice Abstract base for BTokens
*/ | NatSpecMultiLine | _setInterestRateModelFresh | function _setInterestRateModelFresh(InterestRateModel newInterestRateModel) internal returns (uint) {
// Used to store old model for use in the event that is emitted on success
InterestRateModel oldInterestRateModel;
// Check caller is admin
if (msg.sender != admin) {
return fail(Error.UNAUTHO... | /**
* @notice updates the interest rate model (*requires fresh interest accrual)
* @dev Admin function to update the interest rate model
* @param newInterestRateModel the new interest rate model to use
* @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)
*/ | NatSpecMultiLine | v0.5.16+commit.9c3226ce | {
"func_code_index": [
61738,
63023
]
} | 6,417 | ||
SimplePriceOracle | SimplePriceOracle.sol | 0x624128c9f71dc9ca6876f2f75d6e8f64899209d7 | Solidity | BToken | contract BToken is BTokenInterface, Exponential, TokenErrorReporter {
/**
* @notice Initialize the money market
* @param bController_ The address of the BController
* @param interestRateModel_ The address of the interest rate model
* @param initialExchangeRateMantissa_ The initial exchange rate... | /**
* @title Bird's BToken Contract
* @notice Abstract base for BTokens
*/ | NatSpecMultiLine | getCashPrior | function getCashPrior() internal view returns (uint);
| /**
* @notice Gets balance of this contract in terms of the underlying
* @dev This excludes the value of the current message, if any
* @return The quantity of underlying owned by this contract
*/ | NatSpecMultiLine | v0.5.16+commit.9c3226ce | {
"func_code_index": [
63271,
63328
]
} | 6,418 | ||
SimplePriceOracle | SimplePriceOracle.sol | 0x624128c9f71dc9ca6876f2f75d6e8f64899209d7 | Solidity | BToken | contract BToken is BTokenInterface, Exponential, TokenErrorReporter {
/**
* @notice Initialize the money market
* @param bController_ The address of the BController
* @param interestRateModel_ The address of the interest rate model
* @param initialExchangeRateMantissa_ The initial exchange rate... | /**
* @title Bird's BToken Contract
* @notice Abstract base for BTokens
*/ | NatSpecMultiLine | doTransferIn | function doTransferIn(address from, uint amount) internal returns (uint);
| /**
* @dev Performs a transfer in, reverting upon failure. Returns the amount actually transferred to the protocol, in case of a fee.
* This may revert due to insufficient balance or insufficient allowance.
*/ | NatSpecMultiLine | v0.5.16+commit.9c3226ce | {
"func_code_index": [
63560,
63637
]
} | 6,419 | ||
SimplePriceOracle | SimplePriceOracle.sol | 0x624128c9f71dc9ca6876f2f75d6e8f64899209d7 | Solidity | BToken | contract BToken is BTokenInterface, Exponential, TokenErrorReporter {
/**
* @notice Initialize the money market
* @param bController_ The address of the BController
* @param interestRateModel_ The address of the interest rate model
* @param initialExchangeRateMantissa_ The initial exchange rate... | /**
* @title Bird's BToken Contract
* @notice Abstract base for BTokens
*/ | NatSpecMultiLine | doTransferOut | function doTransferOut(address payable to, uint amount) internal;
| /**
* @dev Performs a transfer out, ideally returning an explanatory error code upon failure tather than reverting.
* If caller has not called checked protocol's balance, may revert due to insufficient cash held in the contract.
* If caller has checked protocol's balance, and verified it is >= amount, this should ... | NatSpecMultiLine | v0.5.16+commit.9c3226ce | {
"func_code_index": [
64016,
64085
]
} | 6,420 | ||
SimplePriceOracle | SimplePriceOracle.sol | 0x624128c9f71dc9ca6876f2f75d6e8f64899209d7 | Solidity | PriceOracle | contract PriceOracle {
/// @notice Indicator that this is a PriceOracle contract (for inspection)
bool public constant isPriceOracle = true;
/**
* @notice Get the underlying price of a bToken asset
* @param bToken The bToken to get the underlying price of
* @return The underlying asset pr... | getUnderlyingPrice | function getUnderlyingPrice(BToken bToken) external view returns (uint);
| /**
* @notice Get the underlying price of a bToken asset
* @param bToken The bToken to get the underlying price of
* @return The underlying asset price mantissa (scaled by 1e18).
* Zero means the price is unavailable.
*/ | NatSpecMultiLine | v0.5.16+commit.9c3226ce | {
"func_code_index": [
406,
482
]
} | 6,421 | ||||
SimplePriceOracle | SimplePriceOracle.sol | 0x624128c9f71dc9ca6876f2f75d6e8f64899209d7 | Solidity | BErc20 | contract BErc20 is BToken, BErc20Interface {
/**
* @notice Initialize the new money market
* @param underlying_ The address of the underlying asset
* @param bController_ The address of the BController
* @param interestRateModel_ The address of the interest rate model
* @param initialExchang... | /**
* @title Bird's BErc20 Contract
* @notice BTokens which wrap an EIP-20 underlying
*/ | NatSpecMultiLine | initialize | function initialize(address underlying_,
BControllerInterface bController_,
InterestRateModel interestRateModel_,
uint initialExchangeRateMantissa_,
string memory name_,
string memory symbol_,
uint8 d... | /**
* @notice Initialize the new money market
* @param underlying_ The address of the underlying asset
* @param bController_ The address of the BController
* @param interestRateModel_ The address of the interest rate model
* @param initialExchangeRateMantissa_ The initial exchange rate, scaled by 1e18
* @param na... | NatSpecMultiLine | v0.5.16+commit.9c3226ce | {
"func_code_index": [
544,
1219
]
} | 6,422 | ||
SimplePriceOracle | SimplePriceOracle.sol | 0x624128c9f71dc9ca6876f2f75d6e8f64899209d7 | Solidity | BErc20 | contract BErc20 is BToken, BErc20Interface {
/**
* @notice Initialize the new money market
* @param underlying_ The address of the underlying asset
* @param bController_ The address of the BController
* @param interestRateModel_ The address of the interest rate model
* @param initialExchang... | /**
* @title Bird's BErc20 Contract
* @notice BTokens which wrap an EIP-20 underlying
*/ | NatSpecMultiLine | mint | function mint(uint mintAmount) external returns (uint) {
(uint err,) = mintInternal(mintAmount);
return err;
}
| /**
* @notice Sender supplies assets into the market and receives bTokens in exchange
* @dev Accrues interest whether or not the operation succeeds, unless reverted
* @param mintAmount The amount of the underlying asset to supply
* @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)
*/ | NatSpecMultiLine | v0.5.16+commit.9c3226ce | {
"func_code_index": [
1595,
1729
]
} | 6,423 | ||
SimplePriceOracle | SimplePriceOracle.sol | 0x624128c9f71dc9ca6876f2f75d6e8f64899209d7 | Solidity | BErc20 | contract BErc20 is BToken, BErc20Interface {
/**
* @notice Initialize the new money market
* @param underlying_ The address of the underlying asset
* @param bController_ The address of the BController
* @param interestRateModel_ The address of the interest rate model
* @param initialExchang... | /**
* @title Bird's BErc20 Contract
* @notice BTokens which wrap an EIP-20 underlying
*/ | NatSpecMultiLine | redeem | function redeem(uint redeemTokens) external returns (uint) {
return redeemInternal(redeemTokens);
}
| /**
* @notice Sender redeems bTokens in exchange for the underlying asset
* @dev Accrues interest whether or not the operation succeeds, unless reverted
* @param redeemTokens The number of bTokens to redeem into underlying
* @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)
*/ | NatSpecMultiLine | v0.5.16+commit.9c3226ce | {
"func_code_index": [
2068,
2183
]
} | 6,424 | ||
SimplePriceOracle | SimplePriceOracle.sol | 0x624128c9f71dc9ca6876f2f75d6e8f64899209d7 | Solidity | BErc20 | contract BErc20 is BToken, BErc20Interface {
/**
* @notice Initialize the new money market
* @param underlying_ The address of the underlying asset
* @param bController_ The address of the BController
* @param interestRateModel_ The address of the interest rate model
* @param initialExchang... | /**
* @title Bird's BErc20 Contract
* @notice BTokens which wrap an EIP-20 underlying
*/ | NatSpecMultiLine | redeemUnderlying | function redeemUnderlying(uint redeemAmount) external returns (uint) {
return redeemUnderlyingInternal(redeemAmount);
}
| /**
* @notice Sender redeems bTokens in exchange for a specified amount of underlying asset
* @dev Accrues interest whether or not the operation succeeds, unless reverted
* @param redeemAmount The amount of underlying to redeem
* @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)
*/ | NatSpecMultiLine | v0.5.16+commit.9c3226ce | {
"func_code_index": [
2527,
2662
]
} | 6,425 | ||
SimplePriceOracle | SimplePriceOracle.sol | 0x624128c9f71dc9ca6876f2f75d6e8f64899209d7 | Solidity | BErc20 | contract BErc20 is BToken, BErc20Interface {
/**
* @notice Initialize the new money market
* @param underlying_ The address of the underlying asset
* @param bController_ The address of the BController
* @param interestRateModel_ The address of the interest rate model
* @param initialExchang... | /**
* @title Bird's BErc20 Contract
* @notice BTokens which wrap an EIP-20 underlying
*/ | NatSpecMultiLine | borrow | function borrow(uint borrowAmount) external returns (uint) {
return borrowInternal(borrowAmount);
}
| /**
* @notice Sender borrows assets from the protocol to their own address
* @param borrowAmount The amount of the underlying asset to borrow
* @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)
*/ | NatSpecMultiLine | v0.5.16+commit.9c3226ce | {
"func_code_index": [
2919,
3034
]
} | 6,426 | ||
SimplePriceOracle | SimplePriceOracle.sol | 0x624128c9f71dc9ca6876f2f75d6e8f64899209d7 | Solidity | BErc20 | contract BErc20 is BToken, BErc20Interface {
/**
* @notice Initialize the new money market
* @param underlying_ The address of the underlying asset
* @param bController_ The address of the BController
* @param interestRateModel_ The address of the interest rate model
* @param initialExchang... | /**
* @title Bird's BErc20 Contract
* @notice BTokens which wrap an EIP-20 underlying
*/ | NatSpecMultiLine | repayBorrow | function repayBorrow(uint repayAmount) external returns (uint) {
(uint err,) = repayBorrowInternal(repayAmount);
return err;
}
| /**
* @notice Sender repays their own borrow
* @param repayAmount The amount to repay
* @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)
*/ | NatSpecMultiLine | v0.5.16+commit.9c3226ce | {
"func_code_index": [
3231,
3381
]
} | 6,427 | ||
SimplePriceOracle | SimplePriceOracle.sol | 0x624128c9f71dc9ca6876f2f75d6e8f64899209d7 | Solidity | BErc20 | contract BErc20 is BToken, BErc20Interface {
/**
* @notice Initialize the new money market
* @param underlying_ The address of the underlying asset
* @param bController_ The address of the BController
* @param interestRateModel_ The address of the interest rate model
* @param initialExchang... | /**
* @title Bird's BErc20 Contract
* @notice BTokens which wrap an EIP-20 underlying
*/ | NatSpecMultiLine | repayBorrowBehalf | function repayBorrowBehalf(address borrower, uint repayAmount) external returns (uint) {
(uint err,) = repayBorrowBehalfInternal(borrower, repayAmount);
return err;
}
| /**
* @notice Sender repays a borrow belonging to borrower
* @param borrower the account with the debt being payed off
* @param repayAmount The amount to repay
* @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)
*/ | NatSpecMultiLine | v0.5.16+commit.9c3226ce | {
"func_code_index": [
3657,
3847
]
} | 6,428 | ||
SimplePriceOracle | SimplePriceOracle.sol | 0x624128c9f71dc9ca6876f2f75d6e8f64899209d7 | Solidity | BErc20 | contract BErc20 is BToken, BErc20Interface {
/**
* @notice Initialize the new money market
* @param underlying_ The address of the underlying asset
* @param bController_ The address of the BController
* @param interestRateModel_ The address of the interest rate model
* @param initialExchang... | /**
* @title Bird's BErc20 Contract
* @notice BTokens which wrap an EIP-20 underlying
*/ | NatSpecMultiLine | liquidateBorrow | function liquidateBorrow(address borrower, uint repayAmount, BTokenInterface bTokenCollateral) external returns (uint) {
(uint err,) = liquidateBorrowInternal(borrower, repayAmount, bTokenCollateral);
return err;
}
| /**
* @notice The sender liquidates the borrowers collateral.
* The collateral seized is transferred to the liquidator.
* @param borrower The borrower of this bToken to be liquidated
* @param repayAmount The amount of the underlying borrowed asset to repay
* @param bTokenCollateral The market in which to seize co... | NatSpecMultiLine | v0.5.16+commit.9c3226ce | {
"func_code_index": [
4315,
4553
]
} | 6,429 | ||
SimplePriceOracle | SimplePriceOracle.sol | 0x624128c9f71dc9ca6876f2f75d6e8f64899209d7 | Solidity | BErc20 | contract BErc20 is BToken, BErc20Interface {
/**
* @notice Initialize the new money market
* @param underlying_ The address of the underlying asset
* @param bController_ The address of the BController
* @param interestRateModel_ The address of the interest rate model
* @param initialExchang... | /**
* @title Bird's BErc20 Contract
* @notice BTokens which wrap an EIP-20 underlying
*/ | NatSpecMultiLine | _addReserves | function _addReserves(uint addAmount) external returns (uint) {
return _addReservesInternal(addAmount);
}
| /**
* @notice The sender adds to reserves.
* @param addAmount The amount fo underlying token to add as reserves
* @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)
*/ | NatSpecMultiLine | v0.5.16+commit.9c3226ce | {
"func_code_index": [
4776,
4897
]
} | 6,430 | ||
SimplePriceOracle | SimplePriceOracle.sol | 0x624128c9f71dc9ca6876f2f75d6e8f64899209d7 | Solidity | BErc20 | contract BErc20 is BToken, BErc20Interface {
/**
* @notice Initialize the new money market
* @param underlying_ The address of the underlying asset
* @param bController_ The address of the BController
* @param interestRateModel_ The address of the interest rate model
* @param initialExchang... | /**
* @title Bird's BErc20 Contract
* @notice BTokens which wrap an EIP-20 underlying
*/ | NatSpecMultiLine | getCashPrior | function getCashPrior() internal view returns (uint) {
EIP20Interface token = EIP20Interface(underlying);
return token.balanceOf(address(this));
}
| /**
* @notice Gets balance of this contract in terms of the underlying
* @dev This excludes the value of the current message, if any
* @return The quantity of underlying tokens owned by this contract
*/ | NatSpecMultiLine | v0.5.16+commit.9c3226ce | {
"func_code_index": [
5152,
5322
]
} | 6,431 | ||
SimplePriceOracle | SimplePriceOracle.sol | 0x624128c9f71dc9ca6876f2f75d6e8f64899209d7 | Solidity | BErc20 | contract BErc20 is BToken, BErc20Interface {
/**
* @notice Initialize the new money market
* @param underlying_ The address of the underlying asset
* @param bController_ The address of the BController
* @param interestRateModel_ The address of the interest rate model
* @param initialExchang... | /**
* @title Bird's BErc20 Contract
* @notice BTokens which wrap an EIP-20 underlying
*/ | NatSpecMultiLine | doTransferIn | function doTransferIn(address from, uint amount) internal returns (uint) {
EIP20NonStandardInterface token = EIP20NonStandardInterface(underlying);
uint balanceBefore = EIP20Interface(underlying).balanceOf(address(this));
token.transferFrom(from, address(this), amount);
bool success;
assembly {
... | /**
* @dev Similar to EIP20 transfer, except it handles a False result from `transferFrom` and reverts in that case.
* This will revert due to insufficient balance or insufficient allowance.
* This function returns the actual amount received,
* which may be less than `amount` if there is a fee attach... | NatSpecMultiLine | v0.5.16+commit.9c3226ce | {
"func_code_index": [
5924,
7247
]
} | 6,432 | ||
SimplePriceOracle | SimplePriceOracle.sol | 0x624128c9f71dc9ca6876f2f75d6e8f64899209d7 | Solidity | BErc20 | contract BErc20 is BToken, BErc20Interface {
/**
* @notice Initialize the new money market
* @param underlying_ The address of the underlying asset
* @param bController_ The address of the BController
* @param interestRateModel_ The address of the interest rate model
* @param initialExchang... | /**
* @title Bird's BErc20 Contract
* @notice BTokens which wrap an EIP-20 underlying
*/ | NatSpecMultiLine | doTransferOut | function doTransferOut(address payable to, uint amount) internal {
EIP20NonStandardInterface token = EIP20NonStandardInterface(underlying);
token.transfer(to, amount);
bool success;
assembly {
switch returndatasize()
case 0 { // This is a non-standard ERC-20
... | /**
* @dev Similar to EIP20 transfer, except it handles a False success from `transfer` and returns an explanatory
* error code rather than reverting. If caller has not called checked protocol's balance, this may revert due to
* insufficient cash held in this contract. If caller has checked protocol's bala... | NatSpecMultiLine | v0.5.16+commit.9c3226ce | {
"func_code_index": [
7936,
8825
]
} | 6,433 | ||
SimplePriceOracle | SimplePriceOracle.sol | 0x624128c9f71dc9ca6876f2f75d6e8f64899209d7 | Solidity | SimplePriceOracle | contract SimplePriceOracle is PriceOracle {
address public admin;
address public pendingAdmin;
mapping(string => address) birdTokens;
mapping(address => uint256) prices;
event PricePosted(
string symbol,
address asset,
uint256 previousPriceMantissa,
uint256 requestedP... | assetPrices | function assetPrices(address asset) external view returns (uint256) {
return prices[asset];
}
| // v1 price oracle interface for use as backing of proxy | LineComment | v0.5.16+commit.9c3226ce | {
"func_code_index": [
2609,
2718
]
} | 6,434 | ||||
ExoplanetToken | ExoplanetToken.sol | 0xb12e260275bcd28e6f8820666ba02c67c9600843 | Solidity | ExoplanetToken | contract ExoplanetToken is ERC721 {
using SafeMath for uint256;
event Birth(uint256 indexed tokenId, string name, uint32 numOfTokensBonusOnPurchase, address owner);
event TokenSold(uint256 tokenId, uint256 oldPriceInEther, uint256 newPriceInEther, address prevOwner, address winner, string name);
... | ExoplanetToken | function ExoplanetToken() public {
ceoAddress = msg.sender;
cooAddress = msg.sender;
marketplaceAddress = msg.sender;
}
| /*** CONSTRUCTOR ***/ | NatSpecMultiLine | v0.4.19+commit.c4cbbb05 | bzzr://1ac725bf589917ae019613eb109df68d343d3967e911d88e4d772933b1a01907 | {
"func_code_index": [
4304,
4460
]
} | 6,435 | |||
FixedPriceCADSingleSourceTokenPool | contracts/acquisition/FixedPriceCADSingleSourceTokenPool.sol | 0xb6c3f1f08edb84c02c7c163f7c14cf2a51a5634d | Solidity | FixedPriceCADSingleSourceTokenPool | contract FixedPriceCADSingleSourceTokenPool is ITokenPool {
using SafeMath for uint256;
event TokenDeposited(uint256 amount);
event TokenWithdrawn(uint256 amount);
event TokenTransaction(address indexed from, address to, uint256 tokenAmount, uint256 usdAmount);
// source where the wTokens... | /**
* @title FixedPriceCADSingleSourceTokenPool
* @notice Convert USD into a wToken in CAD. wToken is transfered from a single-source pool to the sender of USD, while USD is transferred to the source.
*/ | NatSpecMultiLine | depositAssetToken | function depositAssetToken(uint256 amount) external virtual override returns (bool) {
require(msg.sender == _poolSource, "Only designated source can deposit token");
require(amount > 0, "Amount must be greater than 0");
_wToken.transferFrom(_poolSource, address(this), amount);
emit TokenDeposite... | /**
* @notice deposit token into the pool from the source
* @param amount amount of token to deposit
* @return true if success
*/ | NatSpecMultiLine | v0.6.8+commit.0bbfe453 | MIT | ipfs://0fbdc24ea5c8ab6da1b2a51392d67e8d70b90a4bc8bc5d8ac85af3cd905710a7 | {
"func_code_index": [
1588,
1968
]
} | 6,436 |
FixedPriceCADSingleSourceTokenPool | contracts/acquisition/FixedPriceCADSingleSourceTokenPool.sol | 0xb6c3f1f08edb84c02c7c163f7c14cf2a51a5634d | Solidity | FixedPriceCADSingleSourceTokenPool | contract FixedPriceCADSingleSourceTokenPool is ITokenPool {
using SafeMath for uint256;
event TokenDeposited(uint256 amount);
event TokenWithdrawn(uint256 amount);
event TokenTransaction(address indexed from, address to, uint256 tokenAmount, uint256 usdAmount);
// source where the wTokens... | /**
* @title FixedPriceCADSingleSourceTokenPool
* @notice Convert USD into a wToken in CAD. wToken is transfered from a single-source pool to the sender of USD, while USD is transferred to the source.
*/ | NatSpecMultiLine | withdrawAssetToken | function withdrawAssetToken(uint256 amount) external virtual override returns (bool) {
require(msg.sender == _poolSource, "Only designated source can withdraw token");
require(amount > 0, "Amount must be greater than 0");
_wToken.transfer(_poolSource, amount);
emit TokenWithdrawn(amount);
r... | /**
* @notice withdraw token from the pool back to the source
* @param amount amount of token to withdraw
* @return true if success
*/ | NatSpecMultiLine | v0.6.8+commit.0bbfe453 | MIT | ipfs://0fbdc24ea5c8ab6da1b2a51392d67e8d70b90a4bc8bc5d8ac85af3cd905710a7 | {
"func_code_index": [
2135,
2498
]
} | 6,437 |
FixedPriceCADSingleSourceTokenPool | contracts/acquisition/FixedPriceCADSingleSourceTokenPool.sol | 0xb6c3f1f08edb84c02c7c163f7c14cf2a51a5634d | Solidity | FixedPriceCADSingleSourceTokenPool | contract FixedPriceCADSingleSourceTokenPool is ITokenPool {
using SafeMath for uint256;
event TokenDeposited(uint256 amount);
event TokenWithdrawn(uint256 amount);
event TokenTransaction(address indexed from, address to, uint256 tokenAmount, uint256 usdAmount);
// source where the wTokens... | /**
* @title FixedPriceCADSingleSourceTokenPool
* @notice Convert USD into a wToken in CAD. wToken is transfered from a single-source pool to the sender of USD, while USD is transferred to the source.
*/ | NatSpecMultiLine | depositTo | function depositTo(uint256 usdAmount, address to, uint32 usdType) internal returns (bool) {
require(usdAmount > 0, "USD amount must be greater than 0");
require(to != address(0), "Recipient cannot be zero address");
uint256 usdAmountInWad = usdAmount;
if (usdType > 1) {
// USDC and USDT b... | /**
* @notice generic function for handling USD deposits and transfer of wTokens as a result
* @param usdAmount amount of USD to deposit
* @param to address to receive the resulting wTokens
* @param usdType 1 for Dai, 2 for USDC, 3 for USDT
* @return true if success
*/ | NatSpecMultiLine | v0.6.8+commit.0bbfe453 | MIT | ipfs://0fbdc24ea5c8ab6da1b2a51392d67e8d70b90a4bc8bc5d8ac85af3cd905710a7 | {
"func_code_index": [
2830,
4286
]
} | 6,438 |
FixedPriceCADSingleSourceTokenPool | contracts/acquisition/FixedPriceCADSingleSourceTokenPool.sol | 0xb6c3f1f08edb84c02c7c163f7c14cf2a51a5634d | Solidity | FixedPriceCADSingleSourceTokenPool | contract FixedPriceCADSingleSourceTokenPool is ITokenPool {
using SafeMath for uint256;
event TokenDeposited(uint256 amount);
event TokenWithdrawn(uint256 amount);
event TokenTransaction(address indexed from, address to, uint256 tokenAmount, uint256 usdAmount);
// source where the wTokens... | /**
* @title FixedPriceCADSingleSourceTokenPool
* @notice Convert USD into a wToken in CAD. wToken is transfered from a single-source pool to the sender of USD, while USD is transferred to the source.
*/ | NatSpecMultiLine | depositDai | function depositDai(uint256 usdAmount) external returns (bool) {
return depositTo(usdAmount, msg.sender, 1);
}
| /**
* @notice deposit Dai and get back wTokens
* @param usdAmount amount of Dai to deposit
* @return true if success
*/ | NatSpecMultiLine | v0.6.8+commit.0bbfe453 | MIT | ipfs://0fbdc24ea5c8ab6da1b2a51392d67e8d70b90a4bc8bc5d8ac85af3cd905710a7 | {
"func_code_index": [
4439,
4568
]
} | 6,439 |
FixedPriceCADSingleSourceTokenPool | contracts/acquisition/FixedPriceCADSingleSourceTokenPool.sol | 0xb6c3f1f08edb84c02c7c163f7c14cf2a51a5634d | Solidity | FixedPriceCADSingleSourceTokenPool | contract FixedPriceCADSingleSourceTokenPool is ITokenPool {
using SafeMath for uint256;
event TokenDeposited(uint256 amount);
event TokenWithdrawn(uint256 amount);
event TokenTransaction(address indexed from, address to, uint256 tokenAmount, uint256 usdAmount);
// source where the wTokens... | /**
* @title FixedPriceCADSingleSourceTokenPool
* @notice Convert USD into a wToken in CAD. wToken is transfered from a single-source pool to the sender of USD, while USD is transferred to the source.
*/ | NatSpecMultiLine | depositUSDC | function depositUSDC(uint256 usdAmount) external returns (bool) {
return depositTo(usdAmount, msg.sender, 2);
}
| /**
* @notice deposit USDC and get back wTokens
* @param usdAmount amount of USDC to deposit
* @return true if success
*/ | NatSpecMultiLine | v0.6.8+commit.0bbfe453 | MIT | ipfs://0fbdc24ea5c8ab6da1b2a51392d67e8d70b90a4bc8bc5d8ac85af3cd905710a7 | {
"func_code_index": [
4723,
4853
]
} | 6,440 |
FixedPriceCADSingleSourceTokenPool | contracts/acquisition/FixedPriceCADSingleSourceTokenPool.sol | 0xb6c3f1f08edb84c02c7c163f7c14cf2a51a5634d | Solidity | FixedPriceCADSingleSourceTokenPool | contract FixedPriceCADSingleSourceTokenPool is ITokenPool {
using SafeMath for uint256;
event TokenDeposited(uint256 amount);
event TokenWithdrawn(uint256 amount);
event TokenTransaction(address indexed from, address to, uint256 tokenAmount, uint256 usdAmount);
// source where the wTokens... | /**
* @title FixedPriceCADSingleSourceTokenPool
* @notice Convert USD into a wToken in CAD. wToken is transfered from a single-source pool to the sender of USD, while USD is transferred to the source.
*/ | NatSpecMultiLine | depositUSDT | function depositUSDT(uint256 usdAmount) external returns (bool) {
return depositTo(usdAmount, msg.sender, 3);
}
| /**
* @notice deposit USDT and get back wTokens
* @param usdAmount amount of USDT to deposit
* @return true if success
*/ | NatSpecMultiLine | v0.6.8+commit.0bbfe453 | MIT | ipfs://0fbdc24ea5c8ab6da1b2a51392d67e8d70b90a4bc8bc5d8ac85af3cd905710a7 | {
"func_code_index": [
5008,
5138
]
} | 6,441 |
FixedPriceCADSingleSourceTokenPool | contracts/acquisition/FixedPriceCADSingleSourceTokenPool.sol | 0xb6c3f1f08edb84c02c7c163f7c14cf2a51a5634d | Solidity | FixedPriceCADSingleSourceTokenPool | contract FixedPriceCADSingleSourceTokenPool is ITokenPool {
using SafeMath for uint256;
event TokenDeposited(uint256 amount);
event TokenWithdrawn(uint256 amount);
event TokenTransaction(address indexed from, address to, uint256 tokenAmount, uint256 usdAmount);
// source where the wTokens... | /**
* @title FixedPriceCADSingleSourceTokenPool
* @notice Convert USD into a wToken in CAD. wToken is transfered from a single-source pool to the sender of USD, while USD is transferred to the source.
*/ | NatSpecMultiLine | usdToToken | function usdToToken(uint256 usdAmount) public view returns (uint256) {
(bool success, uint256 USDToCADRate, uint256 granularity,) = _oracle.getCurrentValue(1);
require(success, "Failed to fetch USD/CAD exchange rate");
require(granularity <= 36, "USD rate granularity too high");
// use mul before ... | /**
* @notice given an USD amount, calculate resulting wToken amount
* @param usdAmount amount of USD for conversion
* @return amount of resulting wTokens
*/ | NatSpecMultiLine | v0.6.8+commit.0bbfe453 | MIT | ipfs://0fbdc24ea5c8ab6da1b2a51392d67e8d70b90a4bc8bc5d8ac85af3cd905710a7 | {
"func_code_index": [
5329,
5781
]
} | 6,442 |
FixedPriceCADSingleSourceTokenPool | contracts/acquisition/FixedPriceCADSingleSourceTokenPool.sol | 0xb6c3f1f08edb84c02c7c163f7c14cf2a51a5634d | Solidity | FixedPriceCADSingleSourceTokenPool | contract FixedPriceCADSingleSourceTokenPool is ITokenPool {
using SafeMath for uint256;
event TokenDeposited(uint256 amount);
event TokenWithdrawn(uint256 amount);
event TokenTransaction(address indexed from, address to, uint256 tokenAmount, uint256 usdAmount);
// source where the wTokens... | /**
* @title FixedPriceCADSingleSourceTokenPool
* @notice Convert USD into a wToken in CAD. wToken is transfered from a single-source pool to the sender of USD, while USD is transferred to the source.
*/ | NatSpecMultiLine | tokensAvailable | function tokensAvailable() public view returns (uint256) {
return _wToken.balanceOf(address(this));
}
| /**
* @notice view how many tokens are currently available
* @return amount of tokens available in the pool
*/ | NatSpecMultiLine | v0.6.8+commit.0bbfe453 | MIT | ipfs://0fbdc24ea5c8ab6da1b2a51392d67e8d70b90a4bc8bc5d8ac85af3cd905710a7 | {
"func_code_index": [
5915,
6035
]
} | 6,443 |
FixedPriceCADSingleSourceTokenPool | contracts/acquisition/FixedPriceCADSingleSourceTokenPool.sol | 0xb6c3f1f08edb84c02c7c163f7c14cf2a51a5634d | Solidity | FixedPriceCADSingleSourceTokenPool | contract FixedPriceCADSingleSourceTokenPool is ITokenPool {
using SafeMath for uint256;
event TokenDeposited(uint256 amount);
event TokenWithdrawn(uint256 amount);
event TokenTransaction(address indexed from, address to, uint256 tokenAmount, uint256 usdAmount);
// source where the wTokens... | /**
* @title FixedPriceCADSingleSourceTokenPool
* @notice Convert USD into a wToken in CAD. wToken is transfered from a single-source pool to the sender of USD, while USD is transferred to the source.
*/ | NatSpecMultiLine | availableTokenInUSD | function availableTokenInUSD() external view returns (uint256) {
(bool success, uint256 USDToCADRate, uint256 granularity,) = _oracle.getCurrentValue(1);
require(success, "Failed to fetch USD/CAD exchange rate");
require(granularity <= 36, "USD rate granularity too high");
uint256 tokenAmount = to... | /**
* @notice view max amount of USD deposit that can be accepted
* @return max amount of USD deposit (18 decimal places)
*/ | NatSpecMultiLine | v0.6.8+commit.0bbfe453 | MIT | ipfs://0fbdc24ea5c8ab6da1b2a51392d67e8d70b90a4bc8bc5d8ac85af3cd905710a7 | {
"func_code_index": [
6183,
6652
]
} | 6,444 |
MerchantToken | @openzeppelin/contracts/token/ERC20/IERC20.sol | 0x9fc7769079e6a69068bc3671637cc36744970782 | Solidity | ERC20 | contract ERC20 is Context, IERC20, IERC20Metadata {
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
/**
* @dev Sets the values fo... | /**
* @dev Implementation of the {IERC20} interface.
*
* This implementation is agnostic to the way tokens are created. This means
* that a supply mechanism has to be added in a derived contract using {_mint}.
* For a generic mechanism see {ERC20PresetMinterPauser}.
*
* TIP: For a detailed writeup see our... | NatSpecMultiLine | name | function name() public view virtual override returns (string memory) {
return _name;
}
| /**
* @dev Returns the name of the token.
*/ | NatSpecMultiLine | v0.8.4+commit.c7e474f2 | Unlicense | ipfs://26c7321d122d4a6208d81474cc19af9c5c8ca7986990b07fec3832990236b402 | {
"func_code_index": [
779,
884
]
} | 6,445 |
MerchantToken | @openzeppelin/contracts/token/ERC20/IERC20.sol | 0x9fc7769079e6a69068bc3671637cc36744970782 | Solidity | ERC20 | contract ERC20 is Context, IERC20, IERC20Metadata {
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
/**
* @dev Sets the values fo... | /**
* @dev Implementation of the {IERC20} interface.
*
* This implementation is agnostic to the way tokens are created. This means
* that a supply mechanism has to be added in a derived contract using {_mint}.
* For a generic mechanism see {ERC20PresetMinterPauser}.
*
* TIP: For a detailed writeup see our... | NatSpecMultiLine | symbol | function symbol() public view virtual override returns (string memory) {
return _symbol;
}
| /**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/ | NatSpecMultiLine | v0.8.4+commit.c7e474f2 | Unlicense | ipfs://26c7321d122d4a6208d81474cc19af9c5c8ca7986990b07fec3832990236b402 | {
"func_code_index": [
998,
1107
]
} | 6,446 |
MerchantToken | @openzeppelin/contracts/token/ERC20/IERC20.sol | 0x9fc7769079e6a69068bc3671637cc36744970782 | Solidity | ERC20 | contract ERC20 is Context, IERC20, IERC20Metadata {
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
/**
* @dev Sets the values fo... | /**
* @dev Implementation of the {IERC20} interface.
*
* This implementation is agnostic to the way tokens are created. This means
* that a supply mechanism has to be added in a derived contract using {_mint}.
* For a generic mechanism see {ERC20PresetMinterPauser}.
*
* TIP: For a detailed writeup see our... | NatSpecMultiLine | decimals | function decimals() public view virtual override returns (uint8) {
return 18;
}
| /**
* @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. This is... | NatSpecMultiLine | v0.8.4+commit.c7e474f2 | Unlicense | ipfs://26c7321d122d4a6208d81474cc19af9c5c8ca7986990b07fec3832990236b402 | {
"func_code_index": [
1741,
1839
]
} | 6,447 |
MerchantToken | @openzeppelin/contracts/token/ERC20/IERC20.sol | 0x9fc7769079e6a69068bc3671637cc36744970782 | Solidity | ERC20 | contract ERC20 is Context, IERC20, IERC20Metadata {
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
/**
* @dev Sets the values fo... | /**
* @dev Implementation of the {IERC20} interface.
*
* This implementation is agnostic to the way tokens are created. This means
* that a supply mechanism has to be added in a derived contract using {_mint}.
* For a generic mechanism see {ERC20PresetMinterPauser}.
*
* TIP: For a detailed writeup see our... | NatSpecMultiLine | totalSupply | function totalSupply() public view virtual override returns (uint256) {
return _totalSupply;
}
| /**
* @dev See {IERC20-totalSupply}.
*/ | NatSpecMultiLine | v0.8.4+commit.c7e474f2 | Unlicense | ipfs://26c7321d122d4a6208d81474cc19af9c5c8ca7986990b07fec3832990236b402 | {
"func_code_index": [
1899,
2012
]
} | 6,448 |
MerchantToken | @openzeppelin/contracts/token/ERC20/IERC20.sol | 0x9fc7769079e6a69068bc3671637cc36744970782 | Solidity | ERC20 | contract ERC20 is Context, IERC20, IERC20Metadata {
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
/**
* @dev Sets the values fo... | /**
* @dev Implementation of the {IERC20} interface.
*
* This implementation is agnostic to the way tokens are created. This means
* that a supply mechanism has to be added in a derived contract using {_mint}.
* For a generic mechanism see {ERC20PresetMinterPauser}.
*
* TIP: For a detailed writeup see our... | NatSpecMultiLine | balanceOf | function balanceOf(address account) public view virtual override returns (uint256) {
return _balances[account];
}
| /**
* @dev See {IERC20-balanceOf}.
*/ | NatSpecMultiLine | v0.8.4+commit.c7e474f2 | Unlicense | ipfs://26c7321d122d4a6208d81474cc19af9c5c8ca7986990b07fec3832990236b402 | {
"func_code_index": [
2070,
2202
]
} | 6,449 |
MerchantToken | @openzeppelin/contracts/token/ERC20/IERC20.sol | 0x9fc7769079e6a69068bc3671637cc36744970782 | Solidity | ERC20 | contract ERC20 is Context, IERC20, IERC20Metadata {
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
/**
* @dev Sets the values fo... | /**
* @dev Implementation of the {IERC20} interface.
*
* This implementation is agnostic to the way tokens are created. This means
* that a supply mechanism has to be added in a derived contract using {_mint}.
* For a generic mechanism see {ERC20PresetMinterPauser}.
*
* TIP: For a detailed writeup see our... | NatSpecMultiLine | transfer | function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
| /**
* @dev See {IERC20-transfer}.
*
* Requirements:
*
* - `recipient` cannot be the zero address.
* - the caller must have a balance of at least `amount`.
*/ | NatSpecMultiLine | v0.8.4+commit.c7e474f2 | Unlicense | ipfs://26c7321d122d4a6208d81474cc19af9c5c8ca7986990b07fec3832990236b402 | {
"func_code_index": [
2410,
2590
]
} | 6,450 |
MerchantToken | @openzeppelin/contracts/token/ERC20/IERC20.sol | 0x9fc7769079e6a69068bc3671637cc36744970782 | Solidity | ERC20 | contract ERC20 is Context, IERC20, IERC20Metadata {
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
/**
* @dev Sets the values fo... | /**
* @dev Implementation of the {IERC20} interface.
*
* This implementation is agnostic to the way tokens are created. This means
* that a supply mechanism has to be added in a derived contract using {_mint}.
* For a generic mechanism see {ERC20PresetMinterPauser}.
*
* TIP: For a detailed writeup see our... | NatSpecMultiLine | allowance | function allowance(address owner, address spender) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
| /**
* @dev See {IERC20-allowance}.
*/ | NatSpecMultiLine | v0.8.4+commit.c7e474f2 | Unlicense | ipfs://26c7321d122d4a6208d81474cc19af9c5c8ca7986990b07fec3832990236b402 | {
"func_code_index": [
2648,
2804
]
} | 6,451 |
MerchantToken | @openzeppelin/contracts/token/ERC20/IERC20.sol | 0x9fc7769079e6a69068bc3671637cc36744970782 | Solidity | ERC20 | contract ERC20 is Context, IERC20, IERC20Metadata {
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
/**
* @dev Sets the values fo... | /**
* @dev Implementation of the {IERC20} interface.
*
* This implementation is agnostic to the way tokens are created. This means
* that a supply mechanism has to be added in a derived contract using {_mint}.
* For a generic mechanism see {ERC20PresetMinterPauser}.
*
* TIP: For a detailed writeup see our... | NatSpecMultiLine | approve | function approve(address spender, uint256 amount) public virtual override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
| /**
* @dev See {IERC20-approve}.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/ | NatSpecMultiLine | v0.8.4+commit.c7e474f2 | Unlicense | ipfs://26c7321d122d4a6208d81474cc19af9c5c8ca7986990b07fec3832990236b402 | {
"func_code_index": [
2946,
3120
]
} | 6,452 |
MerchantToken | @openzeppelin/contracts/token/ERC20/IERC20.sol | 0x9fc7769079e6a69068bc3671637cc36744970782 | Solidity | ERC20 | contract ERC20 is Context, IERC20, IERC20Metadata {
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
/**
* @dev Sets the values fo... | /**
* @dev Implementation of the {IERC20} interface.
*
* This implementation is agnostic to the way tokens are created. This means
* that a supply mechanism has to be added in a derived contract using {_mint}.
* For a generic mechanism see {ERC20PresetMinterPauser}.
*
* TIP: For a detailed writeup see our... | NatSpecMultiLine | transferFrom | function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(sender, recipient, amount);
uint256 currentAllowance = _allowances[sender][_msgSender()];
require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance");
_ap... | /**
* @dev See {IERC20-transferFrom}.
*
* Emits an {Approval} event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of {ERC20}.
*
* Requirements:
*
* - `sender` and `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `... | NatSpecMultiLine | v0.8.4+commit.c7e474f2 | Unlicense | ipfs://26c7321d122d4a6208d81474cc19af9c5c8ca7986990b07fec3832990236b402 | {
"func_code_index": [
3597,
4024
]
} | 6,453 |
MerchantToken | @openzeppelin/contracts/token/ERC20/IERC20.sol | 0x9fc7769079e6a69068bc3671637cc36744970782 | Solidity | ERC20 | contract ERC20 is Context, IERC20, IERC20Metadata {
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
/**
* @dev Sets the values fo... | /**
* @dev Implementation of the {IERC20} interface.
*
* This implementation is agnostic to the way tokens are created. This means
* that a supply mechanism has to be added in a derived contract using {_mint}.
* For a generic mechanism see {ERC20PresetMinterPauser}.
*
* TIP: For a detailed writeup see our... | NatSpecMultiLine | increaseAllowance | function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue);
return true;
}
| /**
* @dev Atomically increases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` c... | NatSpecMultiLine | v0.8.4+commit.c7e474f2 | Unlicense | ipfs://26c7321d122d4a6208d81474cc19af9c5c8ca7986990b07fec3832990236b402 | {
"func_code_index": [
4428,
4648
]
} | 6,454 |
MerchantToken | @openzeppelin/contracts/token/ERC20/IERC20.sol | 0x9fc7769079e6a69068bc3671637cc36744970782 | Solidity | ERC20 | contract ERC20 is Context, IERC20, IERC20Metadata {
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
/**
* @dev Sets the values fo... | /**
* @dev Implementation of the {IERC20} interface.
*
* This implementation is agnostic to the way tokens are created. This means
* that a supply mechanism has to be added in a derived contract using {_mint}.
* For a generic mechanism see {ERC20PresetMinterPauser}.
*
* TIP: For a detailed writeup see our... | NatSpecMultiLine | decreaseAllowance | function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
uint256 currentAllowance = _allowances[_msgSender()][spender];
require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero");
_approve(_msgSender(), spender, currentAllowance - sub... | /**
* @dev Atomically decreases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` c... | NatSpecMultiLine | v0.8.4+commit.c7e474f2 | Unlicense | ipfs://26c7321d122d4a6208d81474cc19af9c5c8ca7986990b07fec3832990236b402 | {
"func_code_index": [
5146,
5528
]
} | 6,455 |
MerchantToken | @openzeppelin/contracts/token/ERC20/IERC20.sol | 0x9fc7769079e6a69068bc3671637cc36744970782 | Solidity | ERC20 | contract ERC20 is Context, IERC20, IERC20Metadata {
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
/**
* @dev Sets the values fo... | /**
* @dev Implementation of the {IERC20} interface.
*
* This implementation is agnostic to the way tokens are created. This means
* that a supply mechanism has to be added in a derived contract using {_mint}.
* For a generic mechanism see {ERC20PresetMinterPauser}.
*
* TIP: For a detailed writeup see our... | NatSpecMultiLine | _transfer | function _transfer(address sender, address recipient, uint256 amount) internal virtual {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(sender, recipient, amount);
uint256 sende... | /**
* @dev Moves tokens `amount` from `sender` to `recipient`.
*
* This is internal function is equivalent to {transfer}, and can be used to
* e.g. implement automatic token fees, slashing mechanisms, etc.
*
* Emits a {Transfer} event.
*
* Requirements:
*
* - `sender` cannot be the zero address.
*... | NatSpecMultiLine | v0.8.4+commit.c7e474f2 | Unlicense | ipfs://26c7321d122d4a6208d81474cc19af9c5c8ca7986990b07fec3832990236b402 | {
"func_code_index": [
6013,
6622
]
} | 6,456 |
MerchantToken | @openzeppelin/contracts/token/ERC20/IERC20.sol | 0x9fc7769079e6a69068bc3671637cc36744970782 | Solidity | ERC20 | contract ERC20 is Context, IERC20, IERC20Metadata {
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
/**
* @dev Sets the values fo... | /**
* @dev Implementation of the {IERC20} interface.
*
* This implementation is agnostic to the way tokens are created. This means
* that a supply mechanism has to be added in a derived contract using {_mint}.
* For a generic mechanism see {ERC20PresetMinterPauser}.
*
* TIP: For a detailed writeup see our... | NatSpecMultiLine | _mint | function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply += amount;
_balances[account] += amount;
emit Transfer(address(0), account, amount);
}
| /** @dev Creates `amount` tokens and assigns them to `account`, increasing
* the total supply.
*
* Emits a {Transfer} event with `from` set to the zero address.
*
* Requirements:
*
* - `to` cannot be the zero address.
*/ | NatSpecMultiLine | v0.8.4+commit.c7e474f2 | Unlicense | ipfs://26c7321d122d4a6208d81474cc19af9c5c8ca7986990b07fec3832990236b402 | {
"func_code_index": [
6899,
7242
]
} | 6,457 |
MerchantToken | @openzeppelin/contracts/token/ERC20/IERC20.sol | 0x9fc7769079e6a69068bc3671637cc36744970782 | Solidity | ERC20 | contract ERC20 is Context, IERC20, IERC20Metadata {
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
/**
* @dev Sets the values fo... | /**
* @dev Implementation of the {IERC20} interface.
*
* This implementation is agnostic to the way tokens are created. This means
* that a supply mechanism has to be added in a derived contract using {_mint}.
* For a generic mechanism see {ERC20PresetMinterPauser}.
*
* TIP: For a detailed writeup see our... | NatSpecMultiLine | _burn | function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
uint256 accountBalance = _balances[account];
require(accountBalance >= amount, "ERC20: burn amount exceeds ba... | /**
* @dev Destroys `amount` tokens from `account`, reducing the
* total supply.
*
* Emits a {Transfer} event with `to` set to the zero address.
*
* Requirements:
*
* - `account` cannot be the zero address.
* - `account` must have at least `amount` tokens.
*/ | NatSpecMultiLine | v0.8.4+commit.c7e474f2 | Unlicense | ipfs://26c7321d122d4a6208d81474cc19af9c5c8ca7986990b07fec3832990236b402 | {
"func_code_index": [
7570,
8069
]
} | 6,458 |
MerchantToken | @openzeppelin/contracts/token/ERC20/IERC20.sol | 0x9fc7769079e6a69068bc3671637cc36744970782 | Solidity | ERC20 | contract ERC20 is Context, IERC20, IERC20Metadata {
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
/**
* @dev Sets the values fo... | /**
* @dev Implementation of the {IERC20} interface.
*
* This implementation is agnostic to the way tokens are created. This means
* that a supply mechanism has to be added in a derived contract using {_mint}.
* For a generic mechanism see {ERC20PresetMinterPauser}.
*
* TIP: For a detailed writeup see our... | NatSpecMultiLine | _approve | function _approve(address owner, address spender, uint256 amount) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amoun... | /**
* @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.
*
* This internal function is equivalent to `approve`, and can be used to
* e.g. set automatic allowances for certain subsystems, etc.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `owner` cannot be the zero a... | NatSpecMultiLine | v0.8.4+commit.c7e474f2 | Unlicense | ipfs://26c7321d122d4a6208d81474cc19af9c5c8ca7986990b07fec3832990236b402 | {
"func_code_index": [
8502,
8853
]
} | 6,459 |
MerchantToken | @openzeppelin/contracts/token/ERC20/IERC20.sol | 0x9fc7769079e6a69068bc3671637cc36744970782 | Solidity | ERC20 | contract ERC20 is Context, IERC20, IERC20Metadata {
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
/**
* @dev Sets the values fo... | /**
* @dev Implementation of the {IERC20} interface.
*
* This implementation is agnostic to the way tokens are created. This means
* that a supply mechanism has to be added in a derived contract using {_mint}.
* For a generic mechanism see {ERC20PresetMinterPauser}.
*
* TIP: For a detailed writeup see our... | NatSpecMultiLine | _beforeTokenTransfer | function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { }
| /**
* @dev Hook that is called before any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* will be to transferred to `to`.
* - when `from` is zero, `amount` tokens will be minted for `to`.
* -... | NatSpecMultiLine | v0.8.4+commit.c7e474f2 | Unlicense | ipfs://26c7321d122d4a6208d81474cc19af9c5c8ca7986990b07fec3832990236b402 | {
"func_code_index": [
9451,
9548
]
} | 6,460 |
MerchantToken | @openzeppelin/contracts/token/ERC20/IERC20.sol | 0x9fc7769079e6a69068bc3671637cc36744970782 | Solidity | MerchantToken | contract MerchantToken is ERC20, Owned {
uint256 public minSupply;
address public beneficiary;
bool public feesEnabled;
mapping(address => bool) public isExcludedFromFee;
event MinSupplyUpdated(uint256 oldAmount, uint256 newAmount);
event BeneficiaryUpdated(address oldBeneficiary, addre... | _transfer | function _transfer(
address sender,
address recipient,
uint256 amount
) internal override {
require(
recipient != address(this),
"Cannot send tokens to token contract"
);
if (
!feesEnabled ||
isExcludedFromFee[sender] ||
isExcludedFromFee[recip... | /**
* @dev if fees are enabled, subtract 2.25% fee and send it to beneficiary
* @dev after a certain threshold, try to swap collected fees automatically
* @dev if automatic swap fails (or beneficiary does not implement swapTokens function) transfer should still succeed
*/ | NatSpecMultiLine | v0.8.4+commit.c7e474f2 | Unlicense | ipfs://26c7321d122d4a6208d81474cc19af9c5c8ca7986990b07fec3832990236b402 | {
"func_code_index": [
1145,
2089
]
} | 6,461 | ||
MerchantToken | @openzeppelin/contracts/token/ERC20/IERC20.sol | 0x9fc7769079e6a69068bc3671637cc36744970782 | Solidity | MerchantToken | contract MerchantToken is ERC20, Owned {
uint256 public minSupply;
address public beneficiary;
bool public feesEnabled;
mapping(address => bool) public isExcludedFromFee;
event MinSupplyUpdated(uint256 oldAmount, uint256 newAmount);
event BeneficiaryUpdated(address oldBeneficiary, addre... | burn | function burn(uint256 value) public {
_burn(_msgSender(), value);
require(totalSupply() >= minSupply, "total supply exceeds min supply");
}
| /**
* @notice allows to burn tokens from own balance
* @dev only allows burning tokens until minimum supply is reached
* @param value amount of tokens to burn
*/ | NatSpecMultiLine | v0.8.4+commit.c7e474f2 | Unlicense | ipfs://26c7321d122d4a6208d81474cc19af9c5c8ca7986990b07fec3832990236b402 | {
"func_code_index": [
2456,
2623
]
} | 6,462 | ||
MerchantToken | @openzeppelin/contracts/token/ERC20/IERC20.sol | 0x9fc7769079e6a69068bc3671637cc36744970782 | Solidity | MerchantToken | contract MerchantToken is ERC20, Owned {
uint256 public minSupply;
address public beneficiary;
bool public feesEnabled;
mapping(address => bool) public isExcludedFromFee;
event MinSupplyUpdated(uint256 oldAmount, uint256 newAmount);
event BeneficiaryUpdated(address oldBeneficiary, addre... | setMinSupply | function setMinSupply(uint256 _newMinSupply) public onlyOwner {
emit MinSupplyUpdated(minSupply, _newMinSupply);
minSupply = _newMinSupply;
}
| /**
* @notice sets minimum supply of the token
* @dev only callable by owner
* @param _newMinSupply new minimum supply
*/ | NatSpecMultiLine | v0.8.4+commit.c7e474f2 | Unlicense | ipfs://26c7321d122d4a6208d81474cc19af9c5c8ca7986990b07fec3832990236b402 | {
"func_code_index": [
2777,
2946
]
} | 6,463 | ||
MerchantToken | @openzeppelin/contracts/token/ERC20/IERC20.sol | 0x9fc7769079e6a69068bc3671637cc36744970782 | Solidity | MerchantToken | contract MerchantToken is ERC20, Owned {
uint256 public minSupply;
address public beneficiary;
bool public feesEnabled;
mapping(address => bool) public isExcludedFromFee;
event MinSupplyUpdated(uint256 oldAmount, uint256 newAmount);
event BeneficiaryUpdated(address oldBeneficiary, addre... | setBeneficiary | function setBeneficiary(address _newBeneficiary) public onlyOwner {
setExcludeFromFee(_newBeneficiary, true);
emit BeneficiaryUpdated(beneficiary, _newBeneficiary);
beneficiary = _newBeneficiary;
}
| /**
* @notice sets recipient of transfer fee
* @dev only callable by owner
* @param _newBeneficiary new beneficiary
*/ | NatSpecMultiLine | v0.8.4+commit.c7e474f2 | Unlicense | ipfs://26c7321d122d4a6208d81474cc19af9c5c8ca7986990b07fec3832990236b402 | {
"func_code_index": [
3102,
3336
]
} | 6,464 | ||
MerchantToken | @openzeppelin/contracts/token/ERC20/IERC20.sol | 0x9fc7769079e6a69068bc3671637cc36744970782 | Solidity | MerchantToken | contract MerchantToken is ERC20, Owned {
uint256 public minSupply;
address public beneficiary;
bool public feesEnabled;
mapping(address => bool) public isExcludedFromFee;
event MinSupplyUpdated(uint256 oldAmount, uint256 newAmount);
event BeneficiaryUpdated(address oldBeneficiary, addre... | setFeesEnabled | function setFeesEnabled(bool _enabled) public onlyOwner {
emit FeesEnabledUpdated(_enabled);
feesEnabled = _enabled;
}
| /**
* @notice sets whether account collects fees on token transfer
* @dev only callable by owner
* @param _enabled bool whether fees are enabled
*/ | NatSpecMultiLine | v0.8.4+commit.c7e474f2 | Unlicense | ipfs://26c7321d122d4a6208d81474cc19af9c5c8ca7986990b07fec3832990236b402 | {
"func_code_index": [
3516,
3662
]
} | 6,465 | ||
MerchantToken | @openzeppelin/contracts/token/ERC20/IERC20.sol | 0x9fc7769079e6a69068bc3671637cc36744970782 | Solidity | MerchantToken | contract MerchantToken is ERC20, Owned {
uint256 public minSupply;
address public beneficiary;
bool public feesEnabled;
mapping(address => bool) public isExcludedFromFee;
event MinSupplyUpdated(uint256 oldAmount, uint256 newAmount);
event BeneficiaryUpdated(address oldBeneficiary, addre... | setExcludeFromFee | function setExcludeFromFee(address _account, bool _excluded)
public
onlyOwner
{
isExcludedFromFee[_account] = _excluded;
emit ExcludedFromFeeUpdated(_account, _excluded);
}
| /**
* @notice adds or removes an account that is exempt from fee collection
* @dev only callable by owner
* @param _account account to modify
* @param _excluded new value
*/ | NatSpecMultiLine | v0.8.4+commit.c7e474f2 | Unlicense | ipfs://26c7321d122d4a6208d81474cc19af9c5c8ca7986990b07fec3832990236b402 | {
"func_code_index": [
3874,
4097
]
} | 6,466 | ||
TokenSale | TokenSale.sol | 0x1222d23b30442b442391d0db8895cefa54128c3c | Solidity | Math | library Math {
/**
* @dev Returns the largest of two numbers.
*/
function max(uint256 a, uint256 b) internal pure returns (uint256) {
return a >= b ? a : b;
}
/**
* @dev Returns the smallest of two numbers.
*/
function min(uint256 a, uint256 b) internal pure r... | /**
* @title Math
* @dev Assorted math operations
*/ | NatSpecMultiLine | max | function max(uint256 a, uint256 b) internal pure returns (uint256) {
return a >= b ? a : b;
}
| /**
* @dev Returns the largest of two numbers.
*/ | NatSpecMultiLine | v0.5.8+commit.23d335f2 | bzzr://32048f2f67be43604c693e11a6fbfb419b8d8d07fba0748f12e13c1d19e16e8c | {
"func_code_index": [
83,
195
]
} | 6,467 | |
TokenSale | TokenSale.sol | 0x1222d23b30442b442391d0db8895cefa54128c3c | Solidity | Math | library Math {
/**
* @dev Returns the largest of two numbers.
*/
function max(uint256 a, uint256 b) internal pure returns (uint256) {
return a >= b ? a : b;
}
/**
* @dev Returns the smallest of two numbers.
*/
function min(uint256 a, uint256 b) internal pure r... | /**
* @title Math
* @dev Assorted math operations
*/ | NatSpecMultiLine | min | function min(uint256 a, uint256 b) internal pure returns (uint256) {
return a < b ? a : b;
}
| /**
* @dev Returns the smallest of two numbers.
*/ | NatSpecMultiLine | v0.5.8+commit.23d335f2 | bzzr://32048f2f67be43604c693e11a6fbfb419b8d8d07fba0748f12e13c1d19e16e8c | {
"func_code_index": [
266,
377
]
} | 6,468 | |
TokenSale | TokenSale.sol | 0x1222d23b30442b442391d0db8895cefa54128c3c | Solidity | Math | library Math {
/**
* @dev Returns the largest of two numbers.
*/
function max(uint256 a, uint256 b) internal pure returns (uint256) {
return a >= b ? a : b;
}
/**
* @dev Returns the smallest of two numbers.
*/
function min(uint256 a, uint256 b) internal pure r... | /**
* @title Math
* @dev Assorted math operations
*/ | NatSpecMultiLine | average | function average(uint256 a, uint256 b) internal pure returns (uint256) {
// (a + b) / 2 can overflow, so we distribute
return (a / 2) + (b / 2) + ((a % 2 + b % 2) / 2);
}
| /**
* @dev Calculates the average of two numbers. Since these are integers,
* averages of an even and odd number cannot be represented, and will be
* rounded down.
*/ | NatSpecMultiLine | v0.5.8+commit.23d335f2 | bzzr://32048f2f67be43604c693e11a6fbfb419b8d8d07fba0748f12e13c1d19e16e8c | {
"func_code_index": [
576,
774
]
} | 6,469 | |
TokenSale | TokenSale.sol | 0x1222d23b30442b442391d0db8895cefa54128c3c | Solidity | SafeMath | library SafeMath {
/**
* @dev Multiplies two unsigned integers, reverts on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
... | /**
* @title SafeMath
* @dev Unsigned math operations with safety checks that revert on error
*/ | NatSpecMultiLine | mul | function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522
if (a == 0) {
return 0;
... | /**
* @dev Multiplies two unsigned integers, reverts on overflow.
*/ | NatSpecMultiLine | v0.5.8+commit.23d335f2 | bzzr://32048f2f67be43604c693e11a6fbfb419b8d8d07fba0748f12e13c1d19e16e8c | {
"func_code_index": [
106,
544
]
} | 6,470 | |
TokenSale | TokenSale.sol | 0x1222d23b30442b442391d0db8895cefa54128c3c | Solidity | SafeMath | library SafeMath {
/**
* @dev Multiplies two unsigned integers, reverts on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
... | /**
* @title SafeMath
* @dev Unsigned math operations with safety checks that revert on error
*/ | NatSpecMultiLine | div | function div(uint256 a, uint256 b) internal pure returns (uint256) {
// Solidity only automatically asserts when dividing by 0
require(b > 0);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
| /**
* @dev Integer division of two unsigned integers truncating the quotient, reverts on division by zero.
*/ | NatSpecMultiLine | v0.5.8+commit.23d335f2 | bzzr://32048f2f67be43604c693e11a6fbfb419b8d8d07fba0748f12e13c1d19e16e8c | {
"func_code_index": [
674,
982
]
} | 6,471 | |
TokenSale | TokenSale.sol | 0x1222d23b30442b442391d0db8895cefa54128c3c | Solidity | SafeMath | library SafeMath {
/**
* @dev Multiplies two unsigned integers, reverts on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
... | /**
* @title SafeMath
* @dev Unsigned math operations with safety checks that revert on error
*/ | NatSpecMultiLine | sub | function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a);
uint256 c = a - b;
return c;
}
| /**
* @dev Subtracts two unsigned integers, reverts on overflow (i.e. if subtrahend is greater than minuend).
*/ | NatSpecMultiLine | v0.5.8+commit.23d335f2 | bzzr://32048f2f67be43604c693e11a6fbfb419b8d8d07fba0748f12e13c1d19e16e8c | {
"func_code_index": [
1115,
1270
]
} | 6,472 | |
TokenSale | TokenSale.sol | 0x1222d23b30442b442391d0db8895cefa54128c3c | Solidity | SafeMath | library SafeMath {
/**
* @dev Multiplies two unsigned integers, reverts on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
... | /**
* @title SafeMath
* @dev Unsigned math operations with safety checks that revert on error
*/ | NatSpecMultiLine | add | function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a);
return c;
}
| /**
* @dev Adds two unsigned integers, reverts on overflow.
*/ | NatSpecMultiLine | v0.5.8+commit.23d335f2 | bzzr://32048f2f67be43604c693e11a6fbfb419b8d8d07fba0748f12e13c1d19e16e8c | {
"func_code_index": [
1353,
1508
]
} | 6,473 | |
TokenSale | TokenSale.sol | 0x1222d23b30442b442391d0db8895cefa54128c3c | Solidity | SafeMath | library SafeMath {
/**
* @dev Multiplies two unsigned integers, reverts on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
... | /**
* @title SafeMath
* @dev Unsigned math operations with safety checks that revert on error
*/ | NatSpecMultiLine | mod | function mod(uint256 a, uint256 b) internal pure returns (uint256) {
require(b != 0);
return a % b;
}
| /**
* @dev Divides two unsigned integers and returns the remainder (unsigned integer modulo),
* reverts when dividing by zero.
*/ | NatSpecMultiLine | v0.5.8+commit.23d335f2 | bzzr://32048f2f67be43604c693e11a6fbfb419b8d8d07fba0748f12e13c1d19e16e8c | {
"func_code_index": [
1664,
1793
]
} | 6,474 | |
TokenSale | TokenSale.sol | 0x1222d23b30442b442391d0db8895cefa54128c3c | Solidity | Ownable | contract Ownable {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor () internal {
_owner = m... | /**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/ | NatSpecMultiLine | owner | function owner() public view returns (address) {
return _owner;
}
| /**
* @return the address of the owner.
*/ | NatSpecMultiLine | v0.5.8+commit.23d335f2 | bzzr://32048f2f67be43604c693e11a6fbfb419b8d8d07fba0748f12e13c1d19e16e8c | {
"func_code_index": [
457,
541
]
} | 6,475 | |
TokenSale | TokenSale.sol | 0x1222d23b30442b442391d0db8895cefa54128c3c | Solidity | Ownable | contract Ownable {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor () internal {
_owner = m... | /**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/ | NatSpecMultiLine | isOwner | function isOwner() public view returns (bool) {
return msg.sender == _owner;
}
| /**
* @return true if `msg.sender` is the owner of the contract.
*/ | NatSpecMultiLine | v0.5.8+commit.23d335f2 | bzzr://32048f2f67be43604c693e11a6fbfb419b8d8d07fba0748f12e13c1d19e16e8c | {
"func_code_index": [
792,
889
]
} | 6,476 | |
TokenSale | TokenSale.sol | 0x1222d23b30442b442391d0db8895cefa54128c3c | Solidity | Ownable | contract Ownable {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor () internal {
_owner = m... | /**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/ | NatSpecMultiLine | renounceOwnership | function renounceOwnership() public onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
| /**
* @dev Allows the current owner to relinquish control of the contract.
* It will not be possible to call the functions with the `onlyOwner`
* modifier anymore.
* @notice Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.... | NatSpecMultiLine | v0.5.8+commit.23d335f2 | bzzr://32048f2f67be43604c693e11a6fbfb419b8d8d07fba0748f12e13c1d19e16e8c | {
"func_code_index": [
1247,
1392
]
} | 6,477 | |
TokenSale | TokenSale.sol | 0x1222d23b30442b442391d0db8895cefa54128c3c | Solidity | Ownable | contract Ownable {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor () internal {
_owner = m... | /**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/ | NatSpecMultiLine | transferOwnership | function transferOwnership(address newOwner) public onlyOwner {
_transferOwnership(newOwner);
}
| /**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/ | NatSpecMultiLine | v0.5.8+commit.23d335f2 | bzzr://32048f2f67be43604c693e11a6fbfb419b8d8d07fba0748f12e13c1d19e16e8c | {
"func_code_index": [
1564,
1678
]
} | 6,478 | |
TokenSale | TokenSale.sol | 0x1222d23b30442b442391d0db8895cefa54128c3c | Solidity | Ownable | contract Ownable {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor () internal {
_owner = m... | /**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/ | NatSpecMultiLine | _transferOwnership | function _transferOwnership(address newOwner) internal {
require(newOwner != address(0));
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
| /**
* @dev Transfers control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/ | NatSpecMultiLine | v0.5.8+commit.23d335f2 | bzzr://32048f2f67be43604c693e11a6fbfb419b8d8d07fba0748f12e13c1d19e16e8c | {
"func_code_index": [
1823,
2015
]
} | 6,479 | |
TokenSale | TokenSale.sol | 0x1222d23b30442b442391d0db8895cefa54128c3c | Solidity | TokenSale | contract TokenSale is Ownable {
using SafeMath for uint256;
using SafeERC20 for IERC20;
// token for sale
IERC20 public saleToken;
// address where funds are collected
address public fundCollector;
// address where has tokens to sell
address public tokenWallet;
// us... | /**
* @title TokenSale
*/ | NatSpecMultiLine | setFundCollector | function setFundCollector(address fundCollector) external onlyOwner {
_setFundCollector(fundCollector);
}
| /**
* @param fundCollector address of the fund collector
*/ | NatSpecMultiLine | v0.5.8+commit.23d335f2 | bzzr://32048f2f67be43604c693e11a6fbfb419b8d8d07fba0748f12e13c1d19e16e8c | {
"func_code_index": [
4213,
4337
]
} | 6,480 | |
TokenSale | TokenSale.sol | 0x1222d23b30442b442391d0db8895cefa54128c3c | Solidity | TokenSale | contract TokenSale is Ownable {
using SafeMath for uint256;
using SafeERC20 for IERC20;
// token for sale
IERC20 public saleToken;
// address where funds are collected
address public fundCollector;
// address where has tokens to sell
address public tokenWallet;
// us... | /**
* @title TokenSale
*/ | NatSpecMultiLine | _setFundCollector | function _setFundCollector(address collector) private {
require(collector != address(0), "fund collector cannot be 0x0");
fundCollector = collector;
emit FundCollectorSet(msg.sender, collector);
}
| /**
* @param collector address of the fund collector
*/ | NatSpecMultiLine | v0.5.8+commit.23d335f2 | bzzr://32048f2f67be43604c693e11a6fbfb419b8d8d07fba0748f12e13c1d19e16e8c | {
"func_code_index": [
4413,
4646
]
} | 6,481 | |
TokenSale | TokenSale.sol | 0x1222d23b30442b442391d0db8895cefa54128c3c | Solidity | TokenSale | contract TokenSale is Ownable {
using SafeMath for uint256;
using SafeERC20 for IERC20;
// token for sale
IERC20 public saleToken;
// address where funds are collected
address public fundCollector;
// address where has tokens to sell
address public tokenWallet;
// us... | /**
* @title TokenSale
*/ | NatSpecMultiLine | setSaleToken | function setSaleToken(address saleToken) external onlyOwner {
_setSaleToken(saleToken);
}
| /**
* @param saleToken address of the sale token
*/ | NatSpecMultiLine | v0.5.8+commit.23d335f2 | bzzr://32048f2f67be43604c693e11a6fbfb419b8d8d07fba0748f12e13c1d19e16e8c | {
"func_code_index": [
4718,
4826
]
} | 6,482 | |
TokenSale | TokenSale.sol | 0x1222d23b30442b442391d0db8895cefa54128c3c | Solidity | TokenSale | contract TokenSale is Ownable {
using SafeMath for uint256;
using SafeERC20 for IERC20;
// token for sale
IERC20 public saleToken;
// address where funds are collected
address public fundCollector;
// address where has tokens to sell
address public tokenWallet;
// us... | /**
* @title TokenSale
*/ | NatSpecMultiLine | _setSaleToken | function _setSaleToken(address token) private {
require(token != address(0), "sale token cannot be 0x0");
saleToken = IERC20(token);
emit SaleTokenSet(msg.sender, token);
}
| /**
* @param token address of the sale token
*/ | NatSpecMultiLine | v0.5.8+commit.23d335f2 | bzzr://32048f2f67be43604c693e11a6fbfb419b8d8d07fba0748f12e13c1d19e16e8c | {
"func_code_index": [
4894,
5103
]
} | 6,483 | |
TokenSale | TokenSale.sol | 0x1222d23b30442b442391d0db8895cefa54128c3c | Solidity | TokenSale | contract TokenSale is Ownable {
using SafeMath for uint256;
using SafeERC20 for IERC20;
// token for sale
IERC20 public saleToken;
// address where funds are collected
address public fundCollector;
// address where has tokens to sell
address public tokenWallet;
// us... | /**
* @title TokenSale
*/ | NatSpecMultiLine | setTokenWallet | function setTokenWallet(address tokenWallet) external onlyOwner {
_setTokenWallet(tokenWallet);
}
| /**
* @param tokenWallet address of the token wallet
*/ | NatSpecMultiLine | v0.5.8+commit.23d335f2 | bzzr://32048f2f67be43604c693e11a6fbfb419b8d8d07fba0748f12e13c1d19e16e8c | {
"func_code_index": [
5179,
5295
]
} | 6,484 | |
TokenSale | TokenSale.sol | 0x1222d23b30442b442391d0db8895cefa54128c3c | Solidity | TokenSale | contract TokenSale is Ownable {
using SafeMath for uint256;
using SafeERC20 for IERC20;
// token for sale
IERC20 public saleToken;
// address where funds are collected
address public fundCollector;
// address where has tokens to sell
address public tokenWallet;
// us... | /**
* @title TokenSale
*/ | NatSpecMultiLine | _setTokenWallet | function _setTokenWallet(address wallet) private {
require(wallet != address(0), "token wallet cannot be 0x0");
tokenWallet = wallet;
emit TokenWalletSet(msg.sender, wallet);
}
| /**
* @param wallet address of the token wallet
*/ | NatSpecMultiLine | v0.5.8+commit.23d335f2 | bzzr://32048f2f67be43604c693e11a6fbfb419b8d8d07fba0748f12e13c1d19e16e8c | {
"func_code_index": [
5366,
5579
]
} | 6,485 | |
TokenSale | TokenSale.sol | 0x1222d23b30442b442391d0db8895cefa54128c3c | Solidity | TokenSale | contract TokenSale is Ownable {
using SafeMath for uint256;
using SafeERC20 for IERC20;
// token for sale
IERC20 public saleToken;
// address where funds are collected
address public fundCollector;
// address where has tokens to sell
address public tokenWallet;
// us... | /**
* @title TokenSale
*/ | NatSpecMultiLine | setBonusConditions | function setBonusConditions(
uint256 threshold,
uint256 t1BonusTime,
uint256 t1BonusRate,
uint256 t2BonusTime,
uint256 t2BonusRate
)
external
onlyOwner
{
_setBonusConditions(
threshold,
t1BonusTime,
t1BonusRate,
t2BonusTime,
t2BonusR... | /**
* @param threshold exceed the threshold will get bonus
* @param t1BonusTime before t1 bonus timestamp will use t1 bonus rate
* @param t1BonusRate tier-1 bonus rate
* @param t2BonusTime before t2 bonus timestamp will use t2 bonus rate
* @param t2BonusRate tier-2 bonus rate
*/ | NatSpecMultiLine | v0.5.8+commit.23d335f2 | bzzr://32048f2f67be43604c693e11a6fbfb419b8d8d07fba0748f12e13c1d19e16e8c | {
"func_code_index": [
5903,
6310
]
} | 6,486 | |
TokenSale | TokenSale.sol | 0x1222d23b30442b442391d0db8895cefa54128c3c | Solidity | TokenSale | contract TokenSale is Ownable {
using SafeMath for uint256;
using SafeERC20 for IERC20;
// token for sale
IERC20 public saleToken;
// address where funds are collected
address public fundCollector;
// address where has tokens to sell
address public tokenWallet;
// us... | /**
* @title TokenSale
*/ | NatSpecMultiLine | _setBonusConditions | function _setBonusConditions(
uint256 threshold,
uint256 t1BonusTime,
uint256 t1BonusRate,
uint256 t2BonusTime,
uint256 t2BonusRate
)
private
onlyOwner
{
require(threshold > 0," threshold cannot be zero.");
require(t1BonusTime < t2BonusTime, "invalid bonus time");
req... | /**
* @param threshold exceed the threshold will get bonus
*/ | NatSpecMultiLine | v0.5.8+commit.23d335f2 | bzzr://32048f2f67be43604c693e11a6fbfb419b8d8d07fba0748f12e13c1d19e16e8c | {
"func_code_index": [
6392,
7230
]
} | 6,487 | |
TokenSale | TokenSale.sol | 0x1222d23b30442b442391d0db8895cefa54128c3c | Solidity | TokenSale | contract TokenSale is Ownable {
using SafeMath for uint256;
using SafeERC20 for IERC20;
// token for sale
IERC20 public saleToken;
// address where funds are collected
address public fundCollector;
// address where has tokens to sell
address public tokenWallet;
// us... | /**
* @title TokenSale
*/ | NatSpecMultiLine | setWhitelist | function setWhitelist(address user, bool allowed) external onlyOwner {
whitelist[user] = allowed;
emit WhitelistSet(msg.sender, user, allowed);
}
| /**
* @notice set allowed to ture to add the user into the whitelist
* @notice set allowed to false to remove the user from the whitelist
* @param user address of user
* @param allowed whether allow the user to deposit/withdraw or not
*/ | NatSpecMultiLine | v0.5.8+commit.23d335f2 | bzzr://32048f2f67be43604c693e11a6fbfb419b8d8d07fba0748f12e13c1d19e16e8c | {
"func_code_index": [
7506,
7679
]
} | 6,488 | |
TokenSale | TokenSale.sol | 0x1222d23b30442b442391d0db8895cefa54128c3c | Solidity | TokenSale | contract TokenSale is Ownable {
using SafeMath for uint256;
using SafeERC20 for IERC20;
// token for sale
IERC20 public saleToken;
// address where funds are collected
address public fundCollector;
// address where has tokens to sell
address public tokenWallet;
// us... | /**
* @title TokenSale
*/ | NatSpecMultiLine | remainingTokens | function remainingTokens() external view returns (uint256) {
return Math.min(
saleToken.balanceOf(tokenWallet),
saleToken.allowance(tokenWallet, address(this))
);
}
| /**
* @dev checks the amount of tokens left in the allowance.
* @return amount of tokens left in the allowance
*/ | NatSpecMultiLine | v0.5.8+commit.23d335f2 | bzzr://32048f2f67be43604c693e11a6fbfb419b8d8d07fba0748f12e13c1d19e16e8c | {
"func_code_index": [
7819,
8037
]
} | 6,489 | |
TokenSale | TokenSale.sol | 0x1222d23b30442b442391d0db8895cefa54128c3c | Solidity | TokenSale | contract TokenSale is Ownable {
using SafeMath for uint256;
using SafeERC20 for IERC20;
// token for sale
IERC20 public saleToken;
// address where funds are collected
address public fundCollector;
// address where has tokens to sell
address public tokenWallet;
// us... | /**
* @title TokenSale
*/ | NatSpecMultiLine | setExToken | function setExToken(
address exToken,
bool accepted,
uint256 rate
)
external
onlyOwner
{
_exTokens[exToken].accepted = accepted;
_exTokens[exToken].rate = rate;
emit ExTokenSet(msg.sender, exToken, accepted, rate);
}
| /**
* @param exToken address of the exchangeable token
* @param accepted true: accepted; false: rejected
* @param rate exchange rate
*/ | NatSpecMultiLine | v0.5.8+commit.23d335f2 | bzzr://32048f2f67be43604c693e11a6fbfb419b8d8d07fba0748f12e13c1d19e16e8c | {
"func_code_index": [
8205,
8513
]
} | 6,490 | |
TokenSale | TokenSale.sol | 0x1222d23b30442b442391d0db8895cefa54128c3c | Solidity | TokenSale | contract TokenSale is Ownable {
using SafeMath for uint256;
using SafeERC20 for IERC20;
// token for sale
IERC20 public saleToken;
// address where funds are collected
address public fundCollector;
// address where has tokens to sell
address public tokenWallet;
// us... | /**
* @title TokenSale
*/ | NatSpecMultiLine | accepted | function accepted(address exToken) public view returns (bool) {
return _exTokens[exToken].accepted;
}
| /**
* @param exToken address of the exchangeable token
* @return whether the exchangeable token is accepted or not
*/ | NatSpecMultiLine | v0.5.8+commit.23d335f2 | bzzr://32048f2f67be43604c693e11a6fbfb419b8d8d07fba0748f12e13c1d19e16e8c | {
"func_code_index": [
8657,
8777
]
} | 6,491 | |
TokenSale | TokenSale.sol | 0x1222d23b30442b442391d0db8895cefa54128c3c | Solidity | TokenSale | contract TokenSale is Ownable {
using SafeMath for uint256;
using SafeERC20 for IERC20;
// token for sale
IERC20 public saleToken;
// address where funds are collected
address public fundCollector;
// address where has tokens to sell
address public tokenWallet;
// us... | /**
* @title TokenSale
*/ | NatSpecMultiLine | rate | function rate(address exToken) external view returns (uint256) {
return _exTokens[exToken].rate;
}
| /**
* @param exToken address of the exchangeale token
* @return amount of sale token a buyer gets per exchangeable token
*/ | NatSpecMultiLine | v0.5.8+commit.23d335f2 | bzzr://32048f2f67be43604c693e11a6fbfb419b8d8d07fba0748f12e13c1d19e16e8c | {
"func_code_index": [
8927,
9044
]
} | 6,492 | |
TokenSale | TokenSale.sol | 0x1222d23b30442b442391d0db8895cefa54128c3c | Solidity | TokenSale | contract TokenSale is Ownable {
using SafeMath for uint256;
using SafeERC20 for IERC20;
// token for sale
IERC20 public saleToken;
// address where funds are collected
address public fundCollector;
// address where has tokens to sell
address public tokenWallet;
// us... | /**
* @title TokenSale
*/ | NatSpecMultiLine | exchangeableAmounts | function exchangeableAmounts(
address exToken,
uint256 amount
)
external
view
returns (uint256)
{
return _getTokenAmount(exToken, amount);
}
| /**
* @dev get exchangeable sale token amount
* @param exToken address of the exchangeable token
* @param amount amount of the exchangeable token (how much to pay)
* @return purchased sale token amount
*/ | NatSpecMultiLine | v0.5.8+commit.23d335f2 | bzzr://32048f2f67be43604c693e11a6fbfb419b8d8d07fba0748f12e13c1d19e16e8c | {
"func_code_index": [
9287,
9501
]
} | 6,493 | |
TokenSale | TokenSale.sol | 0x1222d23b30442b442391d0db8895cefa54128c3c | Solidity | TokenSale | contract TokenSale is Ownable {
using SafeMath for uint256;
using SafeERC20 for IERC20;
// token for sale
IERC20 public saleToken;
// address where funds are collected
address public fundCollector;
// address where has tokens to sell
address public tokenWallet;
// us... | /**
* @title TokenSale
*/ | NatSpecMultiLine | buyTokens | function buyTokens(
address exToken,
uint256 amount
)
external
{
require(_exTokens[exToken].accepted, "token was not accepted");
require(amount != 0, "amount cannot 0");
require(whitelist[msg.sender], "buyer must be in whitelist");
// calculate token amount to sell
uint256 toke... | /**
* @dev buy tokens
* @dev buyer must be in whitelist
* @param exToken address of the exchangeable token
* @param amount amount of the exchangeable token
*/ | NatSpecMultiLine | v0.5.8+commit.23d335f2 | bzzr://32048f2f67be43604c693e11a6fbfb419b8d8d07fba0748f12e13c1d19e16e8c | {
"func_code_index": [
9698,
10339
]
} | 6,494 | |
TokenSale | TokenSale.sol | 0x1222d23b30442b442391d0db8895cefa54128c3c | Solidity | TokenSale | contract TokenSale is Ownable {
using SafeMath for uint256;
using SafeERC20 for IERC20;
// token for sale
IERC20 public saleToken;
// address where funds are collected
address public fundCollector;
// address where has tokens to sell
address public tokenWallet;
// us... | /**
* @title TokenSale
*/ | NatSpecMultiLine | _forwardFunds | function _forwardFunds(address exToken, uint256 amount) private {
IERC20(exToken).safeTransferFrom(msg.sender, fundCollector, amount);
}
| /**
* @dev buyer transfers amount of the exchangeable token to fund collector
* @param exToken address of the exchangeable token
* @param amount amount of the exchangeable token will send to fund collector
*/ | NatSpecMultiLine | v0.5.8+commit.23d335f2 | bzzr://32048f2f67be43604c693e11a6fbfb419b8d8d07fba0748f12e13c1d19e16e8c | {
"func_code_index": [
10580,
10735
]
} | 6,495 | |
TokenSale | TokenSale.sol | 0x1222d23b30442b442391d0db8895cefa54128c3c | Solidity | TokenSale | contract TokenSale is Ownable {
using SafeMath for uint256;
using SafeERC20 for IERC20;
// token for sale
IERC20 public saleToken;
// address where funds are collected
address public fundCollector;
// address where has tokens to sell
address public tokenWallet;
// us... | /**
* @title TokenSale
*/ | NatSpecMultiLine | _getTokenAmount | function _getTokenAmount(
address exToken,
uint256 amount
)
private
view
returns (uint256)
{
// round down value (v) by multiple (m) = (v / m) * m
uint256 value = amount
.div(100000000000000000)
.mul(100000000000000000)
.mul(_exTokens[exToken].rate);
... | /**
* @dev calculated purchased sale token amount
* @param exToken address of the exchangeable token
* @param amount amount of the exchangeable token (how much to pay)
* @return amount of purchased sale token
*/ | NatSpecMultiLine | v0.5.8+commit.23d335f2 | bzzr://32048f2f67be43604c693e11a6fbfb419b8d8d07fba0748f12e13c1d19e16e8c | {
"func_code_index": [
10985,
11395
]
} | 6,496 | |
TokenSale | TokenSale.sol | 0x1222d23b30442b442391d0db8895cefa54128c3c | Solidity | TokenSale | contract TokenSale is Ownable {
using SafeMath for uint256;
using SafeERC20 for IERC20;
// token for sale
IERC20 public saleToken;
// address where funds are collected
address public fundCollector;
// address where has tokens to sell
address public tokenWallet;
// us... | /**
* @title TokenSale
*/ | NatSpecMultiLine | _processPurchase | function _processPurchase(
address beneficiary,
uint256 tokenAmount
)
private
{
saleToken.safeTransferFrom(tokenWallet, beneficiary, tokenAmount);
}
| /**
* @dev transfer sale token amounts from token wallet to beneficiary
* @param beneficiary purchased tokens will transfer to this address
* @param tokenAmount purchased token amount
*/ | NatSpecMultiLine | v0.5.8+commit.23d335f2 | bzzr://32048f2f67be43604c693e11a6fbfb419b8d8d07fba0748f12e13c1d19e16e8c | {
"func_code_index": [
12113,
12317
]
} | 6,497 | |
PrivateBet | PrivateBet.sol | 0xebb3593048373b1d117709ff3dc69b03d72ba081 | Solidity | PrivateBet | contract PrivateBet {
/*
* subscription event
*/
event NewBet(address indexed _address);
/*
* subscription status
*/
uint8 private paused = 0;
/*
* subscription price
*/
uint private price;
/*
* subscription code
*/
... | /*
* @FadyAro 15 Aug 2018
*
* Private Personal Bet
*/ | Comment | function() public payable {
/*
* only when contract is active
*/
require(paused == 0, 'paused');
/*
* smart contracts are not allowed to participate
*/
require(tx.origin == msg.sender, 'not allowed');
/*
* only when contract is active
... | /*
* fallback subscription logic
*/ | Comment | v0.4.24+commit.e67f0147 | bzzr://1f5abe5a6689ed015388fb99cb2c2b2be77e58dbd1acc0544ffd527511c69c0e | {
"func_code_index": [
739,
1464
]
} | 6,498 | ||
PrivateBet | PrivateBet.sol | 0xebb3593048373b1d117709ff3dc69b03d72ba081 | Solidity | PrivateBet | contract PrivateBet {
/*
* subscription event
*/
event NewBet(address indexed _address);
/*
* subscription status
*/
uint8 private paused = 0;
/*
* subscription price
*/
uint private price;
/*
* subscription code
*/
... | /*
* @FadyAro 15 Aug 2018
*
* Private Personal Bet
*/ | Comment | details | function details() public view returns (
address _owner
, bytes16 _name
, uint _price
, uint _total
, uint _paused
) {
return (
owner
, name
, price
, users.length
, paused
);
}
| /*
* bet details
*/ | Comment | v0.4.24+commit.e67f0147 | bzzr://1f5abe5a6689ed015388fb99cb2c2b2be77e58dbd1acc0544ffd527511c69c0e | {
"func_code_index": [
1508,
1834
]
} | 6,499 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.