aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGreg Hysen <greg.hysen@gmail.com>2018-11-26 13:20:46 +0800
committerGreg Hysen <greg.hysen@gmail.com>2018-11-29 08:38:11 +0800
commit3bf5a4e83f57f82090a64fc76fcc7bf3f7c68607 (patch)
tree40c39bcd9bc4a1a960a0cbe1214d696ef132449e
parent50344fa24a4a708ae90030af107afb15366f883f (diff)
downloaddexon-sol-tools-3bf5a4e83f57f82090a64fc76fcc7bf3f7c68607.tar
dexon-sol-tools-3bf5a4e83f57f82090a64fc76fcc7bf3f7c68607.tar.gz
dexon-sol-tools-3bf5a4e83f57f82090a64fc76fcc7bf3f7c68607.tar.bz2
dexon-sol-tools-3bf5a4e83f57f82090a64fc76fcc7bf3f7c68607.tar.lz
dexon-sol-tools-3bf5a4e83f57f82090a64fc76fcc7bf3f7c68607.tar.xz
dexon-sol-tools-3bf5a4e83f57f82090a64fc76fcc7bf3f7c68607.tar.zst
dexon-sol-tools-3bf5a4e83f57f82090a64fc76fcc7bf3f7c68607.zip
Moved some consts outside of a loop
-rw-r--r--packages/utils/src/abi_encoder/calldata/calldata.ts11
1 files changed, 6 insertions, 5 deletions
diff --git a/packages/utils/src/abi_encoder/calldata/calldata.ts b/packages/utils/src/abi_encoder/calldata/calldata.ts
index da61b2256..668b92f06 100644
--- a/packages/utils/src/abi_encoder/calldata/calldata.ts
+++ b/packages/utils/src/abi_encoder/calldata/calldata.ts
@@ -178,6 +178,12 @@ export class Calldata {
if (this._root === undefined) {
throw new Error('expected root');
}
+ // Constants for constructing annotated string
+ const offsetPadding = 10;
+ const valuePadding = 74;
+ const namePadding = 80;
+ const evmWordStartIndex = 0;
+ const emptySize = 0;
// Construct annotated calldata
let hexValue = `${this._selector}`;
let offset = 0;
@@ -189,11 +195,6 @@ export class Calldata {
const name = block.getName();
const parentName = block.getParentName();
const prettyName = name.replace(`${parentName}.`, '').replace(`${functionName}.`, '');
- const offsetPadding = 10;
- const valuePadding = 74;
- const namePadding = 80;
- const evmWordStartIndex = 0;
- const emptySize = 0;
// Resulting line will be <offsetStr><valueStr><nameStr>
let offsetStr = '';
let valueStr = '';