Commit 096800ca authored by Yury's avatar Yury
Browse files

update vendor. Update common module. Message: перенес init из блока при...

update vendor. Update common module. Message: перенес init из блока при инициализации канала в invoke
parent c6c4a635
No related merge requests found
Showing with 444 additions and 134 deletions
+444 -134
......@@ -36,21 +36,6 @@ func timeFuncFactory(adapter shim.ChaincodeStubInterface) func() (int64, error)
// Init initialize chaincode with proper parameters
func (t CommonChaincode) Init(adapter shim.ChaincodeStubInterface) (response pb.Response) {
defer func() {
GlobalLogger.Info("end init")
if r := recover(); r != nil {
response = shim.Error(fmt.Sprintf("FATAL_ERROR: %f", r))
}
}()
GlobalLogger.Info("Start initializing ..")
_, args := adapter.GetFunctionAndParameters()
if err := t.InitChaincode(args); err != nil {
GlobalLogger.Error(err.Error())
return shim.Error(err.Error())
}
return shim.Success([]byte("Chaincode initialized successfully"))
}
......@@ -90,6 +75,23 @@ func (t CommonChaincode) Invoke(adapter shim.ChaincodeStubInterface) (response p
GlobalLogger.Infof("ChaincodeName: %s", ChaincodeParameters.ChaincodeName)
GlobalLogger.Infof("functionName: %s", functionName)
if functionName == "init" {
defer func() {
GlobalLogger.Info("end init")
if r := recover(); r != nil {
response = shim.Error(fmt.Sprintf("FATAL_ERROR: %f", r))
}
}()
GlobalLogger.Info("Start initializing ..")
if err := t.InitChaincode(args); err != nil {
GlobalLogger.Error(err.Error())
return shim.Error(err.Error())
}
return shim.Success([]byte("Chaincode initialized successfully"))
}
timeGetter := timeFuncFactory(adapter)
_, err := timeGetter()
if err != nil {
......
package isystempreference
import (
"gitlab.smartblocklab.com/smartcontracts/common/model/requests"
"gitlab.smartblocklab.com/smartcontracts/common/model/preferenceCC"
)
type ISystemPreferenceManager interface {
AddPreference(preference *preferenceCC.Preference) (*preferenceCC.Preference, error)
GetPreference(key *requests.Id) (*preferenceCC.Preference, error)
UpdatePreference(preference *preferenceCC.Preference) (*preferenceCC.Preference, error)
}
......@@ -9,15 +9,16 @@ type ITransactionManager interface {
// invoke
LockFundsOnAccount(txnArgs *transactionCC.TxnFundsLockInput) error
LockOutFundsOnAccount(txnArgs *transactionCC.OutTxnFundsLockInput) error
TransferFunds(operationId *requests.Id) (*transactionCC.TransferFundsResponseList, error)
UnlockFundsOnAccount(operationId *requests.Id) (*transactionCC.TransferFundsResponseList, error)
LockFundsOnAccount(txnArgs *transactionCC.TxnFundsLockInput) (*transactionCC.UserTransactionsList, error)
LockOutFundsOnAccount(txnArgs *transactionCC.OutTxnFundsLockInput) (*transactionCC.UserTransactionsList, error)
TransferFunds(operationId *requests.Id) (*transactionCC.UserTransactionsList, error)
UnlockFundsOnAccount(operationId *requests.Id) (*transactionCC.UserTransactionsList, error)
LoadCryptocurrency(systemUserID string) (*transactionCC.LoadCryptocurrencyResultList, error)
LockTransferToMarket(txnArgs *transactionCC.OutTxnFundsLockInput) error
LoadMarketFounds(operationID *requests.Id) (*transactionCC.LoadCryptocurrencyResultList, error)
WithdrawalMarketFounds(findLockAmountByOperationIDAndUserIdArg transactionCC.FindLockAmountByOperationIdAndUserIdAndCurrencyTypeArg) error
//LockTransferToMarket(txnArgs *transactionCC.OutTxnFundsLockInput) error
//LoadMarketFounds(operationID *requests.Id) (*transactionCC.LoadCryptocurrencyResultList, error)
//WithdrawalMarketFounds(findLockAmountByOperationIDAndUserIdArg transactionCC.FindLockAmountByOperationIdAndUserIdAndCurrencyTypeArg) error
// query
......
package invoke
const (
KycDocumentCC = "kycdocumentCC"
KycDocumentsChannel = "kycdocumentchannel"
KycDocumentStatusCC = "kycdocumentstatusCC"
KycDocumentStatusChannel = "kycdocumentstatuschannel"
KycRuleStatusCC = "kycrulestatusCC"
KycRuleStatusChannel = "kycrulestatuschannel"
EthereumInputCC = "ethereuminputCC"
EthereumInputChannel = "ethereuminputchannel"
AddKeyValueFunction = "addKeyValue"
GetKeyValueFunction = "getKeyValue"
AddKeyValueArrayFunction = "addKeyValueArray"
GetKeyValueArrayFunction = "getKeyValueArray"
)
\ No newline at end of file
......@@ -19,6 +19,12 @@ const (
SessionCC = "sessionCC"
SessionChannel = "sessionchannel"
KycUserCC = "kycuserCC"
KycUserChannel = "kycuserchannel"
KycRuleCC = "kycruleCC"
KycRuleChannel = "kycrulechannel"
AddPreferenceFunction = "addPreference"
GetPreferenceFunction = "getPreference"
UpdatePreferenceFunction = "updatePreference"
......
......@@ -37,6 +37,7 @@ type NewWallet struct {
type NewAccount struct {
WalletID string `json:"wallet_id,omitempty"`
Type AccountCCType `json:"type,omitempty"`
// todo validate CurrencyType
CurrencyType string `json:"currency_type,omitempty"`
}
......@@ -47,6 +48,7 @@ type WalletWithAccounts struct {
type GetAccountByCurrencyTypeArg struct {
UserID string `json:"user_id,omitempty"`
// todo validate CurrencyType
CurrencyType string `json:"currency_type,omitempty"`
}
......
......@@ -5,6 +5,21 @@ import (
"errors"
)
type Id struct {
Id string `json:"id,omitempty"`
UserId string `json:"user_id,omitempty"`
}
type ArrayId struct {
ArrayId []Id `json:"array_id,omitempty"`
}
func UnmarshalArrayId(data []byte) (*ArrayId, error) {
var obj ArrayId
err := json.Unmarshal(data, &obj)
return &obj, err;
}
func (this Id) Validate() error {
if len(this.Id) == 0 {
return errors.New("Id is empty")
......
......@@ -4,11 +4,6 @@ import (
"encoding/json"
)
type Id struct {
Id string `json:"id,omitempty"`
UserId string `json:"user_id,omitempty"`
}
type Parameter struct {
UserID string `json:"user_id,omitempty"`
ActionId int32 `json:"action_id,omitempty"`
......
......@@ -8,6 +8,10 @@ import (
"gitlab.smartblocklab.com/smartcontracts/common/chaincode"
"encoding/json"
"reflect"
"gitlab.smartblocklab.com/smartcontracts/common/invoke"
"gitlab.smartblocklab.com/smartcontracts/common/model/requests"
"gitlab.smartblocklab.com/smartcontracts/common/remote/remote_systempreference"
"strconv"
)
// TransactionRecord transaction struct which denotes transaction
......@@ -28,6 +32,51 @@ type TransactionRecord struct {
}
func (this TransactionRecord) CheckBeforeAdd(manager chaincode.IManager) error {
// TODO добавить проверку в регуляторном канале передав this
// проверка статических переменных
// общие данные в общем канале
// время добавления
// кто добавления
// время обновления
// кто обновил
// проверка типа процесса и доступных криптовалют для этого процесса
processTypeCryptocurrencyRemoteManager := remote_systempreference.GetSystempreferenceRemoteManager(manager, invoke.Processtypecryptocurrencychannel, invoke.ProcesstypecryptocurrencyCC)
processPreference, err := processTypeCryptocurrencyRemoteManager.GetPreference(&requests.Id{Id: this.ProcessType.String()})
if err != nil {
return err
}
if processPreference == nil {
return chaincode.GlobalLogger.Errorf("Process type %s not found", this.ProcessType.String())
}
processCurrencyType := processPreference.Fields[this.Amount.CurrencyType]
if processCurrencyType != "true" {
return chaincode.GlobalLogger.Errorf("currency type %s is not avalible for process type %s", this.Amount.CurrencyType, this.ProcessType.String())
}
// проверка типа криптовалюты
systemPreferenceRemoteManager := remote_systempreference.GetSystempreferenceRemoteManager(manager, invoke.Cryptocurrencyconstraintchannel, invoke.CryptocurrencyconstraintCC)
cryptocurrencyConstraintPreference, err := systemPreferenceRemoteManager.GetPreference(&requests.Id{Id: this.Amount.CurrencyType})
if err != nil {
return err
}
if cryptocurrencyConstraintPreference == nil {
return chaincode.GlobalLogger.Errorf("Constraints for CurrencyType %s not found", this.Amount.CurrencyType)
}
scaleUint64, err := strconv.ParseUint(cryptocurrencyConstraintPreference.Fields["scale"], 10, 32)
if err != nil {
return chaincode.GlobalLogger.Error(err.Error())
}
scale := uint(scaleUint64)
newAsset, err := nums.NewAsset(cryptocurrencyConstraintPreference.Key, scale, cryptocurrencyConstraintPreference.Fields["min_value"], cryptocurrencyConstraintPreference.Fields["max_value"])
number := this.Amount.Number()
number.Asset = newAsset // TODO use UpdateAsset
err = number.Validate()
if err != nil {
return chaincode.GlobalLogger.Error(err.Error())
}
return nil
}
......
......@@ -14,12 +14,6 @@ type (
TxnProcessCommissionType string
)
// Enumerate transactions process types
const (
SenderCommission TxnProcessCommissionType = "SENDER_COMMISSION"
ReceiverCommission TxnProcessCommissionType = "RECEIVER_COMMISSION"
)
// TxnFundsLockInput encapsulates input parameters
// for lock funds transaction type
type OutTxnFundsLockInput struct {
......@@ -64,7 +58,7 @@ type TransferFundsResponseList struct {
}
type TransferFundsResponse struct {
TransactionRecordList []TransactionRecord `json:"transaction_record_list,omitempty"`
TransactionRecordList []*TransactionRecord `json:"transaction_record_list,omitempty"`
ErrorMsg string `json:"error_msg,omitempty"`
Status ResultStatus `json:"status,omitempty"`
}
......@@ -81,6 +75,23 @@ type UnlockTransactionInfoList struct {
LockTransactionRecordInfoList []LockTransactionRecordInfo
}
// проверка что все транзакции из списка имеют один ProcessType и operationID
// при условии что для типа процесса "Транзакция комиссия с получателя" комиссия не указана
func (this *UnlockTransactionInfoList) Validate() error {
for _, lockTransactionRecordInfo := range this.LockTransactionRecordInfoList {
err := lockTransactionRecordInfo.ValidateOperationID()
if err != nil {
return err
}
err = lockTransactionRecordInfo.ValidateProcessType()
if err != nil {
return err
}
}
return nil
}
type LockTransactionRecordInfo struct {
InLockAmountTransactionRecord *TransactionRecord
OutLockAmountTransactionRecord *TransactionRecord
......@@ -88,41 +99,105 @@ type LockTransactionRecordInfo struct {
OutLockCommissionTransactionRecord *TransactionRecord
}
func (lockTransactionRecordInfo LockTransactionRecordInfo) Validate() error {
// проверка что OperationID совпадает у всех транзакций
// поля InLockCommissionTransactionRecord и OutLockCommissionTransactionRecord могут быть nil для процесса TransferReceiverCommission_ProcessType
func (this LockTransactionRecordInfo) ValidateOperationID() error {
if this.InLockAmountTransactionRecord == nil || len(this.InLockAmountTransactionRecord.OperationID) == 0 {
return errors.Errorf("InLockAmountTransactionRecord need to be not nil and have field OperationID")
}
if this.OutLockAmountTransactionRecord == nil || len(this.OutLockAmountTransactionRecord.OperationID) == 0 {
return errors.Errorf("InLockAmountTransactionRecord need to be not nil and have field OperationID")
}
outLockedAmountTransactionRecord := lockTransactionRecordInfo.OutLockAmountTransactionRecord
inLockedAmountTransactionRecord := lockTransactionRecordInfo.InLockAmountTransactionRecord
inLockedCommissionTransactionRecord := lockTransactionRecordInfo.InLockCommissionTransactionRecord
err := CheckTransactionRecord(lockTransactionRecordInfo.OutLockAmountTransactionRecord)
if err != nil {
return errors.New("out locked amount" + err.Error())
if this.InLockAmountTransactionRecord.OperationID != this.OutLockAmountTransactionRecord.OperationID {
return errors.Errorf("Operation id not equals")
}
if this.InLockCommissionTransactionRecord != nil &&
this.InLockAmountTransactionRecord.OperationID != this.InLockCommissionTransactionRecord.OperationID {
return errors.Errorf("Operation id not equals")
}
err = CheckTransactionRecord(lockTransactionRecordInfo.InLockAmountTransactionRecord)
if this.OutLockCommissionTransactionRecord != nil &&
this.InLockAmountTransactionRecord.OperationID != this.OutLockCommissionTransactionRecord.OperationID {
return errors.Errorf("Operation id not equals")
}
return nil
}
// проверка что OperationID совпадает
// поля InLockCommissionTransactionRecord и OutLockCommissionTransactionRecord могут быть nil для процесса TransferReceiverCommission_ProcessType
func (this LockTransactionRecordInfo) ValidateProcessType() error {
if this.InLockAmountTransactionRecord != nil && this.OutLockAmountTransactionRecord != nil &&
this.InLockAmountTransactionRecord.ProcessType != this.OutLockAmountTransactionRecord.ProcessType {
return errors.Errorf("ProcessType not equals InLockAmountTransactionRecord %s and OutLockAmountTransactionRecord %s",
this.InLockAmountTransactionRecord.ProcessType,
this.OutLockAmountTransactionRecord.ProcessType)
}
if this.InLockCommissionTransactionRecord != nil && this.OutLockCommissionTransactionRecord != nil &&
this.InLockCommissionTransactionRecord.ProcessType != this.OutLockCommissionTransactionRecord.ProcessType {
return errors.Errorf("ProcessType not equals InLockCommissionTransactionRecord %s and OutLockCommissionTransactionRecord %s",
this.InLockCommissionTransactionRecord.ProcessType,
this.OutLockCommissionTransactionRecord.ProcessType)
}
if this.InLockCommissionTransactionRecord != nil && this.InLockAmountTransactionRecord != nil &&
this.InLockCommissionTransactionRecord.ProcessType != this.InLockAmountTransactionRecord.ProcessType {
return errors.Errorf("ProcessType not equals InLockCommissionTransactionRecord %s and InLockAmountTransactionRecord %s",
this.InLockCommissionTransactionRecord.ProcessType,
this.InLockAmountTransactionRecord.ProcessType)
}
if this.OutLockCommissionTransactionRecord != nil && this.OutLockAmountTransactionRecord != nil &&
this.OutLockCommissionTransactionRecord.ProcessType != this.OutLockAmountTransactionRecord.ProcessType {
return errors.Errorf("ProcessType not equals OutLockCommissionTransactionRecord %s and OutLockAmountTransactionRecord %s",
this.OutLockCommissionTransactionRecord.ProcessType,
this.OutLockAmountTransactionRecord.ProcessType)
}
return nil
}
func (lockTransactionRecordInfo LockTransactionRecordInfo) Validate() error {
err := lockTransactionRecordInfo.ValidateOperationID()
if err != nil {
return errors.New("ValidateOperationID" + err.Error())
}
lockTransactionRecordInfo.ValidateProcessType()
if err != nil {
return errors.New("in locked amount" + err.Error())
return errors.New("ValidateProcessType " + err.Error())
}
//err = CheckTransactionRecord("out locked commission ", lockTransactionRecordInfo.OutLockCommissionTransactionRecord)
//if err != nil {
// logger.Error(err)
// return nil, err
//}
outLockedAmountTransactionRecord := lockTransactionRecordInfo.OutLockAmountTransactionRecord
inLockedAmountTransactionRecord := lockTransactionRecordInfo.InLockAmountTransactionRecord
outLockedCommissionTransactionRecord := lockTransactionRecordInfo.OutLockCommissionTransactionRecord
inLockedCommissionTransactionRecord := lockTransactionRecordInfo.InLockCommissionTransactionRecord
err = CheckTransactionRecord(lockTransactionRecordInfo.InLockCommissionTransactionRecord)
err = CheckTransactionRecord(outLockedAmountTransactionRecord)
if err != nil {
return errors.New("in locked commission" + err.Error())
return errors.New("out locked amount " + err.Error())
}
// check operationID
if len(inLockedAmountTransactionRecord.OperationID) == 0 || len(outLockedAmountTransactionRecord.OperationID) == 0 || len(inLockedCommissionTransactionRecord.OperationID) == 0 {
return errors.New("operationID can't be nil")
err = CheckTransactionRecord(inLockedAmountTransactionRecord)
if err != nil {
return errors.New("in locked amount " + err.Error())
}
if !(inLockedAmountTransactionRecord.OperationID == outLockedAmountTransactionRecord.OperationID &&
inLockedAmountTransactionRecord.OperationID == inLockedCommissionTransactionRecord.OperationID) {
return errors.New("operationID need to be equals inLockedAmountTransactionRecord, outLockedAmountTransactionRecord, inLockedCommissionTransactionRecord")
if outLockedAmountTransactionRecord.ProcessType != TransferReceiverCommission_ProcessType {
err = CheckTransactionRecord(outLockedCommissionTransactionRecord)
if err != nil {
return errors.New("out locked commission " + err.Error())
}
err = CheckTransactionRecord(inLockedCommissionTransactionRecord)
if err != nil {
return errors.New("in locked commission " + err.Error())
}
}
return nil
......@@ -175,7 +250,7 @@ const (
// of cryptocurrency import results
type LoadCryptocurrencyResult struct {
ExternalTransactionId string `json:"external_transaction_id"`
TransactionRecordList []TransactionRecord `json:"transaction_record_list"`
TransactionRecordList []*TransactionRecord `json:"transaction_record_list"`
Status ResultStatus `json:"status"`
CommonMessage string `json:"common_message"`
DetailMessage string `json:"detail_message"`
......
......@@ -26,14 +26,14 @@ func (processType ProcessType) String() string {
// Enumerate transactions process types
const (
ExchangeWithBothCommission_ProcessType ProcessType = "EXCHANGE_WITH_BOTH_COMMISSION"
TransferSenderCommissions_ProcessType ProcessType = "TRANSFER_SENDER_COMMISSIONS"
TransferReceiverCommissions_ProcessType ProcessType = "TRANSFER_RECEIVER_COMMISSIONS"
DepositFunds_ProcessType ProcessType = "DEPOSIT_FUNDS"
WithdrawalFunds_ProcessType ProcessType = "WITHDRAWAL_FUNDS"
TransferToMarket_ProcessType ProcessType = "TRANSFER_TO_MARKET"
CreateMarketOrder_ProcessType ProcessType = "CREATE_MARKET_ORDER"
CancelMarketOrder_ProcessType ProcessType = "CANCEL_MARKET_ORDER"
ExchangeWithBothCommission_ProcessType ProcessType = "EXCHANGE_WITH_BOTH_COMMISSION"
TransferSenderCommission_ProcessType ProcessType = "TRANSFER_SENDER_COMMISSION"
TransferReceiverCommission_ProcessType ProcessType = "TRANSFER_RECEIVER_COMMISSION"
DepositFunds_ProcessType ProcessType = "DEPOSIT_FUNDS"
WithdrawalFunds_ProcessType ProcessType = "WITHDRAWAL_FUNDS"
TransferToMarket_ProcessType ProcessType = "TRANSFER_TO_MARKET"
CreateMarketOrder_ProcessType ProcessType = "CREATE_MARKET_ORDER"
CancelMarketOrder_ProcessType ProcessType = "CANCEL_MARKET_ORDER"
)
// OperationType define operation types
......
......@@ -21,6 +21,9 @@ var waves, _ = NewAsset("WAVES", 8, "100000000", "0.00000001")
var zec, _ = NewAsset("ZEC", 8, "21000000", "0.00000001")
var zero, _ = NewAsset("ZEROASSET", 0, "0", "0")
var errAsset, _ = NewAsset("ERRORASSET", 0, "0", "0")
var btg, _ = NewAsset("BTG", 8, "21000000", "0.00000001")
var doge, _ = NewAsset("DOGE", 8, "21000000", "0.00000001")
var emc2, _ = NewAsset("EMC2", 8, "21000000", "0.00000001")
func AssetFrom(symbol string) *Asset {
switch symbol {
......@@ -56,6 +59,12 @@ func AssetFrom(symbol string) *Asset {
return waves
case "ZEC":
return zec
case "BTG":
return btg
case "DOGE":
return doge
case "EMC2":
return emc2
case ZeroAsset:
return zero
default:
......
......@@ -80,8 +80,8 @@ func (obj *CurrencyNumber) AssetEquals(b *CurrencyNumber) bool {
}
}
func (obj *CurrencyNumber) UpdateAsset(b *CurrencyNumber) *CurrencyNumber {
obj.Asset = b.Asset
func (obj *CurrencyNumber) UpdateAsset(asset *Asset) *CurrencyNumber {
obj.Asset = asset
return obj
}
......
package remote_systempreference
import (
"gitlab.smartblocklab.com/smartcontracts/common/model/requests"
"gitlab.smartblocklab.com/smartcontracts/common/chaincode"
"github.com/pkg/errors"
"gitlab.smartblocklab.com/smartcontracts/common/invoke"
"encoding/json"
"gitlab.smartblocklab.com/smartcontracts/common/interfaces/isystempreference"
"gitlab.smartblocklab.com/smartcontracts/common/model/preferenceCC"
)
type ISystempreferenceRemoteManager struct {
*chaincode.RemoteManagerImpl
}
func GetSystempreferenceRemoteManager(iManager chaincode.IManager, channelName string, chaincodeName string) isystempreference.ISystemPreferenceManager {
remoteManagerImpl := &chaincode.RemoteManagerImpl{iManager, channelName, chaincodeName}
return &ISystempreferenceRemoteManager{remoteManagerImpl}
}
func (this ISystempreferenceRemoteManager) AddPreference(preference *preferenceCC.Preference) (*preferenceCC.Preference, error) {
return nil, errors.New("Failed to make remote call")
}
func (this ISystempreferenceRemoteManager) UpdatePreference(preference *preferenceCC.Preference) (*preferenceCC.Preference, error) {
return nil, errors.New("Failed to make remote call")
}
func (this ISystempreferenceRemoteManager) GetPreference(key *requests.Id) (*preferenceCC.Preference, error) {
if resp := this.SignedInvokeChaincode(this.GetChannelName(), this.GetChaincodeName(), invoke.GetPreferenceFunction, key); resp.Status != 200 {
return nil, errors.New(resp.Message)
} else {
var result preferenceCC.Preference
if err := json.Unmarshal(resp.Payload, &result); err != nil {
return nil, errors.New(err.Error())
} else {
return &result, nil
}
}
}
......@@ -20,16 +20,16 @@ func GetTransactionRemoteManager(iManager chaincode.IManager, channelName string
}
// invoke
func (this TransactionRemoteManagerImpl) LockFundsOnAccount(txnArgs *transactionCC.TxnFundsLockInput) error {
return errors.New("Failed to make remote call")
func (this TransactionRemoteManagerImpl) LockFundsOnAccount(txnArgs *transactionCC.TxnFundsLockInput) (*transactionCC.UserTransactionsList, error) {
return nil, errors.New("Failed to make remote call")
}
func (this TransactionRemoteManagerImpl) LockOutFundsOnAccount(txnArgs *transactionCC.OutTxnFundsLockInput) error {
return errors.New("Failed to make remote call")
func (this TransactionRemoteManagerImpl) LockOutFundsOnAccount(txnArgs *transactionCC.OutTxnFundsLockInput) (*transactionCC.UserTransactionsList, error) {
return nil, errors.New("Failed to make remote call")
}
func (this TransactionRemoteManagerImpl) LockTransferToMarket(txnArgs *transactionCC.OutTxnFundsLockInput) error {
return errors.New("Failed to make remote call")
func (this TransactionRemoteManagerImpl) LockTransferToMarket(txnArgs *transactionCC.OutTxnFundsLockInput) (*transactionCC.UserTransactionsList, error) {
return nil, errors.New("Failed to make remote call")
}
func (this TransactionRemoteManagerImpl) TransferFunds(id *requests.Id) (*transactionCC.TransferFundsResponseList, error) {
func (this TransactionRemoteManagerImpl) TransferFunds(id *requests.Id) (*transactionCC.UserTransactionsList, error) {
return nil, errors.New("Failed to make remote call")
}
func (this TransactionRemoteManagerImpl) LoadCryptocurrency(systemUserID string) (*transactionCC.LoadCryptocurrencyResultList, error) {
......@@ -42,7 +42,7 @@ func (this TransactionRemoteManagerImpl) WithdrawalMarketFounds(findLockAmountBy
return errors.New("Failed to make remote call")
}
func (this TransactionRemoteManagerImpl) UnlockFundsOnAccount(id *requests.Id) (*transactionCC.TransferFundsResponseList, error) {
func (this TransactionRemoteManagerImpl) UnlockFundsOnAccount(id *requests.Id) (*transactionCC.UserTransactionsList, error) {
return nil, errors.New("Failed to make remote call")
}
......
......@@ -7,9 +7,13 @@ import "gitlab.smartblocklab.com/smartcontracts/common/invoke"
const ping = "ping"
const clearLedger = "clearLedger"
var SecurityPreferenceArray = []SecurityPreference{
// Common
// invoke
// ping
SecurityPreference{invoke.AccountCC, ping, ServiceParameter | UnsecuredParameter, []Roles{UserRole}},
SecurityPreference{invoke.MarketaccountCC, ping, ServiceParameter | UnsecuredParameter, []Roles{UserRole}},
SecurityPreference{invoke.AuthCC, ping, ServiceParameter | UnsecuredParameter, []Roles{UserRole}},
......@@ -26,8 +30,15 @@ var SecurityPreferenceArray = []SecurityPreference{
SecurityPreference{invoke.SessionCC, ping, ServiceParameter | UnsecuredParameter, []Roles{UserRole}},
SecurityPreference{invoke.ProcesstypecryptocurrencyCC, ping, ServiceParameter | UnsecuredParameter, []Roles{UserRole}},
SecurityPreference{invoke.CryptocurrencyconstraintCC, ping, ServiceParameter | UnsecuredParameter, []Roles{UserRole}},
SecurityPreference{invoke.KycUserCC, ping, ServiceParameter | UnsecuredParameter, []Roles{UserRole}},
SecurityPreference{invoke.KycRuleCC, ping, ServiceParameter | UnsecuredParameter, []Roles{UserRole}},
SecurityPreference{invoke.KycDocumentCC, ping, ServiceParameter | UnsecuredParameter, []Roles{UserRole}},
SecurityPreference{invoke.KycDocumentStatusCC, ping, ServiceParameter | UnsecuredParameter, []Roles{UserRole}},
SecurityPreference{invoke.KycRuleStatusCC, ping, ServiceParameter | UnsecuredParameter, []Roles{UserRole}},
SecurityPreference{invoke.EthereumInputCC, ping, ServiceParameter | UnsecuredParameter, []Roles{UserRole}},
// clearLedger
SecurityPreference{invoke.AccountCC, clearLedger, ServiceParameter | UnsecuredParameter, []Roles{UserRole}},
SecurityPreference{invoke.MarketaccountCC, clearLedger, ServiceParameter | UnsecuredParameter, []Roles{UserRole}},
SecurityPreference{invoke.AuthCC, clearLedger, ServiceParameter | UnsecuredParameter, []Roles{UserRole}},
......@@ -44,6 +55,12 @@ var SecurityPreferenceArray = []SecurityPreference{
SecurityPreference{invoke.SessionCC, clearLedger, ServiceParameter | UnsecuredParameter, []Roles{UserRole}},
SecurityPreference{invoke.ProcesstypecryptocurrencyCC, clearLedger, ServiceParameter | UnsecuredParameter, []Roles{UserRole}},
SecurityPreference{invoke.CryptocurrencyconstraintCC, clearLedger, ServiceParameter | UnsecuredParameter, []Roles{UserRole}},
SecurityPreference{invoke.KycUserCC, clearLedger, ServiceParameter | UnsecuredParameter, []Roles{UserRole}},
SecurityPreference{invoke.KycRuleCC, clearLedger, ServiceParameter | UnsecuredParameter, []Roles{UserRole}},
SecurityPreference{invoke.KycDocumentCC, clearLedger, ServiceParameter | UnsecuredParameter, []Roles{UserRole}},
SecurityPreference{invoke.KycDocumentStatusCC, clearLedger, ServiceParameter | UnsecuredParameter, []Roles{UserRole}},
SecurityPreference{invoke.KycRuleStatusCC, clearLedger, ServiceParameter | UnsecuredParameter, []Roles{UserRole}},
SecurityPreference{invoke.EthereumInputCC, clearLedger, ServiceParameter | UnsecuredParameter, []Roles{UserRole}},
// AccountCC
......@@ -224,4 +241,57 @@ var SecurityPreferenceArray = []SecurityPreference{
SecurityPreference{invoke.CryptocurrencyconstraintCC, invoke.UpdatePreferenceFunction, UserParameter, []Roles{UserRole}},
// query
SecurityPreference{invoke.CryptocurrencyconstraintCC, invoke.GetPreferenceFunction, ServiceParameter | UnsecuredParameter, []Roles{UserRole}},
// KycUserCC extends Preference
// invoke
SecurityPreference{invoke.KycUserCC, invoke.AddPreferenceFunction, UserParameter, []Roles{UserRole}},
SecurityPreference{invoke.KycUserCC, invoke.UpdatePreferenceFunction, UserParameter, []Roles{UserRole}},
// query
SecurityPreference{invoke.KycUserCC, invoke.GetPreferenceFunction, ServiceParameter | UnsecuredParameter, []Roles{UserRole}},
// KycRuleCC extends Preference
// invoke
SecurityPreference{invoke.KycRuleCC, invoke.AddPreferenceFunction, UserParameter, []Roles{UserRole}},
SecurityPreference{invoke.KycRuleCC, invoke.UpdatePreferenceFunction, UserParameter, []Roles{UserRole}},
// query
SecurityPreference{invoke.KycRuleCC, invoke.GetPreferenceFunction, ServiceParameter | UnsecuredParameter, []Roles{UserRole}},
// KycDocumentCC extends KeyValue
// invoke
SecurityPreference{invoke.KycDocumentCC, invoke.AddKeyValueFunction, UserParameter, []Roles{UserRole}},
SecurityPreference{invoke.KycDocumentCC, invoke.AddKeyValueArrayFunction, UserParameter, []Roles{UserRole}},
// query
SecurityPreference{invoke.KycDocumentCC, invoke.GetKeyValueFunction, ServiceParameter | UnsecuredParameter, []Roles{UserRole}},
SecurityPreference{invoke.KycDocumentCC, invoke.GetKeyValueArrayFunction, ServiceParameter | UnsecuredParameter, []Roles{UserRole}},
// KycDocumentStatusCC extends KeyValue
// invoke
SecurityPreference{invoke.KycDocumentStatusCC, invoke.AddKeyValueFunction, UserParameter, []Roles{UserRole}},
SecurityPreference{invoke.KycDocumentStatusCC, invoke.AddKeyValueArrayFunction, UserParameter, []Roles{UserRole}},
// query
SecurityPreference{invoke.KycDocumentStatusCC, invoke.GetKeyValueFunction, ServiceParameter | UnsecuredParameter, []Roles{UserRole}},
SecurityPreference{invoke.KycDocumentStatusCC, invoke.GetKeyValueArrayFunction, ServiceParameter | UnsecuredParameter, []Roles{UserRole}},
// KycRuleStatusCC extends KeyValue
// invoke
SecurityPreference{invoke.KycRuleStatusCC, invoke.AddKeyValueFunction, UserParameter, []Roles{UserRole}},
SecurityPreference{invoke.KycRuleStatusCC, invoke.AddKeyValueArrayFunction, UserParameter, []Roles{UserRole}},
// query
SecurityPreference{invoke.KycRuleStatusCC, invoke.GetKeyValueFunction, ServiceParameter | UnsecuredParameter, []Roles{UserRole}},
SecurityPreference{invoke.KycRuleStatusCC, invoke.GetKeyValueArrayFunction, ServiceParameter | UnsecuredParameter, []Roles{UserRole}},
// EthereumInputCC extends KeyValue
// invoke
SecurityPreference{invoke.EthereumInputCC, invoke.AddKeyValueFunction, UserParameter, []Roles{UserRole}},
SecurityPreference{invoke.EthereumInputCC, invoke.AddKeyValueArrayFunction, UserParameter, []Roles{UserRole}},
// query
SecurityPreference{invoke.EthereumInputCC, invoke.GetKeyValueFunction, ServiceParameter | UnsecuredParameter, []Roles{UserRole}},
SecurityPreference{invoke.EthereumInputCC, invoke.GetKeyValueArrayFunction, ServiceParameter | UnsecuredParameter, []Roles{UserRole}},
}
......@@ -51,154 +51,166 @@
"revisionTime": "2017-08-14T20:04:35Z"
},
{
"checksumSHA1": "/XZ4m4svj3Fj6L0KwXyhsWQ05wk=",
"checksumSHA1": "sJL75QTTpVFo6XsdHFR+LtLENeY=",
"path": "gitlab.smartblocklab.com/smartcontracts/common/chaincode",
"revision": "5bfc0b476dbe021f6c0b8dfd81a082bcfe46af63",
"revisionTime": "2018-10-12T01:33:21Z"
"revision": "385676035ecb6f338c988b504e27459670017455",
"revisionTime": "2018-11-09T14:53:00Z"
},
{
"checksumSHA1": "3EGlvoDeO1a58RpYUaT9++RvSDk=",
"path": "gitlab.smartblocklab.com/smartcontracts/common/interfaces/iaccount",
"revision": "5bfc0b476dbe021f6c0b8dfd81a082bcfe46af63",
"revisionTime": "2018-10-12T01:33:21Z"
"revision": "385676035ecb6f338c988b504e27459670017455",
"revisionTime": "2018-11-09T14:53:00Z"
},
{
"checksumSHA1": "+ry1g+Pf5VRSjOmA729vLd585wI=",
"path": "gitlab.smartblocklab.com/smartcontracts/common/interfaces/icryptocurrency",
"revision": "5bfc0b476dbe021f6c0b8dfd81a082bcfe46af63",
"revisionTime": "2018-10-12T01:33:21Z"
"revision": "385676035ecb6f338c988b504e27459670017455",
"revisionTime": "2018-11-09T14:53:00Z"
},
{
"checksumSHA1": "OIYl5lGCHxLOVW0TKLUcrCMBrjk=",
"path": "gitlab.smartblocklab.com/smartcontracts/common/interfaces/iorganization",
"revision": "5bfc0b476dbe021f6c0b8dfd81a082bcfe46af63",
"revisionTime": "2018-10-12T01:33:21Z"
"revision": "385676035ecb6f338c988b504e27459670017455",
"revisionTime": "2018-11-09T14:53:00Z"
},
{
"checksumSHA1": "c55nfnoOqt6aHJ4w8nmEHBMUYeQ=",
"checksumSHA1": "i5Tivl+u5oAZvO6mqjUon+/9n5k=",
"path": "gitlab.smartblocklab.com/smartcontracts/common/interfaces/isystempreference",
"revision": "385676035ecb6f338c988b504e27459670017455",
"revisionTime": "2018-11-09T14:53:00Z"
},
{
"checksumSHA1": "zQmw0ExD4Nysez6uU99tjaEUZ8Y=",
"path": "gitlab.smartblocklab.com/smartcontracts/common/interfaces/itransaction",
"revision": "5bfc0b476dbe021f6c0b8dfd81a082bcfe46af63",
"revisionTime": "2018-10-12T01:33:21Z"
"revision": "385676035ecb6f338c988b504e27459670017455",
"revisionTime": "2018-11-09T14:53:00Z"
},
{
"checksumSHA1": "JDL+BJ9cVj9WftBiBeE3Dh1HIlQ=",
"path": "gitlab.smartblocklab.com/smartcontracts/common/interfaces/iuser",
"revision": "5bfc0b476dbe021f6c0b8dfd81a082bcfe46af63",
"revisionTime": "2018-10-12T01:33:21Z"
"revision": "385676035ecb6f338c988b504e27459670017455",
"revisionTime": "2018-11-09T14:53:00Z"
},
{
"checksumSHA1": "U13mALkMM/JTUTjzkM1dKlE59/w=",
"checksumSHA1": "wir+ij/R7V5bkWyGmCoHKF6HeQE=",
"path": "gitlab.smartblocklab.com/smartcontracts/common/invoke",
"revision": "5bfc0b476dbe021f6c0b8dfd81a082bcfe46af63",
"revisionTime": "2018-10-12T01:33:21Z"
"revision": "385676035ecb6f338c988b504e27459670017455",
"revisionTime": "2018-11-09T14:53:00Z"
},
{
"checksumSHA1": "gfYhgjYDbxwnqh1erzHsPcSn+ms=",
"path": "gitlab.smartblocklab.com/smartcontracts/common/logging",
"revision": "5bfc0b476dbe021f6c0b8dfd81a082bcfe46af63",
"revisionTime": "2018-10-12T01:33:21Z"
"revision": "385676035ecb6f338c988b504e27459670017455",
"revisionTime": "2018-11-09T14:53:00Z"
},
{
"checksumSHA1": "o4w/ryFWs4Kv8SxOWFsKsO0X6Xo=",
"checksumSHA1": "8Au8OGnSEp4jTtaHYtGVDtKW9LM=",
"path": "gitlab.smartblocklab.com/smartcontracts/common/model/accountCC",
"revision": "5bfc0b476dbe021f6c0b8dfd81a082bcfe46af63",
"revisionTime": "2018-10-12T01:33:21Z"
"revision": "385676035ecb6f338c988b504e27459670017455",
"revisionTime": "2018-11-09T14:53:00Z"
},
{
"checksumSHA1": "35dilbQ6aaFiJonqAQ54TPXdRP8=",
"path": "gitlab.smartblocklab.com/smartcontracts/common/model/commissionCC",
"revision": "5bfc0b476dbe021f6c0b8dfd81a082bcfe46af63",
"revisionTime": "2018-10-12T01:33:21Z"
"revision": "385676035ecb6f338c988b504e27459670017455",
"revisionTime": "2018-11-09T14:53:00Z"
},
{
"checksumSHA1": "M/3TP7s8RY9T0Yx6JdxD0XOETxg=",
"path": "gitlab.smartblocklab.com/smartcontracts/common/model/cryptocurrencyCC",
"revision": "5bfc0b476dbe021f6c0b8dfd81a082bcfe46af63",
"revisionTime": "2018-10-12T01:33:21Z"
"revision": "385676035ecb6f338c988b504e27459670017455",
"revisionTime": "2018-11-09T14:53:00Z"
},
{
"checksumSHA1": "HLGeMTgxbY7NGdY1x1Gr9PfVavo=",
"path": "gitlab.smartblocklab.com/smartcontracts/common/model/offerCC",
"revision": "5bfc0b476dbe021f6c0b8dfd81a082bcfe46af63",
"revisionTime": "2018-10-12T01:33:21Z"
"revision": "385676035ecb6f338c988b504e27459670017455",
"revisionTime": "2018-11-09T14:53:00Z"
},
{
"checksumSHA1": "thW1AS0Ts3OHK0U4X2+VxwlacQM=",
"path": "gitlab.smartblocklab.com/smartcontracts/common/model/organizationCC",
"revision": "5bfc0b476dbe021f6c0b8dfd81a082bcfe46af63",
"revisionTime": "2018-10-12T01:33:21Z"
"revision": "385676035ecb6f338c988b504e27459670017455",
"revisionTime": "2018-11-09T14:53:00Z"
},
{
"checksumSHA1": "VbqoP/l9zycufr7gAdUIKL6vecw=",
"path": "gitlab.smartblocklab.com/smartcontracts/common/model/preferenceCC",
"revision": "5bfc0b476dbe021f6c0b8dfd81a082bcfe46af63",
"revisionTime": "2018-10-12T01:33:21Z"
"revision": "385676035ecb6f338c988b504e27459670017455",
"revisionTime": "2018-11-09T14:53:00Z"
},
{
"checksumSHA1": "PlHiLc3o0qVB8oOt3mP1ZchrdQ0=",
"checksumSHA1": "AUBURxeg8h/oyXZtKMXhljMVWCU=",
"path": "gitlab.smartblocklab.com/smartcontracts/common/model/requests",
"revision": "5bfc0b476dbe021f6c0b8dfd81a082bcfe46af63",
"revisionTime": "2018-10-12T01:33:21Z"
"revision": "385676035ecb6f338c988b504e27459670017455",
"revisionTime": "2018-11-09T14:53:00Z"
},
{
"checksumSHA1": "qiG//m4d1c9Z2ZGWJcO1Bpg8H+s=",
"path": "gitlab.smartblocklab.com/smartcontracts/common/model/system_user",
"revision": "5bfc0b476dbe021f6c0b8dfd81a082bcfe46af63",
"revisionTime": "2018-10-12T01:33:21Z"
"revision": "385676035ecb6f338c988b504e27459670017455",
"revisionTime": "2018-11-09T14:53:00Z"
},
{
"checksumSHA1": "TR+PNQ9HB2Jp1X1kKHyf/Wvk/4k=",
"checksumSHA1": "XppcKJF0jKgfTNcKUPHO0+72JYE=",
"path": "gitlab.smartblocklab.com/smartcontracts/common/model/transactionCC",
"revision": "5bfc0b476dbe021f6c0b8dfd81a082bcfe46af63",
"revisionTime": "2018-10-12T01:33:21Z"
"revision": "385676035ecb6f338c988b504e27459670017455",
"revisionTime": "2018-11-09T14:53:00Z"
},
{
"checksumSHA1": "rcOK6pvKIPmfw9OK3lp6ElosZfg=",
"path": "gitlab.smartblocklab.com/smartcontracts/common/model/userCC",
"revision": "5bfc0b476dbe021f6c0b8dfd81a082bcfe46af63",
"revisionTime": "2018-10-12T01:33:21Z"
"revision": "385676035ecb6f338c988b504e27459670017455",
"revisionTime": "2018-11-09T14:53:00Z"
},
{
"checksumSHA1": "uaXULcutLbqy4+nrxDqL1p9Bs7E=",
"path": "gitlab.smartblocklab.com/smartcontracts/common/model/userPreferenceCC",
"revision": "5bfc0b476dbe021f6c0b8dfd81a082bcfe46af63",
"revisionTime": "2018-10-12T01:33:21Z"
"revision": "385676035ecb6f338c988b504e27459670017455",
"revisionTime": "2018-11-09T14:53:00Z"
},
{
"checksumSHA1": "7CrfFb5yE1F3h7R+Ah0yxEXSXBU=",
"checksumSHA1": "he8RUT+rYaFVmFXS9NpbCKgIBtA=",
"path": "gitlab.smartblocklab.com/smartcontracts/common/nums",
"revision": "5bfc0b476dbe021f6c0b8dfd81a082bcfe46af63",
"revisionTime": "2018-10-12T01:33:21Z"
"revision": "385676035ecb6f338c988b504e27459670017455",
"revisionTime": "2018-11-09T14:53:00Z"
},
{
"checksumSHA1": "uaHDyF+Y+3EkPytxLPhorogns5k=",
"path": "gitlab.smartblocklab.com/smartcontracts/common/remote/remote_account",
"revision": "5bfc0b476dbe021f6c0b8dfd81a082bcfe46af63",
"revisionTime": "2018-10-12T01:33:21Z"
"revision": "385676035ecb6f338c988b504e27459670017455",
"revisionTime": "2018-11-09T14:53:00Z"
},
{
"checksumSHA1": "DNgvi7H8/ANU2eExflueAtKKGgQ=",
"path": "gitlab.smartblocklab.com/smartcontracts/common/remote/remote_organization",
"revision": "5bfc0b476dbe021f6c0b8dfd81a082bcfe46af63",
"revisionTime": "2018-10-12T01:33:21Z"
"revision": "385676035ecb6f338c988b504e27459670017455",
"revisionTime": "2018-11-09T14:53:00Z"
},
{
"checksumSHA1": "DWjSP0WJ29YPsri6+KBnC31G8Qo=",
"path": "gitlab.smartblocklab.com/smartcontracts/common/remote/remote_systempreference",
"revision": "385676035ecb6f338c988b504e27459670017455",
"revisionTime": "2018-11-09T14:53:00Z"
},
{
"checksumSHA1": "Ill3Y7lHMiWjDC3eg4e0N+/38J4=",
"checksumSHA1": "MWA5V1dRRMyyMrApOJSbPCPt2Tg=",
"path": "gitlab.smartblocklab.com/smartcontracts/common/remote/remote_transaction",
"revision": "5bfc0b476dbe021f6c0b8dfd81a082bcfe46af63",
"revisionTime": "2018-10-12T01:33:21Z"
"revision": "385676035ecb6f338c988b504e27459670017455",
"revisionTime": "2018-11-09T14:53:00Z"
},
{
"checksumSHA1": "ovJVc9AE+5FBvZVe804ygFHdOGY=",
"path": "gitlab.smartblocklab.com/smartcontracts/common/remote/remote_user",
"revision": "5bfc0b476dbe021f6c0b8dfd81a082bcfe46af63",
"revisionTime": "2018-10-12T01:33:21Z"
"revision": "385676035ecb6f338c988b504e27459670017455",
"revisionTime": "2018-11-09T14:53:00Z"
},
{
"checksumSHA1": "Qx2I1dS/IzAlbIt3jMr9eCyKMfo=",
"checksumSHA1": "zU6FInDVIHje0MUO54MWdO9sMhY=",
"path": "gitlab.smartblocklab.com/smartcontracts/common/security/actions",
"revision": "5bfc0b476dbe021f6c0b8dfd81a082bcfe46af63",
"revisionTime": "2018-10-12T01:33:21Z"
"revision": "385676035ecb6f338c988b504e27459670017455",
"revisionTime": "2018-11-09T14:53:00Z"
},
{
"checksumSHA1": "5Yb2z6UO+Arm/TEd+OEtdnwOt1A=",
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment