Skip to content

Commit

Permalink
optimize burn
Browse files Browse the repository at this point in the history
  • Loading branch information
m-kus committed Apr 12, 2020
1 parent 3337696 commit 028c49f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 27 deletions.
15 changes: 2 additions & 13 deletions src/components/InternalOperation.vue
Original file line number Diff line number Diff line change
Expand Up @@ -384,10 +384,10 @@ export default {
return `overline ${this.data.kind}`;
},
burned() {
let val = this.getBurned(this.data);
let val = this.data.burned || 0;
if (!this.data.internal && !this.data.mempool) {
for (let i = 0; i < this.data.internal_operations.length; i++) {
val += this.getBurned(this.data.internal_operations[i]);
val += this.data.internal_operations[i].burned || 0;
}
}
Expand Down Expand Up @@ -416,17 +416,6 @@ export default {
.catch(err => console.log(err))
.finally(() => (this.loadingRaw = false));
},
getBurned(data) {
if (this.data.status !== "applied" || this.data.mempool) return 0;
let val = 0;
if (data.result.paid_storage_size_diff)
val += data.result.paid_storage_size_diff * 1000;
if (data.result.allocated_destination_contract) val += 257000;
return val;
},
getChangedItems(item) {
let res = item.children.map(x => this.getChangedItems(x), this).flat();
if (item.kind || res.length > 0) res.push(item);
Expand Down
16 changes: 2 additions & 14 deletions src/components/Operation.vue
Original file line number Diff line number Diff line change
Expand Up @@ -166,9 +166,9 @@ export default {
},
totalCost() {
if (this.value.mempool) return 0;
let val = this.getBurned(this.value)
let val = this.value.burned || 0;
for (let i = 0; i < this.value.internal_operations.length; i++) {
val += this.getBurned(this.value.internal_operations[i]);
val += this.value.internal_operations[i].burned || 0;
}
if (!isNaN(this.value.fee)) {
val += this.value.fee;
Expand Down Expand Up @@ -233,18 +233,6 @@ export default {
}
return val;
},
getBurned(data) {
if (this.value.status !== "applied" || this.value.mempool)
return 0;
let val = 0;
if (data.result.paid_storage_size_diff)
val += data.result.paid_storage_size_diff * 1000;
if (data.result.allocated_destination_contract)
val += 257000;
return val;
},
getInvoker(data) {
if (data.source_alias !== undefined) {
return data.source_alias;
Expand Down

0 comments on commit 028c49f

Please sign in to comment.