-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
534 additions
and
1 deletion.
There are no files selected for viewing
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 |
---|---|---|
|
@@ -149,4 +149,4 @@ dist | |
.yarn/install-state.gz | ||
.pnp.* | ||
|
||
|
||
tree.json |
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,27 @@ | ||
// https://github.com/OpenZeppelin/merkle-tree?tab=readme-ov-file#building-a-tree | ||
|
||
import { StandardMerkleTree } from "@openzeppelin/merkle-tree"; | ||
import fs from "fs"; | ||
|
||
async function main() { | ||
try { | ||
const values = [ | ||
["0x1111111111111111111111111111111111111111", "5000000000000000000"], | ||
["0x2222222222222222222222222222222222222222", "2500000000000000000"] | ||
]; | ||
|
||
const tree = StandardMerkleTree.of(values, ["address", "uint256"]); | ||
|
||
console.log('Merkle Root:', tree.root); | ||
fs.writeFileSync("tree.json", JSON.stringify(tree.dump())); | ||
|
||
console.log('Done.') | ||
} catch (err) { | ||
console.log(err) | ||
} | ||
} | ||
|
||
main().catch((error) => { | ||
console.error(error); | ||
process.exitCode = 1; | ||
}); |
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,18 @@ | ||
{ | ||
"name": "eth-merkle-drop", | ||
"author": "P2P Validator <[email protected]>", | ||
"license": "MIT", | ||
"scripts": { | ||
"01-generate-merkle-tree": "ts-node 01-generate-merkle-tree.ts", | ||
"deploy": "forge script script/Deploy.s.sol:Deploy --rpc-url $RPC_URL --private-key $PRIVATE_KEY --broadcast --chain holesky --json --verify --etherscan-api-key $ETHERSCAN_API_KEY -vvvvv" | ||
}, | ||
"dependencies": { | ||
"@openzeppelin/merkle-tree": "1.0.7", | ||
"@types/node": "22.5.4", | ||
"cross-env": "7.0.3", | ||
"dotenv": "16.4.5", | ||
"ts-node": "10.9.2", | ||
"typescript": "5.6.2" | ||
}, | ||
"packageManager": "[email protected]+sha512.4abf725084d7bcbafbd728bfc7bee61f2f791f977fd87542b3579dcb23504d170d46337945e4c66485cd12d588a0c0e570ed9c477e7ccdd8507cf05f3f92eaca" | ||
} |
Oops, something went wrong.