Skip to content

Commit

Permalink
Merge pull request #84 from thesixnetwork/develop
Browse files Browse the repository at this point in the history
⚡️ gas consuming reduced
  • Loading branch information
ddeedev authored Sep 7, 2023
2 parents fdc8447 + 6274620 commit 39d58f5
Showing 1 changed file with 18 additions and 15 deletions.
33 changes: 18 additions & 15 deletions x/nftmngr/keeper/msg_server_perform_action_by_admin.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,27 +127,30 @@ func (k msgServer) PerformActionByAdmin(goCtx context.Context, msg *types.MsgPer
var list_schema_attributes_ []*types.SchemaAttribute
var map_converted_schema_attributes []*types.NftAttributeValue

//TODO:: THIS SHOULD BE THE PROBLEM GAS CONSUMPTION TOO HIGH >> from 0.2 to 0.3
// get schema attributes and convert to NFtAttributeValue
all_schema_attributes := k.GetAllSchemaAttribute(ctx)
val, found := k.GetAttributeOfSchema(ctx, msg.NftSchemaCode)

attributeMap := make(map[string]bool)

for _, schema_attribute := range all_schema_attributes {
if schema_attribute.NftSchemaCode != msg.NftSchemaCode {
continue
}
// Check if the attribute has already been added
if attributeMap[schema_attribute.Name] {
continue
}
// Add the attribute to the list of schema attributes
list_schema_attributes_ = append(list_schema_attributes_, &schema_attribute)
if found {
for _, schema_attribute := range val.SchemaAttributes {
if schema_attribute.NftSchemaCode != msg.NftSchemaCode {
continue
}
// Check if the attribute has already been added
if attributeMap[schema_attribute.Name] {
continue
}
// Add the attribute to the list of schema attributes
list_schema_attributes_ = append(list_schema_attributes_, schema_attribute)

// Add the attribute to the map
attributeMap[schema_attribute.Name] = true
// Add the attribute to the map
attributeMap[schema_attribute.Name] = true

nftAttributeValue_ := ConverSchemaAttributeToNFTAttributeValue(&schema_attribute)
map_converted_schema_attributes = append(map_converted_schema_attributes, nftAttributeValue_)
nftAttributeValue_ := ConverSchemaAttributeToNFTAttributeValue(schema_attribute)
map_converted_schema_attributes = append(map_converted_schema_attributes, nftAttributeValue_)
}
}

// ** META path ../types/meta.go **
Expand Down

0 comments on commit 39d58f5

Please # to comment.