update starter view
This commit is contained in:
@@ -121,8 +121,11 @@ module.exports = {
|
|||||||
//=================== Starter ===================
|
//=================== Starter ===================
|
||||||
DODOStarterProxy: "0x451E07405B79eDEEA87ccFa57e1BaF184Bea6773",
|
DODOStarterProxy: "0x451E07405B79eDEEA87ccFa57e1BaF184Bea6773",
|
||||||
DODOStarterFactory: "0xa28D60c3eCDc52521c8219bd6a4eba0AA8900F88",
|
DODOStarterFactory: "0xa28D60c3eCDc52521c8219bd6a4eba0AA8900F88",
|
||||||
FairFunding: "0x9124B1191DDB6CB1CAF9aA899d5059ea52b5D09B",
|
FairFunding: "0x6eB0b12F31Bfe983a099DcBe9D2CC86768Dd2a3a", //0x9124B1191DDB6CB1CAF9aA899d5059ea52b5D09B
|
||||||
InstantFunding: "0x80B21A1A832D3b0016A0d287967CD9Dce0Ade688"
|
InstantFunding: "0xC2ff4432F111723DD28c52C0f7B1Fe9c6201F3ce", //0x80B21A1A832D3b0016A0d287967CD9Dce0Ade688
|
||||||
|
|
||||||
|
UserQuota: "0xEC548eB229f6C5E1E4d3701F9dD258486E127811",
|
||||||
|
UserQuotaFactory: "0x44640D5a85653279Bf22A45112d3db1BDf14aEF2"
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -24,7 +24,7 @@ contract UserQuota is InitializableOwnable, IQuota {
|
|||||||
for(uint256 i = 0; i< users.length; i++) {
|
for(uint256 i = 0; i< users.length; i++) {
|
||||||
require(users[i] != address(0), "USER_INVALID");
|
require(users[i] != address(0), "USER_INVALID");
|
||||||
userQuota[users[i]] = quotas[i];
|
userQuota[users[i]] = quotas[i];
|
||||||
// emit SetQuota(users[i],quotas[i]);
|
emit SetQuota(users[i],quotas[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
53
contracts/DODOFee/UserQuotaFactory.sol
Normal file
53
contracts/DODOFee/UserQuotaFactory.sol
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
/*
|
||||||
|
|
||||||
|
Copyright 2022 DODO ZOO.
|
||||||
|
SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
pragma solidity 0.6.9;
|
||||||
|
pragma experimental ABIEncoderV2;
|
||||||
|
|
||||||
|
import {ICloneFactory} from "../lib/CloneFactory.sol";
|
||||||
|
import {InitializableOwnable} from "../lib/InitializableOwnable.sol";
|
||||||
|
|
||||||
|
|
||||||
|
interface IQuota {
|
||||||
|
function initOwner(address newOwner) external;
|
||||||
|
function getUserQuota(address user) external view returns (int);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @title DODO UserQuotaFactory
|
||||||
|
* @author DODO Breeder
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
contract UserQuotaFactory is InitializableOwnable{
|
||||||
|
// ============ Templates ============
|
||||||
|
|
||||||
|
address public immutable _CLONE_FACTORY_;
|
||||||
|
address public immutable _USER_QUOTA_TEMPLATE_;
|
||||||
|
|
||||||
|
// ============ Events ============
|
||||||
|
|
||||||
|
event NewQuota(address quota);
|
||||||
|
|
||||||
|
// ============ Functions ============
|
||||||
|
|
||||||
|
constructor(
|
||||||
|
address cloneFactory,
|
||||||
|
address quotaTemplate
|
||||||
|
) public {
|
||||||
|
_CLONE_FACTORY_ = cloneFactory;
|
||||||
|
_USER_QUOTA_TEMPLATE_ = quotaTemplate;
|
||||||
|
}
|
||||||
|
|
||||||
|
function createQuota(
|
||||||
|
address quotaOwner
|
||||||
|
) external onlyOwner returns(address newQuota){
|
||||||
|
newQuota = ICloneFactory(_CLONE_FACTORY_).clone(_USER_QUOTA_TEMPLATE_);
|
||||||
|
IQuota(newQuota).initOwner(quotaOwner);
|
||||||
|
emit NewQuota(newQuota);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -322,7 +322,9 @@ contract FairFunding is Vesting {
|
|||||||
uint256 userFundAmount,
|
uint256 userFundAmount,
|
||||||
uint256 currentPrice,
|
uint256 currentPrice,
|
||||||
uint256 soldTokenAmount,
|
uint256 soldTokenAmount,
|
||||||
|
uint256 totalClaimAmount,
|
||||||
uint256 claimableTokenAmount,
|
uint256 claimableTokenAmount,
|
||||||
|
uint256 claimedTokenAmount,
|
||||||
bool isHaveCap,
|
bool isHaveCap,
|
||||||
uint256 userQuota,
|
uint256 userQuota,
|
||||||
uint256 userCurrentQuota
|
uint256 userCurrentQuota
|
||||||
@@ -339,9 +341,29 @@ contract FairFunding is Vesting {
|
|||||||
getRemainingRatio(block.timestamp,0),
|
getRemainingRatio(block.timestamp,0),
|
||||||
totalAllocation
|
totalAllocation
|
||||||
);
|
);
|
||||||
claimableTokenAmount = totalAllocation.sub(remainingToken).sub(_CLAIMED_TOKEN_[user]);
|
claimedTokenAmount = _CLAIMED_TOKEN_[user];
|
||||||
|
claimableTokenAmount = totalAllocation.sub(remainingToken).sub(claimedTokenAmount);
|
||||||
}else {
|
}else {
|
||||||
claimableTokenAmount = 0;
|
claimableTokenAmount = 0;
|
||||||
|
claimedTokenAmount =0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(raiseFundAmount == 0) {
|
||||||
|
totalClaimAmount = 0;
|
||||||
|
} else {
|
||||||
|
uint256 usedFundRatio = DecimalMath.divFloor(
|
||||||
|
DecimalMath.mulFloor(_TOTAL_TOKEN_AMOUNT_, currentPrice),
|
||||||
|
raiseFundAmount
|
||||||
|
);
|
||||||
|
|
||||||
|
if (usedFundRatio > DecimalMath.ONE) {
|
||||||
|
usedFundRatio = DecimalMath.ONE;
|
||||||
|
}
|
||||||
|
|
||||||
|
totalClaimAmount = DecimalMath.divFloor(
|
||||||
|
DecimalMath.mulFloor(userFundAmount, usedFundRatio),
|
||||||
|
currentPrice
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(_QUOTA_ == address(0)) {
|
if(_QUOTA_ == address(0)) {
|
||||||
|
|||||||
@@ -245,7 +245,9 @@ contract InstantFunding is Vesting {
|
|||||||
uint256 userFundAmount,
|
uint256 userFundAmount,
|
||||||
uint256 currentPrice,
|
uint256 currentPrice,
|
||||||
uint256 soldTokenAmount,
|
uint256 soldTokenAmount,
|
||||||
|
uint256 totalClaimAmount,
|
||||||
uint256 claimableTokenAmount,
|
uint256 claimableTokenAmount,
|
||||||
|
uint256 claimedTokenAmount,
|
||||||
bool isHaveCap,
|
bool isHaveCap,
|
||||||
uint256 userQuota,
|
uint256 userQuota,
|
||||||
uint256 userCurrentQuota
|
uint256 userCurrentQuota
|
||||||
@@ -260,12 +262,17 @@ contract InstantFunding is Vesting {
|
|||||||
uint256 remainingToken = DecimalMath.mulFloor(
|
uint256 remainingToken = DecimalMath.mulFloor(
|
||||||
getRemainingRatio(block.timestamp,0),
|
getRemainingRatio(block.timestamp,0),
|
||||||
totalAllocation
|
totalAllocation
|
||||||
);
|
);
|
||||||
claimableTokenAmount = totalAllocation.sub(remainingToken).sub(_CLAIMED_TOKEN_[user]);
|
claimedTokenAmount = _CLAIMED_TOKEN_[user];
|
||||||
|
claimableTokenAmount = totalAllocation.sub(remainingToken).sub(claimedTokenAmount);
|
||||||
}else {
|
}else {
|
||||||
claimableTokenAmount = 0;
|
claimableTokenAmount = 0;
|
||||||
|
claimedTokenAmount = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
totalClaimAmount = getUserTokenAllocation(user);
|
||||||
|
|
||||||
|
|
||||||
if(_QUOTA_ == address(0)) {
|
if(_QUOTA_ == address(0)) {
|
||||||
isHaveCap = false;
|
isHaveCap = false;
|
||||||
userQuota = uint256(-1);
|
userQuota = uint256(-1);
|
||||||
|
|||||||
@@ -52,3 +52,25 @@ network type: rinkeby
|
|||||||
Deploy time: 2022/2/15 上午9:12:58
|
Deploy time: 2022/2/15 上午9:12:58
|
||||||
Deploy type: STARTER
|
Deploy type: STARTER
|
||||||
InstantFundingTemplate: 0x80B21A1A832D3b0016A0d287967CD9Dce0Ade688
|
InstantFundingTemplate: 0x80B21A1A832D3b0016A0d287967CD9Dce0Ade688
|
||||||
|
====================================================
|
||||||
|
network type: rinkeby
|
||||||
|
Deploy time: 2022/2/17 上午11:25:15
|
||||||
|
Deploy type: QuotaFactory
|
||||||
|
====================================================
|
||||||
|
network type: rinkeby
|
||||||
|
Deploy time: 2022/2/17 上午11:30:18
|
||||||
|
Deploy type: QuotaFactory
|
||||||
|
UserQuotaAddress: 0xEC548eB229f6C5E1E4d3701F9dD258486E127811
|
||||||
|
UserQuotaFactoryAddress: 0x44640D5a85653279Bf22A45112d3db1BDf14aEF2
|
||||||
|
Init UserQuotaFactory Tx: 0x8224ab09182dfb31ecfd03bea3fdba5b5aa620c42a3e33c545b3e40975538981
|
||||||
|
====================================================
|
||||||
|
network type: rinkeby
|
||||||
|
Deploy time: 2022/2/18 下午1:36:36
|
||||||
|
Deploy type: STARTER
|
||||||
|
FairFundingTemplate: 0x6eB0b12F31Bfe983a099DcBe9D2CC86768Dd2a3a
|
||||||
|
InstantFundingTemplate: 0x95D6c48375E7A59438EDc37183676A6706c9bB2a
|
||||||
|
====================================================
|
||||||
|
network type: rinkeby
|
||||||
|
Deploy time: 2022/2/18 下午1:47:09
|
||||||
|
Deploy type: STARTER
|
||||||
|
InstantFundingTemplate: 0xC2ff4432F111723DD28c52C0f7B1Fe9c6201F3ce
|
||||||
|
|||||||
@@ -4,6 +4,9 @@ const file = fs.createWriteStream("../deploy-starter.txt", { 'flags': 'a' });
|
|||||||
let logger = new console.Console(file, file);
|
let logger = new console.Console(file, file);
|
||||||
const { GetConfig } = require("../configAdapter.js")
|
const { GetConfig } = require("../configAdapter.js")
|
||||||
|
|
||||||
|
const UserQuota = artifacts.require("UserQuota");
|
||||||
|
const UserQuotaFactory = artifacts.require("UserQuotaFactory");
|
||||||
|
|
||||||
const DODOStarterProxy = artifacts.require("DODOStarterProxy");
|
const DODOStarterProxy = artifacts.require("DODOStarterProxy");
|
||||||
const DODOStarterFactory = artifacts.require("DODOStarterFactory");
|
const DODOStarterFactory = artifacts.require("DODOStarterFactory");
|
||||||
const FairFunding = artifacts.require("FairFunding");
|
const FairFunding = artifacts.require("FairFunding");
|
||||||
@@ -17,6 +20,7 @@ module.exports = async (deployer, network, accounts) => {
|
|||||||
let CloneFactoryAddress = CONFIG.CloneFactory;
|
let CloneFactoryAddress = CONFIG.CloneFactory;
|
||||||
let WETHAddress = CONFIG.WETH;
|
let WETHAddress = CONFIG.WETH;
|
||||||
|
|
||||||
|
|
||||||
if (DODOApproveProxyAddress == "" || CloneFactoryAddress == "" || WETHAddress == "") return;
|
if (DODOApproveProxyAddress == "" || CloneFactoryAddress == "" || WETHAddress == "") return;
|
||||||
|
|
||||||
let FairFundingTemplate = CONFIG.FairFunding;
|
let FairFundingTemplate = CONFIG.FairFunding;
|
||||||
@@ -24,8 +28,39 @@ module.exports = async (deployer, network, accounts) => {
|
|||||||
let DODOStarterFactoryAddress = CONFIG.DODOStarterFactory;
|
let DODOStarterFactoryAddress = CONFIG.DODOStarterFactory;
|
||||||
let DODOStarterProxyAddress = CONFIG.DODOStarterProxy;
|
let DODOStarterProxyAddress = CONFIG.DODOStarterProxy;
|
||||||
|
|
||||||
|
let UserQuotaAddress = CONFIG.UserQuota;
|
||||||
|
let UserQuotaFactoryAddress = CONFIG.UserQuotaFactory;
|
||||||
|
|
||||||
let multiSigAddress = CONFIG.multiSigAddress;
|
let multiSigAddress = CONFIG.multiSigAddress;
|
||||||
|
|
||||||
|
if (deploySwitch.Quota) {
|
||||||
|
logger.log("====================================================");
|
||||||
|
logger.log("network type: " + network);
|
||||||
|
logger.log("Deploy time: " + new Date().toLocaleString());
|
||||||
|
logger.log("Deploy type: QuotaFactory");
|
||||||
|
|
||||||
|
if (UserQuotaAddress == "") {
|
||||||
|
await deployer.deploy(UserQuota);
|
||||||
|
UserQuotaAddress = UserQuota.address;
|
||||||
|
logger.log("UserQuotaAddress: ", UserQuotaAddress);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (UserQuotaFactoryAddress == "") {
|
||||||
|
await deployer.deploy(
|
||||||
|
UserQuotaFactory,
|
||||||
|
CloneFactoryAddress,
|
||||||
|
UserQuotaAddress
|
||||||
|
);
|
||||||
|
|
||||||
|
UserQuotaFactoryAddress = UserQuotaFactory.address;
|
||||||
|
logger.log("UserQuotaFactoryAddress: ", UserQuotaFactoryAddress);
|
||||||
|
|
||||||
|
const instance = await UserQuotaFactory.at(UserQuotaFactoryAddress);
|
||||||
|
var tx = await instance.initOwner(multiSigAddress);
|
||||||
|
logger.log("Init UserQuotaFactory Tx:", tx.tx);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (deploySwitch.STARTER) {
|
if (deploySwitch.STARTER) {
|
||||||
logger.log("====================================================");
|
logger.log("====================================================");
|
||||||
logger.log("network type: " + network);
|
logger.log("network type: " + network);
|
||||||
|
|||||||
Reference in New Issue
Block a user