@@ -19,6 +19,7 @@ import (
1919 "github.com/aws/aws-sdk-go/service/s3/s3manager"
2020 "github.com/donovansolms/cosmos-inscriptions/indexer/src/indexer/models"
2121 "github.com/donovansolms/cosmos-inscriptions/indexer/src/indexer/types"
22+ "github.com/donovansolms/cosmos-inscriptions/indexer/src/nsfw"
2223 "github.com/kelseyhightower/envconfig"
2324 "github.com/leodido/go-urn"
2425 "gorm.io/gorm"
@@ -36,6 +37,7 @@ type CFT20Config struct {
3637type CFT20 struct {
3738 chainID string
3839 db * gorm.DB
40+ nsfwWorker * nsfw.Worker
3941 s3Endpoint string
4042 s3Region string
4143 s3Bucket string
@@ -55,7 +57,7 @@ type CFT20 struct {
5557 perWalletLimitMaxValue uint64
5658}
5759
58- func NewCFT20Processor (chainID string , db * gorm.DB ) * CFT20 {
60+ func NewCFT20Processor (chainID string , db * gorm.DB , nsfwWorker * nsfw. Worker ) * CFT20 {
5961 // Parse config environment variables for self
6062 var config InscriptionConfig
6163 err := envconfig .Process ("" , & config )
@@ -66,6 +68,7 @@ func NewCFT20Processor(chainID string, db *gorm.DB) *CFT20 {
6668 return & CFT20 {
6769 chainID : chainID ,
6870 db : db ,
71+ nsfwWorker : nsfwWorker ,
6972 s3Endpoint : config .S3Endpoint ,
7073 s3Region : config .S3Region ,
7174 s3Bucket : config .S3Bucket ,
@@ -182,6 +185,8 @@ func (protocol *CFT20) Process(transactionModel models.Transaction, protocolURN
182185 // TODO: Rework the content extraction
183186 contentPath := ""
184187 contentLength := 0
188+ isExplicit := false
189+
185190 // If this token includes content, we need to store it and add to the record
186191 if len (rawTransaction .Body .NonCriticalExtensionOptions ) == 1 {
187192 // Logo is stored in the non_critical_extension_options
@@ -219,6 +224,9 @@ func (protocol *CFT20) Process(transactionModel models.Transaction, protocolURN
219224 return fmt .Errorf ("unable to store content '%s'" , err )
220225 }
221226
227+ // check if content is explicit
228+ isExplicit = <- protocol .nsfwWorker .CheckImage (logoContent )
229+
222230 contentLength = len (logoContent )
223231 }
224232
@@ -239,6 +247,7 @@ func (protocol *CFT20) Process(transactionModel models.Transaction, protocolURN
239247 ContentPath : contentPath ,
240248 ContentSizeBytes : uint64 (contentLength ),
241249 DateCreated : transactionModel .DateCreated ,
250+ IsExplicit : isExplicit ,
242251 CirculatingSupply : 0 ,
243252 }
244253
0 commit comments