Skip to content

Instantly share code, notes, and snippets.

@PaulRBerg
Created June 2, 2020 19:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save PaulRBerg/fad9cedad82d467b9b3bb77dcdddede8 to your computer and use it in GitHub Desktop.
Save PaulRBerg/fad9cedad82d467b9b3bb77dcdddede8 to your computer and use it in GitHub Desktop.
Makes the solidity vscode extension crash
/* SPDX-License-Identifier: LGPL-3.0-or-later */
pragma solidity ^0.6.8;
import "./ErrorReporter.sol";
import "./SbAdmin.sol";
import "./SbErc20Interface.sol";
import "./SbErc20Storage.sol";
import "./ReentrancyGuard.sol";
/**
* @title SbErc20
* @author Sablier
* @notice Sablier's SbErc20 contract
*/
abstract contract SbErc20 is SbErc20Interface, SbErc20Storage, SbAdmin, ErrorReporter, ReentrancyGuard {
/*** Contract Logic Starts Here ***/
/**
* @param underlying_ The address of the underlying asset.
* @param exchangeRateMantissa_ The initial exchange rate, scaled by 1e18.
* @param name_ Erc20 name of this token.
* @param symbol_ Erc20 symbol of this token.
* @param decimals_ EIP-20 decimal precision of this token
*/
constructor(
address underlying_,
uint256 exchangeRateMantissa_,
string memory name_,
string memory symbol_,
uint8 decimals_
) public {
admin = msg.sender;
/* Set underlying and sanity check it */
underlying = underlying_;
Erc20Interface(underlying_).totalSupply();
exchangeRateMantissa = exchangeRateMantissa_;
/* Set the identifiers for this SbToken */
name = name_;
symbol = symbol_;
decimals = decimals_;
}
/*** Public Functions ***/
/*** View Functions ***/
function getCash() external view returns (uint256) {
return 0;
}
/*** Non-Constant Functions ***/
/**
* @notice Sender supplies tokens and receives SbTokens in exchange
* @dev Accrues interest whether or not the operation succeeds, unless reverted
* @param mintAmount The amount of the underlying asset to deposit
* @return uint256 true=success, otherwise it reverts
*/
function mint(uint256 mintAmount) external override returns (bool) {
/*
* EFFECTS & INTERACTIONS
* No safe failures beyond this point.
*/
return noError;
}
/**
* @notice Sender redeems SbTokens in exchange for the underlying asset
* @dev Accrues interest whether or not the operation succeeds, unless reverted
* @param redeemTokens The number of SbTokens to redeem into underlying
* @return bool true=success, otherwise it reverts.
*/
function redeem(uint256 redeemTokens) external override returns (bool) {
/*
* EFFECTS & INTERACTIONS
* No safe failures beyond this point)
*/
return noError;
}
/**
* @notice Sender redeems SbTokens 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 bool true=success, otherwise it reverts.
*/
function redeemUnderlying(uint256 redeemAmount) external override returns (bool) {
/*
* EFFECTS & INTERACTIONS
* No safe failures beyond this point)
*/
return noError;
}
/**
* @notice Transfer `amount` tokens from `msg.sender` to `destination`.
* @param destination The address of the destination account.
* @param amount The number of tokens to transfer.
* @return Whether or not the transfer succeeded.
*/
function transfer(address destination, uint256 amount) external override nonReentrant returns (bool) {
return transferTokens(msg.sender, msg.sender, destination, amount) == noError;
}
/**
* @notice Transfer `amount` tokens from `source` to `destination`.
* @param source The address of the source account.
* @param destination The address of the destination account.
* @param amount The number of tokens to transfer.
* @return Whether or not the transfer succeeded.
*/
function transferFrom(
address source,
address destination,
uint256 amount
) external override nonReentrant returns (bool) {
return transferTokens(msg.sender, source, destination, amount) == noError;
}
/*** Internal Functions ***/
/**
* @notice Transfer `amount` tokens from `source` to `destination` by `spender`.
* @dev Called by both `transfer` and `transferFrom` internally.
* @param spender The address of the account performing the transfer.
* @param source The address of the source account.
* @param destination The address of the destination account.
* @param amount The number of tokens to transfer.
* @return bool true=success, otherwise it reverts.
*/
function transferTokens(
address spender,
address source,
address destination,
uint256 amount
) internal returns (bool) {
return noError;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment