@@ -63,6 +63,14 @@ func (s *currencyServer) Launch(ctx context.Context, req *currencypb.LaunchReque
6363 return & currencypb.LaunchResponse {Result : currencypb .LaunchResponse_DENIED }, nil
6464 }
6565
66+ isModerated , err := s .moderation .ValidateAttestation (ctx , ownerAccount , req .NameModerationAttestation .RawValue , req .Name )
67+ if err != nil {
68+ log .With (zap .Error (err )).Warn ("failed to validate name moderation attestation" )
69+ return nil , status .Error (codes .Internal , "" )
70+ } else if ! isModerated {
71+ return & currencypb.LaunchResponse {Result : currencypb .LaunchResponse_DENIED }, nil
72+ }
73+
6674 symbol := strings .TrimSpace (req .Symbol )
6775 if len (symbol ) == 0 {
6876 symbol = strings .ToUpper (strings .Map (
@@ -77,15 +85,53 @@ func (s *currencyServer) Launch(ctx context.Context, req *currencypb.LaunchReque
7785 if len (symbol ) > currencycreator .MaxCurrencyConfigAccountSymbolLength {
7886 symbol = symbol [0 :currencycreator .MaxCurrencyConfigAccountSymbolLength ]
7987 }
80- } else if symbol != req .Symbol {
81- return & currencypb.LaunchResponse {Result : currencypb .LaunchResponse_DENIED }, nil
88+ } else {
89+ if symbol != req .Symbol {
90+ return & currencypb.LaunchResponse {Result : currencypb .LaunchResponse_DENIED }, nil
91+ }
92+ if req .SymbolModerationAttestation == nil {
93+ return & currencypb.LaunchResponse {Result : currencypb .LaunchResponse_DENIED }, nil
94+ }
95+ isModerated , err := s .moderation .ValidateAttestation (ctx , ownerAccount , req .SymbolModerationAttestation .RawValue , req .Symbol )
96+ if err != nil {
97+ log .With (zap .Error (err )).Warn ("failed to validate symbol moderation attestation" )
98+ return nil , status .Error (codes .Internal , "" )
99+ } else if ! isModerated {
100+ return & currencypb.LaunchResponse {Result : currencypb .LaunchResponse_DENIED }, nil
101+ }
82102 }
83103
84104 description := strings .TrimSpace (req .Description )
105+ if description != req .Description {
106+ return & currencypb.LaunchResponse {Result : currencypb .LaunchResponse_DENIED }, nil
107+ }
108+ if len (req .Description ) > 0 {
109+ if req .DescriptionModerationAttestation == nil {
110+ return & currencypb.LaunchResponse {Result : currencypb .LaunchResponse_DENIED }, nil
111+ }
112+ isModerated , err := s .moderation .ValidateAttestation (ctx , ownerAccount , req .DescriptionModerationAttestation .RawValue , req .Description )
113+ if err != nil {
114+ log .With (zap .Error (err )).Warn ("failed to validate description moderation attestation" )
115+ return nil , status .Error (codes .Internal , "" )
116+ } else if ! isModerated {
117+ return & currencypb.LaunchResponse {Result : currencypb .LaunchResponse_DENIED }, nil
118+ }
119+ }
85120
86121 var processedIcon []byte
87122 var iconExt , iconContentType string
88123 if len (req .Icon ) > 0 {
124+ if req .IconModerationAttestation == nil {
125+ return & currencypb.LaunchResponse {Result : currencypb .LaunchResponse_DENIED }, nil
126+ }
127+ isModerated , err := s .moderation .ValidateAttestation (ctx , ownerAccount , req .IconModerationAttestation .RawValue , req .Icon )
128+ if err != nil {
129+ log .With (zap .Error (err )).Warn ("failed to validate icon moderation attestation" )
130+ return nil , status .Error (codes .Internal , "" )
131+ } else if ! isModerated {
132+ return & currencypb.LaunchResponse {Result : currencypb .LaunchResponse_DENIED }, nil
133+ }
134+
89135 processedIcon , iconExt , iconContentType , err = processIcon (req .Icon )
90136 if err == errInvalidIcon {
91137 return & currencypb.LaunchResponse {Result : currencypb .LaunchResponse_INVALID_ICON }, nil
0 commit comments