Skip to content

Commit 8626f56

Browse files
committed
extend seed expiration time
1 parent 88d4e10 commit 8626f56

File tree

4 files changed

+32
-0
lines changed

4 files changed

+32
-0
lines changed

contract/AElf.Contracts.MultiToken/TokenContract_Actions.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -691,6 +691,16 @@ public override Int32Value GetMaxBatchApproveCount(Empty input)
691691
};
692692
}
693693

694+
public override Empty ExtendSeedExpirationTime(ExtendSeedExpirationTimeInput input)
695+
{
696+
var tokenInfo = GetTokenInfo(input.Symbol);
697+
Assert(tokenInfo != null, "Seed NFT does not exist.");
698+
Assert(tokenInfo.Owner == Context.Sender, "Sender is not Seed NFT owner.");
699+
700+
tokenInfo.ExternalInfo.Value["__seed_exp_time"] = input.ExpirationTime;
701+
return base.ExtendSeedExpirationTime(input);
702+
}
703+
694704
private int GetMaxBatchApproveCount()
695705
{
696706
return State.MaxBatchApproveCount.Value == 0

protobuf/token_contract_impl.proto

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,9 @@ service TokenContractImpl {
182182
rpc GetMaxBatchApproveCount (google.protobuf.Empty) returns (google.protobuf.Int32Value) {
183183

184184
}
185+
186+
rpc ExtendSeedExpirationTime (ExtendSeedExpirationTimeInput) returns (google.protobuf.Empty) {
187+
}
185188
}
186189

187190
message AdvanceResourceTokenInput {
@@ -444,4 +447,9 @@ message ModifyTokenIssuerAndOwnerInput {
444447

445448
message SetTokenIssuerAndOwnerModificationEnabledInput{
446449
bool enabled = 1;
450+
}
451+
452+
message ExtendSeedExpirationTimeInput {
453+
string symbol = 1;
454+
int64 expiration_time = 2;
447455
}

test/AElf.Contracts.MultiToken.Tests/BVT/TokenApplicationTests.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1893,4 +1893,15 @@ public async Task TokenIssuerAndOwnerModification_Test()
18931893
result.TransactionResult.Error.ShouldContain("Set token issuer and owner disabled.");
18941894

18951895
}
1896+
1897+
[Theory]
1898+
[InlineData("SEED-0", 1731927992000)]
1899+
public async Task ExtendSeedExpirationTime_Test(string symbol, long expirationTime)
1900+
{
1901+
ExtendSeedExpirationTimeInput input = new ExtendSeedExpirationTimeInput();
1902+
input.Symbol = symbol;
1903+
input.ExpirationTime = expirationTime;
1904+
1905+
await TokenContractStub.ExtendSeedExpirationTime.CallAsync(input);
1906+
}
18961907
}

test/AElf.Contracts.MultiToken.Tests/MultiTokenContractTestBase.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,4 +240,7 @@ internal async Task<IExecutionResult<Empty>> CreateMutiTokenWithExceptionAsync(
240240
await CreateSeedNftAsync(stub, createInput);
241241
return await stub.Create.SendWithExceptionAsync(createInput);
242242
}
243+
244+
245+
243246
}

0 commit comments

Comments
 (0)