Skip to content

Commit

Permalink
chore: recover auto-deploy.template.js from run log
Browse files Browse the repository at this point in the history
We negledted to check this in. Fortunately, we logged it
and captured the log in a comment.

#48 (comment)
  • Loading branch information
dckc committed Sep 10, 2024
1 parent fff889a commit 0ec4e52
Showing 1 changed file with 56 additions and 0 deletions.
56 changes: 56 additions & 0 deletions contract/src/auto-deploy.template.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
// @ts-check
import { allValues } from './objectTools.js';

Check failure on line 2 in contract/src/auto-deploy.template.js

View workflow job for this annotation

GitHub Actions / unit

'allValues' is defined but never used. Allowed unused vars must match /^_/u
import {
AmountMath,

Check failure on line 4 in contract/src/auto-deploy.template.js

View workflow job for this annotation

GitHub Actions / unit

'AmountMath' is defined but never used. Allowed unused vars must match /^_/u
installContract,
startContract,
} from './platform-goals/start-contract.js';

const { Fail } = assert;

const contractName = '_CONTRACT_NAME_'; // for pattern match
const IST_UNIT = 1_000_000n;

Check failure on line 12 in contract/src/auto-deploy.template.js

View workflow job for this annotation

GitHub Actions / unit

'IST_UNIT' is assigned a value but never used. Allowed unused vars must match /^_/u

/**
* Core eval script to start contract
*
* @param {BootstrapPowers } permittedPowers
* @param {*} config
*
*/
export const deployContract = async (permittedPowers, config) => {
console.log('core eval for', contractName);
const {
// must be supplied by caller or template-replaced
bundleID = Fail`no bundleID`,
} = config?.options?.[contractName] ?? {};

const installation = await installContract(permittedPowers, {
name: contractName,
bundleID,
});

await startContract(permittedPowers, {
name: contractName,
startArgs: {
installation,
},
});

console.log(contractName, '(re)started');
};

/** @type { import("@agoric/vats/src/core/lib-boot.js").BootstrapManifestPermit } */
export const permit = harden({
consume: {
startUpgradable: true, // to start contract and save adminFacet
},
installation: {
consume: { [contractName]: true },
produce: { [contractName]: true },
},
instance: { produce: { [contractName]: true } },
// generate issuer/brand
});

export const main = deployContract;

0 comments on commit 0ec4e52

Please sign in to comment.