@@ -48,10 +48,9 @@ struct TokenPool_Hooks<T> {
4848 ensureOutboundAccess: ((T?, address, uint64) -> void)?;
4949 ensureInboundAccess: ((T?, address, uint64) -> void)?;
5050 ensureNotCursed: ((T?, uint64) -> void)?;
51- applyLockOrBurn: ((T?, TokenPool_LockOrBurnPrepared) -> void)?;
52- applyReleaseOrMint: ((T?, TokenPool_ReleaseOrMintPrepared) -> void)?;
5351
5452 // ReleaseOrMint flow
53+ onReleaseOrMint: ((T, TokenPool_ReleaseOrMint) -> T)?;
5554 postflightCheck: ((T?, TokenPool_ReleaseOrMintInV1, uint256, uint32) -> bool)?;
5655 handleReleaseOrMintMessage: ((T?, address, TokenPool_ReleaseOrMint, TokenPool_ReleaseOrMintPrepared) -> T?)?;
5756
@@ -464,13 +463,10 @@ fun TokenPool<T>.onInternalMessage(mutate self, msgSender: address, msgValue: co
464463 //
465464 // In the worst case, not enough funds, received Jettons are burned.
466465 TransferNotificationForRecipient => {
467- // TODO: how do we know this transfer is allowed - easiest to just accept transfers from the Router (static)
468466 self.onLockOrBurnTransfer(msgSender, msg);
469467 }
470468 TokenPool_ReleaseOrMint => {
471- val (_wait, prepared) = self.validateReleaseOrMint(msgSender, msg.request.load(), msg.requestedFinalityConfig);
472- assert(self.hooks != null && self.hooks.handleReleaseOrMintMessage != null, TokenPool_Error.UnsupportedOperation);
473- self.context = self.hooks.handleReleaseOrMintMessage(self.context, msgSender, msg, prepared);
469+ self.onReleaseOrMint(msgSender, msg);
474470 }
475471 TokenPool_PostflightCheckFinished => {
476472 // TODO: implement me
@@ -871,17 +867,20 @@ fun TokenPool<T>.validateReleaseOrMint(
871867 });
872868}
873869
874- fun TokenPool<T>.releaseOrMint (
870+ fun TokenPool<T>.onReleaseOrMint (
875871 mutate self,
876872 sender: address,
877- request: TokenPool_ReleaseOrMintInV1,
878- requestedFinalityConfig: uint32 = TOKEN_POOL_DEFAULT_FINALITY,
879- ): TokenPool_ReleaseOrMintPrepared {
880- val (_wait, prepared) = self.validateReleaseOrMint(sender, request, requestedFinalityConfig);
881- if (self.hooks != null && self.hooks.applyReleaseOrMint != null) {
882- self.hooks.applyReleaseOrMint(self.context, prepared);
873+ msg: TokenPool_ReleaseOrMint,
874+ ): void {
875+ if (self.hooks != null && self.hooks.onReleaseOrMint != null) {
876+ self.context = self.hooks.onReleaseOrMint(self.context!, msg);
877+ }
878+
879+ val (_wait, prepared) = self.validateReleaseOrMint(sender, msg.request.load(), msg.requestedFinalityConfig);
880+ // TODO: move to specific fn call
881+ if (self.hooks != null && self.hooks.handleReleaseOrMintMessage != null) {
882+ self.context = self.hooks.handleReleaseOrMintMessage(self.context, sender, msg, prepared);
883883 }
884- return prepared;
885884}
886885
887886fun TokenPool<T>.encodeLocalDecimals(self): cell {
0 commit comments