@@ -46,13 +46,15 @@ func (g *Guard) AllowMoneyMovement(ctx context.Context, intentRecord *intent.Rec
46
46
var nativeAmount float64
47
47
var usdMarketValue float64
48
48
var consumptionCalculator func (ctx context.Context , owner string , since time.Time ) (uint64 , float64 , error )
49
+ var action string
49
50
switch intentRecord .IntentType {
50
51
case intent .SendPublicPayment :
51
52
// Public sends are subject to limits
52
53
currency = intentRecord .SendPublicPaymentMetadata .ExchangeCurrency
53
54
nativeAmount = intentRecord .SendPublicPaymentMetadata .NativeAmount
54
55
usdMarketValue = intentRecord .SendPublicPaymentMetadata .UsdMarketValue
55
56
consumptionCalculator = g .data .GetTransactedAmountForAntiMoneyLaundering
57
+ action = actionSendPayment
56
58
case intent .ReceivePaymentsPublicly :
57
59
// Public receives are always allowed
58
60
return true , nil
@@ -73,13 +75,13 @@ func (g *Guard) AllowMoneyMovement(ctx context.Context, intentRecord *intent.Rec
73
75
sendLimit , ok := limit .SendLimits [currency ]
74
76
if ! ok {
75
77
log .Info ("denying intent with unsupported currency" )
76
- recordDenialEvent (ctx , "unsupported currency" )
78
+ recordDenialEvent (ctx , action , "unsupported currency" )
77
79
return false , nil
78
80
}
79
81
80
82
if nativeAmount > sendLimit .PerTransaction {
81
83
log .Info ("denying intent that exceeds per-transaction value" )
82
- recordDenialEvent (ctx , "exceeds per-transaction value" )
84
+ recordDenialEvent (ctx , action , "exceeds per-transaction value" )
83
85
return false , nil
84
86
}
85
87
@@ -93,7 +95,7 @@ func (g *Guard) AllowMoneyMovement(ctx context.Context, intentRecord *intent.Rec
93
95
94
96
if usdInLastDay + usdMarketValue > maxDailyUsdLimit {
95
97
log .Info ("denying intent that exceeds daily usd limit" )
96
- recordDenialEvent (ctx , "exceeds daily usd value" )
98
+ recordDenialEvent (ctx , action , "exceeds daily usd value" )
97
99
return false , nil
98
100
}
99
101
0 commit comments