Skip to content
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

6701 ec oracles list #6963

Closed
wants to merge 33 commits into from
Closed
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
b13f85f
chore: remove empty amm integration test
turadg Feb 10, 2023
e2207ff
refactor(fluxAggregator): split singleton / contract
turadg Feb 9, 2023
727f40c
chore(types): BundleCap
turadg Feb 9, 2023
cd4b947
feat: puppetGovernance setup tools
turadg Feb 9, 2023
fbe5136
test(price): rename test-fluxAggregator
turadg Feb 10, 2023
2add695
test(price): simplify fluxAggregator test
turadg Feb 10, 2023
9e65ecf
chore(types): cleanup
turadg Feb 10, 2023
acd263b
chore(types): fix DeeplyAwaited
turadg Feb 10, 2023
d4ac24e
chore(types): fix allValues
turadg Feb 10, 2023
8010fb2
fix(vaultDirector): add setOfferFilter
turadg Feb 10, 2023
a9c03a5
fix(vaultDirector): getContractGovernor return
turadg Feb 10, 2023
b255ca3
chore(types): installations in WellKnownSpaces
turadg Feb 10, 2023
dbc0159
WIP feat(price): fluxAggregator governance
turadg Feb 10, 2023
dfd334a
WIP: instances don't match
turadg Feb 10, 2023
dcafc14
chore(types): fixup governance
turadg Feb 10, 2023
9931e4f
refactor: WellKnownInstallations
turadg Feb 10, 2023
50b38a8
Revert "refactor: WellKnownInstallations"
turadg Feb 10, 2023
8bc4870
WIP
turadg Feb 10, 2023
ae3d5d2
chore(vaultFactory)!: subscription method compatible with governance
turadg Feb 10, 2023
96a7589
feat!: allow paths in governance methods
turadg Feb 10, 2023
d2fc0ef
fixup something
turadg Feb 10, 2023
5b137a9
give up
turadg Feb 10, 2023
e8c9eb0
fixup getGovernedApiNames
turadg Feb 10, 2023
f6377d9
oracle test passing
turadg Feb 10, 2023
8ec7e31
fixup puppet gov
turadg Feb 10, 2023
7410bb7
clean up debugging
turadg Feb 10, 2023
be64930
fixup splitof fluxAggregator.contract
turadg Feb 10, 2023
b0f4e4a
feat(ec-charter): VoteOnApiCall
turadg Feb 11, 2023
6c7a922
fix(governApi): harden returns
turadg Feb 11, 2023
edc7d2c
test(smartWallet): extract helpers from psm integration
turadg Feb 11, 2023
49ec3ee
fixup! WIP feat(price): fluxAggregator governance
turadg Feb 11, 2023
cd8211a
refactor: DRY WalletName.depositFacet
turadg Feb 11, 2023
d9204e4
feat(price): addOracles by EC
turadg Feb 11, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions packages/governance/src/contractGovernance/governApi.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const { Fail, quote: q } = assert;
const makeApiInvocationPositions = (apiMethodName, methodArgs) => {
const positive = harden({ apiMethodName, methodArgs });
const negative = harden({ dontInvoke: apiMethodName });
return { positive, negative };
return harden({ positive, negative });
};

/**
Expand Down Expand Up @@ -113,11 +113,11 @@ const setupApiGovernance = async (
},
);

return {
return harden({
outcomeOfUpdate,
instance: voteCounter,
details: E(counterPublicFacet).getDetails(),
};
});
};

return Far('paramGovernor', {
Expand Down
33 changes: 33 additions & 0 deletions packages/inter-protocol/src/econCommitteeCharter.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,17 +79,50 @@ export const start = async zcf => {
return zcf.makeInvitation(voteOnOfferFilterHandler, 'vote on offer filter');
};

/**
* @param {Instance} instance
* @param {string} methodName
* @param {string[]} methodArgs
* @param {import('@agoric/time').TimestampValue} deadline
*/
const makeApiInvocationInvitation = (
instance,
methodName,
methodArgs,
deadline,
) => {
const handler = seat => {
seat.exit();

const governor = instanceToGovernor.get(instance);
return E(governor).voteOnApiInvocation(
methodName,
methodArgs,
counter,
deadline,
);
};
return zcf.makeInvitation(handler, 'vote on API invocation');
};

