Skip to content

Commit 17c6730

Browse files
committed
chore: fix ID-505, added tests, and required conditions to prevent permanently locked assets
1 parent 1828dd2 commit 17c6730

File tree

8 files changed

+539
-69
lines changed

8 files changed

+539
-69
lines changed

cardano/gateway/src/shared/modules/lucid/lucid.service.ts

Lines changed: 23 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -436,23 +436,19 @@ export class LucidService {
436436
},
437437
dto.encodedMintChannelRedeemer,
438438
)
439-
.readFrom([dto.connectionUtxo, dto.clientUtxo]);
440-
441-
const addPayToContract = (address: string, inline: string, token: Record<string, bigint>) => {
442-
tx.pay.ToContract(address, { kind: 'inline', value: inline }, token);
443-
};
444-
445-
addPayToContract(deploymentConfig.validators.spendHandler.address, dto.encodedUpdatedHandlerDatum, {
446-
[this.getHandlerTokenUnit()]: 1n,
447-
});
448-
addPayToContract(deploymentConfig.validators.spendChannel.address, dto.encodedChannelDatum, {
449-
[dto.channelTokenUnit]: 1n,
450-
});
451-
addPayToContract(
452-
deploymentConfig.modules.transfer.address,
453-
this.LucidImporter.Data.void(),
454-
dto.transferModuleUtxo.assets,
455-
);
439+
.readFrom([dto.connectionUtxo, dto.clientUtxo])
440+
.pay.ToContract(deploymentConfig.validators.spendHandler.address,
441+
{ kind: 'inline', value: dto.encodedUpdatedHandlerDatum },
442+
{ [this.getHandlerTokenUnit()]: 1n, }
443+
)
444+
.pay.ToContract(deploymentConfig.validators.spendChannel.address,
445+
{ kind: 'inline', value: dto.encodedChannelDatum },
446+
{ [dto.channelTokenUnit]: 1n, }
447+
)
448+
.pay.ToContract(deploymentConfig.modules.transfer.address,
449+
undefined,
450+
dto.transferModuleUtxo.assets
451+
);
456452

457453
return tx;
458454
}
@@ -551,10 +547,7 @@ export class LucidService {
551547
)
552548
.pay.ToContract(
553549
deploymentConfig.modules.transfer.address,
554-
{
555-
kind: 'inline',
556-
value: this.LucidImporter.Data.void(),
557-
},
550+
undefined,
558551
dto.transferModuleUtxo.assets,
559552
)
560553
.mintAssets(
@@ -715,10 +708,7 @@ export class LucidService {
715708
)
716709
.pay.ToContract(
717710
deploymentConfig.modules.transfer.address,
718-
{
719-
kind: 'inline',
720-
value: this.LucidImporter.Data.void(),
721-
},
711+
undefined,
722712
{
723713
...dto.transferModuleUtxo.assets,
724714
lovelace: dto.transferModuleUtxo.assets.lovelace - dto.transferAmount,
@@ -808,10 +798,7 @@ export class LucidService {
808798
)
809799
.pay.ToContract(
810800
deploymentConfig.modules.transfer.address,
811-
{
812-
kind: 'inline',
813-
value: this.LucidImporter.Data.void(),
814-
},
801+
undefined,
815802
{
816803
...dto.transferModuleUtxo.assets,
817804
},
@@ -897,10 +884,7 @@ export class LucidService {
897884
)
898885
.pay.ToContract(
899886
deploymentConfig.modules.transfer.address,
900-
{
901-
kind: 'inline',
902-
value: this.LucidImporter.Data.void(),
903-
},
887+
undefined,
904888
{
905889
...dto.transferModuleUtxo.assets,
906890
},
@@ -985,10 +969,7 @@ export class LucidService {
985969
)
986970
.pay.ToContract(
987971
deploymentConfig.modules.transfer.address,
988-
{
989-
kind: 'inline',
990-
value: this.LucidImporter.Data.void(),
991-
},
972+
undefined,
992973
{
993974
...dto.transferModuleUtxo.assets,
994975
[dto.denomToken]: calculateTransferToken(
@@ -1048,10 +1029,7 @@ export class LucidService {
10481029
)
10491030
.pay.ToContract(
10501031
deploymentConfig.modules.transfer.address,
1051-
{
1052-
kind: 'inline',
1053-
value: this.LucidImporter.Data.void(),
1054-
},
1032+
undefined,
10551033
{
10561034
...dto.transferModuleUtxo.assets,
10571035
[dto.denomToken]: calculateTransferToken(
@@ -1098,10 +1076,7 @@ export class LucidService {
10981076
)
10991077
.pay.ToContract(
11001078
dto.transferModuleAddress,
1101-
{
1102-
kind: 'inline',
1103-
value: this.LucidImporter.Data.void(),
1104-
},
1079+
undefined,
11051080
{
11061081
...dto.transferModuleUTxO.assets,
11071082
[dto.denomToken]: calculateTransferToken(
@@ -1184,10 +1159,7 @@ export class LucidService {
11841159
)
11851160
.pay.ToContract(
11861161
deploymentConfig.modules.transfer.address,
1187-
{
1188-
kind: 'inline',
1189-
value: this.LucidImporter.Data.void(),
1190-
},
1162+
undefined,
11911163
{
11921164
...dto.transferModuleUTxO.assets,
11931165
[dto.voucherTokenUnit]: calculateTransferToken(
@@ -1237,10 +1209,7 @@ export class LucidService {
12371209
)
12381210
.pay.ToContract(
12391211
dto.transferModuleAddress,
1240-
{
1241-
kind: 'inline',
1242-
value: this.LucidImporter.Data.void(),
1243-
},
1212+
undefined,
12441213
{
12451214
...dto.transferModuleUtxo.assets,
12461215
lovelace: dto.transferModuleUtxo.assets.lovelace - dto.transferAmount,
@@ -1287,10 +1256,7 @@ export class LucidService {
12871256
)
12881257
.pay.ToContract(
12891258
dto.transferModuleAddress,
1290-
{
1291-
kind: 'inline',
1292-
value: this.LucidImporter.Data.void(),
1293-
},
1259+
undefined,
12941260
{
12951261
...dto.transferModuleUtxo.assets,
12961262
[dto.denomToken]: calculateTransferToken(

cardano/onchain/lib/ibc/apps/transfer/transfer_module_datum.ak

Lines changed: 0 additions & 2 deletions
This file was deleted.

0 commit comments

Comments
 (0)