Skip to content

Commit

Permalink
change Fortuna Redeem to not require users to lock up minAda in addit…
Browse files Browse the repository at this point in the history
…ion to tuna
  • Loading branch information
MicroProofs committed Jul 15, 2024
1 parent 6bcfa71 commit 80e4b83
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 51 deletions.
2 changes: 1 addition & 1 deletion aiken.lock
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,4 @@ requirements = []
source = "github"

[etags]
"aiken-lang/fuzz@main" = [{ secs_since_epoch = 1720810832, nanos_since_epoch = 123744000 }, "a8294651f1577c671d580c99c9bc5445ef1fd44e4aa3dde550434a4cbc8d50b6"]
"aiken-lang/fuzz@main" = [{ secs_since_epoch = 1721071594, nanos_since_epoch = 601555000 }, "a8294651f1577c671d580c99c9bc5445ef1fd44e4aa3dde550434a4cbc8d50b6"]
2 changes: 1 addition & 1 deletion genesis/previewV2.json

Large diffs are not rendered by default.

33 changes: 14 additions & 19 deletions miner/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -959,7 +959,10 @@ app

const spendRedeemer = Data.to(new Constr(1, [0n]));

const masterLockToken = { [forkValidatorHash + fromText('lock_state')]: 1n };
const masterLockToken = {
[forkValidatorHash + fromText('lock_state')]: 1n,
[fortunaV1.validatorHash + fromText('TUNA')]: prevState.fields[1] + amount,
};

const mintTokens = { [tunav2ValidatorHash + fromText('TUNA')]: amount };

Expand All @@ -971,13 +974,6 @@ app
.mintAssets(mintTokens, tunaRedeemer)
.withdraw(rewardAddress, 0n, lockRedeemer)
.addSigner(await lucid.wallet.address())
.payToContract(
forkValidatorAddress,
{ inline: Data.to(0n) },
{
[fortunaV1.validatorHash + fromText('TUNA')]: amount,
},
)
.complete({ nativeUplc: false });

const signed = await tx.sign().complete();
Expand All @@ -987,8 +983,8 @@ app
console.log(`TX HASH: ${signed.toHash()}`);
console.log('Waiting for confirmation...');

// // await lucid.awaitTx(signed.toHash());
await delay(5000);
await lucid.awaitTx(signed.toHash());
// await delay(5000);
} catch (e) {
console.log(e);
}
Expand All @@ -1013,17 +1009,17 @@ app
const lucid = await Lucid.new(provider, preview ? 'Preview' : 'Mainnet');
lucid.selectWalletFromSeed(fs.readFileSync('seed.txt', { encoding: 'utf-8' }));

// const tx_test = await lucid
// .newTx()
// .payToAddress(await lucid.wallet.address(), { lovelace: 800000000n })
// .payToAddress(await lucid.wallet.address(), { lovelace: 800000000n })
// .complete();
const tx_test = await lucid
.newTx()
.payToAddress(await lucid.wallet.address(), { lovelace: 800000000n })
.payToAddress(await lucid.wallet.address(), { lovelace: 800000000n })
.complete();

// const signed_test = await tx_test.sign().complete();
const signed_test = await tx_test.sign().complete();

// await signed_test.submit();
await signed_test.submit();

// await lucid.awaitTx(signed_test.toHash());
await lucid.awaitTx(signed_test.toHash());

const utxos = (await lucid.wallet.getUtxos()).sort((a, b) => {
return a.txHash.localeCompare(b.txHash) || a.outputIndex - b.outputIndex;
Expand Down Expand Up @@ -1141,7 +1137,6 @@ app
'dmtr-api-key': utxoRpcApiKey,
},
});

let nextToken: BlockRef | undefined = new BlockRef({
index: 54103735n,
hash: fromHex('f21e511c723cda05afca8dddf9338577eb65d953f3cfdca1e604d202e1451c1d'),
Expand Down
Loading

0 comments on commit 80e4b83

Please sign in to comment.