const MakerI = M.interface('Charter InvitationMakers', {
VoteOnParamChange: M.call().returns(M.promise()),
VoteOnPauseOffers: M.call(
InstanceHandleShape,
M.arrayOf(M.string()),
TimestampShape,
).returns(M.promise()),
VoteOnApiCall: M.call(
InstanceHandleShape,
M.string(),
M.arrayOf(M.string()),
TimestampShape,
).returns(M.promise()),
});
const invitationMakers = makeExo('Charter Invitation Makers', MakerI, {
VoteOnParamChange: makeParamInvitation,
VoteOnPauseOffers: makeOfferFilterInvitation,
VoteOnApiCall: makeApiInvocationInvitation,
});

const charterMemberHandler = seat => {
Expand Down
13 changes: 10 additions & 3 deletions packages/inter-protocol/src/price/fluxAggregator.contract.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,17 @@ export const start = async (zcf, privateArgs, baggage) => {
marshaller,
);

trace('got param governance');

const governedApis = {
initOracle: fa.creatorFacet.initOracle,
/**
*
* @param {string} oracleId
*/
addOracle: oracleId => fa.creatorFacet.initOracle(oracleId),
/**
*
* @param {string} oracleId
*/
removeOracle: oracleId => fa.creatorFacet.deleteOracle(oracleId),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The inconsistency between addOracle and initOracle (and likewise removeOracle and deleteOracle) seems like a little sand in the gears.

Tolerable, though, I suppose.

};

const governorFacet = makeGovernorFacet(fa.creatorFacet, governedApis);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ export const createPriceFeed = async (
chainStorage,
chainTimerService,
client,
econCharterKit,
economicCommitteeCreatorFacet,
namesByAddressAdmin,
priceAuthority,
Expand Down Expand Up @@ -221,6 +222,11 @@ export const createPriceFeed = async (
faInstance,
);

E(E.get(econCharterKit).creatorFacet).addInstance(
faInstance,
aggregatorGovernor.creatorFacet,
AGORIC_INSTANCE_NAME,
);
trace('registered', AGORIC_INSTANCE_NAME, faInstance);

// Publish price feed in home.priceAuthority.
Expand Down Expand Up @@ -380,6 +386,7 @@ export const PRICE_FEEDS_MANIFEST = harden({
chainStorage: true,
chainTimerService: true,
client: true,
econCharterKit: true,
namesByAddressAdmin: true,
priceAuthority: true,
priceAuthorityAdmin: true,
Expand Down
31 changes: 30 additions & 1 deletion packages/inter-protocol/test/smartWallet/contexts.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { BridgeId, deeplyFulfilledObject } from '@agoric/internal';
import { unsafeMakeBundleCache } from '@agoric/swingset-vat/tools/bundleTool.js';
import { makeStorageNodeChild } from '@agoric/internal/src/lib-chainStorage.js';
// eslint-disable-next-line no-unused-vars -- used by TS
import { coalesceUpdates } from '@agoric/smart-wallet/src/utils.js';
Comment on lines +3 to +4
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

something like @typedef { Awaited<ReturnType<import('@agoric/smart-wallet/src/utils.js').coalesceUpdates>> } WalletState might avoid increasing the bundle size... oh... this is a test, so there's no relevant bundle. NVM.

import { unsafeMakeBundleCache } from '@agoric/swingset-vat/tools/bundleTool.js';
import { E } from '@endo/far';
import path from 'path';
import { createPriceFeed } from '../../src/proposals/price-feed-proposal.js';
Expand Down Expand Up @@ -125,3 +127,30 @@ export const makeDefaultTestContext = async (t, makeSpace) => {
simpleCreatePriceFeed,
};
};

/**
* @param {Awaited<ReturnType<typeof coalesceUpdates>>} state
* @param {Brand<'nat'>} brand
*/
export const purseBalance = (state, brand) => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Call this invitationPurseBalance? Since #6807 , won't work on any other brand, right?

const balances = Array.from(state.balances.values());
const match = balances.find(b => b.brand === brand);
if (!match) {
console.debug('balances', ...balances);
assert.fail(`${brand} not found in record`);
}
return match.value;
};
/**
* @param {import('@agoric/smart-wallet/src/smartWallet.js').CurrentWalletRecord} record
* @param {Brand<'nat'>} brand
*/
export const currentPurseBalance = (record, brand) => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

likewise currentInvitationPurseBalance?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you really do need the balance of some other brand, use the relevant bank directly, as in:

const getBalanceFor = brand =>
E(E(bank).getPurse(brand)).getCurrentAmount();

const purses = Array.from(record.purses.values());
const match = purses.find(b => b.brand === brand);
if (!match) {
console.debug('purses', ...purses);
assert.fail(`${brand} not found in record`);
}
return match.balance.value;
};
Loading