decode method

  1. @override
DecoderResult<bool> decode(
  1. AbiParameter params,
  2. List<int> bytes
)
override

Decodes a boolean value from the given ABI-encoded bytes. Validates the decoded value using _ABIValidator.

Implementation

@override
DecoderResult<bool> decode(AbiParameter params, List<int> bytes) {
  final toBigInt = BigintUtils.fromBytes(
    bytes.sublist(0, ABIConst.uintBytesLength),
  );
  _ABIValidator.validateBoolean(params, toBigInt);
  return DecoderResult(
    result: toBigInt == BigInt.one,
    consumed: ABIConst.uintBytesLength,
    name: params.name,
  );
}