Use totalExecutedPerDay instead of totalSpentPerDay for calculating quota (#460)
This commit is contained in:
parent
125b66b86d
commit
4cc87ef61a
@ -325,7 +325,7 @@ class ForeignStore {
|
|||||||
@action
|
@action
|
||||||
async getCurrentLimit() {
|
async getCurrentLimit() {
|
||||||
try {
|
try {
|
||||||
const result = await getCurrentLimit(this.foreignBridge, this.tokenDecimals)
|
const result = await getCurrentLimit(this.foreignBridge, this.homeStore.homeBridge, this.tokenDecimals)
|
||||||
this.maxCurrentDeposit = result.maxCurrentDeposit
|
this.maxCurrentDeposit = result.maxCurrentDeposit
|
||||||
this.dailyLimit = result.dailyLimit
|
this.dailyLimit = result.dailyLimit
|
||||||
this.totalSpentPerDay = result.totalSpentPerDay
|
this.totalSpentPerDay = result.totalSpentPerDay
|
||||||
|
@ -429,7 +429,11 @@ class HomeStore {
|
|||||||
@action
|
@action
|
||||||
async getCurrentLimit() {
|
async getCurrentLimit() {
|
||||||
try {
|
try {
|
||||||
const result = await getCurrentLimit(this.homeBridge, this.tokenDecimals)
|
const result = await getCurrentLimit(
|
||||||
|
this.homeBridge,
|
||||||
|
this.rootStore.foreignStore.foreignBridge,
|
||||||
|
this.tokenDecimals
|
||||||
|
)
|
||||||
this.maxCurrentDeposit = result.maxCurrentDeposit
|
this.maxCurrentDeposit = result.maxCurrentDeposit
|
||||||
this.dailyLimit = result.dailyLimit
|
this.dailyLimit = result.dailyLimit
|
||||||
this.totalSpentPerDay = result.totalSpentPerDay
|
this.totalSpentPerDay = result.totalSpentPerDay
|
||||||
|
@ -21,10 +21,10 @@ export const getMinPerTxLimit = async (contract, decimals) => {
|
|||||||
return fromDecimals(minPerTx, decimals)
|
return fromDecimals(minPerTx, decimals)
|
||||||
}
|
}
|
||||||
|
|
||||||
export const getCurrentLimit = async (contract, decimals) => {
|
export const getCurrentLimit = async (contract, otherContract, decimals) => {
|
||||||
const currentDay = await contract.methods.getCurrentDay().call()
|
const currentDay = await contract.methods.getCurrentDay().call()
|
||||||
const dailyLimit = await contract.methods.dailyLimit().call()
|
const dailyLimit = await contract.methods.dailyLimit().call()
|
||||||
const totalSpentPerDay = await contract.methods.totalSpentPerDay(currentDay).call()
|
const totalSpentPerDay = await otherContract.methods.totalExecutedPerDay(currentDay).call()
|
||||||
const maxCurrentDeposit = new BN(dailyLimit).minus(new BN(totalSpentPerDay)).toString(10)
|
const maxCurrentDeposit = new BN(dailyLimit).minus(new BN(totalSpentPerDay)).toString(10)
|
||||||
return {
|
return {
|
||||||
maxCurrentDeposit: fromDecimals(maxCurrentDeposit, decimals),
|
maxCurrentDeposit: fromDecimals(maxCurrentDeposit, decimals),
|
||||||
|
Loading…
Reference in New Issue
Block a user