Conversation
| owner = Principal.fromActor(this); | ||
| subaccount = null; | ||
| }; | ||
| let actualFunnaiBalance = await TokenLedger_Actor.icrc1_balance_of(funnaiAccount); |
There was a problem hiding this comment.
Do we need a try/catch ?
There was a problem hiding this comment.
I wrapped the critical call to this function in a try catch
| owner = Principal.fromActor(this); | ||
| subaccount = null; | ||
| }; | ||
| let actualIcpBalance = await ICP_LEDGER_ACTOR.icrc1_balance_of(icpAccount); |
There was a problem hiding this comment.
Do we need a try/catch ?
| spender_subaccount = null; | ||
| }; | ||
|
|
||
| let icpTransferResult : TokenLedger.Result_3 = await ICP_LEDGER_ACTOR.icrc2_transfer_from(transferFromArgs); |
There was a problem hiding this comment.
Do we need a try/catch ?
| totalNextIcp := totalNextIcp + entry.icpContributionE8S; | ||
| }; | ||
|
|
||
| let totalCyclesForWeek = await calculateCyclesFromIcp(totalNextIcp); |
There was a problem hiding this comment.
Do we need a try/catch ?
|
|
||
| for ((address, mainerEntry) in poolMainersStorage.entries()) { | ||
| // Top up mAIner with cyclesPerMainer via Game State | ||
| let topUpResult = await topUpMainerWithCycles(mainerEntry, icpPerMainer); |
There was a problem hiding this comment.
Do we need a try/catch ?
There was a problem hiding this comment.
external calls in topUpMainerWithCycles are wrapped in a try/catch
| let settingInput : Types.MainerAgentSettingsInput = { | ||
| cyclesBurnRate : Types.CyclesBurnRateDefault = burnRatePerMainer; | ||
| }; | ||
| let updateResult = await mainerCanisterActor.updateAgentSettings(settingInput); |
There was a problem hiding this comment.
Do we need a try/catch ?
| }; | ||
|
|
||
| // Query: Get aggregated past contributions and distributions | ||
| public shared query func getAggregatedHistory() : async Types.Result<{ |
There was a problem hiding this comment.
Should this function and the next ones be truly public, even for anonymous callers?
There was a problem hiding this comment.
as they don't return sensitive info, it's fine to also allow users who aren't logged in to query them
| timeInterval : Types.TimeInterval = #Daily; | ||
| }; | ||
|
|
||
| private func calculateBurnRatePerMainer(cyclesForWeek : Nat) : Nat { |
There was a problem hiding this comment.
This function is not used. Is it still needed?
| } else if (cyclesForWeek <= 7 * cyclesBurnRateDefaultHigh.cycles) { | ||
| return #High; | ||
| } else { | ||
| return #VeryHigh; |
There was a problem hiding this comment.
What happens with the excess cycles that are not burned during the week?
There was a problem hiding this comment.
ideally, all cycles are burnt. Otherwise, they just stay in the mAIner
No description provided.