// Code generated by github.com/fjl/gencodec. DO NOT EDIT.

package core

import (
	"encoding/json"
	"math/big"

	"github.com/ethereum/go-ethereum/common"
	"github.com/ethereum/go-ethereum/common/math"
)

var _ = (*initMarshaling)(nil)

// MarshalJSON marshals as JSON.
func (i Init) MarshalJSON() ([]byte, error) {
	type Init struct {
		Admin           common.Address       	`json:"admin,omitempty"`
		BtrAddress 		common.Address 			`json:"btrAddress,omitempty"`
		Epoch  			 *math.HexOrDecimal256 	`json:"epoch,omitempty"`
		FoundationPool  common.Address 			`json:"foundationPool,omitempty"`
	}
	var enc Init
	enc.Admin = i.Admin
	enc.BtrAddress = i.BtrAddress
	enc.Epoch = (*math.HexOrDecimal256)(i.Epoch)
	enc.FoundationPool = i.FoundationPool
	
	return json.Marshal(&enc)
}

// UnmarshalJSON unmarshals from JSON.
func (i *Init) UnmarshalJSON(input []byte) error {
	type Init struct {
		Admin           *common.Address         `json:"admin,omitempty"`
		BtrAddress		*common.Address         `json:"btrAddress,omitempty"`
		Epoch   		*math.HexOrDecimal256   `json:"epoch,omitempty"`
		FoundationPool  *common.Address         `json:"foundationPool,omitempty"`
	}
	var dec Init
	if err := json.Unmarshal(input, &dec); err != nil {
		return err
	}
	if dec.Admin != nil {
		i.Admin = *dec.Admin
	}
	if dec.BtrAddress != nil {
		i.BtrAddress = *dec.BtrAddress
	}
	if dec.Epoch != nil {
		i.Epoch = (*big.Int)(dec.Epoch)
	}
	if dec.FoundationPool != nil {
		i.FoundationPool = *dec.FoundationPool
	}
	return nil
}
