Skip to content

Commit 259f987

Browse files
committedOct 14, 2021
fix nft creator logic on protocol version 7
1 parent 675935f commit 259f987

File tree

3 files changed

+23
-3
lines changed

3 files changed

+23
-3
lines changed
 

‎Phantasma.Blockchain/Nexus.cs

+11-1
Original file line numberDiff line numberDiff line change
@@ -1265,7 +1265,17 @@ internal void WriteNFT(RuntimeVM Runtime, string symbol, BigInteger tokenID, str
12651265
else
12661266
{
12671267
Runtime.Expect(!mustExist, $"nft {symbol} {tokenID} does not exist");
1268-
var genID = GenerateNFT(Runtime, symbol, chainName, owner, rom, ram, seriesID);
1268+
Address _creator;
1269+
if (this.GetProtocolVersion(Runtime.RootStorage) >= 7)
1270+
{
1271+
_creator = creator;
1272+
}
1273+
else
1274+
{
1275+
_creator = owner;
1276+
}
1277+
1278+
var genID = GenerateNFT(Runtime, symbol, chainName, _creator, rom, ram, seriesID);
12691279
Runtime.Expect(genID == tokenID, "failed to regenerate NFT");
12701280
}
12711281
}

‎Phantasma.Blockchain/Runtime.cs

+11-1
Original file line numberDiff line numberDiff line change
@@ -1352,9 +1352,19 @@ public BigInteger MintToken(string symbol, Address from, Address target, byte[]
13521352
Runtime.Expect(rom.Length <= TokenContent.MaxROMSize, "ROM size exceeds maximum allowed, received: " + rom.Length + ", maximum: " + TokenContent.MaxROMSize);
13531353
Runtime.Expect(ram.Length <= TokenContent.MaxRAMSize, "RAM size exceeds maximum allowed, received: " + ram.Length + ", maximum: " + TokenContent.MaxRAMSize);
13541354

1355+
Address creator;
1356+
if (ProtocolVersion >= 7)
1357+
{
1358+
creator = from;
1359+
}
1360+
else
1361+
{
1362+
creator = target;
1363+
}
1364+
13551365
BigInteger tokenID;
13561366
using (var m = new ProfileMarker("Nexus.CreateNFT"))
1357-
tokenID = Nexus.GenerateNFT(this, symbol, Runtime.Chain.Name, target, rom, ram, seriesID);
1367+
tokenID = Nexus.GenerateNFT(this, symbol, Runtime.Chain.Name, creator, rom, ram, seriesID);
13581368
Runtime.Expect(tokenID > 0, "invalid tokenID");
13591369

13601370
using (var m = new ProfileMarker("Nexus.MintToken"))

‎Phantasma.Domain/DomainSettings.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public StakeReward(Address staker, Timestamp date)
5656

5757
public static class DomainSettings
5858
{
59-
public const int LatestKnownProtocol = 6;
59+
public const int LatestKnownProtocol = 7;
6060

6161
public const int MaxTxPerBlock = 1024;
6262

0 commit comments

Comments
 (0)