forked from ava-labs/subnet-evm
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
send oracle prices to evaluate availableMargin (#159)
* send oracle prices to evaluate availableMargin * deepcopy hState
- Loading branch information
1 parent
182fd14
commit 4685599
Showing
9 changed files
with
96 additions
and
91 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,35 @@ | ||
package hubbleutils | ||
|
||
import "math/big" | ||
|
||
var ( | ||
ChainId int64 | ||
VerifyingContract string | ||
HState *HubbleState | ||
hState *HubbleState | ||
) | ||
|
||
func SetChainIdAndVerifyingSignedOrdersContract(chainId int64, verifyingContract string) { | ||
ChainId = chainId | ||
VerifyingContract = verifyingContract | ||
} | ||
|
||
func SetHubbleState(hState *HubbleState) { | ||
HState = hState | ||
func SetHubbleState(_hState *HubbleState) { | ||
hState = _hState | ||
} | ||
|
||
func GetHubbleState() *HubbleState { | ||
assets := make([]Collateral, len(hState.Assets)) | ||
copy(assets, hState.Assets) | ||
|
||
activeMarkets := make([]Market, len(hState.ActiveMarkets)) | ||
copy(activeMarkets, hState.ActiveMarkets) | ||
|
||
return &HubbleState{ | ||
Assets: assets, | ||
ActiveMarkets: activeMarkets, | ||
MinAllowableMargin: new(big.Int).Set(hState.MinAllowableMargin), | ||
MaintenanceMargin: new(big.Int).Set(hState.MaintenanceMargin), | ||
TakerFee: new(big.Int).Set(hState.TakerFee), | ||
UpgradeVersion: hState.UpgradeVersion, | ||
} | ||
} |
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