syntax = "proto3"; package wallet.v1; import "auth/v1/msg.proto"; import "base/v1/msg.proto"; /* INTERNAL DATA */ message InternalTransactionData { int64 transaction_id = 1; } /* Federation */ message Federation { int64 id = 1; int64 user_id = 2; string ed_public = 3; string ed_public_hash = 4; int32 status = 5; string created_at = 6; string system_wallet_address = 7; } message GetFederationReq { optional int64 federation_id = 1; optional int64 user_id = 2; optional string ed_public = 3; optional string ed_public_hash = 4; } /* Wallet */ message UserInitWalletReq { auth.v1.InternalIAM iam = 1; int64 asset_id = 2; } message WalletList { repeated Wallet list = 1; // optional base.v1.Pagination pagination = 2; double available_balance = 3; double locked_balance = 4; double total_balance = 5; } message Wallet { int64 id = 1; int64 user_id = 2; int64 asset_id = 3; Asset asset_info = 4; int64 federation_id = 5; Federation federation_info = 6; double balance = 7; double frozen_balance = 8; string updated_at = 9; string created_at = 10; string wallet_code = 11; bool accepted_terms = 12; bool is_locked = 13; } /* Asset */ message Asset { int64 id = 1; string name = 2; string code = 3; string issuer = 4; int32 decimal = 5; double limit_amount = 6; string anchor = 7; string image = 8; string description = 9; string url = 10; int64 buy_unit_price = 11; int64 sell_unit_price = 12; double buy_min_amount = 13; double buy_max_amount = 14; double sell_min_amount = 15; double sell_max_amount = 16; double buy_fee_amount = 17; int64 buy_fee_price = 18; double sell_fee_amount = 19; int64 sell_fee_price = 20; double withdraw_min_amount = 21; double withdraw_max_amount = 22; bool is_active = 23; bool can_buy = 24; bool can_sell = 25; bool can_deposit = 26; bool can_withdraw = 27; string updated_at = 28; string created_at = 29; repeated string images = 30; repeated string videos = 31; AssetStatus status = 32; AssetMeta meta = 33; AssetTokenType token_type = 34; AssetPrice price = 35; bool is_base_asset = 36; bool is_locked = 37; Commission commission = 38; AssetType type = 39; } enum AssetTokenType { ASSET_NETWORK_TYPE_UNKNOWN = 0; ASSET_NETWORK_TYPE_STELLAR_NATIVE = 1; ASSET_NETWORK_TYPE_STELLAR_ALPHANUMERIC4 = 2; ASSET_NETWORK_TYPE_STELLAR_ALPHANUMERIC12 = 3; ASSET_NETWORK_TYPE_ERC20 = 4; } enum AssetStatus { ASSET_STATUS_UNKNOWN = 0; ASSET_STATUS_ACTIVE = 1; ASSET_STATUS_INACTIVE = 2; ASSET_STATUS_SOON = 3; ASSET_STATUS_FINISHED = 4; ASSET_STATUS_EVALUATION = 5; ASSET_STATUS_SUSPENDED = 6; } enum AssetType { ASSET_TYPE_UNKNOWN = 0; ASSET_TYPE_PROJECT = 1; ASSET_TYPE_CURRENCY = 2; ASSET_TYPE_NETWORK_GAS = 3; } message AssetList { repeated Asset list = 1; } message AssetFilter { repeated int64 ids = 1; repeated AssetType asset_type = 2; // AssetType repeated AssetType token_type = 3; // AssetType repeated AssetStatus status = 4; repeated string name = 5; optional bool can_buy = 6; optional bool can_sell = 7; optional bool can_deposit = 8; optional bool can_withdraw = 9; optional bool is_active = 10; optional string search = 11; // Not yet implemented ! } message AssetDiscountReq { auth.v1.InternalIAM iam = 1; string code = 2; int64 asset_id = 3; optional double amount = 4; // calculate discount amount } message AssetDiscountRes { uint64 id = 1; string code = 2; string expires_at = 3; double static_amount = 4; double percentage = 5; double max_amount = 6; double discount_amount = 7; // based of asset price and discount amount in req optional int64 supported_asset = 8; } message AssetPrice { string updated_at = 1; double market_price = 2; double admin_price = 3; } message GetAssetReq { optional int64 id = 1; optional string code = 3; } message AssetMeta { PropertyMeta property = 1; } message PropertyMeta { string description = 1; string builder_description = 2; string white_paper_url = 3; string expert_report_url = 4; string project_catalog_url = 5; string ownership_document_url = 6; double total_area_meters = 7; int32 total_unit_count = 8; string usage_type = 9; string completion_date = 10; string user_agreement_url = 11; string location_image = 12; } // Used for both locking and releasing asset :) message LockAssetReq { int64 asset_id = 1; double amount = 2; auth.v1.InternalIAM iam = 3; optional auth.v1.TFA tfa = 4; // if request is not internal } /* BNPL - not really but close name */ // enum BNPLPgState { // // } message GetUserBNPLInfoReq { auth.v1.InternalIAM iam = 1; base.v1.IdReq id = 2; } enum BNPLPaymentsStatus { PENDING_PAYMENT = 0; PAYED = 1; OVER_DUE = 2; NOT_STARTED = 3; NOT_YET_DUE = 4; CANCELED = 5; REJECTED = 6; } message BNPLPayments { uint64 id = 1; double amount = 2; double amount_irr = 7; bool is_paied = 3; string due_date = 4; string settlement_date = 5; BNPLPaymentsStatus status = 6; } message UserBNPLResp { uint64 id = 1; BNPLInfo bnpl = 2; int32 current_step = 3; optional float amount = 4; optional PaymentPeriodInfo payment_period = 5; optional bool accepted_terms = 6; repeated BNPLPayments payments = 7; optional string employee_id = 8; optional auth.v1.Company company = 10; auth.v1.InternalIAM iam = 11; optional string updated_at = 12; optional string created_at = 13; Asset selected_asset = 14; optional string rejection_reason = 15; } message UserBNPLReq { uint64 id = 1; int64 bnpl_id = 2; auth.v1.InternalIAM iam = 6; optional string created_at = 3; optional string employee_id = 4; optional int64 company_id = 5; optional float amount = 7; optional PaymentPeriodInfo payment_period = 8; optional bool has_agreed_contract = 9; optional int32 current_step = 10; // Can be useful for admin to change the current step optional int64 asset_id = 11; } message PaymentPeriodInfo { uint64 id = 1; uint64 period = 2; bool enabled = 3; } message BNPLInfo { uint64 id = 1; string description = 3; repeated Asset supported_assets = 2; optional bool enabled = 4; float amount_start = 5; float amount_end = 6; float amount_steps = 7; repeated PaymentPeriodInfo payment_period = 8; repeated auth.v1.Company possible_companies = 11; string updated_at = 12; string created_at = 13; string expires_at = 14; } message BNPLList { repeated BNPLInfo list = 1; } /* Transaction */ message TransactionList { repeated Transaction list = 1; int64 total_count = 2; } enum TransactionType { UNKNOWN = 0; BUY = 1; SELL = 2; INTERNAL_TRANSFER = 3; EXTERNAL_TRANSFER = 4; REDEEM = 5; TRUST_LINE = 6; WAGE = 7; EXTERNAL_DEPOSIT = 8; INTERNAL_DEPOSIT = 9; MARKETPLACE_BUY = 10; MARKETPLACE_SELL = 11; LOCK = 12; IRT_DEPOSIT = 13; IRT_WITHDRAWAL = 14; } enum TransactionStatus { UNDETERMINED = 0; FAILED = -10; SUSPENDED = -9; CREATED = -1; PENDING_TRX = 1; SUCCESSFUL = 2; } message Transaction { int64 id = 1; int64 asset_id = 2; // Asset asset_info = 3; //Causing network overloading optional int64 from_user_id = 4; optional auth.v1.UserIdentityBasic from_user_info = 5; optional int64 from_federation_id = 6; optional Federation from_federation_info = 7; optional int64 to_user_id = 8; optional auth.v1.UserIdentityBasic to_user_info = 9; optional int64 to_federation_id = 10; optional Federation to_federation_info = 11; double amount = 12; TransactionStatus status = 13; TransactionType type = 14; string updated_at = 15; string created_at = 16; string tracking_code = 17; optional string trx_hash = 18; optional string from_public_key = 19; optional string to_public_key = 20; double token_price = 21; } message UserGetTransactionListReq { auth.v1.InternalIAM iam = 1; optional int32 page_index = 2; optional int32 page_size = 3; optional int64 id = 4; optional int64 asset_id = 5; optional int64 from_user_id = 6; optional int64 from_federation_id = 7; optional int64 to_user_id = 8; optional int64 to_federation_id = 9; optional double amount_from = 10; optional double amount_to = 11; optional string tracking_code = 12; repeated TransactionType type = 13; repeated TransactionStatus status = 14; optional string from_date = 15; optional string to_date = 16; } /* Transfer */ message TransferAssetReq { auth.v1.InternalIAM iam = 1; auth.v1.Recipient recipient = 2; double amount = 3; optional int64 network_id = 4; int64 asset_id = 5; optional bool approval = 6; optional auth.v1.TFA tfa = 7; } message TransferAssetRes { auth.v1.Recipient recipient = 1; double amount = 2; // TODO: Change to Asset int64 transaction_id = 3; string transaction_hash = 4; Asset asset = 5; } /* Redeem Token */ message RedeemTokenReq { auth.v1.InternalIAM iam = 1; int64 asset_id = 2; uint64 bank_info_id = 3; double amount = 4; optional string tfa_code = 5; } message CalculateRedeemTokenRes { Asset asset = 1; double free_balance = 2; double total_balance = 3; double request_amount = 4; double profit_capital = 5; double user_capital = 6; optional auth.v1.BankInfo bank_info = 7; } message RedeemTokenRes { uint64 id = 1; int64 user_id = 2; Asset asset = 3; double free_balance = 4; double total_balance = 5; double request_amount = 6; string created_at = 7; bool is_paied = 8; // receipt.Receipt receipt = 8; double calculated_profit = 9; optional auth.v1.BankInfo bank_info = 10; optional string receipt = 11; } message RedeemTokenResList { repeated RedeemTokenRes list = 1; } /* Utility: Get Public Key from national id */ message NationalIDReq { auth.v1.InternalIAM iam = 1; string national_id = 2; } message PubKeyRes { string pub_key = 1; } /* Network Details */ enum NetworkType { UNKNOWN_NETWORK_TYPE = 0; ETH = 1; XLM = 2; BTC = 3; } message Network { int64 id = 1; string name = 2; string code = 3; string explorer = 4; int64 gas_asset_id = 5; string description = 6; NetworkType type = 7; bool is_active = 8; string image = 9; string updated_at = 10; string created_at = 11; } message NetworkList { repeated Network list = 1; } /* * Commission * */ message Commission { uint64 id = 1; string name = 2; double service_static = 3; double service_percentage = 4; double tax_static = 5; double tax_percentage = 6; optional string collector = 7; optional string description = 8; string updated_at = 9; string created_at = 10; } message EffectiveCommission { double service = 1; double tax = 2; double total = 3; } /* * IPG - Internet Payment Gateway * 1. Get Token * 2. Confirm * 3. Cancel * 4. [optional] check balance * */ // represent the information regarding the withdraw in bank // message BalanceReq { // auth.v1.InternalIAM iam = 1; // auth.v1.BankInfo bank_info = 2; // BankInfo // } enum IPGStatus { IPG_SUCCESS = 0; IPG_FAILED = -1; IPG_PENDING = 1; } // represent the information regarding the sale of the token message IPGGetTokenReq { auth.v1.InternalIAM iam = 1; int64 asset_id = 2; double amount = 3; optional uint64 discount_code = 4; } // represent the information regarding the ipg gateway message IPGGetTokenRes { string url = 1; int64 unit_price = 2; int64 total_price = 3; double amount = 4; string asset = 5; optional uint64 discount_code = 6; } message IPGConfirmReq { string ref_id = 1; string res_code = 2; string sale_order_id = 3; string sale_reference_id = 4; string card_holder_info = 5; string card_holder_pan = 6; string final_amount = 7; } message IPGConfirmRes { string receipt_link = 1; } message SaleManualReq { auth.v1.InternalIAM iam = 1; int64 asset_id = 2; double amount = 3; string paid_at = 4; string rrn = 5; string national_id = 6; optional uint64 discount_code = 7; } /* IRT * * */ message DepositIRTReq { auth.v1.InternalIAM iam = 1; double amount = 3; } message WithdrawIRTReq { auth.v1.InternalIAM iam = 1; double amount = 2; int64 bank_info_id = 3; } message WithdrawIRTRes { int64 transaction_id = 1; int64 amount = 2; string transaction_hash = 3; } message BuyAssetReq { auth.v1.InternalIAM iam = 1; int64 asset_id = 2; double amount_irt = 3; double amount_asset = 4; BuyAssetSide side = 5; optional uint64 aggreement_id = 6; // Only in asset that require agreement contract optional string discount_code = 7; optional auth.v1.TFA tfa = 8; // This might be used in the future } enum BuyAssetSide { BUY_ASSET_FROM_BASE = 0; BUY_ASSET_TO_BASE = 1; } message CalcBuyAssetRes { // int64 id = 1; // Wallet wallet = 1; // Asset asset = 2; // double amount = 4; BuyAssetSide side = 1; double calculated_irt_amount = 2; double calculated_asset_amount = 3; EffectiveCommission commission = 4; optional AssetDiscountRes discount_detail = 5; // double buy_min_amount = 7; } message BuyAssetRes { bool success = 1; string irt_hash = 2; string asset_hash = 3; } /* Contract */ enum ContractType { CONTRACT_TYPE_ICO = 0; CONTRACT_TYPE_MARKET = 1; CONTRACT_TYPE_BNPL = 2; CONTRACT_TYPE_REDEEM = 3; } message GenerateContractReq { auth.v1.InternalIAM iam = 1; int64 asset_id = 2; int64 amount = 3; ContractType contract_type = 4; map metadata = 5; } message ContractRes { string link = 1; uint64 aggreement_id = 2; uint64 transaction_id = 3; string contract_hash = 4; string contract_content = 5; }