Added comments

This commit is contained in:
Thrilok Kumar 2020-05-16 23:21:37 +05:30
parent 2c9ae90b41
commit dc8c18e051

View File

@ -9,34 +9,34 @@ import { DSMath } from "../common/math.sol";
interface SoloMarginContract { interface SoloMarginContract {
struct Info { struct Info {
address owner; // The address that owns the account address owner;
uint256 number; // A nonce that allows a single address to control many accounts uint256 number;
} }
enum ActionType { enum ActionType {
Deposit, // supply tokens Deposit,
Withdraw, // borrow tokens Withdraw,
Transfer, // transfer balance between accounts Transfer,
Buy, // buy an amount of some token (externally) Buy,
Sell, // sell an amount of some token (externally) Sell,
Trade, // trade tokens against another account Trade,
Liquidate, // liquidate an undercollateralized or expiring account Liquidate,
Vaporize, // use excess tokens to zero-out a completely negative account Vaporize,
Call // send arbitrary data to an address Call
} }
enum AssetDenomination { enum AssetDenomination {
Wei, // the amount is denominated in wei Wei,
Par // the amount is denominated in par Par
} }
enum AssetReference { enum AssetReference {
Delta, // the amount is given as a delta from the current value Delta,
Target // the amount is given as an exact number to end up at Target
} }
struct AssetAmount { struct AssetAmount {
bool sign; // true if positive bool sign;
AssetDenomination denomination; AssetDenomination denomination;
AssetReference ref; AssetReference ref;
uint256 value; uint256 value;
@ -54,7 +54,7 @@ interface SoloMarginContract {
} }
struct Wei { struct Wei {
bool sign; // true if positive bool sign;
uint256 value; uint256 value;
} }
@ -149,7 +149,11 @@ contract BasicResolver is DydxHelpers {
event LogPayback(address indexed token, uint marketId, uint256 tokenAmt, uint256 getId, uint256 setId); event LogPayback(address indexed token, uint marketId, uint256 tokenAmt, uint256 getId, uint256 setId);
/** /**
* @dev Deposit ETH/ERC20 * @dev Deposit ETH/ERC20_Token.
* @param token token address to deposit.(For ETH: 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE)
* @param amt token amount to deposit.
* @param getId Get token amount at this ID from `InstaMemory` Contract.
* @param setId Set token amount at this ID in `InstaMemory` Contract.
*/ */
function deposit(address token, uint amt, uint getId, uint setId) external payable{ function deposit(address token, uint amt, uint getId, uint setId) external payable{
SoloMarginContract dydxContract = SoloMarginContract(getDydxAddress()); SoloMarginContract dydxContract = SoloMarginContract(getDydxAddress());
@ -181,7 +185,13 @@ contract BasicResolver is DydxHelpers {
EventInterface(getEventAddr()).emitEvent(_type, _id, _eventCode, _eventParam); EventInterface(getEventAddr()).emitEvent(_type, _id, _eventCode, _eventParam);
} }
/**
* @dev Withdraw ETH/ERC20_Token.
* @param token token address to withdraw.(For ETH: 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE)
* @param amt token amount to withdraw.
* @param getId Get token amount at this ID from `InstaMemory` Contract.
* @param setId Set token amount at this ID in `InstaMemory` Contract.
*/
function withdraw(address token, uint amt, uint getId, uint setId) external payable{ function withdraw(address token, uint amt, uint getId, uint setId) external payable{
SoloMarginContract dydxContract = SoloMarginContract(getDydxAddress()); SoloMarginContract dydxContract = SoloMarginContract(getDydxAddress());
@ -213,7 +223,11 @@ contract BasicResolver is DydxHelpers {
} }
/** /**
* @dev Borrow ETH/ERC20 * @dev Borrow ETH/ERC20_Token.
* @param token token address to borrow.(For ETH: 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE)
* @param amt token amount to borrow.
* @param getId Get token amount at this ID from `InstaMemory` Contract.
* @param setId Set token amount at this ID in `InstaMemory` Contract.
*/ */
function borrow(address token, uint amt, uint getId, uint setId) external payable { function borrow(address token, uint amt, uint getId, uint setId) external payable {
SoloMarginContract dydxContract = SoloMarginContract(getDydxAddress()); SoloMarginContract dydxContract = SoloMarginContract(getDydxAddress());
@ -242,7 +256,11 @@ contract BasicResolver is DydxHelpers {
} }
/** /**
* @dev Payback ETH/ERC20 * @dev Payback borrowed ETH/ERC20_Token.
* @param token token address to payback.(For ETH: 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE)
* @param amt token amount to payback.
* @param getId Get token amount at this ID from `InstaMemory` Contract.
* @param setId Set token amount at this ID in `InstaMemory` Contract.
*/ */
function payback(address token, uint amt, uint getId, uint setId) external payable { function payback(address token, uint amt, uint getId, uint setId) external payable {
SoloMarginContract dydxContract = SoloMarginContract(getDydxAddress()); SoloMarginContract dydxContract = SoloMarginContract(getDydxAddress());