Skip to content

Commit

Permalink
fix(upload-contract): no automatic contracts/* upload
Browse files Browse the repository at this point in the history
This is needed to prevent spamming on-chain objects with contracts
that probably are never used.
  • Loading branch information
michaelfig committed Oct 21, 2019
1 parent 98db740 commit 654bd5e
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 11 deletions.
8 changes: 3 additions & 5 deletions lib/ag-solo/contracts/README-contract.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
This folder contains contracts that are bundled and installed when ag-solo first starts.
This folder contains contracts that can be bundled and installed after ag-solo starts.

## Zoe uploads

Each Zoe contract entrypoint is named `zoe-NAME.js`, where **NAME** is an identifier. These files are ES modules which can import other modules. The direct exports from `zoe-NAME.js` become properties on **NAME**'s installation.

Note that the `makeContract` export accepts a `pureFns` argument and returns a instantiation function that receives a Zoe instance as an argument.
Note that the `makeContract` export accepts a Zoe instance as an argument.

```js
import harden from '@agoric/harden';

export const makeContract = harden(pureFns => zoe => { ... });
export const makeContract = harden(zoe => { ... });
```

The following global variables are available to all modules in your Zoe contract:
Expand Down Expand Up @@ -52,5 +52,3 @@ ag-solo upload-contract NAME=ENTRYPOINT.js [NAME=ENTRYPOINT.js...]
To access the contract installation object, use `home.uploads~.get(NAME)`.

To list all contracts in the uploads scratch pad: `home.uploads~.list()`.

Again, note that all the `contractHost-*.js` and `zoe-*.js` in this directory are automatically uploaded when ag-solo first starts.
2 changes: 1 addition & 1 deletion lib/ag-solo/contracts/zoe-automaticRefund.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import harden from '@agoric/harden';
* @param {governingContractFacet} zoe - the governing
* contract facet of zoe
*/
export const makeContract = _pureFns => zoe => {
export const makeContract = zoe => {
let count = 0;
return harden({
makeOffer: async escrowReceipt => {
Expand Down
3 changes: 2 additions & 1 deletion lib/ag-solo/start.js
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,8 @@ export default async function start(basedir, withSES, argv) {
console.log(`swingset running`);

// Install the contracts, if given a client role.
if (argv.find(value => value.match(/^--role=.*client/)) !== undefined) {
// FIXME: Don't do this for now.
if (false && argv.find(value => value.match(/^--role=.*client/)) !== undefined) {
const contractsDir = path.join(basedir, 'contracts');
const pairs = (await fs.promises.readdir(contractsDir))
.sort()
Expand Down
2 changes: 1 addition & 1 deletion lib/ag-solo/upload-contract.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import makeCapTP from '@agoric/captp';
import fs from 'fs';
import path from 'path';

import buildSourceBundle from './build-source-bundle';
import buildSourceBundle from '@agoric/bundle-source';

const makePromise = () => {
const pr = {};
Expand Down
29 changes: 26 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"license": "Apache-2.0",
"dependencies": {
"@agoric/acorn-eventual-send": "^1.0.1",
"@agoric/bundle-source": "^0.1.0",
"@agoric/captp": "^0.1.2",
"@agoric/ertp": "^0.1.7",
"@agoric/evaluate": "^2.1.2",
Expand Down

0 comments on commit 654bd5e

Please sign in to comment.