tranche tweaks

This commit is contained in:
Tim Olson
2023-12-09 00:59:49 -04:00
parent 7e33ffba76
commit f5fe0a45b7
2 changed files with 13 additions and 11 deletions

View File

@@ -37,6 +37,7 @@
</template>
<template v-slot:expanded-row="{item}">
<tr>
<td>&nbsp;</td>
<td colspan="100">
<v-table>
<!--
@@ -50,8 +51,8 @@
-->
<tbody>
<tr v-for="(t, i) in item.order.tranches">
<td>Tranche {{ i + 1 }}</td>
<td>
<td class="text-right">Tranche {{ i + 1 }}</td>
<td class="text-center w-33">
<suspense>
<span>
<token-amount :addr="item.amountToken" :amount="item.trancheFilled[i]" :raw="true"/>
@@ -60,10 +61,11 @@
</span>
</suspense>
</td>
<td>
{{describeTrancheTime(item,t)}}
{{describeTrancheLine(item,true,t.minIntercept,t.minSlope)}}
{{describeTrancheLine(item,false,t.maxIntercept,t.maxSlope)}}
<td class="text-left">
<span class="mx-3">{{ describeTrancheTime(item, true, t) }}</span>
<span class="mx-3">{{ describeTrancheTime(item, false, t) }}</span>
<span class="mx-3">{{ describeTrancheLine(item, true, t.minIntercept, t.minSlope) }}</span>
<span class="mx-3">{{ describeTrancheLine(item, false, t.maxIntercept, t.maxSlope) }}</span>
</td>
</tr>
</tbody>
@@ -225,22 +227,20 @@ const orders = computed(()=>{
return result
})
function describeTrancheTime(st, t) {
function describeTrancheTime(st, isStart, t) {
let result = ''
if( t.minIsBarrier || t.maxIsBarrier )
return 'barrier'
if( t.startTime > 0 ) {
if( isStart && t.startTime > 0 ) {
const started = t.startTimeIsRelative ? st.start + t.startTime : t.startTime
console.log('started', started, st.start, t.startTime)
result += started*1000 < Date.now() ? 'Activated ' : 'Activates '
result += dateString(started) + ' '
}
if( t.endTime < 4294967295 ) {
if( !isStart && t.endTime < 4294967295 ) {
const ended = t.endTimeIsRelative ? st.start + t.endTime : t.endTime
result += ended*1000 < Date.now() ? 'Expired ' : 'Expires '
result += dateString(ended)
}
console.log('tt', st, t)
return result
}