Describe the issue
Changing the structure of the originations object for better discoverability.
Examples
The current originations object is structured as follows:
{
"chinstrap": {
"networks": {
"development": {
"ce454cb23b49e96cd9190eed128ab4eb5e83bca865b3c3ef1c4ede0124ba5a0a": {
"orignation_hash": "ooDL2ymhse9ExVpJCV9M1xD54ACPXr7s7DQ2fejXTHz2jXmb94i",
"address": "KT1VuEMFcjJ1GnhVyg3LdfYbhKH7F7wo2u5B",
"name": "contract_name",
"date": "2022-08-16T11:22:48.104119"
},
}
}
}
}
For better discoverability I propose the following:
{
"chinstrap": {
"networks": {
"development": {
"<contract_name>": [
{
"hash": "ce454cb23b49e96cd9190eed128ab4eb5e83bca865b3c3ef1c4ede0124ba5a0a",
"orignation_hash": "ooDL2ymhse9ExVpJCV9M1xD54ACPXr7s7DQ2fejXTHz2jXmb94i",
"address": "KT1VuEMFcjJ1GnhVyg3LdfYbhKH7F7wo2u5B",
"name": "contract_name",
"date": "2022-08-16T11:22:48.104119"
}
]
}
}
}
}
At every run of chinstrap originate
, the script would check if a contract already exists at the corresponding index of the contract_name
array. For example, suppose you want to deploy two instances of nft_contract
to the sandbox and have two files in the originations/
folder:
- 1_nft_contract_a.py
- 2_nft_contract_b.py
The steps would be as follows:
- On the first run of
chinstrap originate
, two instances will be originated and two corresponding objects will be appended to the array under chinstrap.networks.development.nft_contract
- On the second run of chinstrap originate, the script detects that contracts already exist at index 0 and 1 of the
chinstrap.networks.development.nft_contract
, and simply returns the existing deployments.
- You add
3_nft_contract_b.py
to the originations/
folder and run chinstrap originate
. The first two originations are skipped as per the logic above, but the third one is executed because the script detects nothing at index 3 of the nft_contract
array.