ui/offering.go
func (h *Handler) fillOffering(
	logger log.Logger, offering *data.Offering) error {
	agent := &data.Account{}
	// TODO: This is definitely wrong, should be:
	// `h.findByColumn(..., "eth_addr", offering.Agent)`
	if err := h.findByPrimaryKey(logger,
		ErrAccountNotFound, agent, string(offering.Agent)); err != nil {
		return err
	}

	template := &data.Template{}
	if err := h.findByPrimaryKey(logger,
		ErrTemplateNotFound, template, offering.Template); err != nil {
		return err
	}

	offering.ID = util.NewUUID()
	offering.Status = data.OfferEmpty
	offering.Agent = agent.EthAddr
	offering.BlockNumberUpdated = 1
	offering.CurrentSupply = offering.Supply
	// TODO: remove once prepaid is implemented.
	offering.BillingType = data.BillingPostpaid

	return h.setOfferingHash(logger, offering, template, agent)
}
func (h *Handler) fillOffering(
	logger log.Logger, offering *data.Offering) error {
	agent := &data.Account{}
	// TODO: This is definitely wrong, should be:
	// `h.findByColumn(..., "eth_addr", offering.Agent)`
	if err := h.findByPrimaryKey(logger,
		ErrAccountNotFound, agent, string(offering.Agent)); err != nil {
		return err
	}

	template := &data.Template{}
	if err := h.findByPrimaryKey(logger,
		ErrTemplateNotFound, template, offering.Template); err != nil {
		return err
	}

	offering.ID = util.NewUUID()
	offering.Status = data.OfferEmpty
	offering.Agent = agent.EthAddr
	offering.BlockNumberUpdated = 1
	offering.CurrentSupply = offering.Supply
	// TODO: remove once prepaid is implemented.
	offering.BillingType = data.BillingPostpaid

	return h.setOfferingHash(logger, offering, template, agent)
}
func ( h * Handler ) fillOffering ( logger log . Logger , offering * data . Offering ) error { agent := & data . Account { } // TODO: This is definitely wrong, should be: // `h.findByColumn(..., "eth_addr", offering.Agent)` if err := h . findByPrimaryKey ( logger , ErrAccountNotFound , agent , string ( offering . Agent ) ) ; err != nil { return err } template := & data . Template { } if err := h . findByPrimaryKey ( logger , ErrTemplateNotFound , template , offering . Template ) ; err != nil { return err } offering . ID = util . NewUUID ( ) offering . Status = data . OfferEmpty offering . Agent = agent . EthAddr offering . BlockNumberUpdated = 1 offering . CurrentSupply = offering . Supply // TODO: remove once prepaid is implemented. offering . BillingType = data . BillingPostpaid return h . setOfferingHash ( logger , offering , template , agent ) }
// fillOffering fills offerings nonce, status, hash and signature.
fillOffering fills offerings nonce status hash and signature .