UNPKG

5.52 kBJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3const BigNumber_1 = require("./utils/BigNumber");
4/**
5 * black hole address on Asimov blockchain.
6 */
7const AddressZero = '0x6600000000000000000000000000000000000000';
8exports.AddressZero = AddressZero;
9/**
10 * zero value hash.
11 */
12const HashZero = '0x0000000000000000000000000000000000000000000000000000000000000000';
13exports.HashZero = HashZero;
14/**
15 * BN -1
16 */
17const NegativeOne = BigNumber_1.bigNumberify(-1);
18exports.NegativeOne = NegativeOne;
19/**
20 * BN 0
21 */
22const Zero = BigNumber_1.bigNumberify(0);
23exports.Zero = Zero;
24/**
25 * BN 1
26 */
27const One = BigNumber_1.bigNumberify(1);
28exports.One = One;
29/**
30 * BN 2
31 */
32const Two = BigNumber_1.bigNumberify(2);
33exports.Two = Two;
34/**
35 * BN max uint256
36 */
37const MaxUint256 = BigNumber_1.bigNumberify('0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff');
38exports.MaxUint256 = MaxUint256;
39/**
40 * default asset type, which is Asim on Asimov MainNet.
41 */
42const DefaultAsset = '000000000000000000000000';
43exports.DefaultAsset = DefaultAsset;
44/**
45 * Complier errors.
46 */
47const COMPILE_ERROR_TYPE = {
48 JSONError: 'JSONError',
49 IOError: 'IOError',
50 ParserError: 'ParserError',
51 DocstringParsingError: 'DocstringParsingError',
52 SyntaxError: 'SyntaxError',
53 DeclarationError: 'DeclarationError',
54 TypeError: 'TypeError',
55 UnimplementedFeatureError: 'UnimplementedFeatureError',
56 InternalCompilerError: 'InternalCompilerError',
57 Exception: 'Exception',
58 CompilerError: 'CompilerError',
59 FatalError: 'FatalError',
60 Warning: 'Warning'
61};
62exports.COMPILE_ERROR_TYPE = COMPILE_ERROR_TYPE;
63/**
64 * Transaction object.
65 */
66const TRANSACTION = {
67 /**
68 * types of contract invocation on Asimov blockchain.
69 */
70 CONTRACT_TYPE: {
71 /**
72 * deploy a new contract instance.
73 */
74 CREATE: 'create',
75 /**
76 * call contract methods.
77 */
78 CALL: 'call',
79 /**
80 * submit a new template.
81 */
82 TEMPLATE: 'template',
83 /**
84 * vote on contract methods.
85 */
86 VOTE: 'vote'
87 },
88 /**
89 * version.
90 */
91 DEFAULT_VERSION: 1,
92 /**
93 * lock time.
94 */
95 DEFAULT_LOCK_TIME: 0
96};
97exports.TRANSACTION = TRANSACTION;
98/**
99 * asset type of UTXO.
100 */
101const ASSET_TYPE = {
102 /**
103 * fungible asset (dividable).
104 */
105 DEVIDABLE: 0,
106 /**
107 * non fungible asset (not dividable).
108 */
109 UNDEVIDABLE: 1
110};
111exports.ASSET_TYPE = ASSET_TYPE;
112/**
113 * organization id is assigned when registering to Asimov blockchain, it grows incrementally from 1 to max of uint32.
114 */
115const DEFAULT_ORGANIZATION_ID = 0;
116exports.DEFAULT_ORGANIZATION_ID = DEFAULT_ORGANIZATION_ID;
117/**
118 * address length on Asimov blockchain with 1 byte type prefix.
119 *
120 * - 66 - normal account.
121 * - 63 - contract.
122 */
123const ADDRESS_LENGTH = 21;
124exports.ADDRESS_LENGTH = ADDRESS_LENGTH;
125/**
126 * asset length on Asimov blockchain.
127 *
128 * - bytes [1,4] - asset properties.
129 * - bytes [5,8] - organization id.
130 * - bytes [9,12] - asset index inside the organization.
131 */
132const ASSETS_LENGTH = 12;
133exports.ASSETS_LENGTH = ASSETS_LENGTH;
134/**
135 * addresses reserved for system contracts.
136 * from 0x6300000000000000000000000000000000000064 to 0x63000000000000000000000000000000000003E7.
137 */
138const GENESIS_CONTRACT = {
139 MIN: 100,
140 MAX: 999
141};
142exports.GENESIS_CONTRACT = GENESIS_CONTRACT;
143/**
144 * special method types in contract.
145 *
146 * - view/pure - readonly method
147 * - constructor
148 */
149const MethodType = {
150 View: 'view',
151 Pure: 'pure',
152 Constructor: 'constructor'
153};
154exports.MethodType = MethodType;
155/**
156 * system contracts.
157 */
158const SYSTEM_CONTRACT_ADDRESS = {
159 /**
160 * Genesis organization (Asimov foundation)
161 */
162 GenesisOrganization: '0x630000000000000000000000000000000000000064',
163 /**
164 * Schedule contract, DEPRECATED.
165 */
166 Schedule: '0x630000000000000000000000000000000000000069',
167 /**
168 * Consensus management.
169 */
170 ConsensusManagement: '0x630000000000000000000000000000000000000068',
171 /**
172 * Registry center.
173 */
174 RegistryCenter: '0x630000000000000000000000000000000000000065',
175 /**
176 * Template warehouse.
177 */
178 TemplateWarehouse: '0x630000000000000000000000000000000000000067',
179 /**
180 * Validator committee.
181 */
182 ValidatorCommittee: '0x630000000000000000000000000000000000000066'
183};
184exports.SYSTEM_CONTRACT_ADDRESS = SYSTEM_CONTRACT_ADDRESS;
185/**
186 * default transaction fee settings with value set to 21000 satoshis and asset type set to Asim.
187 */
188const DefaultFee = {
189 amount: 21000,
190 asset: '000000000000000000000000'
191};
192exports.DefaultFee = DefaultFee;
193/**
194 * gas amplifier on the estimated gas limit. gas estimation is augmented to make sure enough gas is provided to the transaction.
195 */
196const GasAmplifier = 1.2;
197exports.GasAmplifier = GasAmplifier;
198/**
199 * fee amplifier on the estimated fee. fee estimation is augmented to make sure enough fee is provided to the transaction.
200 */
201const FeeAmplifier = 1.2;
202exports.FeeAmplifier = FeeAmplifier;
203/**
204 * minimal gas limit set on a transaction.
205 */
206const MinGasLimit = 21000;
207exports.MinGasLimit = MinGasLimit;
208/**
209 * default template category. 1 represents organization.
210 */
211const DefaultCategory = 1;
212exports.DefaultCategory = DefaultCategory;
213/**
214 * default gas price.
215 */
216const DefaultGasPrice = 0.02;
217exports.DefaultGasPrice = DefaultGasPrice;
218//# sourceMappingURL=Constant.js.map
\No newline at end of file