-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Alex Vanin <[email protected]>
- Loading branch information
Showing
3 changed files
with
13 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,6 +19,7 @@ import ( | |
"github.com/nspcc-dev/neo-go/pkg/interop/runtime" | ||
"github.com/nspcc-dev/neo-go/pkg/interop/storage" | ||
"github.com/nspcc-dev/neo-go/pkg/interop/util" | ||
"github.com/nspcc-dev/neofs-contract/common" | ||
) | ||
|
||
// Prefixes used for contract data storage. | ||
|
@@ -88,32 +89,6 @@ func Update(nef []byte, manifest string) { | |
// _deploy initializes defaults (total supply and registration price) on contract deploy. | ||
func _deploy(data interface{}, isUpdate bool) { | ||
if isUpdate { | ||
ctx := storage.GetContext() | ||
it := storage.Find(ctx, []byte{prefixRecord}, storage.DeserializeValues) | ||
for iterator.Next(it) { | ||
oldRec := iterator.Value(it).(struct { | ||
key string | ||
rec RecordState | ||
}) | ||
newRec := RecordState{ | ||
Name: oldRec.rec.Name, | ||
Type: oldRec.rec.Type, | ||
Data: oldRec.rec.Data, | ||
ID: 0, | ||
} | ||
newKey := append([]byte(oldRec.key), newRec.ID) | ||
rec := std.Serialize(newRec) | ||
storage.Put(ctx, newKey, rec) | ||
storage.Delete(ctx, oldRec.key) | ||
} | ||
|
||
maxExpire := 1<<31 - 1 | ||
domains := storage.Find(ctx, []byte{prefixName}, storage.ValuesOnly|storage.DeserializeValues) | ||
for iterator.Next(domains) { | ||
ns := iterator.Value(domains).(NameState) | ||
putSoaRecord(ctx, ns.Name, "[email protected]", 86400, 7200, maxExpire, 3600) | ||
} | ||
|
||
return | ||
} | ||
ctx := storage.GetContext() | ||
|