Skip to content

Commit

Permalink
account store gas calc adjustments
Browse files Browse the repository at this point in the history
  • Loading branch information
juliancwirko committed Dec 17, 2022
1 parent b647596 commit 3e624c9
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
12 changes: 6 additions & 6 deletions src/account-store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
}
}

Expand Down

0 comments on commit 3e624c9

Please sign in to comment.