-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3d25c53
commit 974f4f1
Showing
18 changed files
with
1,082 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
SDK_PATH =/Users/chris/agoric-sdk | ||
COSMIC_SWINGSET_PATH =/Users/chris/agoric-sdk/packages/cosmic-swingset | ||
VATS_PATH =/Users/chris/agoric-sdk/packages/vats | ||
KEPLR_ADDRESS2 = agoric1tq3v943uaycqp90qvuyaqzwdc3eh52xzrcl4p6 | ||
KEPLR_ADDRESS = agoric16cnnlc60cgkp7mgwtj9htf5jlakel85lhvft96 | ||
KREAD_REPO = /Users/chris/agoric-kryha/agoric/code/Agoric/agoric/contract/src/index.js | ||
EVAL_PERMIT = /Users/chris/agoric-kryha/agoric/code/Agoric/agoric/contract/src/proposal/powers.json | ||
EVAL_CODE = /Users/chris/agoric-kryha/agoric/code/Agoric/agoric/contract/src/proposal/chain-storage-proposal.js | ||
EVAL_CLEAN = $(EVAL_CODE)-clean.js | ||
KR_AG_DIR = /Users/chris/agoric-kread/agoric |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#!/usr/bin/env node | ||
|
||
import fs from 'fs'; | ||
|
||
const Fail = (template, ...args) => { | ||
throw Error(String.raw(template, ...args.map(val => String(val)))); | ||
}; | ||
|
||
/** | ||
* Parse output of `agoric run proposal-builder.js` | ||
* | ||
* @param {string} txt | ||
* | ||
* adapted from packages/boot/test/bootstrapTests/supports.js | ||
*/ | ||
const parseProposalParts = txt => { | ||
const evals = [ | ||
...txt.matchAll(/swingset-core-eval (?<permit>\S+) (?<script>\S+)/g), | ||
].map(m => { | ||
if (!m.groups) throw Fail`Invalid proposal output ${m[0]}`; | ||
const { permit, script } = m.groups; | ||
return { permit, script }; | ||
}); | ||
evals.length || Fail`No swingset-core-eval found in proposal output: ${txt}`; | ||
|
||
const bundles = [...txt.matchAll(/swingset install-bundle @([^\n]+)/gm)].map( | ||
([, bundle]) => bundle, | ||
); | ||
bundles.length || Fail`No bundles found in proposal output: ${txt}`; | ||
|
||
return { evals, bundles }; | ||
}; | ||
|
||
const main = (stdin, readFileSync) => { | ||
const input = readFileSync(stdin.fd).toString(); | ||
const parts = parseProposalParts(input); | ||
// relies on console.log printing to stdout unmodified | ||
console.log(JSON.stringify(parts)); | ||
}; | ||
|
||
main(process.stdin, fs.readFileSync); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
// @jessie-check | ||
|
||
import '@agoric/governance/exported.js'; | ||
import { M } from '@agoric/store'; | ||
import { TimestampShape } from '@agoric/time'; | ||
import { prepareExo, provideDurableMapStore } from '@agoric/vat-data'; | ||
import '@agoric/zoe/exported.js'; | ||
import '@agoric/zoe/src/contracts/exported.js'; | ||
import { | ||
InstallationShape, | ||
InstanceHandleShape, | ||
} from '@agoric/zoe/src/typeGuards.js'; | ||
import { E } from '@endo/far'; | ||
|
||
/** | ||
* @file This contract makes it possible for those who govern the KREAd contract | ||
* to call for votes to pause offers. | ||
*/ | ||
|
||
export const INVITATION_MAKERS_DESC = 'charter member invitation'; | ||
|
||
/** @type {ContractMeta} */ | ||
export const meta = { | ||
customTermsShape: { | ||
binaryVoteCounterInstallation: InstallationShape, | ||
}, | ||
upgradability: 'canUpgrade', | ||
}; | ||
harden(meta); | ||
|
||
/** | ||
* @param {ZCF<{ binaryVoteCounterInstallation: Installation }>} zcf | ||
* @param {undefined} privateArgs | ||
* @param {import('@agoric/vat-data').Baggage} baggage | ||
*/ | ||
export const start = async (zcf, privateArgs, baggage) => { | ||
const { binaryVoteCounterInstallation: counter } = zcf.getTerms(); | ||
/** @type {MapStore<Instance, GovernorCreatorFacet<any>>} */ | ||
const instanceToGovernor = provideDurableMapStore( | ||
baggage, | ||
'instanceToGovernor', | ||
); | ||
|
||
const makeOfferFilterInvitation = (instance, strings, deadline) => { | ||
const voteOnOfferFilterHandler = seat => { | ||
seat.exit(); | ||
|
||
const governor = instanceToGovernor.get(instance); | ||
return E(governor).voteOnOfferFilter(counter, deadline, strings); | ||
}; | ||
|
||
return zcf.makeInvitation(voteOnOfferFilterHandler, 'vote on offer filter'); | ||
}; | ||
|
||
const MakerI = M.interface('Charter InvitationMakers', { | ||
VoteOnPauseOffers: M.call( | ||
InstanceHandleShape, | ||
M.arrayOf(M.string()), | ||
TimestampShape, | ||
).returns(M.promise()), | ||
}); | ||
|
||
// durable so that when this contract is upgraded this ocap held | ||
// by committee members (from their invitations) stay capable | ||
const invitationMakers = prepareExo( | ||
baggage, | ||
'Charter Invitation Makers', | ||
MakerI, | ||
{ | ||
VoteOnPauseOffers: makeOfferFilterInvitation, | ||
}, | ||
); | ||
|
||
const charterMemberHandler = seat => { | ||
seat.exit(); | ||
return harden({ invitationMakers }); | ||
}; | ||
|
||
const CharterCreatorI = M.interface('Charter creatorFacet', { | ||
addInstance: M.call(InstanceHandleShape, M.any()) | ||
.optional(M.string()) | ||
.returns(), | ||
makeCharterMemberInvitation: M.call().returns(M.promise()), | ||
}); | ||
|
||
const creatorFacet = prepareExo( | ||
baggage, | ||
'Charter creatorFacet', | ||
CharterCreatorI, | ||
{ | ||
/** | ||
* @param {Instance} governedInstance | ||
* @param {GovernorCreatorFacet<any>} governorFacet | ||
* @param {string} [label] for diagnostic use only | ||
*/ | ||
addInstance: (governedInstance, governorFacet, label) => { | ||
console.log('charter: adding instance', label); | ||
instanceToGovernor.init(governedInstance, governorFacet); | ||
}, | ||
makeCharterMemberInvitation: () => | ||
zcf.makeInvitation(charterMemberHandler, INVITATION_MAKERS_DESC), | ||
}, | ||
); | ||
|
||
return harden({ creatorFacet }); | ||
}; | ||
harden(start); | ||
|
||
/** | ||
* @typedef {import('@agoric/zoe/src/zoeService/utils.js').StartedInstanceKit<start>} KreadCharterStartResult | ||
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.