Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ require (
github.com/aws/aws-sdk-go-v2/feature/rds/auth v1.6.25
github.com/aws/aws-sdk-go-v2/service/s3 v1.102.2
github.com/code-payments/code-vm-indexer v1.2.0
github.com/code-payments/ocp-protobuf-api v1.13.0
github.com/code-payments/ocp-protobuf-api v1.13.2-0.20260610171241-de46af911053
github.com/emirpasic/gods v1.12.0
github.com/envoyproxy/protoc-gen-validate v1.2.1
github.com/golang/protobuf v1.5.4
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,8 @@ github.com/cockroachdb/apd v1.1.0 h1:3LFP3629v+1aKXU5Q37mxmRxX/pIu1nijXydLShEq5I
github.com/cockroachdb/apd v1.1.0/go.mod h1:8Sl8LxpKi29FqWXR16WEFZRNSz3SoPzUzeMeY4+DwBQ=
github.com/code-payments/code-vm-indexer v1.2.0 h1:rSHpBMiT9BKgmKcXg/VIoi/h0t7jNxGx07Qz59m+6Q0=
github.com/code-payments/code-vm-indexer v1.2.0/go.mod h1:vn91YN2qNqb+gGJeZe2+l+TNxVmEEiRHXXnIn2Y40h8=
github.com/code-payments/ocp-protobuf-api v1.13.0 h1:Skzi+h0wqAu1e8zMNN7jCeQoJB3t1BVAVpnv0JuRDIU=
github.com/code-payments/ocp-protobuf-api v1.13.0/go.mod h1:tw6BooY5a8l6CtSZnKOruyKII0W04n89pcM4BizrgG8=
github.com/code-payments/ocp-protobuf-api v1.13.2-0.20260610171241-de46af911053 h1:0B96K7/z7TpFbAJeyzP43A0eM58Ie/KRuu5U6PUrses=
github.com/code-payments/ocp-protobuf-api v1.13.2-0.20260610171241-de46af911053/go.mod h1:tw6BooY5a8l6CtSZnKOruyKII0W04n89pcM4BizrgG8=
github.com/containerd/continuity v0.0.0-20190827140505-75bee3e2ccb6 h1:NmTXa/uVnDyp0TY5MKi197+3HWcnYWfnHGyaFthlnGw=
github.com/containerd/continuity v0.0.0-20190827140505-75bee3e2ccb6/go.mod h1:GL3xCUCBDV3CZiTSEKksMWbLE66hEyuu9qyDOOqM47Y=
github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk=
Expand Down
6 changes: 3 additions & 3 deletions ocp/aml/guard_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -194,9 +194,9 @@ func makeReceivePaymentsPubliclyIntent(t *testing.T, owner *common.Account, usdM
IntentType: intent.ReceivePaymentsPublicly,

ReceivePaymentsPubliclyMetadata: &intent.ReceivePaymentsPubliclyMetadata{
Source: testutil.NewRandomAccount(t).PublicKey().ToBase58(),
Quantity: uint64(usdMarketValue),
IsRemoteSend: true,
Source: testutil.NewRandomAccount(t).PublicKey().ToBase58(),
Quantity: uint64(usdMarketValue),
IsIndirectSend: true,

OriginalExchangeCurrency: currency_lib.USD,
OriginalExchangeRate: 1.0,
Expand Down
20 changes: 10 additions & 10 deletions ocp/data/intent/intent.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,16 +80,16 @@ type SendPublicPaymentMetadata struct {
NativeAmount float64
UsdMarketValue float64

IsWithdrawal bool
IsRemoteSend bool
IsSwapSell bool
IsWithdrawal bool
IsIndirectSend bool
IsSwapSell bool
}

type ReceivePaymentsPubliclyMetadata struct {
Source string
Quantity uint64

IsRemoteSend bool
IsIndirectSend bool
IsReturned bool
IsIssuerVoidingGiftCard bool

Expand Down Expand Up @@ -358,9 +358,9 @@ func (m *SendPublicPaymentMetadata) Clone() SendPublicPaymentMetadata {
NativeAmount: m.NativeAmount,
UsdMarketValue: m.UsdMarketValue,

IsWithdrawal: m.IsWithdrawal,
IsRemoteSend: m.IsRemoteSend,
IsSwapSell: m.IsSwapSell,
IsWithdrawal: m.IsWithdrawal,
IsIndirectSend: m.IsIndirectSend,
IsSwapSell: m.IsSwapSell,
}
}

Expand All @@ -375,7 +375,7 @@ func (m *SendPublicPaymentMetadata) CopyTo(dst *SendPublicPaymentMetadata) {
dst.UsdMarketValue = m.UsdMarketValue

dst.IsWithdrawal = m.IsWithdrawal
dst.IsRemoteSend = m.IsRemoteSend
dst.IsIndirectSend = m.IsIndirectSend
dst.IsSwapSell = m.IsSwapSell
}

Expand Down Expand Up @@ -412,7 +412,7 @@ func (m *ReceivePaymentsPubliclyMetadata) Clone() ReceivePaymentsPubliclyMetadat
Source: m.Source,
Quantity: m.Quantity,

IsRemoteSend: m.IsRemoteSend,
IsIndirectSend: m.IsIndirectSend,
IsReturned: m.IsReturned,
IsIssuerVoidingGiftCard: m.IsIssuerVoidingGiftCard,

Expand All @@ -428,7 +428,7 @@ func (m *ReceivePaymentsPubliclyMetadata) CopyTo(dst *ReceivePaymentsPubliclyMet
dst.Source = m.Source
dst.Quantity = m.Quantity

dst.IsRemoteSend = m.IsRemoteSend
dst.IsIndirectSend = m.IsIndirectSend
dst.IsReturned = m.IsReturned
dst.IsIssuerVoidingGiftCard = m.IsIssuerVoidingGiftCard

Expand Down
10 changes: 5 additions & 5 deletions ocp/data/intent/memory/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -194,16 +194,16 @@ func (s *store) filterByType(items []*intent.Record, intentType intent.Type) []*
return res
}

func (s *store) filterByRemoteSendFlag(items []*intent.Record, want bool) []*intent.Record {
func (s *store) filterByIndirectSendFlag(items []*intent.Record, want bool) []*intent.Record {
var res []*intent.Record
for _, item := range items {
switch item.IntentType {
case intent.SendPublicPayment:
if item.SendPublicPaymentMetadata.IsRemoteSend == want {
if item.SendPublicPaymentMetadata.IsIndirectSend == want {
res = append(res, item)
}
case intent.ReceivePaymentsPublicly:
if item.ReceivePaymentsPubliclyMetadata.IsRemoteSend == want {
if item.ReceivePaymentsPubliclyMetadata.IsIndirectSend == want {
res = append(res, item)
}
}
Expand Down Expand Up @@ -319,7 +319,7 @@ func (s *store) GetOriginalGiftCardIssuedIntent(ctx context.Context, giftCardVau
items := s.findByDestination(giftCardVault)
items = s.filterByType(items, intent.SendPublicPayment)
items = s.filterByState(items, false, intent.StateRevoked)
items = s.filterByRemoteSendFlag(items, true)
items = s.filterByIndirectSendFlag(items, true)

if len(items) == 0 {
return nil, intent.ErrIntentNotFound
Expand All @@ -340,7 +340,7 @@ func (s *store) GetGiftCardClaimedIntent(ctx context.Context, giftCardVault stri
items := s.findBySource(giftCardVault)
items = s.filterByType(items, intent.ReceivePaymentsPublicly)
items = s.filterByState(items, false, intent.StateRevoked)
items = s.filterByRemoteSendFlag(items, true)
items = s.filterByIndirectSendFlag(items, true)

if len(items) == 0 {
return nil, intent.ErrIntentNotFound
Expand Down
16 changes: 8 additions & 8 deletions ocp/data/intent/postgres/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ type intentModel struct {
UsdMarketValue float64 `db:"usd_market_value"`
OriginalUsdMarketValue float64 `db:"original_usd_market_value"`
IsWithdrawal bool `db:"is_withdraw"`
IsRemoteSend bool `db:"is_remote_send"`
IsIndirectSend bool `db:"is_remote_send"` // todo: rename column
IsReturned bool `db:"is_returned"`
IsIssuerVoidingGiftCard bool `db:"is_issuer_voiding_gift_card"`
IsSwap bool `db:"is_swap"`
Expand Down Expand Up @@ -106,13 +106,13 @@ func toIntentModel(obj *intent.Record) (*intentModel, error) {
m.OriginalUsdMarketValue = obj.SendPublicPaymentMetadata.UsdMarketValue

m.IsWithdrawal = obj.SendPublicPaymentMetadata.IsWithdrawal
m.IsRemoteSend = obj.SendPublicPaymentMetadata.IsRemoteSend
m.IsIndirectSend = obj.SendPublicPaymentMetadata.IsIndirectSend
m.IsSwap = obj.SendPublicPaymentMetadata.IsSwapSell
case intent.ReceivePaymentsPublicly:
m.Source = obj.ReceivePaymentsPubliclyMetadata.Source
m.Quantity = obj.ReceivePaymentsPubliclyMetadata.Quantity

m.IsRemoteSend = obj.ReceivePaymentsPubliclyMetadata.IsRemoteSend
m.IsIndirectSend = obj.ReceivePaymentsPubliclyMetadata.IsIndirectSend
m.IsReturned = obj.ReceivePaymentsPubliclyMetadata.IsReturned
m.IsIssuerVoidingGiftCard = obj.ReceivePaymentsPubliclyMetadata.IsIssuerVoidingGiftCard

Expand Down Expand Up @@ -189,16 +189,16 @@ func fromIntentModel(obj *intentModel) *intent.Record {
NativeAmount: obj.NativeAmount,
UsdMarketValue: obj.UsdMarketValue,

IsWithdrawal: obj.IsWithdrawal,
IsRemoteSend: obj.IsRemoteSend,
IsSwapSell: obj.IsSwap,
IsWithdrawal: obj.IsWithdrawal,
IsIndirectSend: obj.IsIndirectSend,
IsSwapSell: obj.IsSwap,
}
case intent.ReceivePaymentsPublicly:
record.ReceivePaymentsPubliclyMetadata = &intent.ReceivePaymentsPubliclyMetadata{
Source: obj.Source,
Quantity: obj.Quantity,

IsRemoteSend: obj.IsRemoteSend,
IsIndirectSend: obj.IsIndirectSend,
IsReturned: obj.IsReturned,
IsIssuerVoidingGiftCard: obj.IsIssuerVoidingGiftCard,

Expand Down Expand Up @@ -256,7 +256,7 @@ func (m *intentModel) dbSave(ctx context.Context, db *sqlx.DB) error {
m.UsdMarketValue,
m.OriginalUsdMarketValue,
m.IsWithdrawal,
m.IsRemoteSend,
m.IsIndirectSend,
m.IsReturned,
m.IsIssuerVoidingGiftCard,
m.IsSwap,
Expand Down
Loading
Loading