File tree Expand file tree Collapse file tree 2 files changed +28
-3
lines changed
contract/AElf.Contracts.MultiToken Expand file tree Collapse file tree 2 files changed +28
-3
lines changed Original file line number Diff line number Diff line change @@ -694,12 +694,29 @@ public override Int32Value GetMaxBatchApproveCount(Empty input)
694694 public override Empty ExtendSeedExpirationTime ( ExtendSeedExpirationTimeInput input )
695695 {
696696 var tokenInfo = GetTokenInfo ( input . Symbol ) ;
697- Assert ( tokenInfo != null , "Seed NFT does not exist." ) ;
697+ if ( tokenInfo == null )
698+ {
699+ throw new AssertionException ( "Seed NFT does not exist." ) ;
700+ }
701+
698702 Assert ( tokenInfo . Owner == Context . Sender , "Sender is not Seed NFT owner." ) ;
703+ var oldExpireTimeLong = 0L ;
704+ if ( tokenInfo . ExternalInfo . Value . TryGetValue ( TokenContractConstants . SeedExpireTimeExternalInfoKey ,
705+ out var oldExpireTime ) )
706+ {
707+ long . TryParse ( oldExpireTime , out oldExpireTimeLong ) ;
708+ }
699709
700- tokenInfo . ExternalInfo . Value [ TokenContractConstants . SeedExpireTimeExternalInfoKey ] = input . ExpirationTime . ToString ( ) ;
710+ tokenInfo . ExternalInfo . Value [ TokenContractConstants . SeedExpireTimeExternalInfoKey ] =
711+ input . ExpirationTime . ToString ( ) ;
701712 State . TokenInfos [ input . Symbol ] = tokenInfo ;
702- base . ExtendSeedExpirationTime ( input ) ;
713+ Context . Fire ( new SeedExpirationTimeUpdated
714+ {
715+ ChainId = tokenInfo . IssueChainId ,
716+ Symbol = input . Symbol ,
717+ OldExpirationTime = oldExpireTimeLong ,
718+ NewExpirationTime = input . ExpirationTime
719+ } ) ;
703720 return new Empty ( ) ;
704721 }
705722
Original file line number Diff line number Diff line change @@ -452,4 +452,12 @@ message SetTokenIssuerAndOwnerModificationEnabledInput{
452452message ExtendSeedExpirationTimeInput {
453453 string symbol = 1 ;
454454 int64 expiration_time = 2 ;
455+ }
456+
457+ message SeedExpirationTimeUpdated {
458+ option (aelf.is_event ) = true ;
459+ int32 chain_id = 1 ;
460+ string symbol = 2 ;
461+ int64 old_expiration_time = 3 ;
462+ int64 new_expiration_time = 4 ;
455463}
You can’t perform that action at this time.
0 commit comments