@@ -46,13 +46,15 @@ func (g *Guard) AllowMoneyMovement(ctx context.Context, intentRecord *intent.Rec
4646 var nativeAmount float64
4747 var usdMarketValue float64
4848 var consumptionCalculator func (ctx context.Context , owner string , since time.Time ) (uint64 , float64 , error )
49+ var action string
4950 switch intentRecord .IntentType {
5051 case intent .SendPublicPayment :
5152 // Public sends are subject to limits
5253 currency = intentRecord .SendPublicPaymentMetadata .ExchangeCurrency
5354 nativeAmount = intentRecord .SendPublicPaymentMetadata .NativeAmount
5455 usdMarketValue = intentRecord .SendPublicPaymentMetadata .UsdMarketValue
5556 consumptionCalculator = g .data .GetTransactedAmountForAntiMoneyLaundering
57+ action = actionSendPayment
5658 case intent .ReceivePaymentsPublicly :
5759 // Public receives are always allowed
5860 return true , nil
@@ -73,13 +75,13 @@ func (g *Guard) AllowMoneyMovement(ctx context.Context, intentRecord *intent.Rec
7375 sendLimit , ok := limit .SendLimits [currency ]
7476 if ! ok {
7577 log .Info ("denying intent with unsupported currency" )
76- recordDenialEvent (ctx , "unsupported currency" )
78+ recordDenialEvent (ctx , action , "unsupported currency" )
7779 return false , nil
7880 }
7981
8082 if nativeAmount > sendLimit .PerTransaction {
8183 log .Info ("denying intent that exceeds per-transaction value" )
82- recordDenialEvent (ctx , "exceeds per-transaction value" )
84+ recordDenialEvent (ctx , action , "exceeds per-transaction value" )
8385 return false , nil
8486 }
8587
@@ -93,7 +95,7 @@ func (g *Guard) AllowMoneyMovement(ctx context.Context, intentRecord *intent.Rec
9395
9496 if usdInLastDay + usdMarketValue > maxDailyUsdLimit {
9597 log .Info ("denying intent that exceeds daily usd limit" )
96- recordDenialEvent (ctx , "exceeds daily usd value" )
98+ recordDenialEvent (ctx , action , "exceeds daily usd value" )
9799 return false , nil
98100 }
99101
0 commit comments