Skip to content

Commit

Permalink
add object limit amount
Browse files Browse the repository at this point in the history
  • Loading branch information
jadeydi committed May 7, 2024
1 parent ee1f2a3 commit 449d7c0
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion object.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,18 @@ import (
"github.com/MixinNetwork/mixin/common"
)

func CreateObjectStorageTransaction(ctx context.Context, extra []byte, traceId string, references []string, u *SafeUser) (*SequencerTransactionRequest, error) {
func CreateObjectStorageTransaction(ctx context.Context, extra []byte, traceId string, references []string, limit string, u *SafeUser) (*SequencerTransactionRequest, error) {
if len(extra) > common.ExtraSizeStorageCapacity {
return nil, fmt.Errorf("too large extra %d > %d", len(extra), common.ExtraSizeStorageCapacity)
}
step := common.NewIntegerFromString(common.ExtraStoragePriceStep)
amount := step.Mul(len(extra)/common.ExtraSizeStorageStep + 1)
if limit != "" {
strl := common.NewIntegerFromString(limit)
if strl.Cmp(amount) > 0 {
amount = strl
}
}
addr := common.NewAddressFromSeed(make([]byte, 64))
mix := NewMainnetMixAddress([]string{addr.String()}, 1)
mix.Threshold = 64
Expand Down

0 comments on commit 449d7c0

Please sign in to comment.