forked from matter-labs/zksync
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rewrite gen-token-add-contract in ts
- Loading branch information
1 parent
176362d
commit 9bf564e
Showing
10 changed files
with
53 additions
and
88 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import * as fs from 'fs'; | ||
import * as path from 'path'; | ||
import * as Handlebars from 'handlebars'; | ||
|
||
const network = process.env.ETH_NETWORK as string; | ||
const ZKSYNC_HOME = process.env.ZKSYNC_HOME as string; | ||
if (!network) { | ||
throw new Error('ETH_NETWORK is not set'); | ||
} | ||
if (!ZKSYNC_HOME) { | ||
throw new Error('ZKSYNC_HOME is not set'); | ||
} | ||
|
||
const pathToTokenList = path.join(ZKSYNC_HOME, `etc/tokens/${network}.json`); | ||
const tokenList = JSON.parse(fs.readFileSync(pathToTokenList, { encoding: 'utf-8' })); | ||
const pathToExample = path.join(ZKSYNC_HOME, `contracts/contract-templates/TokenInitTemplate.template`); | ||
const template = Handlebars.compile(fs.readFileSync(pathToExample, { encoding: 'utf-8' })); | ||
const templateParams = { | ||
token_len: tokenList.length, | ||
tokens: tokenList | ||
}; | ||
const contract = template(templateParams); | ||
const outputPath = path.join(ZKSYNC_HOME, `contracts/contracts/TokenInit.sol`); | ||
fs.writeFileSync(outputPath, contract, { encoding: 'utf-8' }); |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6933,6 +6933,18 @@ handle-thing@^2.0.0: | |
resolved "https://registry.yarnpkg.com/handle-thing/-/handle-thing-2.0.1.tgz#857f79ce359580c340d43081cc648970d0bb234e" | ||
integrity sha512-9Qn4yBxelxoh2Ow62nP+Ka/kMnOXRi8BXnRaUwezLNhqelnN49xKz4F/dPP8OYLxLxq6JDtZb2i9XznUQbNPTg== | ||
|
||
handlebars@^4.7.6: | ||
version "4.7.6" | ||
resolved "https://registry.yarnpkg.com/handlebars/-/handlebars-4.7.6.tgz#d4c05c1baf90e9945f77aa68a7a219aa4a7df74e" | ||
integrity sha512-1f2BACcBfiwAfStCKZNrUCgqNZkGsAT7UM3kkYtXuLo0KnaVfjKOyf7PRzB6++aK9STyT1Pd2ZCPe3EGOXleXA== | ||
dependencies: | ||
minimist "^1.2.5" | ||
neo-async "^2.6.0" | ||
source-map "^0.6.1" | ||
wordwrap "^1.0.0" | ||
optionalDependencies: | ||
uglify-js "^3.1.4" | ||
|
||
har-schema@^2.0.0: | ||
version "2.0.0" | ||
resolved "https://registry.yarnpkg.com/har-schema/-/har-schema-2.0.0.tgz#a94c2224ebcac04782a0d9035521f24735b7ec92" | ||
|
@@ -12636,6 +12648,11 @@ [email protected]: | |
commander "~2.19.0" | ||
source-map "~0.6.1" | ||
|
||
uglify-js@^3.1.4: | ||
version "3.12.3" | ||
resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-3.12.3.tgz#bb26c4abe0e68c55e9776bca9bed99a4df73facf" | ||
integrity sha512-feZzR+kIcSVuLi3s/0x0b2Tx4Iokwqt+8PJM7yRHKuldg4MLdam4TCFeICv+lgDtuYiCtdmrtIP+uN9LWvDasw== | ||
|
||
ultron@~1.1.0: | ||
version "1.1.1" | ||
resolved "https://registry.yarnpkg.com/ultron/-/ultron-1.1.1.tgz#9fe1536a10a664a65266a1e3ccf85fd36302bc9c" | ||
|
@@ -13541,6 +13558,11 @@ word-wrap@~1.2.3: | |
resolved "https://registry.yarnpkg.com/word-wrap/-/word-wrap-1.2.3.tgz#610636f6b1f703891bd34771ccb17fb93b47079c" | ||
integrity sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ== | ||
|
||
wordwrap@^1.0.0: | ||
version "1.0.0" | ||
resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-1.0.0.tgz#27584810891456a4171c8d0226441ade90cbcaeb" | ||
integrity sha1-J1hIEIkUVqQXHI0CJkQa3pDLyus= | ||
|
||
worker-farm@^1.7.0: | ||
version "1.7.0" | ||
resolved "https://registry.yarnpkg.com/worker-farm/-/worker-farm-1.7.0.tgz#26a94c5391bbca926152002f69b84a4bf772e5a8" | ||
|
@@ -13811,7 +13833,7 @@ zksync-crypto@^0.4.2: | |
integrity sha512-PQw0e7t80uP7c5LHonEh4dS4wGpK2TC4uYR/16jcDCaCS2wY/exF37hAOeQiskb0hnU2C6/jqtvBMbsMTzVh7Q== | ||
|
||
"zksync@link:sdk/zksync.js": | ||
version "0.8.3" | ||
version "0.8.4" | ||
dependencies: | ||
axios "^0.21.0" | ||
websocket "^1.0.30" | ||
|