annotation && v2proxy add gasreturn and trade incentive && proxyV2 incentive test

This commit is contained in:
owen05
2021-01-08 17:19:23 +08:00
parent 267ad24edc
commit 34d9ccf668
33 changed files with 537 additions and 90 deletions

View File

@@ -14,6 +14,12 @@ import {DVMTrader} from "./DVMTrader.sol";
import {DVMFunding} from "./DVMFunding.sol";
import {DVMVault} from "./DVMVault.sol";
/**
* @title DODO VendingMachine
* @author DODO Breeder
*
* @notice DODOVendingMachine initialization
*/
contract DVM is DVMTrader, DVMFunding {
function init(
address maintainer,
@@ -76,6 +82,7 @@ contract DVM is DVMTrader, DVMFunding {
}
// ============ Version Control ============
function version() external pure returns (string memory) {
return "DVM 1.0.0";
}

View File

@@ -40,11 +40,10 @@ contract DVMFunding is DVMVault {
quoteInput = quoteBalance.sub(quoteReserve);
require(baseInput > 0, "NO_BASE_INPUT");
// case 1. initial supply
// 包含了 baseReserve == 0 && quoteReserve == 0 的情况
// 在提币的时候向下取整。因此永远不会出现balance为0但totalsupply不为0的情况
// 但有可能出现reserve>0但totalSupply=0的场景
// Round down when withdrawing. Therefore, never be a situation occuring balance is 0 but totalsupply is not 0
// But May Happenreserve >0 But totalSupply = 0
if (totalSupply == 0) {
// case 1. initial supply
require(baseBalance >= 10**3, "INSUFFICIENT_LIQUIDITY_MINED");
shares = baseBalance; // 以免出现balance很大但shares很小的情况
} else if (baseReserve > 0 && quoteReserve == 0) {

View File

@@ -35,7 +35,7 @@ contract DVMTrader is DVMVault {
uint256 quoteAmount
);
// ============ Execute ============
// ============ Trade Functions ============
function sellBase(address to)
external

View File

@@ -179,6 +179,7 @@ contract DVMVault is DVMStorage {
}
// ============================ Permit ======================================
function permit(
address owner,
address spender,
@@ -205,5 +206,4 @@ contract DVMVault is DVMStorage {
);
_approve(owner, spender, value);
}
// ===========================================================================
}