Skip to content

Commit

Permalink
preparing for deplyoment
Browse files Browse the repository at this point in the history
* chore: prune interchain-ui/

* chore: prune klunky deployment scripts

* chore: prune offer-up contract test

* chore: prune launchIt etc. power-tools contracts

* chore: marshalTables not used in src (WIP)

delete it? or is it used in tests?

* chore: prune extra copy of test-bundle-source.js

* chore: move offer-tool src/ -> scripts/

* build: upgrade typescript to support @import

* build: prune agoric cli (WIP)

goal: use https://github.com/Agoric/dapp-agoric-basics/blob/main/contract/scripts/deploy-contract.js

* build: pin xsnap etc.

build just 1 xsnap, and don't clone the whole git history

* refactor(test-airdrop): address static type errors

* style: lint

* fix: update a3p image tag from main to latest

cf. Agoric/agoric-3-proposals@1fb8e54

* fix: don't strip brand

* fix: avoid collision between types.js and types.d.ts

* fix: bring ERTP, Zoe/ZCF types in scope

* test: update test-bundle-source to use airdropCampaign

* refactor: well-typed objectTools (WIP)

why 2 objectTools?

getWindowLength and getTokenQuantity are not generic object tools;
they're specific to EpochDetails; why are they here?

* build: get ERTP from upgrade-14 (WIP)

is this needed? it's probably best

* fix: export privateArgsShape, customTermsShape for compat.

* refactor: static types for airdrop/prepare

* refactor: use TimestampRecord in updateEpochDetails

* fix: currentCancelToken typo (WIP NEEDSTEST)

* refactor: 86_400n -> DAY

* refactor: harden() consistently

* refactor: misc test notes

* build: lock packages with typescript @import

* test: tone down bundle logging

* test: skip non-working tests; add todo to empty test file

* feat(timer): added logic for using absolute timers.

* refactor:

1. state machine logic
    * removed values related to constructing state machine from customTerms.

2. streamlined airdrop preparation
    * removed  from exo object.
    * moved logic responsible for setting wake up fn that triggers contract state to transition from prepared -> open out of exo object (iow, marks the contract as being open for claim)

---------

Co-authored-by: Dan Connolly <dckc@madmode.com>
  • Loading branch information
tgrecojs and dckc authored Apr 15, 2024
1 parent e74f41b commit e3ca4cf
Show file tree
Hide file tree
Showing 73 changed files with 1,761 additions and 14,557 deletions.
5 changes: 2 additions & 3 deletions contract/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
"@jessie.js/eslint-plugin": "^0.4.0",
"@typescript-eslint/eslint-plugin": "^6.7.0",
"@typescript-eslint/parser": "^6.7.0",
"agoric": "^0.21.2-u12.0",
"ava": "^5.3.0",
"eslint": "^8.47.0",
"eslint-config-airbnb-base": "^15.0.0",
Expand All @@ -43,10 +42,10 @@
"prettier": "^3.0.3",
"prettier-plugin-jsdoc": "^1.0.0",
"type-coverage": "^2.26.3",
"typescript": "~5.2.2"
"typescript": "^5.5.0-dev.20240327"
},
"dependencies": {
"@agoric/ertp": "^0.16.3-u12.0",
"@agoric/ertp": "^0.16.3-u14.0",
"@agoric/store": "^0.9.2",
"@agoric/vat-data": "0.5.3-u14.0",
"@agoric/vats": "0.15.2-u14.1",
Expand Down
48 changes: 0 additions & 48 deletions contract/scripts/build-contract-deployer.js

This file was deleted.

11 changes: 0 additions & 11 deletions contract/scripts/build-proposal.sh

This file was deleted.

24 changes: 0 additions & 24 deletions contract/scripts/install-bundles.sh

This file was deleted.

File renamed without changes.
41 changes: 0 additions & 41 deletions contract/scripts/parseProposals.mjs

This file was deleted.

22 changes: 0 additions & 22 deletions contract/scripts/propose-start-contract.sh

This file was deleted.

File renamed without changes.
5 changes: 3 additions & 2 deletions contract/src/airdrop/helpers/messages.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,16 @@
* @description contains variables for all string values used within codebase for the sake of limiting.
*/

const { quote: q } = assert;

const CONSTANTS = {
AIRDROP_ADMIN_MESSAGES: {
DEPOSIT_TOKENS_ERROR: `Payment has failed liveliness check. This is either because it has been used already, or it is from the wrong issuer. Please check these details and try again`,
ADD_ACCOUNTS_SUCCESS: list =>
`Successfully added ${list.length} eligible accounts.`,
},
CLAIM_MESSAGES: {
createClaimSuccessMsg: ({ value }) =>
`Successfully claimed ${value}n tokens.`,
createClaimSuccessMsg: amt => `Successfully claimed ${q(amt)} tokens.`,
OFFER_DESCRIPTION: 'claim airdrop invitation',
INELIGIBLE_ACCOUNT_ERROR:
'Claim failed. Signature does not correspond to an address on Airdrop allowlist.',
Expand Down
31 changes: 12 additions & 19 deletions contract/src/airdrop/helpers/objectTools.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
// @ts-check

/** @import { ERef } from '@endo/eventual-send'; */

const { entries, fromEntries } = Object;

/** @type { <T extends Record<string, ERef<any>>>(obj: T) => Promise<{ [K in keyof T]: Awaited<T[K]>}> } */
export const allValues = async (obj) => {
export const allValues = async obj => {
const es = await Promise.all(
entries(obj).map(async ([k, v]) => [k, await v]),
);
Expand All @@ -21,27 +24,17 @@ export const mapValues = (obj, f) =>
/** @type {<X, Y>(xs: X[], ys: Y[]) => [X, Y][]} */
export const zip = (xs, ys) => xs.map((x, i) => [x, ys[i]]);


/** @type {<T>(x: T[]) => T} */
const head = ([x, ...xs]) => x;

const composeM =
method =>
(...ms) =>
ms.reduce((f, g) => x => g(x)[method](f));

const compose =
(...fns) =>
initialValue =>
fns.reduceRight((acc, val) => val(acc), initialValue);

const getProp = prop => obj => obj[prop];
const getWindowLength = compose(getProp('windowLength'), head);
const getTokenQuantity = compose(getProp('tokenQuantity'), head);

export {
compose,
getProp,
getWindowLength,
getTokenQuantity,
head
}

/** @type { <O extends { windowLength: unknown }>(o: O[]) => O['windowLength'] } */
const getWindowLength = x => head(x).windowLength;
/** @type { <O extends { tokenQuantity: unknown }>(o: O[]) => O['tokenQuantity'] } */
const getTokenQuantity = x => head(x).tokenQuantity;

export { getWindowLength, getTokenQuantity, head };
Loading

0 comments on commit e3ca4cf

Please sign in to comment.