From 3e624c9c76019a17c19616176f521874b22cd781 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julian=20=C4=86wirko?= Date: Sat, 17 Dec 2022 13:15:16 +0100 Subject: [PATCH] account store gas calc adjustments --- CHANGELOG.md | 3 +++ package.json | 2 +- src/account-store.ts | 12 ++++++------ 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a5ed66c..62c7425 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +### [0.7.2](https://github.com/xdevguild/buildo-begins/releases/tag/v0.7.2) (2022-12-17) +- adjust gas limit calculation for the `buildo-begins account-store` + ### [0.7.1](https://github.com/xdevguild/buildo-begins/releases/tag/v0.7.1) (2022-12-11) - added `buildo-begins account-store` (Account storage) - you can now save custom data under an account as key-value pairs - updated dependencies diff --git a/package.json b/package.json index a7813ae..0335a03 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ }, "type": "module", "types": "build/types", - "version": "0.7.1", + "version": "0.7.2", "description": "MultiversX (Elrond) blockchain CLI helper tools", "main": "build/index.js", "bin": { diff --git a/src/account-store.ts b/src/account-store.ts index a5a844b..b7e2fa5 100644 --- a/src/account-store.ts +++ b/src/account-store.ts @@ -31,9 +31,9 @@ const getTotalAdditionalGasLimit = ( data: TransactionPayload, keyValuePairs: string ) => { - const saveKeyValueCost = 250000; - const moveBalanceCost = 50000; - const costPerByte = data.length() * 1500; + const saveKeyValueCost = 100_000; + const moveBalanceCost = 50_000; + const costPerByte = data.length() * 1_500; let persistPerByteKey = 0; let persistPerByteValue = 0; @@ -44,9 +44,9 @@ const getTotalAdditionalGasLimit = ( const split = keyValue.replaceAll(' ', '').split(':'); const key = split[0]; const value = split[1]; - persistPerByteKey = persistPerByteKey + key.length * 10_000; - persistPerByteValue = persistPerByteValue + value.length * 10_000; - storePerByte = storePerByte + value.length * 50_000; + persistPerByteKey = persistPerByteKey + key.length * 1_000; + persistPerByteValue = persistPerByteValue + value.length * 1_000; + storePerByte = storePerByte + value.length * 10_000; } }