hindley-milner-systems / dapp-ertp-airdrop

0 stars 2 forks source link

implement minting capabilities directly within the airdrop contract #55

Closed tgrecojs closed 3 months ago

linear[bot] commented 6 months ago

LAR-102 implement minting capabilities directly within the airdrop contract

dckc commented 6 months ago

notes from today's office hours discussion:

import { Far } from '@endo/marshal';
import { E } from '@endo/far';
import { AmountMath } from '@agoric/ertp';

const deployContract1 = async ({
  consume: { zoe, bankManager, agoricNames },
}) => {
  const installation = await E(agoricNames).lookup('installation', 'contract1');
  const started = await E(zoe).startInstance(installation);
  const terms = await E(zoe).getTerms(started.instance);
  const {
    issuers: { Token123: issuer },
    brands: { Token123: brand },
  } = terms;

  const empty = AmountMath.makeEmpty(brand);
  const purse = E(issuer).makeEmptyPurse();
  const payment = await E(purse).withdraw(empty);

  const kit = { issuer, brand, payment };

  // https://tutorials.cosmos.network/tutorials/6-ibc-dev/
  const denom = 'ibc/234293u549238y5932y53'; // observed from a transfer, or hash(path, basedenom)
  const issuerName = 'Token123';
  const proposedName = issuerName;

  await E(bankManager).addAsset(denom, issuerName, proposedName, kit);
};

const start = async zcf => {
  const token123kit = await zcf.makeZCFMint('Token123', 'nat');

   // ...
};

harden(start);
export { start };
tgrecojs commented 3 months ago

this design changed quite a while back but if you could sign off that would be great @dckc.

below is relevant code section.

https://github.com/hindley-milner-systems/dapp-ertp-airdrop/blob/2e6ed388628ad782cc483a3d5fb8742221e74b7f/contract/src/airdrop/airdropKitCreator.js#L119-L126

dckc commented 3 months ago

looks fine.

I presume there's adequate test coverage and ci automation.