isUsedAsMutable method

bool isUsedAsMutable(
  1. TransactionBlockDataBuilder transactionData,
  2. int index
)

Implementation

bool isUsedAsMutable(TransactionBlockDataBuilder transactionData, int index) {
  var usedAsMutable = false;

  transactionData.getInputUses(index, (arg, tx) {
    if (tx["MoveCall"]?["_argumentTypes"] != null) {
      final arguments = tx["MoveCall"]["arguments"].toList();
      final argIndex = arguments.indexWhere((element) =>
        DeepCollectionEquality().equals(element, arg)
      );
      if (argIndex != -1) {
        usedAsMutable = tx["MoveCall"]["_argumentTypes"][argIndex]["ref"] != '&' || usedAsMutable;
      }
    } else if (tx["MakeMoveVec"] != null || tx["MergeCoins"] == null || tx["SplitCoins"] == null) {
      usedAsMutable = true;
    }
  });

  return usedAsMutable;
}