-
Notifications
You must be signed in to change notification settings - Fork 222
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(run-protocol): preview launch support, PSM work-around #5215
Merged
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
cfd5648
feat(vats): export AssetTerms type from mintHolder.js
dckc 4c5d2d4
refactor(run-protocol): move startPSM() to src/psm/startPSM.js
dckc cb8f68b
fix(run-protocol): PSM governance, anchor mintHolder
dckc 17f1ab3
chore(run-protocol): write 2 proposals: econ-committee, main
dckc 5276d26
docs(run-protocol): preview docs, WIP
dckc 1a11305
build(run-protocol): deploy-contracts script
dckc d0c71a1
build(run-protocol): build:eval:main, deploy:contracts npm scripts
dckc 744deb6
build(run-protocol): Makefile for agd tx gov submit-proposal etc.
dckc 8a8671d
chore(run-protocol): exclude PSM_MANIFEST from MAIN for now (WIP)
dckc 8c2d6d5
build(run-protocol): writePsmScript for bootstrap version skew
dckc 4a72474
build(run-protocol): PSM work-around npm scripts
dckc 50d8426
build(run-protocol): generated gov-startPSM.js script
dckc 6f83843
chore(run-protocol): 3-member committee for preview
dckc File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
TITLE = Start RUN Protocol Preview | ||
|
||
EVAL_DEPOSIT = 1000000ubld | ||
GAS_ADJUSTMENT = 1.2 | ||
|
||
# stage | ||
AG_SOLO_BASEDIR = /tmp/stage23 | ||
NETWORK_CONFIG = https://stage.agoric.net/network-config | ||
CHAIN_ID = $(shell curl -Ss "$(NETWORK_CONFIG)" | jq -r .chainName) | ||
RPC_IP = $(shell curl -Ss "$(NETWORK_CONFIG)" | jq -r .rpcAddrs[0] | cut -d":" -f1) | ||
CHAIN_OPTS = --node=http://$(RPC_IP):26657 --chain-id=$(CHAIN_ID) | ||
|
||
# local-chain | ||
# AG_SOLO_BASEDIR=../cosmic-swingset/t1/8000 | ||
# CHAIN_ID = agoric | ||
# CHAIN_OPTS = --chain-id=$(CHAIN_ID) | ||
|
||
# pairs of permit, code | ||
EVALS = gov-econ-committee-permit.json gov-econ-committee.js \ | ||
gov-amm-vaults-etc-permit.json gov-amm-vaults-etc.js \ | ||
./scripts/gov-startPSM-permit.json ./scripts/gov-startPSM.js | ||
|
||
submit-proposal: $(EVALS) | ||
git describe --tags --always | ||
agd $(CHAIN_OPTS) \ | ||
--home=$(AG_SOLO_BASEDIR)/ag-cosmos-helper-statedir --keyring-backend=test \ | ||
tx gov submit-proposal swingset-core-eval \ | ||
$(EVALS) \ | ||
--title="$(TITLE) on $(CHAIN_ID)" --description="$$(cat ./docs/run-protocol-preview.md)" \ | ||
--deposit=$(EVAL_DEPOSIT) \ | ||
--gas=auto --gas-adjustment=$(GAS_ADJUSTMENT) \ | ||
--yes --from=ag-solo -b block | ||
|
||
|
||
gov-q: | ||
agd $(CHAIN_OPTS) query gov proposals --output json | \ | ||
jq -c '.proposals[] | [.proposal_id,.voting_end_time,.status]'; | ||
|
||
ADDR=agoric1z8vavxgfjztlhay5kftgp4kp5l4znkh4gf8lg4 | ||
|
||
bank-q: | ||
agd $(CHAIN_OPTS) query bank balances $(ADDR) |
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,25 @@ | ||
# Start RUN Protocol Preview on Devnet | ||
|
||
We propose to launch a preview of the RUN Protocol on Devnet, | ||
comprising the following contracts: | ||
|
||
- runStake - borrow RUN against staked BLD | ||
- AMM - Automated Market Maker | ||
- VaultFactory - collateralized RUN debt positions | ||
- liquidateMinimum | ||
- PSM - Parity Stability Module | ||
- mintHolder | ||
- reserve - asset reserve for the RUN protocol | ||
|
||
along with supporting governance contracts: | ||
- contractGovernor | ||
- binaryVoteCounter | ||
- committee | ||
|
||
This is a `swingset-core-eval` proposal that includes JavaScript to execute to enact the proposal, as well as a JSON policy to limit the capabilities of the proposal. | ||
|
||
See also: | ||
- [using keplr wallet for devnet governance and staking](https://github.com/Agoric/documentation/issues/668) | ||
- [Install RUN Protocol Preview release in devnet on April 22 · Issue \#5062 · Agoric/agoric\-sdk](https://github.com/Agoric/agoric-sdk/issues/5062) | ||
- https://agoric.com/discord channel `#devnet` | ||
- https://commonwealth.im/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,101 @@ | ||
#!/usr/bin/env node | ||
// @ts-check | ||
import url from 'url'; | ||
import { makeHelpers } from '@agoric/deploy-script-support'; | ||
import { E } from '@endo/eventual-send'; | ||
import { getCopyMapEntries, makeCopyMap } from '@agoric/store'; | ||
|
||
// TODO: CLI options to choose contracts | ||
const contractRefs = [ | ||
'../../governance/bundles/bundle-contractGovernor.js', | ||
'../../governance/bundles/bundle-committee.js', | ||
'../../governance/bundles/bundle-binaryVoteCounter.js', | ||
'../bundles/bundle-runStake.js', | ||
'../bundles/bundle-amm.js', | ||
'../bundles/bundle-vaultFactory.js', | ||
'../bundles/bundle-liquidateMinimum.js', | ||
'../bundles/bundle-reserve.js', | ||
'../bundles/bundle-psm.js', | ||
'../../vats/bundles/bundle-mintHolder.js', | ||
]; | ||
const contractRoots = contractRefs.map(ref => | ||
url.fileURLToPath(new URL(ref, import.meta.url)), | ||
); | ||
|
||
/** @type {<T>(store: any, key: string, make: () => T) => Promise<T>} */ | ||
const provide = async (store, key, make) => { | ||
const found = await E(store).get(key); | ||
if (found) { | ||
return found; | ||
} | ||
const value = make(); | ||
await E(store).set(key, value); | ||
return value; | ||
}; | ||
|
||
export default async (homeP, endowments) => { | ||
const home = await homeP; | ||
const { zoe, scratch, board } = home; | ||
|
||
const { installInPieces, getBundlerMaker } = await makeHelpers( | ||
homeP, | ||
endowments, | ||
); | ||
const bundler = E(getBundlerMaker({ log: console.log })).makeBundler({ | ||
zoe, | ||
}); | ||
|
||
console.log('getting installCache...'); | ||
/** @type {CopyMap<string, {installation: Installation, boardId: string, path?: string}>} */ | ||
const initial = await provide(scratch, 'installCache', () => makeCopyMap([])); | ||
console.log('initially:', initial.payload.keys.length, 'entries'); | ||
|
||
// ISSUE: getCopyMapEntries of CopyMap<K, V> loses K, V. | ||
/** @type {Map<string, {installation: Installation, boardId: string, path?: string}>} */ | ||
const working = new Map(getCopyMapEntries(initial)); | ||
|
||
let added = 0; | ||
|
||
/** @type {EndoZipBase64Bundle[]} */ | ||
const bundles = await Promise.all( | ||
contractRoots.map(path => import(path).then(m => m.default)), | ||
); | ||
|
||
let ix = 0; | ||
for await (const bundle of bundles) { | ||
const sha512 = bundle.endoZipBase64Sha512; | ||
if (working.has(bundle.endoZipBase64Sha512)) { | ||
console.log('hit:', { path: contractRefs[ix], sha512 }); | ||
} else { | ||
console.log('miss:', { | ||
path: contractRefs[ix], | ||
length: bundle.endoZipBase64.length, | ||
sha512, | ||
}); | ||
const installation = await installInPieces(bundle, bundler, { | ||
persist: true, | ||
}); | ||
const boardId = await E(board).getId(installation); | ||
working.set(sha512, { installation, boardId, path: contractRefs[ix] }); | ||
added += 1; | ||
} | ||
ix += 1; | ||
} | ||
|
||
const final = makeCopyMap(working); | ||
assert.equal(final.payload.keys.length, working.size); | ||
await (added > 0 && E(home.scratch).set('installCache', final)); | ||
console.log({ | ||
initial: initial.payload.keys.length, | ||
added, | ||
total: working.size, | ||
}); | ||
|
||
const items = [...working.entries()] | ||
.map(([sha512, { boardId, path }]) => ({ sha512, boardId, path })) | ||
.sort(); | ||
const boardId = await E(board).getId(JSON.stringify(items)); | ||
console.log({ | ||
boardId, | ||
}); | ||
}; |
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,48 @@ | ||
{ | ||
"consume": { | ||
"bankManager": "bank", | ||
"zoe": "zoe", | ||
"feeMintAccess": "zoe", | ||
"economicCommitteeCreatorFacet": "economicCommittee", | ||
"chainTimerService": "timer", | ||
"agoricNamesAdmin": true, | ||
"board": true | ||
}, | ||
"installation": { | ||
"consume": { | ||
"mintHolder": "zoe", | ||
"contractGovernor": "zoe", | ||
"psm": "zoe" | ||
} | ||
}, | ||
"issuer": { | ||
"produce": { | ||
"AUSD": true | ||
}, | ||
"consume": { | ||
"AUSD": "bank" | ||
} | ||
}, | ||
"brand": { | ||
"produce": { | ||
"AUSD": true | ||
}, | ||
"consume": { | ||
"AUSD": "bank", | ||
"RUN": "zoe" | ||
} | ||
}, | ||
"produce": { | ||
"psmCreatorFacet": "psm", | ||
"psmGovernorCreatorFacet": "psmGovernor" | ||
}, | ||
"instance": { | ||
"consume": { | ||
"economicCommittee": "economicCommittee" | ||
}, | ||
"produce": { | ||
"psm": "psm", | ||
"psmGovernor": "psm" | ||
} | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this build * like 'lint' does?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
perhaps... but some of the build:* things involve blockchain access, so they don't fit the same workflow.