Skip to content

Commit

Permalink
Deployment script: Last touches
Browse files Browse the repository at this point in the history
  • Loading branch information
ueco-jb committed Sep 3, 2024
1 parent 8e57436 commit 22de41b
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 31 deletions.
2 changes: 0 additions & 2 deletions scripts/deploy/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,4 @@ $ ./run.sh

it will check checksums of the contracts, then will proceed to store necessary wasm binaries.

In the middle process will stop, and user must update `configs/factory_config.json` file with newly uploaded binaries ID.

All necessary output is stored in `result.json` file.
12 changes: 7 additions & 5 deletions scripts/deploy/configs/gauges_config.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"orchestrator": {
"label": "gauge v1.3.0-beta",
"label": "gauge orchestrator v1.3.0-beta",
"instantiate": {
"voting_powers": "paloma1al324k42hg47fz3qdnuy2s7wcfw8agny8gujmh",
"owner": "paloma1zwskvpcpvplxacxef2ez5w9rpxcdkd54e9slnv"
Expand All @@ -10,24 +10,26 @@
{
"label": "gauge-adapter v1.3.0-beta ugrain",
"instantiate": {
"factory": "paloma1r3zgdsn3dcze07a4r60rxxx7ppvkxfshn9np0pwtkgarrld0786sdssl9a",
"factory": "paloma1pt5d7rnkkz24sfutsld8c40r28py3jzgj95ml4ef7krtdr77xq0q47ufnv",
"rewards_asset": {
"info": {
"native": "ugrains"
},
"amount": "10000"
}
},
"epoch_length": 164000,
"owner": "paloma1zwskvpcpvplxacxef2ez5w9rpxcdkd54e9slnv"
}
}
],
"gauges": [
{
"create_gauge": {
"title": "gauge rewards paloma",
"adapter": "paloma1sthrn5ep8ls5vzz8f9gp89khhmedahhdqd244dh9uqzk3hx2pzrsr8facx",
"adapter": "paloma1ttrgu24gmfxg0mymf02awyx2kaepvnz7k75zsn87s65kds86yepsc2g2ku",
"epoch_size": 86400,
"max_options_selected": 3
}
}
]
}
}
2 changes: 1 addition & 1 deletion scripts/deploy/configs/multi_hop_config.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"label": "palomadex-multi-hop v0.4.0",
"instantiate": {
"wyndex_factory": "paloma1cspcn0rdpxtarxxyra0mctys0s3zg584at9m8q6p2wn99m4fxupsp2zukk"
"wyndex_factory": "paloma1pt5d7rnkkz24sfutsld8c40r28py3jzgj95ml4ef7krtdr77xq0q47ufnv"
}
}
32 changes: 9 additions & 23 deletions scripts/deploy/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -284,28 +284,15 @@ async function createGauges(client, wallet, gasPriceS, messages, gaugeOrchestrat
const gasPrice = GasPrice.fromString(gasPriceS);
const executeFee = calculateFee(1_000_000, gasPrice);

var gauges = [];

for (var i = 0; i < messages.length; i++) {
const result = await client.execute(
wallet,
gaugeOrchestratorAddress,
messages[i],
executeFee
);
const wasmEvent = result.logs[0].events.find((e) => e.type === "wasm").attributes;
const gaugeAddress = wasmEvent.find(function (element) {
return element.key === '_contract_address'
});
const gaugeInfo = {
gaugeLabel: messages[i].create_gauge.title,
gaugeAddress: gaugeAddress.value,
};
console.info(`Gauge initialized:\n${JSON.stringify(gaugeInfo, null, 4)}\n`);
gauges.push(gaugeInfo);
console.info(`Gauge initialized: ${messages[i].create_gauge.title}\n`);
};

return gauges;
}

async function main() {
Expand Down Expand Up @@ -399,14 +386,12 @@ async function main() {
// Instantiate gauge orchestrator
const gaugeOrchestratorAddress = await instantiateContract(client, address, palomaConfig.gasPrice, gaugesConfig.orchestrator, gaugeOrchestratorCodeId);

// Update adapter config with correct gauge orchestrator address
gaugesConfig.adapters.forEach(adapter => {
adapter.instantiate.factory = factoryAddress; // Update factory address for each adapter
adapter.instantiate.gauge_orchestrator = gaugeOrchestratorAddress; // Add gauge orchestrator address to each adapter
});

const gaugeAdapters = await instantiateGaugeAdapters(client, address, palomaConfig.gasPrice, gaugeAdapterCodeId, gaugesConfig.adapters);

gaugesConfig.gauges.forEach(gauge => {
gauge.create_gauge.adapter = gaugeAdapters[0].address;
});

// Save the updated gauges config with gauge orchestrator and adapters addresses
writeJsonConfig(gaugesConfigPath, gaugesConfig);

Expand All @@ -425,9 +410,10 @@ async function main() {
factoryAddress: factoryAddress,
multiHopAddress: multiHopAddress,
pairs: pairs,
// gaugeOrchestratorAddress: gaugeOrchestratorAddress,
// gaugeAdapters: gaugeAdapters,
// gauges: gauges
daoCore: daoCoreAddress,
gaugeOrchestratorAddress: gaugeOrchestratorAddress,
gaugeAdapters: gaugeAdapters,
gauges: gauges
};
fs.writeFileSync("result.json", JSON.stringify(raport, null, 4), "utf8");
console.info("Result was saved to result.json file!");
Expand Down

0 comments on commit 22de41b

Please sign in to comment.