Skip to content

Track USDC swap account #41

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 19 commits into from
Jan 29, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
660bd85
Update account data packages to include mint
jeffyanta Jan 23, 2024
4fc8ebc
Update common data packages to include mint
jeffyanta Jan 23, 2024
06cd36b
Update account server to pull mint from DB records
jeffyanta Jan 23, 2024
707ece9
Update transaction service to handle mint and fix tests
jeffyanta Jan 23, 2024
ea37e34
Fix tests everywhere else
jeffyanta Jan 23, 2024
8ed98ff
Make external deposit store interface more generic
jeffyanta Jan 23, 2024
4c46194
Pull in v1.8.4 APIs
jeffyanta Jan 23, 2024
577d9e5
Support swap account in account info store
jeffyanta Jan 23, 2024
eddcbd2
Update core RPCs and utilities for swap account integration
jeffyanta Jan 23, 2024
5d90113
Refactor Geyser external deposit handler to handle USDC swap accounts
jeffyanta Jan 24, 2024
333ca8a
Define chat messages used in manual USDC deposit swap flow
jeffyanta Jan 24, 2024
adc3097
Integrate USDC being converted chat message into Swap RPC
jeffyanta Jan 24, 2024
b0f5ab3
Integrate USDC deposited chat message into Geyser
jeffyanta Jan 24, 2024
6f7ab45
Detect if Kin external deposit is a Code swap, and message accordingly
jeffyanta Jan 24, 2024
0e6ad67
Implement LinkAdditionalAccounts RPC in Account service
jeffyanta Jan 25, 2024
12c7664
Update Swap RPC
jeffyanta Jan 26, 2024
bd27752
Consistency in how common mints are constructed
jeffyanta Jan 29, 2024
ff28baf
Update TestIsCodeAccount_HappyPath to incorporate a swap account
jeffyanta Jan 29, 2024
b63d6a6
Update CalculateFromBlockchain comments
jeffyanta Jan 29, 2024
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
Prev Previous commit
Next Next commit
Pull in v1.8.4 APIs
  • Loading branch information
jeffyanta committed Jan 23, 2024
commit 4c46194160c5a0b6d02ee1e28399020960213044
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ require (
firebase.google.com/go/v4 v4.8.0
github.com/aws/aws-sdk-go-v2 v0.17.0
github.com/bits-and-blooms/bloom/v3 v3.1.0
github.com/code-payments/code-protobuf-api v1.8.3
github.com/code-payments/code-protobuf-api v1.8.4
github.com/emirpasic/gods v1.12.0
github.com/envoyproxy/protoc-gen-validate v0.1.0
github.com/golang-jwt/jwt/v5 v5.0.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,8 @@ github.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWH
github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs=
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-protobuf-api v1.8.3 h1:BEGKUvHZu5TvfsX4zhzSppuvZGlHH/DbvVBS0/oB18M=
github.com/code-payments/code-protobuf-api v1.8.3/go.mod h1:pHQm75vydD6Cm2qHAzlimW6drysm489Z4tVxC2zHSsU=
github.com/code-payments/code-protobuf-api v1.8.4 h1:7JtuhU3IMlFUVxi3JMAc91RDrarIlE2uqusuthMm8WE=
github.com/code-payments/code-protobuf-api v1.8.4/go.mod h1:pHQm75vydD6Cm2qHAzlimW6drysm489Z4tVxC2zHSsU=
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
17 changes: 0 additions & 17 deletions pkg/code/server/grpc/account/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import (
"github.com/code-payments/code-server/pkg/grpc/client"
"github.com/code-payments/code-server/pkg/kin"
timelock_token_v1 "github.com/code-payments/code-server/pkg/solana/timelock/v1"
"github.com/code-payments/code-server/pkg/usdc"
)

var (
Expand Down Expand Up @@ -375,20 +374,6 @@ func (s *server) getProtoAccountInfo(ctx context.Context, records *common.Accoun
}
}

var mintDecimals uint32
var mintDisplayName string
switch mintAccount.PublicKey().ToBase58() {
case kin.Mint:
mintDecimals = kin.Decimals
mintDisplayName = "Kin"
case usdc.Mint:
mintDecimals = usdc.Decimals
mintDisplayName = "USDC"
default:
// todo: Add a dynamic check when we extend support byeond Kin and USDC
return nil, errors.New("unsupported mint")
}

return &accountpb.TokenAccountInfo{
Address: tokenAccount.ToProto(),
Owner: ownerAccount.ToProto(),
Expand All @@ -404,8 +389,6 @@ func (s *server) getProtoAccountInfo(ctx context.Context, records *common.Accoun
OriginalExchangeData: originalExchangeData,
Relationship: relationship,
Mint: mintAccount.ToProto(),
MintDecimals: mintDecimals,
MintDisplayName: mintDisplayName,
}, nil
}

Expand Down
2 changes: 0 additions & 2 deletions pkg/code/server/grpc/account/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -282,8 +282,6 @@ func TestGetTokenAccountInfos_UserAccounts_HappyPath(t *testing.T) {
assert.Equal(t, accountpb.TokenAccountInfo_CLAIM_STATE_UNKNOWN, accountInfo.ClaimState)
assert.Nil(t, accountInfo.OriginalExchangeData)
assert.Equal(t, common.KinMintAccount.PublicKey().ToBytes(), accountInfo.Mint.Value)
assert.EqualValues(t, kin.Decimals, accountInfo.MintDecimals)
assert.Equal(t, "Kin", accountInfo.MintDisplayName)
}

primaryAccountInfoRecord, err := env.data.GetLatestAccountInfoByOwnerAddressAndType(env.ctx, ownerAccount.PublicKey().ToBase58(), commonpb.AccountType_PRIMARY)
Expand Down