Move cycles from share service#100
Conversation
| // Send via system API | ||
| D.print("Challenger: sendCyclesToOperatorAdmin - calling system API to send cycles"); | ||
| let deposit_cycles_args = { canister_id : Principal = Principal.fromText(OPERATOR_WALLET_ADDRESS); }; | ||
| let _ = ignore IC0.deposit_cycles(deposit_cycles_args); |
There was a problem hiding this comment.
I would leave it as is, with ignore, but I wanted to highlight we sometimes use await.
Not sure what is best, maybe ignore is best, because we have seen that await IC0.deposit_cycles can silently fail and stop processing the message.
| D.print("Challenger: sendCyclesToOperatorAdmin - calling system API to send cycles"); | ||
| let deposit_cycles_args = { canister_id : Principal = Principal.fromText(OPERATOR_WALLET_ADDRESS); }; | ||
| let _ = ignore IC0.deposit_cycles(deposit_cycles_args); | ||
| D.print("Challenger: sendCyclesToOperatorAdmin - deposit_cycles successful"); |
There was a problem hiding this comment.
But when using ignore, we can not claim yet the deposit_cycles was successful.
Maybe just log explicity: deposit_cycles called with ignore, so we know from looking at the logs what we did.
|
|
||
| // Share Service: Move cycles to operator's wallet (e.g. onicai) | ||
| stable let OPERATOR_WALLET_ADDRESS : Text = "jh35u-eqaaa-aaaag-abf3a-cai"; | ||
| stable var cyclesTransactionsStorage : List.List<Types.CyclesTransaction> = List.nil<Types.CyclesTransaction>(); |
There was a problem hiding this comment.
Probably still fine, but this list is growing in every canister.
Shall we plan on adding the cyclesTransactionsStorage to the archiving logic?
Applies to GameState, Challenger, Judge, mAInerCreator, ShareService
There was a problem hiding this comment.
as these are very small entries and there won't be many (as we trigger this manually from time to time), I think it's fine
| try { | ||
| // Only move cycles if cycles balance is big enough | ||
| if (currentCyclesBalance - CYCLES_AMOUNT_TO_OPERATOR < MIN_CYCLES_BALANCE) { | ||
| D.print("Challenger: sendCyclesToOperatorAdmin - requested cycles transaction but balance is not big enough: " # debug_show(currentCyclesBalance) # debug_show(msg)); |
There was a problem hiding this comment.
Refers to "Challenger"
Several lines here
No description provided.