-
Notifications
You must be signed in to change notification settings - Fork 110
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into withdraw-emissions
- Loading branch information
Showing
21 changed files
with
373 additions
and
273 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package appcontext | ||
|
||
import ( | ||
"github.com/zeta-chain/zetacore/common" | ||
"github.com/zeta-chain/zetacore/zetaclient/config" | ||
corecontext "github.com/zeta-chain/zetacore/zetaclient/core_context" | ||
) | ||
|
||
// AppContext contains global app structs like config, core context and logger | ||
type AppContext struct { | ||
coreContext *corecontext.ZetaCoreContext | ||
config *config.Config | ||
} | ||
|
||
// NewAppContext creates and returns new AppContext | ||
func NewAppContext( | ||
coreContext *corecontext.ZetaCoreContext, | ||
config *config.Config, | ||
) *AppContext { | ||
return &AppContext{ | ||
coreContext: coreContext, | ||
config: config, | ||
} | ||
} | ||
|
||
func (a *AppContext) Config() *config.Config { | ||
return a.config | ||
} | ||
|
||
func (a *AppContext) ZetaCoreContext() *corecontext.ZetaCoreContext { | ||
return a.coreContext | ||
} | ||
|
||
// GetBTCChainAndConfig returns btc chain and config if enabled | ||
func (a *AppContext) GetBTCChainAndConfig() (common.Chain, config.BTCConfig, bool) { | ||
btcConfig, configEnabled := a.Config().GetBTCConfig() | ||
btcChain, _, paramsEnabled := a.ZetaCoreContext().GetBTCChainParams() | ||
|
||
if !configEnabled || !paramsEnabled { | ||
return common.Chain{}, config.BTCConfig{}, false | ||
} | ||
|
||
return btcChain, btcConfig, true | ||
} |
Oops, something went wrong.