-
Notifications
You must be signed in to change notification settings - Fork 129
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* updated logic to pull and filter events * custom events to websocket * wip * wip * added new block logic event scraper * put gsrpc library inside repo and set default block to latest * add decimals and extrinsic id * add asset name and don't stop on reaching last block * get omnipool events * filter pools in code * fix rebase errors * hydration liquidity and asset scrapers * hydration - fix 4 pool error in parsing assets --------- Co-authored-by: Erion Barasuol <erion@ebl1v1on.local>
- Loading branch information
Showing
12 changed files
with
933 additions
and
9 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package hydrationhelper | ||
|
||
import ( | ||
"github.com/sirupsen/logrus" | ||
"time" | ||
) | ||
|
||
const ( | ||
AssetAddressURI = "AssetRegistry:Assets" | ||
Blockchain = "polkadot" | ||
GetAssetsPath = "assets" | ||
) | ||
|
||
type HydrationClient struct { | ||
logger *logrus.Entry | ||
sleepBetweenCalls time.Duration | ||
debug bool | ||
} | ||
|
||
func NewHydrationClient(logger *logrus.Entry, sleepBetweenCalls time.Duration, isDebug bool) *HydrationClient { | ||
return &HydrationClient{ | ||
logger: logger, | ||
sleepBetweenCalls: sleepBetweenCalls, | ||
debug: isDebug, | ||
} | ||
} |
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,59 @@ | ||
package hydrationhelper | ||
|
||
const ( | ||
DefaultRefreshDelay = 400 // millisec | ||
DefaultSleepBetweenContractCalls = 300 // millisec | ||
DefaultEventsLimit = 100 | ||
DefaultSwapContractsLimit = 100 | ||
) | ||
|
||
type HydrationAssetMetadata struct { | ||
Id string `json:"id"` | ||
Name string `json:"name"` | ||
Symbol string `json:"symbol"` | ||
Decimals uint `json:"decimals"` | ||
Icon string `json:"icon"` | ||
Type string `json:"type"` | ||
IsSufficient bool `json:"isSufficient"` | ||
ExistentialDeposit string `json:"existentialDeposit"` | ||
Origin int `json:"origin"` | ||
} | ||
|
||
type HydrationPoolTokenMetada struct { | ||
ID string `json:"id"` | ||
Balance string `json:"balance"` | ||
Name string `json:"name"` | ||
Symbol string `json:"symbol"` | ||
Decimals int `json:"decimals"` | ||
Icon string `json:"icon"` | ||
Type string `json:"type"` | ||
IsSufficient bool `json:"isSufficient"` | ||
ExistentialDeposit string `json:"existentialDeposit"` | ||
Origin int `json:"origin,omitempty"` | ||
UsdBalance string `json:"usdBalance"` | ||
Index int `json:"index"` | ||
} | ||
|
||
type HydrationPoolUsdBalanceMetadata struct { | ||
Amount string `json:"amount"` | ||
Decimals int `json:"decimals"` | ||
} | ||
|
||
type HydrationPoolMetada struct { | ||
Address string `json:"address"` | ||
Type string `json:"type"` | ||
Tokens []HydrationPoolTokenMetada `json:"tokens"` | ||
MaxInRatio int `json:"maxInRatio"` | ||
MaxOutRatio int `json:"maxOutRatio"` | ||
MinTradingLimit int `json:"minTradingLimit"` | ||
} | ||
|
||
type HydrationSwapEvent struct { | ||
TxID string `json:"txId"` | ||
Timestamp int64 `json:"timestamp"` | ||
BlockHash string `json:"blockHash"` | ||
AssetIn string `json:"assetIn"` | ||
AssetOut string `json:"assetOut"` | ||
AmountIn string `json:"amountIn"` | ||
AmountOut string `json:"amountOut"` | ||
} |
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
Oops, something went wrong.