I did add <system>
to my code, but it does not compile anyway. What did I do wrong?
.mops/base@0.10.4/src/ExperimentalCycles.mo:96.60-96.77: type error [M0096], expression of type
<system>Nat -> Nat
cannot produce expected type
Nat -> Nat
.mops/base@0.10.4/src/ExperimentalCycles.mo:124.43-124.57: type error [M0096], expression of type
<system>Nat -> ()
cannot produce expected type
Nat -> ()
import Cycles "mo:base/ExperimentalCycles";
import Int "mo:base/Int";
import Debug "mo:base/Debug";
import Nat "mo:base/Nat";
module {
public func topUpCycles<system>(maxCycles: Nat): (accepted : Nat) {
// Debug.print("maxCycles: " # debug_show(maxCycles) # " Proposed cycles: " # debug_show(Cycles.available()) # " balance: " # debug_show(Cycles.balance()));
// let amount = Int.min(maxCycles, Int.max(0, Cycles.available() + Cycles.balance()));
let amount = Int.min(maxCycles, Cycles.available()) - Cycles.balance();
let amount2 = Int.max(amount, 0);
// Debug.print("Accepting cycles: " # debug_show(amount2));
Cycles.accept<system>(Int.abs(amount2));
};
public func addPart<system>(maxAmount: Nat) {
let amount = Nat.min(Cycles.balance() / 2, maxAmount);
ignore Cycles.accept(amount);
// Debug.print("adding " # debug_show(amount) # " cycles");
Cycles.add<system>(amount);
};
}