@@ -853,17 +853,63 @@ private void CheckTokenAlias(string alias, string collectionSymbol)
853853
854854 public override Empty AddToTransferBlackList ( Address input )
855855 {
856- AssertSenderAddressWith ( GetDefaultParliamentController ( ) . OwnerAddress ) ;
856+ AssertControllerForTransferBlackList ( ) ;
857857 Assert ( input != null && ! input . Value . IsNullOrEmpty ( ) , "Invalid address." ) ;
858858 State . TransferBlackList [ input ] = true ;
859859 return new Empty ( ) ;
860860 }
861861
862+ public override Empty BatchAddToTransferBlackList ( BatchAddToTransferBlackListInput input )
863+ {
864+ AssertControllerForTransferBlackList ( ) ;
865+ Assert ( input != null && input . Addresses != null && input . Addresses . Count > 0 , "Invalid input." ) ;
866+
867+ // Validate all addresses first
868+ foreach ( var address in input . Addresses )
869+ {
870+ Assert ( address != null && ! address . Value . IsNullOrEmpty ( ) , "Invalid address." ) ;
871+ }
872+
873+ // Remove duplicates and add to blacklist
874+ var uniqueAddresses = input . Addresses . Distinct ( ) . ToList ( ) ;
875+ foreach ( var address in uniqueAddresses )
876+ {
877+ State . TransferBlackList [ address ] = true ;
878+ }
879+
880+ return new Empty ( ) ;
881+ }
882+
862883 public override Empty RemoveFromTransferBlackList ( Address input )
863884 {
885+ // Removing from transfer blacklist requires higher security and response speed is not critical,
886+ // so it should be controlled by Parliament.
864887 AssertSenderAddressWith ( GetDefaultParliamentController ( ) . OwnerAddress ) ;
865888 Assert ( input != null && ! input . Value . IsNullOrEmpty ( ) , "Invalid address." ) ;
866889 State . TransferBlackList [ input ] = false ;
867890 return new Empty ( ) ;
868891 }
892+
893+ public override Empty BatchRemoveFromTransferBlackList ( BatchRemoveFromTransferBlackListInput input )
894+ {
895+ // Removing from transfer blacklist requires higher security and response speed is not critical,
896+ // so it should be controlled by Parliament.
897+ AssertSenderAddressWith ( GetDefaultParliamentController ( ) . OwnerAddress ) ;
898+ Assert ( input != null && input . Addresses != null && input . Addresses . Count > 0 , "Invalid input." ) ;
899+
900+ // Validate all addresses first
901+ foreach ( var address in input . Addresses )
902+ {
903+ Assert ( address != null && ! address . Value . IsNullOrEmpty ( ) , "Invalid address." ) ;
904+ }
905+
906+ // Remove duplicates and remove from blacklist
907+ var uniqueAddresses = input . Addresses . Distinct ( ) . ToList ( ) ;
908+ foreach ( var address in uniqueAddresses )
909+ {
910+ State . TransferBlackList [ address ] = false ;
911+ }
912+
913+ return new Empty ( ) ;
914+ }
869915}
0 commit comments