From 2d49b9363c5770f52a5d37bdc39fa52c34bad6c9 Mon Sep 17 00:00:00 2001
From: suerlych <19871208@lhcyf>
Date: Wed, 4 Dec 2024 16:14:48 +0800
Subject: [PATCH] fix seed renew
---
.../Forest.Contracts.SymbolRegistrar.csproj | 10 +++++++++
.../SymbolRegistrarContract_Action.cs | 21 ++++++++++++++-----
.../SymbolRegistrarContractTests_Buy.cs | 16 +++++++++++++-
3 files changed, 41 insertions(+), 6 deletions(-)
diff --git a/contract/Forest.Contracts.SymbolRegistrar/Forest.Contracts.SymbolRegistrar.csproj b/contract/Forest.Contracts.SymbolRegistrar/Forest.Contracts.SymbolRegistrar.csproj
index 76490d11..5d7acf82 100644
--- a/contract/Forest.Contracts.SymbolRegistrar/Forest.Contracts.SymbolRegistrar.csproj
+++ b/contract/Forest.Contracts.SymbolRegistrar/Forest.Contracts.SymbolRegistrar.csproj
@@ -19,6 +19,12 @@
Protobuf\Proto\acs0.proto
+
+ Protobuf\Proto\reference\acs1.proto
+
+
+ Protobuf\Proto\reference\acs2.proto
+
Protobuf\Proto\acs3.proto
@@ -40,9 +46,13 @@
Protobuf\Proto\reference\token_contract.proto
+
Protobuf\Proto\token_contract_impl.proto
+
+ Protobuf\Proto\reference\transaction_fee.proto
+
diff --git a/contract/Forest.Contracts.SymbolRegistrar/SymbolRegistrarContract_Action.cs b/contract/Forest.Contracts.SymbolRegistrar/SymbolRegistrarContract_Action.cs
index 4ff9f0ce..d9ddbcee 100644
--- a/contract/Forest.Contracts.SymbolRegistrar/SymbolRegistrarContract_Action.cs
+++ b/contract/Forest.Contracts.SymbolRegistrar/SymbolRegistrarContract_Action.cs
@@ -124,15 +124,26 @@ private void DoCreateSeed(Address to, string symbol, long expireTime = 0)
ImageUrl = seedInfo.ImageUrl
});
}
-
private void DoRenewSeed(string seedSymbol, long expireTime = 0)
{
+ if (State.TokenImplContract.Value == null)
+ {
+ State.TokenImplContract.Value = State.TokenContract.Value;
+ }
+
+ var renewInput = new ExtendSeedExpirationTimeInput
+ {
+ Symbol = seedSymbol,
+ ExpirationTime = expireTime
+ };
- State.TokenImplContract.ExtendSeedExpirationTime.Send(
- new ExtendSeedExpirationTimeInput
+ State.ProxyAccountContract.ForwardCall.Send(
+ new ForwardCallInput
{
- Symbol = seedSymbol,
- ExpirationTime = expireTime
+ ContractAddress = State.TokenContract.Value,
+ MethodName = nameof(State.TokenImplContract.ExtendSeedExpirationTime),
+ ProxyAccountHash = GetProxyAccountHash(),
+ Args = renewInput.ToByteString()
});
}
diff --git a/test/Forest.Contracts.SymbolRegistrar.Tests/SymbolRegistrarContractTests_Buy.cs b/test/Forest.Contracts.SymbolRegistrar.Tests/SymbolRegistrarContractTests_Buy.cs
index a3e42127..fc23011e 100644
--- a/test/Forest.Contracts.SymbolRegistrar.Tests/SymbolRegistrarContractTests_Buy.cs
+++ b/test/Forest.Contracts.SymbolRegistrar.Tests/SymbolRegistrarContractTests_Buy.cs
@@ -313,6 +313,20 @@ public async Task Buy_existsFT_fail()
res.ShouldNotBeNull();
res.Message.ShouldContain("Symbol exists");
}
-
+
+ [Fact]
+ public async Task SeedRenew_Test ()
+ {
+ await Buy_success();
+ await User1SymbolRegistrarContractStub.RegularSeedRenew.SendAsync(new RegularSeedRenewInput()
+ {
+ SeedSymbol = "SEED-1",
+ Price = new Price()
+ {
+ Symbol = "ELF",
+ Amount = 4700000000
+ }
+ });
+ }
}
}
\ No newline at end of file