Skip to content

Bug with min_ada_required() #282

@BlakeBrown

Description

@BlakeBrown

min_ada_required() seems to report the wrong minimum ADA value for multiassets 😢

To repro:

  // Construct multiasset
  const assets = Assets.new();
  assets.insert(
    AssetName.new(
      Buffer.from("436c756d737947686f737473313331", "hex")
    ),
    BigNum.from_str("1")
  );
  const multiAsset = MultiAsset.new();
  multiAsset.insert(
    ScriptHash.from_bytes(
      Buffer.from(
        "b000e9f3994de3226577b4d61280994e53c07948c8839d628f4a425a",
        "hex"
      )
    ),
    assets
  );

  // Construct value
  const testValue = Value.new(
    BigNum.from_str("0")
  );
  testValue.set_multiasset(multiAsset);

  // Print min_ada
  console.log(
    min_ada_required(
      testValue,
      false,
      BigNum.from_str("1000000")
    ).to_str()
  );

Gives a total of 40 ADA or 40,000,000 lovelace 🤯

Any ideas why this might be happening?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions