Gathering detailed insights and metrics for @structured-deployments/core
Gathering detailed insights and metrics for @structured-deployments/core
Gathering detailed insights and metrics for @structured-deployments/core
Gathering detailed insights and metrics for @structured-deployments/core
npm install @structured-deployments/core
Typescript
Module System
Node Version
NPM Version
68.9
Supply Chain
95.3
Quality
80.2
Maintenance
100
Vulnerability
99.6
License
Total Downloads
617
Last Day
2
Last Week
8
Last Month
34
Last Year
617
Minified
Minified + Gzipped
Latest Version
1.1.1
Package Id
@structured-deployments/core@1.1.1
Unpacked Size
19.68 kB
Size
6.19 kB
File Count
6
NPM Version
10.5.2
Node Version
20.13.1
Publised On
24 Jul 2024
Cumulative downloads
Total Downloads
Last day
0%
2
Compared to previous day
Last week
100%
8
Compared to previous week
Last month
161.5%
34
Compared to previous month
Last year
0%
617
Compared to previous year
1
10x your Deploy Scripts
Structured Deployments is a new way to organize your deploy process into a series of tasks. If a task runs successfully the output will be cached locally so it doesn't have to be re-run again. Only new tasks, tasks that previously failed, or tasks that have a changed dependency will be re-run.
This leads to two crucial advantages.
You should use this library if:
You should NOT use this library if:
In this example, we need to do three things:
The task dependency graph looks like this:
Deploy GLDToken -> Deploy Lock -> Transfer 5 GLDToken to Lock
1import { ethers } from "hardhat" 2import { register_contract_deploy } from "@structured-deployments/evm-ethers" 3import { sync_tasks, register_task } from "@structured-deployments/core"; 4 5(async () => { 6 const deploy_mock_erc = await register_contract_deploy( 7 "Gold Token", 8 await ethers.getContractFactory("GLDToken"), 9 [], 10 async () => ([ethers.parseEther("10")]) // Array of constructor args. In this situation, 11 // 10 GLDToken will be minted to deployer 12 ) 13 14 const deploy_lock = await register_contract_deploy( 15 "Lock", 16 await ethers.getContractFactory("Lock"), 17 [deploy_mock_erc], 18 async ([deploy_erc_output]) => { 19 const block_timestamp = (await ethers.provider.getBlock("latest"))?.timestamp 20 if (!block_timestamp) { 21 throw new Error("Could not retrieve latest block_timestamp") 22 } 23 return [ 24 block_timestamp + 60 * 60 * 24 * 7, // Accessible in 1 week 25 deploy_erc_output.contract_address 26 ] 27 } 28 ) 29 30 register_task( 31 "Deposit to Lock", 32 [deploy_lock, deploy_mock_erc], 33 async ([deploy_lock_output, deploy_erc_output]) => { 34 console.log("Depositing GLD Token to Lock contract") 35 const gold_token = await ethers.getContractAt("GLDToken", deploy_erc_output.contract_address) 36 const tx = await gold_token.transfer(deploy_lock_output.contract_address, ethers.parseEther("5")) 37 console.log("Successfully deposited GLD into Lock") 38 return { tx_hash: tx.hash } 39 } 40 ) 41 42 await sync_tasks() 43 44})()
Full example code can be found in the examples
folder
Code is structured into the main @structured-deployments/core
package, and a number of other library packages that provide basic chain-specific premade tasks, like deploying contracts, sending native tokens, and interacting with contracts. It is possible you will be able to write your entire deploy script with just the premade tasks in these libraries, but it is likely you will have to use the register_task
function in core to do anything custom or non-standard.
All projects will need to import the core package: npm install @structured-deployments/core
And also any libraries you may want to use
@structured-deployments/evm-ethers
This project currently is in pre-alpha. There are likely to be rough spots. Please contact me on Telegram if you have any questions or for support: @mjurenka
No vulnerabilities found.
No security vulnerabilities found.