Skip to content

Commit

Permalink
Feature unstake from provider
Browse files Browse the repository at this point in the history
  • Loading branch information
Jayashsatolia403 committed Dec 17, 2024
1 parent 14d6ccc commit 5d400c7
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 @@ -401,8 +401,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 @@ -226,7 +226,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 @@ -242,6 +242,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 @@ -228,6 +228,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 5d400c7

Please sign in to comment.