Skip to content

Commit

Permalink
Merge pull request #1709 from 0chain/feat/unstake-from-provider
Browse files Browse the repository at this point in the history
Feature unstake from provider
  • Loading branch information
dabasov authored Dec 28, 2024
2 parents 22512f8 + 5d400c7 commit 83fa6ca
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 3 deletions.
4 changes: 2 additions & 2 deletions wasmsdk/allocation.go
Original file line number Diff line number Diff line change
Expand Up @@ -413,8 +413,8 @@ func lockStakePool(providerType, tokens, fee uint64, providerID string) (string,
// - providerType: provider type (1: miner, 2:sharder, 3:blobber, 4:validator, 5:authorizer)
// - fee: transaction fees (in SAS)
// - providerID: provider id
func unlockStakePool(providerType, fee uint64, providerID string) (int64, error) {
unstake, _, err := sdk.StakePoolUnlock(sdk.ProviderType(providerType), providerID, fee)
func unlockStakePool(providerType, fee uint64, providerID, clientID string) (int64, error) {
unstake, _, err := sdk.StakePoolUnlock(sdk.ProviderType(providerType), providerID, clientID, fee)
return unstake, err
}

Expand Down
3 changes: 2 additions & 1 deletion zboxcore/sdk/blobber_operations.go
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ func StakePoolLock(providerType ProviderType, providerID string, value, fee uint
// - providerType: provider type
// - providerID: provider ID
// - fee: transaction fee
func StakePoolUnlock(providerType ProviderType, providerID string, fee uint64) (unstake int64, nonce int64, err error) {
func StakePoolUnlock(providerType ProviderType, providerID, clientID string, fee uint64) (unstake int64, nonce int64, err error) {
if !client.IsSDKInitialized() {
return 0, 0, sdkNotInitialized
}
Expand All @@ -274,6 +274,7 @@ func StakePoolUnlock(providerType ProviderType, providerID string, fee uint64) (
spr := stakePoolRequest{
ProviderType: providerType,
ProviderID: providerID,
ClientID: clientID,
}

var sn = transaction.SmartContractTxnData{
Expand Down
1 change: 1 addition & 0 deletions zboxcore/sdk/sdk.go
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,7 @@ func GetStakePoolUserInfo(clientID string, offset, limit int) (info *StakePoolUs
type stakePoolRequest struct {
ProviderType ProviderType `json:"provider_type,omitempty"`
ProviderID string `json:"provider_id,omitempty"`
ClientID string `json:"client_id,omitempty"`
}

// stakePoolLock is stake pool unlock response in case where tokens
Expand Down
1 change: 1 addition & 0 deletions zcncore/transaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ type StakePool struct {
type stakePoolRequest struct {
ProviderType Provider `json:"provider_type,omitempty"`
ProviderID string `json:"provider_id,omitempty"`
ClientID string `json:"client_id,omitempty"`
}

type MinerSCDelegatePoolInfo struct {
Expand Down

0 comments on commit 83fa6ca

Please sign in to comment.