smartcontractkit / chainlink-cosmos

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Investigate if there is a better way to parse an array of structs to an struct

krebernisak opened this issue · comments

Consider this snippet in pkg/terra/contract_config_tracker.go:

	for _, event := range res.Txs[0].TxResult.Events {
		if event.Type == "wasm-set_config" {
			output := types.ContractConfig{}
			// TODO: is there a better way to parse an array of structs to an struct
			for _, attr := range event.Attributes {
				key, value := string(attr.Key), string(attr.Value)
				switch key {