diff --git a/cmd/debugger/main.go b/cmd/debugger/main.go index b6521c47..a3a60938 100644 --- a/cmd/debugger/main.go +++ b/cmd/debugger/main.go @@ -3,30 +3,30 @@ package main import ( "context" "fmt" - "github.com/Layr-Labs/go-sidecar/internal/contractStore/postgresContractStore" - "github.com/Layr-Labs/go-sidecar/internal/eigenState/rewardSubmissions" - "github.com/Layr-Labs/go-sidecar/internal/eigenState/submittedDistributionRoots" - "github.com/Layr-Labs/go-sidecar/internal/postgres" - pgStorage "github.com/Layr-Labs/go-sidecar/internal/storage/postgres" + ethereum2 "github.com/Layr-Labs/go-sidecar/pkg/clients/ethereum" + "github.com/Layr-Labs/go-sidecar/pkg/clients/etherscan" + "github.com/Layr-Labs/go-sidecar/pkg/contractCaller" + "github.com/Layr-Labs/go-sidecar/pkg/contractManager" + "github.com/Layr-Labs/go-sidecar/pkg/contractStore/postgresContractStore" + "github.com/Layr-Labs/go-sidecar/pkg/eigenState/rewardSubmissions" + "github.com/Layr-Labs/go-sidecar/pkg/eigenState/submittedDistributionRoots" + "github.com/Layr-Labs/go-sidecar/pkg/fetcher" + "github.com/Layr-Labs/go-sidecar/pkg/indexer" + "github.com/Layr-Labs/go-sidecar/pkg/pipeline" + "github.com/Layr-Labs/go-sidecar/pkg/postgres" + "github.com/Layr-Labs/go-sidecar/pkg/sidecar" + pgStorage "github.com/Layr-Labs/go-sidecar/pkg/storage/postgres" "log" - "github.com/Layr-Labs/go-sidecar/internal/clients/ethereum" - "github.com/Layr-Labs/go-sidecar/internal/clients/etherscan" "github.com/Layr-Labs/go-sidecar/internal/config" - "github.com/Layr-Labs/go-sidecar/internal/contractCaller" - "github.com/Layr-Labs/go-sidecar/internal/contractManager" - "github.com/Layr-Labs/go-sidecar/internal/eigenState/avsOperators" - "github.com/Layr-Labs/go-sidecar/internal/eigenState/operatorShares" - "github.com/Layr-Labs/go-sidecar/internal/eigenState/stakerDelegations" - "github.com/Layr-Labs/go-sidecar/internal/eigenState/stakerShares" - "github.com/Layr-Labs/go-sidecar/internal/eigenState/stateManager" - "github.com/Layr-Labs/go-sidecar/internal/fetcher" - "github.com/Layr-Labs/go-sidecar/internal/indexer" "github.com/Layr-Labs/go-sidecar/internal/logger" "github.com/Layr-Labs/go-sidecar/internal/metrics" - "github.com/Layr-Labs/go-sidecar/internal/pipeline" - "github.com/Layr-Labs/go-sidecar/internal/postgres/migrations" - "github.com/Layr-Labs/go-sidecar/internal/sidecar" + "github.com/Layr-Labs/go-sidecar/pkg/eigenState/avsOperators" + "github.com/Layr-Labs/go-sidecar/pkg/eigenState/operatorShares" + "github.com/Layr-Labs/go-sidecar/pkg/eigenState/stakerDelegations" + "github.com/Layr-Labs/go-sidecar/pkg/eigenState/stakerShares" + "github.com/Layr-Labs/go-sidecar/pkg/eigenState/stateManager" + "github.com/Layr-Labs/go-sidecar/pkg/postgres/migrations" "go.uber.org/zap" ) @@ -42,7 +42,7 @@ func main() { } etherscanClient := etherscan.NewEtherscanClient(cfg, l) - client := ethereum.NewClient(cfg.EthereumRpcConfig.BaseUrl, l) + client := ethereum2.NewClient(cfg.EthereumRpcConfig.BaseUrl, l) pgConfig := postgres.PostgresConfigFromDbConfig(&cfg.DatabaseConfig) pgConfig.CreateDbIfNotExists = true @@ -121,7 +121,7 @@ func main() { } transactionHash := "0xf6775c38af1d2802bcbc2b7c8959c0d5b48c63a14bfeda0261ba29d76c68c423" - transaction := ðereum.EthereumTransaction{} + transaction := ðereum2.EthereumTransaction{} for _, tx := range block.Block.Transactions { if tx.Hash.Value() == transactionHash { @@ -132,7 +132,7 @@ func main() { logIndex := 4 receipt := block.TxReceipts[transaction.Hash.Value()] - var interestingLog *ethereum.EthereumEventLog + var interestingLog *ethereum2.EthereumEventLog for _, log := range receipt.Logs { if log.LogIndex.Value() == uint64(logIndex) { diff --git a/cmd/run.go b/cmd/run.go index eff2d272..0f74ab51 100644 --- a/cmd/run.go +++ b/cmd/run.go @@ -3,32 +3,32 @@ package cmd import ( "context" "fmt" - "github.com/Layr-Labs/go-sidecar/internal/contractStore/postgresContractStore" - "github.com/Layr-Labs/go-sidecar/internal/postgres" - pgStorage "github.com/Layr-Labs/go-sidecar/internal/storage/postgres" + "github.com/Layr-Labs/go-sidecar/pkg/clients/ethereum" + "github.com/Layr-Labs/go-sidecar/pkg/clients/etherscan" + "github.com/Layr-Labs/go-sidecar/pkg/contractCaller" + "github.com/Layr-Labs/go-sidecar/pkg/contractManager" + "github.com/Layr-Labs/go-sidecar/pkg/contractStore/postgresContractStore" + "github.com/Layr-Labs/go-sidecar/pkg/fetcher" + "github.com/Layr-Labs/go-sidecar/pkg/indexer" + "github.com/Layr-Labs/go-sidecar/pkg/pipeline" + "github.com/Layr-Labs/go-sidecar/pkg/postgres" + "github.com/Layr-Labs/go-sidecar/pkg/shutdown" + "github.com/Layr-Labs/go-sidecar/pkg/sidecar" + pgStorage "github.com/Layr-Labs/go-sidecar/pkg/storage/postgres" "log" "time" - "github.com/Layr-Labs/go-sidecar/internal/clients/ethereum" - "github.com/Layr-Labs/go-sidecar/internal/clients/etherscan" "github.com/Layr-Labs/go-sidecar/internal/config" - "github.com/Layr-Labs/go-sidecar/internal/contractCaller" - "github.com/Layr-Labs/go-sidecar/internal/contractManager" - "github.com/Layr-Labs/go-sidecar/internal/eigenState/avsOperators" - "github.com/Layr-Labs/go-sidecar/internal/eigenState/operatorShares" - "github.com/Layr-Labs/go-sidecar/internal/eigenState/rewardSubmissions" - "github.com/Layr-Labs/go-sidecar/internal/eigenState/stakerDelegations" - "github.com/Layr-Labs/go-sidecar/internal/eigenState/stakerShares" - "github.com/Layr-Labs/go-sidecar/internal/eigenState/stateManager" - "github.com/Layr-Labs/go-sidecar/internal/eigenState/submittedDistributionRoots" - "github.com/Layr-Labs/go-sidecar/internal/fetcher" - "github.com/Layr-Labs/go-sidecar/internal/indexer" "github.com/Layr-Labs/go-sidecar/internal/logger" "github.com/Layr-Labs/go-sidecar/internal/metrics" - "github.com/Layr-Labs/go-sidecar/internal/pipeline" - "github.com/Layr-Labs/go-sidecar/internal/postgres/migrations" - "github.com/Layr-Labs/go-sidecar/internal/shutdown" - "github.com/Layr-Labs/go-sidecar/internal/sidecar" + "github.com/Layr-Labs/go-sidecar/pkg/eigenState/avsOperators" + "github.com/Layr-Labs/go-sidecar/pkg/eigenState/operatorShares" + "github.com/Layr-Labs/go-sidecar/pkg/eigenState/rewardSubmissions" + "github.com/Layr-Labs/go-sidecar/pkg/eigenState/stakerDelegations" + "github.com/Layr-Labs/go-sidecar/pkg/eigenState/stakerShares" + "github.com/Layr-Labs/go-sidecar/pkg/eigenState/stateManager" + "github.com/Layr-Labs/go-sidecar/pkg/eigenState/submittedDistributionRoots" + "github.com/Layr-Labs/go-sidecar/pkg/postgres/migrations" "github.com/spf13/cobra" "github.com/spf13/pflag" "github.com/spf13/viper" diff --git a/internal/python/lossyTokens.py b/internal/python/lossyTokens.py deleted file mode 100644 index 99fdf5f3..00000000 --- a/internal/python/lossyTokens.py +++ /dev/null @@ -1,597 +0,0 @@ -from decimal import Decimal, getcontext, ROUND_UP, ROUND_HALF_UP, ROUND_DOWN, ROUND_HALF_DOWN, ROUND_FLOOR - -def lossyAdd(tokens: str): - big_amount = float(tokens) - div = 0.999999999999999 - res = big_amount * div - - res_str = "{}".format(res) - return "{}".format(int(Decimal(res_str))) - -def amazonStakerTokenRewards(sp:str, tpd:str) -> str: - getcontext().prec = 15 - stakerProportion = Decimal(sp) - tokensPerDay = Decimal(tpd) - - decimal_res = Decimal(stakerProportion * tokensPerDay) - - getcontext().prec = 20 - rounded = decimal_res.quantize(Decimal('1'), rounding=ROUND_HALF_UP) - - return "{}".format(rounded) - - -def nilStakerTokenRewards(sp:str, tpd:str) -> str: - print(getcontext().prec) - # getcontext().prec = 38 - stakerProportion = Decimal(sp) - tokensPerDay = Decimal(tpd) - - print("{}, {}".format(stakerProportion, tokensPerDay)) - decimal_res = Decimal(stakerProportion * tokensPerDay) - print("Decimal: {}".format(decimal_res)) - truncated = decimal_res.quantize(Decimal('0.1'), rounding=ROUND_UP) - print("Truncated: {}".format(truncated)) - rounded = truncated.quantize(Decimal('1'), rounding=ROUND_HALF_UP) - - return "{}".format(rounded) - -def stakerTokenRewards(sp:str, tpd:str) -> str: - stakerProportion = float(sp) - tokensPerDay = int(tpd) - - decimal_res = stakerProportion * tokensPerDay - - parts = str(decimal_res).split("+") - # Need more precision - if len(parts) == 2 and int(parts[1]) > 16: - stakerProportion = Decimal(sp) - tokensPerDay = Decimal(tpd) - - getcontext().prec = 17 - getcontext().rounding = ROUND_DOWN - decimal_res = stakerProportion * tokensPerDay - - return "{}".format(int(decimal_res)) - - return "{}".format(int(decimal_res)) - -def stakerTokenRewardsAlt(sp:str, tpd:str) -> str: - stakerProportion = Decimal(sp) - tokensPerDay = Decimal(tpd) - - getcontext().prec = 17 - getcontext().rounding = ROUND_DOWN - print("{} {}".format(stakerProportion, tokensPerDay)) - decimal_res = stakerProportion * tokensPerDay - print("{}".format(decimal_res)) - - return "{}".format(int(decimal_res)) - - -def nileOperatorTokenRewards(totalStakerOperatorTokens:str) -> str: - if totalStakerOperatorTokens[-1] == "0": - return "{}".format(int(totalStakerOperatorTokens) // 10) - totalStakerOperatorTokens = Decimal(totalStakerOperatorTokens) - operatorTokens = Decimal(str(totalStakerOperatorTokens)) * Decimal(0.1) - rounded = operatorTokens.quantize(Decimal('1'), rounding=ROUND_HALF_UP) - return "{}".format(rounded) - -#print(lossyAdd("1428571428571428571428571428571428571.4142857142857143")) -#print(lossyCalc("0.092173497467823", "142857142857142700000000")) - -numbers = [ - ["2262498437749998","226249843775000"], - ["1077804256999999","107780425700000"], - ["1200335945499999","120033594550000"], - ["2579821510499997","257982151050000"], - ["1077804256999999","107780425700000"], - ["97982205000000","9798220500000"], - ["2731616159749997","273161615975000"], - ["1468013852499999","146801385250000"], - ["1460746763499999","146074676350000"], - ["97982205000000","9798220500000"], - ["2160308386499998","216030838650000"], - ["2173632495999998","217363249600000"], - ["979822051749999","97982205175000"], - ["1077804256999999","107780425700000"], - ["97982205000000","9798220500000"], - ["1205181123749999","120518112375000"], - ["1692326232749998","169232623275000"], - ["19596441000000","1959644100000"], - ["1077804256999999","107780425700000"], - ["2766886966999997","276688696700000"], - ["1421109574749999","142110957475000"], - ["1327025256749999","132702525675000"], - ["1513152979749999","151315297975000"], - ["1724319284249998","172431928425000"], - ["1881072278499998","188107227850000"], - ["1077804256999999","107780425700000"], - ["1077804256999999","107780425700000"], - ["2767046562249997","276704656225000"], - ["1771544047249998","177154404725000"], - ["979822051749999","97982205175000"], - ["2766618839499997","276661883950000"], - ["1111499404999999","111149940500000"], - ["1256537372499999","125653737250000"], - ["1311309356749999","131130935675000"], - ["1077804256999999","107780425700000"], - ["1476639073749999","147663907375000"], - ["619368817749999","61936881775000"], - ["2351572924249998","235157292425000"], - ["1077804256999999","107780425700000"], - ["38824366794749960","3882436679474996"], - ["1329923441749999","132992344175000"], - ["1077804256999999","107780425700000"], - ["1171094469499999","117109446950000"], - ["1077804256999999","107780425700000"], - ["2164538729999998","216453873000000"], - ["2094265522499998","209426552250000"], - ["1448972310749999","144897231075000"], - ["1077804256999999","107780425700000"], - ["1403751361499999","140375136150000"], - ["979822051749999","97982205175000"], - ["979822051749999","97982205175000"], - ["1085802969749999","108580296975000"], - ["1077804256999999","107780425700000"], - ["1077804256999999","107780425700000"], - ["1124308426749999","112430842675000"], - ["1077804256999999","107780425700000"], - ["1077804256999999","107780425700000"], - ["1182901487499999","118290148750000"], - ["1372466011999999","137246601200000"], - ["979822051749999","97982205175000"], - ["1120320939499999","112032093950000"], - ["1077804256999999","107780425700000"], - ["2813743578249997","281374357825000"], - ["1997209544499998","199720954450000"], - ["342937718000000","34293771800000"], - ["1077804256999999","107780425700000"], - ["2504518724749998","250451872475000"], - ["489911025749999","48991102575000"], - ["1169357997749999","116935799775000"], - ["1077804256999999","107780425700000"], - ["1263158553749999","126315855375000"], - ["1094640640499999","109464064050000"], - ["1284065770249999","128406577025000"], - ["1521653686749998","152165368675000"], - ["1077804256999999","107780425700000"], - ["1695020089999998","169502009000000"], - ["1077804256999999","107780425700000"], - ["1089590665249999","108959066525000"], - ["4333353594249996","433335359425000"], - ["979822051749999","97982205175000"], - ["2766860861499997","276686086150000"], - ["3737419616999996","373741961700000"], - ["1682669036499998","168266903650000"], - ["979822051749999","97982205175000"], - ["718515954363749200","71851595436374920"], - ["1077804256999999","107780425700000"], - ["3350684550249997","335068455025000"], - ["979822051749999","97982205175000"], - ["1077804256999999","107780425700000"], - ["1077804256999999","107780425700000"], - ["2766670760499997","276667076050000"], - ["1139779232999999","113977923300000"], - ["1294703182249999","129470318225000"], - ["1401943427499999","140194342750000"], - ["1077804256999999","107780425700000"], - ["8661942075499991","866194207549999"], - ["979822051749999","97982205175000"], - ["1077804256999999","107780425700000"], - ["979822051749999","97982205175000"], - ["9798220500000","979822050000"], - ["1077804256999999","107780425700000"], - ["1077804256999999","107780425700000"], - ["1329616345749999","132961634575000"], - ["2285721732999998","228572173300000"], - ["440830750000","44083075000"], - ["1309869932249999","130986993225000"], - ["1077804256999999","107780425700000"], - ["2767143131249997","276714313125000"], - ["1087449895749999","108744989575000"], - ["1440582461749999","144058246175000"], - ["1437596903499999","143759690350000"], - ["3739760468499996","373976046850000"], - ["1228930342749999","122893034275000"], - ["1668502454499998","166850245450000"], - ["1077804256999999","107780425700000"], - ["20400709468749976","2040070946874998"], - ["1077804256999999","107780425700000"], - ["1077804256999999","107780425700000"], - ["1501152824749998","150115282475000"], - ["1077804256999999","107780425700000"], - ["1077804256999999","107780425700000"], - ["1588788984249999","158878898425000"], - ["97982205000000","9798220500000"], - ["2766955102999997","276695510300000"], - ["1077804256999999","107780425700000"], - ["1077804256999999","107780425700000"], - ["1213777201499999","121377720150000"], - ["2766522236999998","276652223700000"], - ["1077804256999999","107780425700000"], - ["1077804256999999","107780425700000"], - ["1077804256999999","107780425700000"], - ["1518724180249999","151872418025000"], - ["1077804256999999","107780425700000"], - ["102040547000000","10204054700000"], - ["1521663646499999","152166364650000"], - ["2766883311999998","276688331200000"], - ["1077804256999999","107780425700000"], - ["1077804256999999","107780425700000"], - ["1077804256999999","107780425700000"], - ["1239913664499999","123991366450000"], - ["1083648329249999","108364832925000"], - ["2766567664499997","276656766450000"], - ["1077804256999999","107780425700000"], - ["121497934250000","12149793425000"], - ["1489329518749999","148932951875000"], - ["705471877249999","70547187725000"], - ["1365074446999999","136507444700000"], - ["148259503000000","14825950300000"], - ["120582017500000","12058201750000"], - ["1077804256999999","107780425700000"], - ["1077804256999999","107780425700000"], - ["1077804256999999","107780425700000"], - ["1077804256999999","107780425700000"], - ["1077804256999999","107780425700000"], - ["3458772690249997","345877269025000"], - ["1096846600499999","109684660050000"], - ["2642116312499998","264211631250000"], - ["1186049670749999","118604967075000"], - ["3379361777249997","337936177725000"], - ["1073027971999999","107302797200000"], - ["1077804256999999","107780425700000"], - ["1077804256999999","107780425700000"], - ["2205003116999998","220500311700000"], - ["1400476333249999","140047633325000"], - ["1334754243499999","133475424350000"], - ["75000261135249920","7500026113524992"], - ["2766917160499997","276691716050000"], - ["1077804256999999","107780425700000"], - ["4081356354749996","408135635475000"], - ["115064965500000","11506496550000"], - ["140863986000000","14086398600000"], - ["1421544889999999","142154489000000"], - ["1249751425499999","124975142550000"], - ["1522711647499999","152271164750000"], - ["1077804256999999","107780425700000"], - ["1077804256999999","107780425700000"], - ["1077804256999999","107780425700000"], - ["1077804256999999","107780425700000"], - ["2766928990999997","276692899100000"], - ["1251222885499999","125122288550000"], - ["1804670182999998","180467018300000"], - ["1286074936749999","128607493675000"], - ["22474595357499976","2247459535749998"], - ["1077804256999999","107780425700000"], - ["1077804256999999","107780425700000"], - ["2766772303499997","276677230350000"], - ["1077804256999999","107780425700000"], - ["1077804256999999","107780425700000"], - ["1077804256999999","107780425700000"], - ["1077804256999999","107780425700000"], - ["1077804256999999","107780425700000"], - ["1636477811999998","163647781200000"], - ["1077804256999999","107780425700000"], - ["1077804256999999","107780425700000"], - ["1077804256999999","107780425700000"], - ["2766759761749998","276675976175000"], - ["1077804256999999","107780425700000"], - ["2367891235249998","236789123525000"], - ["2111355676249998","211135567625000"], - ["97982205000000","9798220500000"], - ["1077804256999999","107780425700000"], - ["1077804256999999","107780425700000"], - ["1335070157749999","133507015775000"], - ["1088824402499999","108882440250000"], - ["1591863078499998","159186307850000"], - ["1093209052249999","109320905225000"], - ["1231725361499999","123172536150000"], - ["1077804256999999","107780425700000"], - ["1188849744499999","118884974450000"], - ["1325974469749999","132597446975000"], - ["1077804256999999","107780425700000"], - ["1170727959499999","117072795950000"], - ["1077804256999999","107780425700000"], - ["1077804256999999","107780425700000"], - ["2766687807749997","276668780775000"], - ["979822051749999","97982205175000"], - ["1077804256999999","107780425700000"], - ["1195382903249999","119538290325000"], - ["131740039000000","13174003900000"], - ["1077804256999999","107780425700000"], - ["1584454986249999","158445498625000"], - ["1496388154999999","149638815500000"], - ["2783380170999997","278338017100000"], - ["2766853466749997","276685346675000"], - ["97982205000000","9798220500000"], - ["1077804256999999","107780425700000"], - ["1077804256999999","107780425700000"], - ["1077804256999999","107780425700000"], - ["1259437513249999","125943751325000"], - ["2559660094249998","255966009425000"], - ["97982205000000","9798220500000"], - ["97982205000000","9798220500000"], - ["1077804256999999","107780425700000"], - ["7828778194249992","782877819424999"], - ["1077804256999999","107780425700000"], - ["1077804256999999","107780425700000"], - ["1138055195249999","113805519525000"], - ["979822051749999","97982205175000"], - ["1192936111999999","119293611200000"], - ["1117604526499999","111760452650000"], - ["1077804256999999","107780425700000"], - ["391928820500000","39192882050000"], - ["1671343943749998","167134394375000"], - ["1237619152499999","123761915250000"], - ["1461227295249999","146122729525000"], - ["536422250000","53642225000"], - ["1077804256999999","107780425700000"], - ["746783849749999","74678384975000"], - ["8686889065749991","868688906574999"], - ["979822051749999","97982205175000"], - ["1077804256999999","107780425700000"], - ["3577907333749997","357790733375000"], - ["9798220500000","979822050000"], - ["2766688656499997","276668865650000"], - ["1077804256999999","107780425700000"], - ["1190360713999999","119036071400000"], - ["1372170432249999","137217043225000"], - ["1180097737749999","118009773775000"], - ["979822051749999","97982205175000"], - ["1077804256999999","107780425700000"], - ["1231665739249999","123166573925000"], - ["1250928951499999","125092895150000"], - ["1077804256999999","107780425700000"], - ["1122446018749999","112244601875000"], - ["1077804256999999","107780425700000"], - ["3465020847749997","346502084775000"], - ["497502843250000","49750284325000"], - ["2766694622499997","276669462250000"], - ["1077804256999999","107780425700000"], - ["9799200250000","979920025000"], - ["1077804256999999","107780425700000"], - ["3393183871249997","339318387125000"], - ["1224777564749999","122477756475000"], - ["1077804256999999","107780425700000"], - ["2766784225749997","276678422575000"], - ["1084088666249999","108408866625000"], - ["979822051749999","97982205175000"], - ["1077804256999999","107780425700000"], - ["1077804256999999","107780425700000"], - ["120671798250000","12067179825000"], - ["97982205000000","9798220500000"], - ["1207335820749999","120733582075000"], - ["979822051749999","97982205175000"], - ["1708717776499998","170871777650000"], - ["1077804256999999","107780425700000"], - ["2171666879249998","217166687925000"], - ["2766540531749997","276654053175000"], - ["97982205000000","9798220500000"], - ["1077804256999999","107780425700000"], - ["1077804256999999","107780425700000"], - ["1077804256999999","107780425700000"], - ["1139514050249999","113951405025000"], - ["1347136987749999","134713698775000"], - ["1077804256999999","107780425700000"], - ["1077804256999999","107780425700000"], - ["1077804256999999","107780425700000"], - ["1077804256999999","107780425700000"], - ["2373897634749998","237389763475000"], - ["1077804256999999","107780425700000"], - ["1077804256999999","107780425700000"], - ["1296568008249999","129656800825000"], - ["1747592574499998","174759257450000"], - ["1718446376999998","171844637700000"], - ["97982205000000","9798220500000"], - ["1077804256999999","107780425700000"], - ["1126212608249999","112621260825000"], - ["1382620828249999","138262082825000"], - ["1827529957249998","182752995725000"], - ["1077804256999999","107780425700000"], - ["1077804256999999","107780425700000"], - ["1077804256999999","107780425700000"], - ["1077804256999999","107780425700000"], - ["2766997874749997","276699787475000"], - ["1077804256999999","107780425700000"], - ["1077804256999999","107780425700000"], - ["3558586463999997","355858646400000"], - ["148139296000000","14813929600000"], - ["1228361717249999","122836171725000"], - ["1120021586249999","112002158625000"], - ["1077804256999999","107780425700000"], - ["75838000000","7583800000"], - ["2813176036999997","281317603700000"], - ["1126418676499999","112641867650000"], - ["1077804256999999","107780425700000"], - ["1168952628749999","116895262875000"], - ["1286002109999999","128600211000000"], - ["1077804256999999","107780425700000"], - ["1077804256999999","107780425700000"], - ["1106691471749999","110669147175000"], - ["1077804256999999","107780425700000"], - ["2767147036499997","276714703650000"], - ["2766894477499997","276689447750000"], - ["1077804256999999","107780425700000"], - ["1221210601249999","122121060125000"], - ["1077804256999999","107780425700000"], - ["1474944833499998","147494483350000"], - ["3355500944749997","335550094475000"], - ["36042871697249960","3604287169724996"], - ["1077804256999999","107780425700000"], - ["103861137250000","10386113725000"], - ["1077804256999999","107780425700000"], - ["1077804256999999","107780425700000"], - ["7982080906749991","798208090674999"], - ["1077804256999999","107780425700000"], - ["6600292500000","660029250000"], - ["158317476750000","15831747675000"], - ["1077804256999999","107780425700000"], - ["1266130821999999","126613082200000"], - ["1087461430249999","108746143025000"], - ["1925894882749998","192589488275000"], - ["109489270750000","10948927075000"], - ["3011552248749997","301155224875000"], - ["5302500000","530250000"], - ["1077804256999999","107780425700000"], - ["1295497476749999","129549747675000"], - ["1514257759249998","151425775925000"], - ["1973412247749998","197341224775000"], - ["2612205589999997","261220559000000"], - ["1077804256999999","107780425700000"], - ["1077804256999999","107780425700000"], - ["1215310149499999","121531014950000"], - ["1077804256999999","107780425700000"], - ["1087895020499999","108789502050000"], - ["1077804256999999","107780425700000"], - ["1077804256999999","107780425700000"], - ["147078692250000","14707869225000"], - ["2464874880999998","246487488100000"], - ["1166980098249999","116698009825000"], - ["734866538749999","73486653875000"], - ["2163704354999998","216370435500000"], - ["1281449592249999","128144959225000"], - ["1198409126249999","119840912625000"], - ["2767120898499997","276712089850000"], - ["1959088190749998","195908819075000"], - ["1077804256999999","107780425700000"], - ["1170951049999999","117095105000000"], - ["1154675041749999","115467504175000"], - ["1134384833499999","113438483350000"], - ["1077804256999999","107780425700000"], - ["1077804256999999","107780425700000"], - ["1077804256999999","107780425700000"], - ["1194101009249999","119410100925000"], - ["1388429900249999","138842990025000"], - ["979822051749999","97982205175000"], - ["1122446018749999","112244601875000"], - ["1077804256999999","107780425700000"], - ["1077804256999999","107780425700000"], - ["1731852292499998","173185229250000"], - ["1396115605249999","139611560525000"], - ["1077804256999999","107780425700000"], - ["1077804256999999","107780425700000"], - ["1081755392249999","108175539225000"], - ["1115170505749999","111517050575000"], - ["1077804256999999","107780425700000"], - ["1880982576249998","188098257625000"], - ["1253732266249999","125373226625000"], - ["1077804256999999","107780425700000"], - ["117578912750000","11757891275000"], - ["2766816535749997","276681653575000"], - ["1151717784499999","115171778450000"], - ["1073440472499999","107344047250000"], - ["1842220677249998","184222067725000"], - ["1444291238499999","144429123850000"], - ["185920687750000","18592068775000"], - ["1077804256999999","107780425700000"], - ["2766739048249997","276673904825000"], - ["1077804256999999","107780425700000"], - ["1111127251249999","111112725125000"], - ["1077804256999999","107780425700000"], - ["1077804256999999","107780425700000"], - ["1077804256999999","107780425700000"], - ["1077804256999999","107780425700000"], - ["1077804256999999","107780425700000"], - ["2495212757249998","249521275725000"], - ["1109533228999999","110953322900000"], - ["1204528088999999","120452808900000"], - ["2767240998749997","276724099875000"], - ["1077804256999999","107780425700000"], - ["27022701521749972","2702270152174997"], - ["1133721705999999","113372170600000"], - ["2766637369749997","276663736975000"], - ["1077804256999999","107780425700000"], - ["1077804256999999","107780425700000"], - ["979822051749999","97982205175000"], - ["861929137749999","86192913775000"], - ["1077804256999999","107780425700000"], - ["3503727170499996","350372717050000"], - ["1060787189499999","106078718950000"], - ["979822051749999","97982205175000"], - ["2045249932249998","204524993225000"], - ["482354676250000","48235467625000"], - ["1077804256999999","107780425700000"], - ["1397360907249999","139736090725000"], - ["1175341173499999","117534117350000"], - ["2767044838249997","276704483825000"], - ["1077804256999999","107780425700000"], - ["1077804256999999","107780425700000"], - ["1449542205249999","144954220525000"], - ["1077804256999999","107780425700000"], - ["2321707502749998","232170750275000"], - ["1077804256999999","107780425700000"], - ["1077804256999999","107780425700000"], - ["1513531123249999","151353112325000"], - ["2740460193499997","274046019350000"], - ["1077804256999999","107780425700000"], - ["1149339404999999","114933940500000"], - ["1151809466249999","115180946625000"], - ["1077804256999999","107780425700000"], - ["1077804256999999","107780425700000"], - ["1249904385249999","124990438525000"], - ["1096106635999999","109610663600000"], - ["6898005302249993","689800530224999"], - ["1077804256999999","107780425700000"], - ["1077804256999999","107780425700000"], - ["1077804256999999","107780425700000"], - ["2766392857999997","276639285800000"], - ["1077804256999999","107780425700000"], - ["2921368330249997","292136833025000"], - ["1369704807999999","136970480800000"], - ["1077804256999999","107780425700000"], - ["5006256564499995","500625656450000"], - ["1077804256999999","107780425700000"], - ["109740069750000","10974006975000"], - ["1077804256999999","107780425700000"], - ["1346236941999999","134623694200000"], - ["1077804256999999","107780425700000"], - ["1077804256999999","107780425700000"], - ["1077804256999999","107780425700000"], - ["1103601738249999","110360173825000"], - ["2704308862999998","270430886300000"], - ["864763585499999","86476358550000"], - ["979822051749999","97982205175000"], - ["1576305397999998","157630539800000"], - ["147299275500000","14729927550000"], - ["1077804256999999","107780425700000"], - ["1077804256999999","107780425700000"], - ["1077804256999999","107780425700000"], - ["1077804256999999","107780425700000"], - ["1077804256999999","107780425700000"], - ["1321185449499999","132118544950000"], - ["1077804256999999","107780425700000"], - ["1244374005749999","124437400575000"], - ["1077804256999999","107780425700000"], - ["1077804256999999","107780425700000"], - ["979822051749999","97982205175000"], - ["1077804256999999","107780425700000"], - ["2175404280999998","217540428100000"], - ["2324262255249998","232426225525000"], - ["1087602477499999","108760247750000"], - ["1077804256999999","107780425700000"], - ["1077804256999999","107780425700000"], - ["1226466551749999","122646655175000"], - ["2797069106499997","279706910650000"], - ["1122461615499999","112246161550000"], - ["1156738466749999","115673846675000"], - ["5920104740249994","592010474024999"], - ["1077804256999999","107780425700000"], - ["1077804256999999","107780425700000"], - ["13604498250000","1360449825000"], - ["1367625821749999","136762582175000"], -] -issues = 0 -indexes = [] -#for i, number in enumerate(numbers): -for i, number in enumerate(numbers): - res = nileOperatorTokenRewards(number[0]) - if res != number[1]: - issues += 1 - indexes.append(i) - print("{}".format(number[0])) - print("Expected: {}".format(number[1])) - print("Got: {}".format(res)) - print("--------") -print("issues: {} {}".format(issues, indexes)) diff --git a/internal/clients/ethereum/client.go b/pkg/clients/ethereum/client.go similarity index 100% rename from internal/clients/ethereum/client.go rename to pkg/clients/ethereum/client.go diff --git a/internal/clients/ethereum/handlers.go b/pkg/clients/ethereum/handlers.go similarity index 100% rename from internal/clients/ethereum/handlers.go rename to pkg/clients/ethereum/handlers.go diff --git a/internal/clients/ethereum/types.go b/pkg/clients/ethereum/types.go similarity index 100% rename from internal/clients/ethereum/types.go rename to pkg/clients/ethereum/types.go diff --git a/internal/clients/etherscan/client.go b/pkg/clients/etherscan/client.go similarity index 100% rename from internal/clients/etherscan/client.go rename to pkg/clients/etherscan/client.go diff --git a/internal/contractCaller/abis.go b/pkg/contractCaller/abis.go similarity index 100% rename from internal/contractCaller/abis.go rename to pkg/contractCaller/abis.go diff --git a/internal/contractCaller/contractCaller.go b/pkg/contractCaller/contractCaller.go similarity index 99% rename from internal/contractCaller/contractCaller.go rename to pkg/contractCaller/contractCaller.go index c6a62e5a..a65b5257 100644 --- a/internal/contractCaller/contractCaller.go +++ b/pkg/contractCaller/contractCaller.go @@ -4,10 +4,10 @@ import ( "context" "errors" "fmt" + "github.com/Layr-Labs/go-sidecar/pkg/clients/ethereum" "math/big" "strings" - "github.com/Layr-Labs/go-sidecar/internal/clients/ethereum" "github.com/Layr-Labs/go-sidecar/pkg/utils" "github.com/ethereum/go-ethereum/accounts/abi" "github.com/ethereum/go-ethereum/accounts/abi/bind" diff --git a/internal/contractManager/contractManager.go b/pkg/contractManager/contractManager.go similarity index 95% rename from internal/contractManager/contractManager.go rename to pkg/contractManager/contractManager.go index 7b7b1d39..c7f34de0 100644 --- a/internal/contractManager/contractManager.go +++ b/pkg/contractManager/contractManager.go @@ -3,20 +3,20 @@ package contractManager import ( "context" "fmt" + ethereum2 "github.com/Layr-Labs/go-sidecar/pkg/clients/ethereum" + "github.com/Layr-Labs/go-sidecar/pkg/clients/etherscan" + "github.com/Layr-Labs/go-sidecar/pkg/contractStore" + "github.com/Layr-Labs/go-sidecar/pkg/utils" "github.com/DataDog/datadog-go/v5/statsd" - "github.com/Layr-Labs/go-sidecar/internal/clients/ethereum" - "github.com/Layr-Labs/go-sidecar/internal/clients/etherscan" - "github.com/Layr-Labs/go-sidecar/internal/contractStore" "github.com/Layr-Labs/go-sidecar/internal/metrics" - "github.com/Layr-Labs/go-sidecar/internal/utils" "go.uber.org/zap" ) type ContractManager struct { ContractStore contractStore.ContractStore EtherscanClient *etherscan.EtherscanClient - EthereumClient *ethereum.Client + EthereumClient *ethereum2.Client Statsd *statsd.Client Logger *zap.Logger } @@ -24,7 +24,7 @@ type ContractManager struct { func NewContractManager( cs contractStore.ContractStore, ec *etherscan.EtherscanClient, - e *ethereum.Client, + e *ethereum2.Client, s *statsd.Client, l *zap.Logger, ) *ContractManager { @@ -69,7 +69,7 @@ func (cm *ContractManager) FindOrCreateContractWithProxy( return nil, err } - storageValue, err := cm.EthereumClient.GetStorageAt(context.Background(), contractAddress, ethereum.EIP1967_STORAGE_SLOT, "latest") + storageValue, err := cm.EthereumClient.GetStorageAt(context.Background(), contractAddress, ethereum2.EIP1967_STORAGE_SLOT, "latest") if err != nil { cm.Logger.Sugar().Errorw("Failed to get storage value", zap.Error(err), zap.String("contractAddress", contractAddress)) } else { @@ -97,7 +97,7 @@ func (cm *ContractManager) CreateContract( zap.String("contractAddress", contractAddress), ) } else { - bytecodeHash = ethereum.HashBytecode(bytecode) + bytecodeHash = ethereum2.HashBytecode(bytecode) cm.Logger.Sugar().Debugw("Fetched contract bytecode", zap.String("contractAddress", contractAddress), zap.String("bytecodeHash", bytecodeHash), diff --git a/internal/contractStore/contractStore.go b/pkg/contractStore/contractStore.go similarity index 100% rename from internal/contractStore/contractStore.go rename to pkg/contractStore/contractStore.go diff --git a/internal/contractStore/coreContracts/testnet.json b/pkg/contractStore/coreContracts/testnet.json similarity index 100% rename from internal/contractStore/coreContracts/testnet.json rename to pkg/contractStore/coreContracts/testnet.json diff --git a/internal/contractStore/postgresContractStore/postgresContractStore.go b/pkg/contractStore/postgresContractStore/postgresContractStore.go similarity index 98% rename from internal/contractStore/postgresContractStore/postgresContractStore.go rename to pkg/contractStore/postgresContractStore/postgresContractStore.go index 55110c91..4a015741 100644 --- a/internal/contractStore/postgresContractStore/postgresContractStore.go +++ b/pkg/contractStore/postgresContractStore/postgresContractStore.go @@ -5,11 +5,11 @@ import ( "encoding/json" "errors" "fmt" - "github.com/Layr-Labs/go-sidecar/internal/postgres" + "github.com/Layr-Labs/go-sidecar/pkg/contractStore" + "github.com/Layr-Labs/go-sidecar/pkg/postgres" "strings" "github.com/Layr-Labs/go-sidecar/internal/config" - "github.com/Layr-Labs/go-sidecar/internal/contractStore" "go.uber.org/zap" "golang.org/x/xerrors" "gorm.io/gorm" diff --git a/internal/contractStore/postgresContractStore/postgresContractStore_test.go b/pkg/contractStore/postgresContractStore/postgresContractStore_test.go similarity index 98% rename from internal/contractStore/postgresContractStore/postgresContractStore_test.go rename to pkg/contractStore/postgresContractStore/postgresContractStore_test.go index 8b57dcb3..680f4e0a 100644 --- a/internal/contractStore/postgresContractStore/postgresContractStore_test.go +++ b/pkg/contractStore/postgresContractStore/postgresContractStore_test.go @@ -2,10 +2,10 @@ package postgresContractStore import ( "github.com/Layr-Labs/go-sidecar/internal/config" - "github.com/Layr-Labs/go-sidecar/internal/contractStore" "github.com/Layr-Labs/go-sidecar/internal/logger" - "github.com/Layr-Labs/go-sidecar/internal/postgres" "github.com/Layr-Labs/go-sidecar/internal/tests" + "github.com/Layr-Labs/go-sidecar/pkg/contractStore" + "github.com/Layr-Labs/go-sidecar/pkg/postgres" "github.com/stretchr/testify/assert" "go.uber.org/zap" "gorm.io/gorm" diff --git a/internal/eigenState/avsOperators/avsOperators.go b/pkg/eigenState/avsOperators/avsOperators.go similarity index 97% rename from internal/eigenState/avsOperators/avsOperators.go rename to pkg/eigenState/avsOperators/avsOperators.go index 5c43b8d0..13acce12 100644 --- a/internal/eigenState/avsOperators/avsOperators.go +++ b/pkg/eigenState/avsOperators/avsOperators.go @@ -4,17 +4,17 @@ import ( "database/sql" "errors" "fmt" + "github.com/Layr-Labs/go-sidecar/pkg/storage" + "github.com/Layr-Labs/go-sidecar/pkg/utils" "slices" "sort" "strings" "time" "github.com/Layr-Labs/go-sidecar/internal/config" - "github.com/Layr-Labs/go-sidecar/internal/eigenState/base" - "github.com/Layr-Labs/go-sidecar/internal/eigenState/stateManager" - "github.com/Layr-Labs/go-sidecar/internal/eigenState/types" - "github.com/Layr-Labs/go-sidecar/internal/storage" - "github.com/Layr-Labs/go-sidecar/internal/utils" + "github.com/Layr-Labs/go-sidecar/pkg/eigenState/base" + "github.com/Layr-Labs/go-sidecar/pkg/eigenState/stateManager" + "github.com/Layr-Labs/go-sidecar/pkg/eigenState/types" "go.uber.org/zap" "golang.org/x/xerrors" "gorm.io/gorm" diff --git a/internal/eigenState/avsOperators/avsOperators_test.go b/pkg/eigenState/avsOperators/avsOperators_test.go similarity index 97% rename from internal/eigenState/avsOperators/avsOperators_test.go rename to pkg/eigenState/avsOperators/avsOperators_test.go index add93c7d..f344c1ca 100644 --- a/internal/eigenState/avsOperators/avsOperators_test.go +++ b/pkg/eigenState/avsOperators/avsOperators_test.go @@ -2,15 +2,15 @@ package avsOperators import ( "database/sql" - "github.com/Layr-Labs/go-sidecar/internal/postgres" + "github.com/Layr-Labs/go-sidecar/pkg/postgres" + "github.com/Layr-Labs/go-sidecar/pkg/storage" "testing" "time" "github.com/Layr-Labs/go-sidecar/internal/config" - "github.com/Layr-Labs/go-sidecar/internal/eigenState/stateManager" "github.com/Layr-Labs/go-sidecar/internal/logger" - "github.com/Layr-Labs/go-sidecar/internal/storage" "github.com/Layr-Labs/go-sidecar/internal/tests" + "github.com/Layr-Labs/go-sidecar/pkg/eigenState/stateManager" "github.com/stretchr/testify/assert" "go.uber.org/zap" "gorm.io/gorm" diff --git a/internal/eigenState/base/baseEigenState.go b/pkg/eigenState/base/baseEigenState.go similarity index 96% rename from internal/eigenState/base/baseEigenState.go rename to pkg/eigenState/base/baseEigenState.go index 848380cb..f5b03b62 100644 --- a/internal/eigenState/base/baseEigenState.go +++ b/pkg/eigenState/base/baseEigenState.go @@ -5,16 +5,16 @@ import ( "encoding/json" "errors" "fmt" + "github.com/Layr-Labs/go-sidecar/pkg/parser" + "github.com/Layr-Labs/go-sidecar/pkg/storage" "slices" "strings" - "github.com/Layr-Labs/go-sidecar/internal/eigenState/types" + "github.com/Layr-Labs/go-sidecar/pkg/eigenState/types" "github.com/wealdtech/go-merkletree/v2" "github.com/wealdtech/go-merkletree/v2/keccak256" orderedmap "github.com/wk8/go-ordered-map/v2" - "github.com/Layr-Labs/go-sidecar/internal/parser" - "github.com/Layr-Labs/go-sidecar/internal/storage" "go.uber.org/zap" "gorm.io/gorm" ) diff --git a/internal/eigenState/eigenstate_test.go b/pkg/eigenState/eigenstate_test.go similarity index 87% rename from internal/eigenState/eigenstate_test.go rename to pkg/eigenState/eigenstate_test.go index f8a6f803..0a727cd2 100644 --- a/internal/eigenState/eigenstate_test.go +++ b/pkg/eigenState/eigenstate_test.go @@ -1,15 +1,15 @@ package eigenState import ( - "github.com/Layr-Labs/go-sidecar/internal/postgres" + "github.com/Layr-Labs/go-sidecar/pkg/postgres" "testing" "github.com/Layr-Labs/go-sidecar/internal/config" - "github.com/Layr-Labs/go-sidecar/internal/eigenState/avsOperators" - "github.com/Layr-Labs/go-sidecar/internal/eigenState/operatorShares" - "github.com/Layr-Labs/go-sidecar/internal/eigenState/stateManager" "github.com/Layr-Labs/go-sidecar/internal/logger" "github.com/Layr-Labs/go-sidecar/internal/tests" + "github.com/Layr-Labs/go-sidecar/pkg/eigenState/avsOperators" + "github.com/Layr-Labs/go-sidecar/pkg/eigenState/operatorShares" + "github.com/Layr-Labs/go-sidecar/pkg/eigenState/stateManager" "github.com/stretchr/testify/assert" "go.uber.org/zap" "gorm.io/gorm" diff --git a/internal/eigenState/operatorShares/operatorShares.go b/pkg/eigenState/operatorShares/operatorShares.go similarity index 96% rename from internal/eigenState/operatorShares/operatorShares.go rename to pkg/eigenState/operatorShares/operatorShares.go index 7033dc79..d125fc03 100644 --- a/internal/eigenState/operatorShares/operatorShares.go +++ b/pkg/eigenState/operatorShares/operatorShares.go @@ -4,6 +4,8 @@ import ( "database/sql" "encoding/json" "fmt" + "github.com/Layr-Labs/go-sidecar/pkg/storage" + "github.com/Layr-Labs/go-sidecar/pkg/types/numbers" "math/big" "slices" "sort" @@ -13,12 +15,9 @@ import ( pkgUtils "github.com/Layr-Labs/go-sidecar/pkg/utils" "github.com/Layr-Labs/go-sidecar/internal/config" - "github.com/Layr-Labs/go-sidecar/internal/eigenState/base" - "github.com/Layr-Labs/go-sidecar/internal/eigenState/stateManager" - "github.com/Layr-Labs/go-sidecar/internal/eigenState/types" - "github.com/Layr-Labs/go-sidecar/internal/storage" - "github.com/Layr-Labs/go-sidecar/internal/types/numbers" - "github.com/Layr-Labs/go-sidecar/internal/utils" + "github.com/Layr-Labs/go-sidecar/pkg/eigenState/base" + "github.com/Layr-Labs/go-sidecar/pkg/eigenState/stateManager" + "github.com/Layr-Labs/go-sidecar/pkg/eigenState/types" "go.uber.org/zap" "golang.org/x/xerrors" "gorm.io/gorm" @@ -402,7 +401,7 @@ func (osm *OperatorSharesModel) GenerateStateRoot(blockNumber uint64) (types.Sta if err != nil { return "", err } - return types.StateRoot(utils.ConvertBytesToString(fullTree.Root())), nil + return types.StateRoot(pkgUtils.ConvertBytesToString(fullTree.Root())), nil } func (osm *OperatorSharesModel) sortValuesForMerkleTree(diffs []*OperatorSharesDiff) []*base.MerkleTreeInput { diff --git a/internal/eigenState/operatorShares/operatorShares_test.go b/pkg/eigenState/operatorShares/operatorShares_test.go similarity index 97% rename from internal/eigenState/operatorShares/operatorShares_test.go rename to pkg/eigenState/operatorShares/operatorShares_test.go index f4a16c33..930843dc 100644 --- a/internal/eigenState/operatorShares/operatorShares_test.go +++ b/pkg/eigenState/operatorShares/operatorShares_test.go @@ -2,17 +2,17 @@ package operatorShares import ( "database/sql" - "github.com/Layr-Labs/go-sidecar/internal/postgres" + "github.com/Layr-Labs/go-sidecar/pkg/postgres" + "github.com/Layr-Labs/go-sidecar/pkg/storage" "math/big" "strings" "testing" "time" "github.com/Layr-Labs/go-sidecar/internal/config" - "github.com/Layr-Labs/go-sidecar/internal/eigenState/stateManager" "github.com/Layr-Labs/go-sidecar/internal/logger" - "github.com/Layr-Labs/go-sidecar/internal/storage" "github.com/Layr-Labs/go-sidecar/internal/tests" + "github.com/Layr-Labs/go-sidecar/pkg/eigenState/stateManager" "github.com/stretchr/testify/assert" "go.uber.org/zap" "gorm.io/gorm" diff --git a/internal/eigenState/rewardSubmissions/rewardSubmissions.go b/pkg/eigenState/rewardSubmissions/rewardSubmissions.go similarity index 97% rename from internal/eigenState/rewardSubmissions/rewardSubmissions.go rename to pkg/eigenState/rewardSubmissions/rewardSubmissions.go index 22e98239..83f0ca88 100644 --- a/internal/eigenState/rewardSubmissions/rewardSubmissions.go +++ b/pkg/eigenState/rewardSubmissions/rewardSubmissions.go @@ -4,18 +4,18 @@ import ( "database/sql" "encoding/json" "fmt" + "github.com/Layr-Labs/go-sidecar/pkg/storage" + "github.com/Layr-Labs/go-sidecar/pkg/types/numbers" + "github.com/Layr-Labs/go-sidecar/pkg/utils" "slices" "sort" "strings" "time" "github.com/Layr-Labs/go-sidecar/internal/config" - "github.com/Layr-Labs/go-sidecar/internal/eigenState/base" - "github.com/Layr-Labs/go-sidecar/internal/eigenState/stateManager" - "github.com/Layr-Labs/go-sidecar/internal/eigenState/types" - "github.com/Layr-Labs/go-sidecar/internal/storage" - "github.com/Layr-Labs/go-sidecar/internal/types/numbers" - "github.com/Layr-Labs/go-sidecar/internal/utils" + "github.com/Layr-Labs/go-sidecar/pkg/eigenState/base" + "github.com/Layr-Labs/go-sidecar/pkg/eigenState/stateManager" + "github.com/Layr-Labs/go-sidecar/pkg/eigenState/types" "go.uber.org/zap" "golang.org/x/xerrors" "gorm.io/gorm" diff --git a/internal/eigenState/rewardSubmissions/rewardSubmissions_test.go b/pkg/eigenState/rewardSubmissions/rewardSubmissions_test.go similarity index 99% rename from internal/eigenState/rewardSubmissions/rewardSubmissions_test.go rename to pkg/eigenState/rewardSubmissions/rewardSubmissions_test.go index 7c1aa33e..ffe8c8e9 100644 --- a/internal/eigenState/rewardSubmissions/rewardSubmissions_test.go +++ b/pkg/eigenState/rewardSubmissions/rewardSubmissions_test.go @@ -2,17 +2,17 @@ package rewardSubmissions import ( "fmt" - "github.com/Layr-Labs/go-sidecar/internal/postgres" + "github.com/Layr-Labs/go-sidecar/pkg/postgres" + "github.com/Layr-Labs/go-sidecar/pkg/storage" "math/big" "strings" "testing" "time" "github.com/Layr-Labs/go-sidecar/internal/config" - "github.com/Layr-Labs/go-sidecar/internal/eigenState/stateManager" "github.com/Layr-Labs/go-sidecar/internal/logger" - "github.com/Layr-Labs/go-sidecar/internal/storage" "github.com/Layr-Labs/go-sidecar/internal/tests" + "github.com/Layr-Labs/go-sidecar/pkg/eigenState/stateManager" "github.com/stretchr/testify/assert" "go.uber.org/zap" "gorm.io/gorm" diff --git a/internal/eigenState/stakerDelegations/stakerDelegations.go b/pkg/eigenState/stakerDelegations/stakerDelegations.go similarity index 97% rename from internal/eigenState/stakerDelegations/stakerDelegations.go rename to pkg/eigenState/stakerDelegations/stakerDelegations.go index 79f6f599..1207c05f 100644 --- a/internal/eigenState/stakerDelegations/stakerDelegations.go +++ b/pkg/eigenState/stakerDelegations/stakerDelegations.go @@ -4,17 +4,17 @@ import ( "database/sql" "errors" "fmt" + "github.com/Layr-Labs/go-sidecar/pkg/storage" + "github.com/Layr-Labs/go-sidecar/pkg/utils" "slices" "sort" "strings" "time" "github.com/Layr-Labs/go-sidecar/internal/config" - "github.com/Layr-Labs/go-sidecar/internal/eigenState/base" - "github.com/Layr-Labs/go-sidecar/internal/eigenState/stateManager" - "github.com/Layr-Labs/go-sidecar/internal/eigenState/types" - "github.com/Layr-Labs/go-sidecar/internal/storage" - "github.com/Layr-Labs/go-sidecar/internal/utils" + "github.com/Layr-Labs/go-sidecar/pkg/eigenState/base" + "github.com/Layr-Labs/go-sidecar/pkg/eigenState/stateManager" + "github.com/Layr-Labs/go-sidecar/pkg/eigenState/types" "go.uber.org/zap" "golang.org/x/xerrors" "gorm.io/gorm" diff --git a/internal/eigenState/stakerDelegations/stakerDelegations_test.go b/pkg/eigenState/stakerDelegations/stakerDelegations_test.go similarity index 97% rename from internal/eigenState/stakerDelegations/stakerDelegations_test.go rename to pkg/eigenState/stakerDelegations/stakerDelegations_test.go index 3c4bfd10..eb15f9ed 100644 --- a/internal/eigenState/stakerDelegations/stakerDelegations_test.go +++ b/pkg/eigenState/stakerDelegations/stakerDelegations_test.go @@ -2,15 +2,15 @@ package stakerDelegations import ( "database/sql" - "github.com/Layr-Labs/go-sidecar/internal/postgres" + "github.com/Layr-Labs/go-sidecar/pkg/postgres" + "github.com/Layr-Labs/go-sidecar/pkg/storage" "testing" "time" "github.com/Layr-Labs/go-sidecar/internal/config" - "github.com/Layr-Labs/go-sidecar/internal/eigenState/stateManager" "github.com/Layr-Labs/go-sidecar/internal/logger" - "github.com/Layr-Labs/go-sidecar/internal/storage" "github.com/Layr-Labs/go-sidecar/internal/tests" + "github.com/Layr-Labs/go-sidecar/pkg/eigenState/stateManager" "github.com/stretchr/testify/assert" "go.uber.org/zap" "gorm.io/gorm" diff --git a/internal/eigenState/stakerShares/stakerShares.go b/pkg/eigenState/stakerShares/stakerShares.go similarity index 98% rename from internal/eigenState/stakerShares/stakerShares.go rename to pkg/eigenState/stakerShares/stakerShares.go index 420bb86b..4e996f67 100644 --- a/internal/eigenState/stakerShares/stakerShares.go +++ b/pkg/eigenState/stakerShares/stakerShares.go @@ -6,6 +6,8 @@ import ( "encoding/json" "errors" "fmt" + "github.com/Layr-Labs/go-sidecar/pkg/storage" + "github.com/Layr-Labs/go-sidecar/pkg/types/numbers" "math/big" "slices" "sort" @@ -13,12 +15,9 @@ import ( "time" "github.com/Layr-Labs/go-sidecar/internal/config" - "github.com/Layr-Labs/go-sidecar/internal/eigenState/base" - "github.com/Layr-Labs/go-sidecar/internal/eigenState/stateManager" - "github.com/Layr-Labs/go-sidecar/internal/eigenState/types" - "github.com/Layr-Labs/go-sidecar/internal/storage" - "github.com/Layr-Labs/go-sidecar/internal/types/numbers" - "github.com/Layr-Labs/go-sidecar/internal/utils" + "github.com/Layr-Labs/go-sidecar/pkg/eigenState/base" + "github.com/Layr-Labs/go-sidecar/pkg/eigenState/stateManager" + "github.com/Layr-Labs/go-sidecar/pkg/eigenState/types" pkgUtils "github.com/Layr-Labs/go-sidecar/pkg/utils" "go.uber.org/zap" "golang.org/x/xerrors" @@ -704,7 +703,7 @@ func (ss *StakerSharesModel) GenerateStateRoot(blockNumber uint64) (types.StateR if err != nil { return "", err } - return types.StateRoot(utils.ConvertBytesToString(fullTree.Root())), nil + return types.StateRoot(pkgUtils.ConvertBytesToString(fullTree.Root())), nil } func (ss *StakerSharesModel) sortValuesForMerkleTree(diffs []*StakerSharesDiff) []*base.MerkleTreeInput { diff --git a/internal/eigenState/stakerShares/stakerShares_test.go b/pkg/eigenState/stakerShares/stakerShares_test.go similarity index 99% rename from internal/eigenState/stakerShares/stakerShares_test.go rename to pkg/eigenState/stakerShares/stakerShares_test.go index 9dc723b9..2fdc8208 100644 --- a/internal/eigenState/stakerShares/stakerShares_test.go +++ b/pkg/eigenState/stakerShares/stakerShares_test.go @@ -1,18 +1,18 @@ package stakerShares import ( - "github.com/Layr-Labs/go-sidecar/internal/postgres" + "github.com/Layr-Labs/go-sidecar/pkg/postgres" + "github.com/Layr-Labs/go-sidecar/pkg/storage" + "github.com/Layr-Labs/go-sidecar/pkg/types/numbers" "math/big" "strings" "testing" "time" "github.com/Layr-Labs/go-sidecar/internal/config" - "github.com/Layr-Labs/go-sidecar/internal/eigenState/stateManager" "github.com/Layr-Labs/go-sidecar/internal/logger" - "github.com/Layr-Labs/go-sidecar/internal/storage" "github.com/Layr-Labs/go-sidecar/internal/tests" - "github.com/Layr-Labs/go-sidecar/internal/types/numbers" + "github.com/Layr-Labs/go-sidecar/pkg/eigenState/stateManager" "github.com/stretchr/testify/assert" "go.uber.org/zap" "gorm.io/gorm" diff --git a/internal/eigenState/stateManager/stateManager.go b/pkg/eigenState/stateManager/stateManager.go similarity index 97% rename from internal/eigenState/stateManager/stateManager.go rename to pkg/eigenState/stateManager/stateManager.go index 8243303e..16a41ead 100644 --- a/internal/eigenState/stateManager/stateManager.go +++ b/pkg/eigenState/stateManager/stateManager.go @@ -3,12 +3,12 @@ package stateManager import ( "errors" "fmt" + "github.com/Layr-Labs/go-sidecar/pkg/storage" + "github.com/Layr-Labs/go-sidecar/pkg/utils" "slices" "time" - "github.com/Layr-Labs/go-sidecar/internal/eigenState/types" - "github.com/Layr-Labs/go-sidecar/internal/storage" - "github.com/Layr-Labs/go-sidecar/internal/utils" + "github.com/Layr-Labs/go-sidecar/pkg/eigenState/types" "github.com/wealdtech/go-merkletree/v2" "github.com/wealdtech/go-merkletree/v2/keccak256" "go.uber.org/zap" diff --git a/internal/eigenState/stateManager/stateManager_test.go b/pkg/eigenState/stateManager/stateManager_test.go similarity index 94% rename from internal/eigenState/stateManager/stateManager_test.go rename to pkg/eigenState/stateManager/stateManager_test.go index 15b1bbe9..9d50da0e 100644 --- a/internal/eigenState/stateManager/stateManager_test.go +++ b/pkg/eigenState/stateManager/stateManager_test.go @@ -1,13 +1,13 @@ package stateManager import ( - "github.com/Layr-Labs/go-sidecar/internal/postgres" + "github.com/Layr-Labs/go-sidecar/pkg/postgres" "testing" "github.com/Layr-Labs/go-sidecar/internal/config" - "github.com/Layr-Labs/go-sidecar/internal/eigenState/types" "github.com/Layr-Labs/go-sidecar/internal/logger" "github.com/Layr-Labs/go-sidecar/internal/tests" + "github.com/Layr-Labs/go-sidecar/pkg/eigenState/types" "github.com/stretchr/testify/assert" "go.uber.org/zap" "gorm.io/gorm" diff --git a/internal/eigenState/submittedDistributionRoots/submittedDistributionRoots.go b/pkg/eigenState/submittedDistributionRoots/submittedDistributionRoots.go similarity index 97% rename from internal/eigenState/submittedDistributionRoots/submittedDistributionRoots.go rename to pkg/eigenState/submittedDistributionRoots/submittedDistributionRoots.go index abe0de6d..d1f7e10b 100644 --- a/internal/eigenState/submittedDistributionRoots/submittedDistributionRoots.go +++ b/pkg/eigenState/submittedDistributionRoots/submittedDistributionRoots.go @@ -4,6 +4,8 @@ import ( "database/sql" "encoding/json" "fmt" + "github.com/Layr-Labs/go-sidecar/pkg/storage" + "github.com/Layr-Labs/go-sidecar/pkg/utils" "reflect" "slices" "sort" @@ -12,11 +14,9 @@ import ( "time" "github.com/Layr-Labs/go-sidecar/internal/config" - "github.com/Layr-Labs/go-sidecar/internal/eigenState/base" - "github.com/Layr-Labs/go-sidecar/internal/eigenState/stateManager" - "github.com/Layr-Labs/go-sidecar/internal/eigenState/types" - "github.com/Layr-Labs/go-sidecar/internal/storage" - "github.com/Layr-Labs/go-sidecar/internal/utils" + "github.com/Layr-Labs/go-sidecar/pkg/eigenState/base" + "github.com/Layr-Labs/go-sidecar/pkg/eigenState/stateManager" + "github.com/Layr-Labs/go-sidecar/pkg/eigenState/types" "go.uber.org/zap" "golang.org/x/xerrors" "gorm.io/gorm" diff --git a/internal/eigenState/submittedDistributionRoots/submittedDistributionRoots_test.go b/pkg/eigenState/submittedDistributionRoots/submittedDistributionRoots_test.go similarity index 97% rename from internal/eigenState/submittedDistributionRoots/submittedDistributionRoots_test.go rename to pkg/eigenState/submittedDistributionRoots/submittedDistributionRoots_test.go index 7eda7b1d..b416ac54 100644 --- a/internal/eigenState/submittedDistributionRoots/submittedDistributionRoots_test.go +++ b/pkg/eigenState/submittedDistributionRoots/submittedDistributionRoots_test.go @@ -1,16 +1,16 @@ package submittedDistributionRoots import ( - "github.com/Layr-Labs/go-sidecar/internal/postgres" + "github.com/Layr-Labs/go-sidecar/pkg/postgres" + "github.com/Layr-Labs/go-sidecar/pkg/storage" "math/big" "testing" "time" "github.com/Layr-Labs/go-sidecar/internal/config" - "github.com/Layr-Labs/go-sidecar/internal/eigenState/stateManager" "github.com/Layr-Labs/go-sidecar/internal/logger" - "github.com/Layr-Labs/go-sidecar/internal/storage" "github.com/Layr-Labs/go-sidecar/internal/tests" + "github.com/Layr-Labs/go-sidecar/pkg/eigenState/stateManager" "github.com/stretchr/testify/assert" "go.uber.org/zap" "gorm.io/gorm" diff --git a/internal/eigenState/types/types.go b/pkg/eigenState/types/types.go similarity index 97% rename from internal/eigenState/types/types.go rename to pkg/eigenState/types/types.go index 4c394a13..4f1fb4e7 100644 --- a/internal/eigenState/types/types.go +++ b/pkg/eigenState/types/types.go @@ -1,7 +1,7 @@ package types import ( - "github.com/Layr-Labs/go-sidecar/internal/storage" + "github.com/Layr-Labs/go-sidecar/pkg/storage" ) type StateRoot string diff --git a/internal/fetcher/fetcher.go b/pkg/fetcher/fetcher.go similarity index 83% rename from internal/fetcher/fetcher.go rename to pkg/fetcher/fetcher.go index 5afceaf1..ee75415a 100644 --- a/internal/fetcher/fetcher.go +++ b/pkg/fetcher/fetcher.go @@ -2,22 +2,22 @@ package fetcher import ( "context" + ethereum2 "github.com/Layr-Labs/go-sidecar/pkg/clients/ethereum" "slices" "sync" - "github.com/Layr-Labs/go-sidecar/internal/clients/ethereum" "github.com/Layr-Labs/go-sidecar/internal/config" "github.com/ethereum/go-ethereum/common/hexutil" "go.uber.org/zap" ) type Fetcher struct { - EthClient *ethereum.Client + EthClient *ethereum2.Client Logger *zap.Logger Config *config.Config } -func NewFetcher(ethClient *ethereum.Client, cfg *config.Config, l *zap.Logger) *Fetcher { +func NewFetcher(ethClient *ethereum2.Client, cfg *config.Config, l *zap.Logger) *Fetcher { return &Fetcher{ EthClient: ethClient, Logger: l, @@ -26,9 +26,9 @@ func NewFetcher(ethClient *ethereum.Client, cfg *config.Config, l *zap.Logger) * } type FetchedBlock struct { - Block *ethereum.EthereumBlock + Block *ethereum2.EthereumBlock // map[transactionHash] => transactionReceipt - TxReceipts map[string]*ethereum.EthereumTransactionReceipt + TxReceipts map[string]*ethereum2.EthereumTransactionReceipt // map[contractAddress] => stored value ContractStorage map[string]string } @@ -40,11 +40,11 @@ func (f *Fetcher) FetchBlock(ctx context.Context, blockNumber uint64) (*FetchedB return nil, err } - txReceiptRequests := make([]*ethereum.RPCRequest, 0) + txReceiptRequests := make([]*ethereum2.RPCRequest, 0) f.Logger.Sugar().Debugf("Fetching '%d' transactions from block '%d'", len(block.Transactions), blockNumber) for i, tx := range block.Transactions { - txReceiptRequests = append(txReceiptRequests, ethereum.GetTransactionReceiptRequest(tx.Hash.Value(), uint(i))) + txReceiptRequests = append(txReceiptRequests, ethereum2.GetTransactionReceiptRequest(tx.Hash.Value(), uint(i))) } f.Logger.Sugar().Debugw("Fetching transaction receipts", @@ -58,9 +58,9 @@ func (f *Fetcher) FetchBlock(ctx context.Context, blockNumber uint64) (*FetchedB return nil, err } - receipts := make(map[string]*ethereum.EthereumTransactionReceipt) + receipts := make(map[string]*ethereum2.EthereumTransactionReceipt) for _, response := range receiptResponses { - r, err := ethereum.RPCMethod_getTransactionReceipt.ResponseParser(response.Result) + r, err := ethereum2.RPCMethod_getTransactionReceipt.ResponseParser(response.Result) if err != nil { f.Logger.Sugar().Errorw("failed to parse transaction receipt", zap.Error(err), @@ -133,7 +133,7 @@ func (f *Fetcher) FetchBlock(ctx context.Context, blockNumber uint64) (*FetchedB for _, receipt := range receipts { if receipt.ContractAddress != "" { if cb, ok := contractBytecodeMap[receipt.ContractAddress.Value()]; ok { - receipt.ContractBytecode = ethereum.EthereumHexString(cb) + receipt.ContractBytecode = ethereum2.EthereumHexString(cb) } } } @@ -158,5 +158,5 @@ func (f *Fetcher) GetContractStorageSlot(ctx context.Context, contractAddress st stringBlock = hexutil.EncodeUint64(blockNumber) } - return f.EthClient.GetStorageAt(ctx, contractAddress, ethereum.EIP1967_STORAGE_SLOT, stringBlock) + return f.EthClient.GetStorageAt(ctx, contractAddress, ethereum2.EIP1967_STORAGE_SLOT, stringBlock) } diff --git a/internal/indexer/indexer.go b/pkg/indexer/indexer.go similarity index 90% rename from internal/indexer/indexer.go rename to pkg/indexer/indexer.go index dc00787e..7e4e0b67 100644 --- a/internal/indexer/indexer.go +++ b/pkg/indexer/indexer.go @@ -3,31 +3,31 @@ package indexer import ( "context" "fmt" + ethereum2 "github.com/Layr-Labs/go-sidecar/pkg/clients/ethereum" + "github.com/Layr-Labs/go-sidecar/pkg/clients/etherscan" + "github.com/Layr-Labs/go-sidecar/pkg/contractCaller" + "github.com/Layr-Labs/go-sidecar/pkg/contractManager" + "github.com/Layr-Labs/go-sidecar/pkg/contractStore" + "github.com/Layr-Labs/go-sidecar/pkg/fetcher" + "github.com/Layr-Labs/go-sidecar/pkg/parser" + "github.com/Layr-Labs/go-sidecar/pkg/storage" "slices" - "github.com/Layr-Labs/go-sidecar/internal/clients/ethereum" - "github.com/Layr-Labs/go-sidecar/internal/clients/etherscan" "github.com/Layr-Labs/go-sidecar/internal/config" - "github.com/Layr-Labs/go-sidecar/internal/contractCaller" - "github.com/Layr-Labs/go-sidecar/internal/contractManager" - "github.com/Layr-Labs/go-sidecar/internal/contractStore" - "github.com/Layr-Labs/go-sidecar/internal/fetcher" - "github.com/Layr-Labs/go-sidecar/internal/parser" - "github.com/Layr-Labs/go-sidecar/internal/storage" "go.uber.org/zap" "golang.org/x/xerrors" ) type Indexer struct { - Logger *zap.Logger - MetadataStore storage.BlockStore - ContractStore contractStore.ContractStore + Logger *zap.Logger + MetadataStore storage.BlockStore + ContractStore contractStore.ContractStore ContractManager *contractManager.ContractManager EtherscanClient *etherscan.EtherscanClient Fetcher *fetcher.Fetcher - EthereumClient *ethereum.Client - Config *config.Config - ContractCaller contractCaller.IContractCaller + EthereumClient *ethereum2.Client + Config *config.Config + ContractCaller contractCaller.IContractCaller } type IndexErrorType int @@ -41,8 +41,8 @@ const ( ) type IndexError struct { - Type IndexErrorType - Err error + Type IndexErrorType + Err error BlockNumber uint64 TransactionHash string LogIndex int @@ -87,7 +87,7 @@ func NewIndexer( cs contractStore.ContractStore, es *etherscan.EtherscanClient, cm *contractManager.ContractManager, - e *ethereum.Client, + e *ethereum2.Client, f *fetcher.Fetcher, cc contractCaller.IContractCaller, l *zap.Logger, @@ -240,7 +240,7 @@ func (idx *Indexer) IsInterestingAddress(addr string) bool { return slices.Contains(idx.Config.GetInterestingAddressForConfigEnv(), addr) } -func (idx *Indexer) IsInterestingTransaction(txn *ethereum.EthereumTransaction, receipt *ethereum.EthereumTransactionReceipt) bool { +func (idx *Indexer) IsInterestingTransaction(txn *ethereum2.EthereumTransaction, receipt *ethereum2.EthereumTransactionReceipt) bool { address := txn.To.Value() contractAddress := receipt.ContractAddress.Value() @@ -254,8 +254,8 @@ func (idx *Indexer) IsInterestingTransaction(txn *ethereum.EthereumTransaction, func (idx *Indexer) FilterInterestingTransactions( block *storage.Block, fetchedBlock *fetcher.FetchedBlock, -) []*ethereum.EthereumTransaction { - interestingTransactions := make([]*ethereum.EthereumTransaction, 0) +) []*ethereum2.EthereumTransaction { + interestingTransactions := make([]*ethereum2.EthereumTransaction, 0) for _, tx := range fetchedBlock.Block.Transactions { txReceipt, ok := fetchedBlock.TxReceipts[tx.Hash.Value()] if !ok { @@ -289,8 +289,8 @@ func (idx *Indexer) FilterInterestingTransactions( func (idx *Indexer) IndexTransaction( block *storage.Block, - tx *ethereum.EthereumTransaction, - receipt *ethereum.EthereumTransactionReceipt, + tx *ethereum2.EthereumTransaction, + receipt *ethereum2.EthereumTransactionReceipt, ) (*storage.Transaction, error) { return idx.MetadataStore.InsertBlockTransaction( block.Number, @@ -304,8 +304,8 @@ func (idx *Indexer) IndexTransaction( } func (idx *Indexer) FindAndHandleContractCreationForTransactions( - transactions []*ethereum.EthereumTransaction, - receipts map[string]*ethereum.EthereumTransactionReceipt, + transactions []*ethereum2.EthereumTransaction, + receipts map[string]*ethereum2.EthereumTransactionReceipt, contractStorage map[string]string, blockNumber uint64, ) { diff --git a/internal/indexer/restakedStrategies.go b/pkg/indexer/restakedStrategies.go similarity index 97% rename from internal/indexer/restakedStrategies.go rename to pkg/indexer/restakedStrategies.go index fc641f03..58e6491b 100644 --- a/internal/indexer/restakedStrategies.go +++ b/pkg/indexer/restakedStrategies.go @@ -3,12 +3,12 @@ package indexer import ( "context" "fmt" - "github.com/Layr-Labs/go-sidecar/internal/postgres" + "github.com/Layr-Labs/go-sidecar/pkg/contractCaller" + "github.com/Layr-Labs/go-sidecar/pkg/postgres" + "github.com/Layr-Labs/go-sidecar/pkg/storage" "sync" "github.com/Layr-Labs/go-sidecar/internal/config" - "github.com/Layr-Labs/go-sidecar/internal/contractCaller" - "github.com/Layr-Labs/go-sidecar/internal/storage" "go.uber.org/zap" ) diff --git a/internal/indexer/restakedStrategies_test.go b/pkg/indexer/restakedStrategies_test.go similarity index 89% rename from internal/indexer/restakedStrategies_test.go rename to pkg/indexer/restakedStrategies_test.go index 3c64918f..2d9c3139 100644 --- a/internal/indexer/restakedStrategies_test.go +++ b/pkg/indexer/restakedStrategies_test.go @@ -3,19 +3,19 @@ package indexer import ( "context" "fmt" - "github.com/Layr-Labs/go-sidecar/internal/clients/ethereum" - "github.com/Layr-Labs/go-sidecar/internal/clients/etherscan" "github.com/Layr-Labs/go-sidecar/internal/config" - "github.com/Layr-Labs/go-sidecar/internal/contractCaller" - "github.com/Layr-Labs/go-sidecar/internal/contractManager" - "github.com/Layr-Labs/go-sidecar/internal/contractStore/postgresContractStore" - "github.com/Layr-Labs/go-sidecar/internal/fetcher" "github.com/Layr-Labs/go-sidecar/internal/logger" "github.com/Layr-Labs/go-sidecar/internal/metrics" - "github.com/Layr-Labs/go-sidecar/internal/postgres" - "github.com/Layr-Labs/go-sidecar/internal/storage" - pgStorage "github.com/Layr-Labs/go-sidecar/internal/storage/postgres" "github.com/Layr-Labs/go-sidecar/internal/tests" + "github.com/Layr-Labs/go-sidecar/pkg/clients/ethereum" + "github.com/Layr-Labs/go-sidecar/pkg/clients/etherscan" + "github.com/Layr-Labs/go-sidecar/pkg/contractCaller" + "github.com/Layr-Labs/go-sidecar/pkg/contractManager" + "github.com/Layr-Labs/go-sidecar/pkg/contractStore/postgresContractStore" + "github.com/Layr-Labs/go-sidecar/pkg/fetcher" + "github.com/Layr-Labs/go-sidecar/pkg/postgres" + "github.com/Layr-Labs/go-sidecar/pkg/storage" + pgStorage "github.com/Layr-Labs/go-sidecar/pkg/storage/postgres" "github.com/stretchr/testify/assert" "go.uber.org/zap" "gorm.io/gorm" diff --git a/internal/indexer/transactionLogs.go b/pkg/indexer/transactionLogs.go similarity index 98% rename from internal/indexer/transactionLogs.go rename to pkg/indexer/transactionLogs.go index f37a9b56..90d0c723 100644 --- a/internal/indexer/transactionLogs.go +++ b/pkg/indexer/transactionLogs.go @@ -6,11 +6,11 @@ import ( "encoding/json" "errors" "fmt" + "github.com/Layr-Labs/go-sidecar/pkg/clients/ethereum" + "github.com/Layr-Labs/go-sidecar/pkg/parser" + "github.com/Layr-Labs/go-sidecar/pkg/utils" "regexp" - "github.com/Layr-Labs/go-sidecar/internal/clients/ethereum" - "github.com/Layr-Labs/go-sidecar/internal/parser" - "github.com/Layr-Labs/go-sidecar/internal/utils" "github.com/ethereum/go-ethereum/accounts/abi" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common/hexutil" diff --git a/internal/parser/parser.go b/pkg/parser/parser.go similarity index 86% rename from internal/parser/parser.go rename to pkg/parser/parser.go index 675ed8bc..9a60e390 100644 --- a/internal/parser/parser.go +++ b/pkg/parser/parser.go @@ -1,6 +1,8 @@ package parser -import "github.com/Layr-Labs/go-sidecar/internal/clients/ethereum" +import ( + "github.com/Layr-Labs/go-sidecar/pkg/clients/ethereum" +) type ParsedTransaction struct { MethodName string diff --git a/internal/pipeline/blocks.go b/pkg/pipeline/blocks.go similarity index 100% rename from internal/pipeline/blocks.go rename to pkg/pipeline/blocks.go diff --git a/internal/pipeline/pipeline.go b/pkg/pipeline/pipeline.go similarity index 96% rename from internal/pipeline/pipeline.go rename to pkg/pipeline/pipeline.go index 963f45c8..40563514 100644 --- a/internal/pipeline/pipeline.go +++ b/pkg/pipeline/pipeline.go @@ -2,11 +2,11 @@ package pipeline import ( "context" + "github.com/Layr-Labs/go-sidecar/pkg/fetcher" + "github.com/Layr-Labs/go-sidecar/pkg/indexer" + "github.com/Layr-Labs/go-sidecar/pkg/storage" - "github.com/Layr-Labs/go-sidecar/internal/eigenState/stateManager" - "github.com/Layr-Labs/go-sidecar/internal/fetcher" - "github.com/Layr-Labs/go-sidecar/internal/indexer" - "github.com/Layr-Labs/go-sidecar/internal/storage" + "github.com/Layr-Labs/go-sidecar/pkg/eigenState/stateManager" "go.uber.org/zap" ) diff --git a/internal/pipeline/pipeline_integration_test.go b/pkg/pipeline/pipeline_integration_test.go similarity index 78% rename from internal/pipeline/pipeline_integration_test.go rename to pkg/pipeline/pipeline_integration_test.go index ec79b012..5b2a4e70 100644 --- a/internal/pipeline/pipeline_integration_test.go +++ b/pkg/pipeline/pipeline_integration_test.go @@ -4,30 +4,30 @@ import ( "context" "database/sql" "fmt" - "github.com/Layr-Labs/go-sidecar/internal/contractStore/postgresContractStore" - "github.com/Layr-Labs/go-sidecar/internal/postgres" - postgres2 "github.com/Layr-Labs/go-sidecar/internal/storage/postgres" + "github.com/Layr-Labs/go-sidecar/pkg/clients/ethereum" + "github.com/Layr-Labs/go-sidecar/pkg/clients/etherscan" + "github.com/Layr-Labs/go-sidecar/pkg/contractCaller" + "github.com/Layr-Labs/go-sidecar/pkg/contractManager" + "github.com/Layr-Labs/go-sidecar/pkg/contractStore/postgresContractStore" + "github.com/Layr-Labs/go-sidecar/pkg/fetcher" + "github.com/Layr-Labs/go-sidecar/pkg/indexer" + "github.com/Layr-Labs/go-sidecar/pkg/postgres" + "github.com/Layr-Labs/go-sidecar/pkg/storage" + postgres2 "github.com/Layr-Labs/go-sidecar/pkg/storage/postgres" "log" "testing" - "github.com/Layr-Labs/go-sidecar/internal/clients/ethereum" - "github.com/Layr-Labs/go-sidecar/internal/clients/etherscan" "github.com/Layr-Labs/go-sidecar/internal/config" - "github.com/Layr-Labs/go-sidecar/internal/contractCaller" - "github.com/Layr-Labs/go-sidecar/internal/contractManager" - "github.com/Layr-Labs/go-sidecar/internal/eigenState/avsOperators" - "github.com/Layr-Labs/go-sidecar/internal/eigenState/operatorShares" - "github.com/Layr-Labs/go-sidecar/internal/eigenState/rewardSubmissions" - "github.com/Layr-Labs/go-sidecar/internal/eigenState/stakerDelegations" - "github.com/Layr-Labs/go-sidecar/internal/eigenState/stakerShares" - "github.com/Layr-Labs/go-sidecar/internal/eigenState/stateManager" - "github.com/Layr-Labs/go-sidecar/internal/eigenState/submittedDistributionRoots" - "github.com/Layr-Labs/go-sidecar/internal/fetcher" - "github.com/Layr-Labs/go-sidecar/internal/indexer" "github.com/Layr-Labs/go-sidecar/internal/logger" "github.com/Layr-Labs/go-sidecar/internal/metrics" - "github.com/Layr-Labs/go-sidecar/internal/storage" "github.com/Layr-Labs/go-sidecar/internal/tests" + "github.com/Layr-Labs/go-sidecar/pkg/eigenState/avsOperators" + "github.com/Layr-Labs/go-sidecar/pkg/eigenState/operatorShares" + "github.com/Layr-Labs/go-sidecar/pkg/eigenState/rewardSubmissions" + "github.com/Layr-Labs/go-sidecar/pkg/eigenState/stakerDelegations" + "github.com/Layr-Labs/go-sidecar/pkg/eigenState/stakerShares" + "github.com/Layr-Labs/go-sidecar/pkg/eigenState/stateManager" + "github.com/Layr-Labs/go-sidecar/pkg/eigenState/submittedDistributionRoots" "github.com/stretchr/testify/assert" "go.uber.org/zap" "gorm.io/gorm" diff --git a/internal/postgres/migrations/202409061249_bootstrapDb/up.go b/pkg/postgres/migrations/202409061249_bootstrapDb/up.go similarity index 100% rename from internal/postgres/migrations/202409061249_bootstrapDb/up.go rename to pkg/postgres/migrations/202409061249_bootstrapDb/up.go diff --git a/internal/postgres/migrations/202409061250_eigenlayerStateTables/up.go b/pkg/postgres/migrations/202409061250_eigenlayerStateTables/up.go similarity index 100% rename from internal/postgres/migrations/202409061250_eigenlayerStateTables/up.go rename to pkg/postgres/migrations/202409061250_eigenlayerStateTables/up.go diff --git a/internal/postgres/migrations/202409061720_operatorShareChanges/up.go b/pkg/postgres/migrations/202409061720_operatorShareChanges/up.go similarity index 100% rename from internal/postgres/migrations/202409061720_operatorShareChanges/up.go rename to pkg/postgres/migrations/202409061720_operatorShareChanges/up.go diff --git a/internal/postgres/migrations/202409062151_stakerDelegations/up.go b/pkg/postgres/migrations/202409062151_stakerDelegations/up.go similarity index 100% rename from internal/postgres/migrations/202409062151_stakerDelegations/up.go rename to pkg/postgres/migrations/202409062151_stakerDelegations/up.go diff --git a/internal/postgres/migrations/202409080918_staterootTable/up.go b/pkg/postgres/migrations/202409080918_staterootTable/up.go similarity index 100% rename from internal/postgres/migrations/202409080918_staterootTable/up.go rename to pkg/postgres/migrations/202409080918_staterootTable/up.go diff --git a/internal/postgres/migrations/202409082234_stakerShare/up.go b/pkg/postgres/migrations/202409082234_stakerShare/up.go similarity index 100% rename from internal/postgres/migrations/202409082234_stakerShare/up.go rename to pkg/postgres/migrations/202409082234_stakerShare/up.go diff --git a/internal/postgres/migrations/202409101144_submittedDistributionRoot/up.go b/pkg/postgres/migrations/202409101144_submittedDistributionRoot/up.go similarity index 100% rename from internal/postgres/migrations/202409101144_submittedDistributionRoot/up.go rename to pkg/postgres/migrations/202409101144_submittedDistributionRoot/up.go diff --git a/internal/postgres/migrations/202409101540_rewardSubmissions/up.go b/pkg/postgres/migrations/202409101540_rewardSubmissions/up.go similarity index 100% rename from internal/postgres/migrations/202409101540_rewardSubmissions/up.go rename to pkg/postgres/migrations/202409101540_rewardSubmissions/up.go diff --git a/internal/postgres/migrations/202409161057_avsOperatorDeltas/up.go b/pkg/postgres/migrations/202409161057_avsOperatorDeltas/up.go similarity index 100% rename from internal/postgres/migrations/202409161057_avsOperatorDeltas/up.go rename to pkg/postgres/migrations/202409161057_avsOperatorDeltas/up.go diff --git a/internal/postgres/migrations/202409181340_stakerDelegationDelta/up.go b/pkg/postgres/migrations/202409181340_stakerDelegationDelta/up.go similarity index 100% rename from internal/postgres/migrations/202409181340_stakerDelegationDelta/up.go rename to pkg/postgres/migrations/202409181340_stakerDelegationDelta/up.go diff --git a/internal/postgres/migrations/202410241239_combinedRewards/up.go b/pkg/postgres/migrations/202410241239_combinedRewards/up.go similarity index 100% rename from internal/postgres/migrations/202410241239_combinedRewards/up.go rename to pkg/postgres/migrations/202410241239_combinedRewards/up.go diff --git a/internal/postgres/migrations/202410241313_operatorAvsRegistrationSnapshots/up.go b/pkg/postgres/migrations/202410241313_operatorAvsRegistrationSnapshots/up.go similarity index 100% rename from internal/postgres/migrations/202410241313_operatorAvsRegistrationSnapshots/up.go rename to pkg/postgres/migrations/202410241313_operatorAvsRegistrationSnapshots/up.go diff --git a/internal/postgres/migrations/202410241417_operatorAvsStrategySnapshots/up.go b/pkg/postgres/migrations/202410241417_operatorAvsStrategySnapshots/up.go similarity index 100% rename from internal/postgres/migrations/202410241417_operatorAvsStrategySnapshots/up.go rename to pkg/postgres/migrations/202410241417_operatorAvsStrategySnapshots/up.go diff --git a/internal/postgres/migrations/202410241431_operatorShareSnapshots/up.go b/pkg/postgres/migrations/202410241431_operatorShareSnapshots/up.go similarity index 100% rename from internal/postgres/migrations/202410241431_operatorShareSnapshots/up.go rename to pkg/postgres/migrations/202410241431_operatorShareSnapshots/up.go diff --git a/internal/postgres/migrations/202410241450_stakerDelegationSnapshots/up.go b/pkg/postgres/migrations/202410241450_stakerDelegationSnapshots/up.go similarity index 100% rename from internal/postgres/migrations/202410241450_stakerDelegationSnapshots/up.go rename to pkg/postgres/migrations/202410241450_stakerDelegationSnapshots/up.go diff --git a/internal/postgres/migrations/202410241456_stakerShareSnapshots/up.go b/pkg/postgres/migrations/202410241456_stakerShareSnapshots/up.go similarity index 100% rename from internal/postgres/migrations/202410241456_stakerShareSnapshots/up.go rename to pkg/postgres/migrations/202410241456_stakerShareSnapshots/up.go diff --git a/internal/postgres/migrations/202410241539_goldTables/up.go b/pkg/postgres/migrations/202410241539_goldTables/up.go similarity index 98% rename from internal/postgres/migrations/202410241539_goldTables/up.go rename to pkg/postgres/migrations/202410241539_goldTables/up.go index 092f5e94..331f3645 100644 --- a/internal/postgres/migrations/202410241539_goldTables/up.go +++ b/pkg/postgres/migrations/202410241539_goldTables/up.go @@ -3,7 +3,7 @@ package _202410241539_goldTables import ( "database/sql" "github.com/Layr-Labs/go-sidecar/internal/config" - "github.com/Layr-Labs/go-sidecar/internal/storage" + "github.com/Layr-Labs/go-sidecar/pkg/storage" "gorm.io/gorm" ) diff --git a/internal/postgres/migrations/migrator.go b/pkg/postgres/migrations/migrator.go similarity index 72% rename from internal/postgres/migrations/migrator.go rename to pkg/postgres/migrations/migrator.go index bbf95836..8601d18f 100644 --- a/internal/postgres/migrations/migrator.go +++ b/pkg/postgres/migrations/migrator.go @@ -3,23 +3,23 @@ package migrations import ( "database/sql" "fmt" - _202409061249_bootstrapDb "github.com/Layr-Labs/go-sidecar/internal/postgres/migrations/202409061249_bootstrapDb" - _202409061250_eigenlayerStateTables "github.com/Layr-Labs/go-sidecar/internal/postgres/migrations/202409061250_eigenlayerStateTables" - _202409061720_operatorShareChanges "github.com/Layr-Labs/go-sidecar/internal/postgres/migrations/202409061720_operatorShareChanges" - _202409062151_stakerDelegations "github.com/Layr-Labs/go-sidecar/internal/postgres/migrations/202409062151_stakerDelegations" - _202409080918_staterootTable "github.com/Layr-Labs/go-sidecar/internal/postgres/migrations/202409080918_staterootTable" - _202409082234_stakerShare "github.com/Layr-Labs/go-sidecar/internal/postgres/migrations/202409082234_stakerShare" - _202409101144_submittedDistributionRoot "github.com/Layr-Labs/go-sidecar/internal/postgres/migrations/202409101144_submittedDistributionRoot" - _202409101540_rewardSubmissions "github.com/Layr-Labs/go-sidecar/internal/postgres/migrations/202409101540_rewardSubmissions" - _202409161057_avsOperatorDeltas "github.com/Layr-Labs/go-sidecar/internal/postgres/migrations/202409161057_avsOperatorDeltas" - _202409181340_stakerDelegationDelta "github.com/Layr-Labs/go-sidecar/internal/postgres/migrations/202409181340_stakerDelegationDelta" - _202410241239_combinedRewards "github.com/Layr-Labs/go-sidecar/internal/postgres/migrations/202410241239_combinedRewards" - _202410241313_operatorAvsRegistrationSnapshots "github.com/Layr-Labs/go-sidecar/internal/postgres/migrations/202410241313_operatorAvsRegistrationSnapshots" - _202410241417_operatorAvsStrategySnapshots "github.com/Layr-Labs/go-sidecar/internal/postgres/migrations/202410241417_operatorAvsStrategySnapshots" - _202410241431_operatorShareSnapshots "github.com/Layr-Labs/go-sidecar/internal/postgres/migrations/202410241431_operatorShareSnapshots" - _202410241450_stakerDelegationSnapshots "github.com/Layr-Labs/go-sidecar/internal/postgres/migrations/202410241450_stakerDelegationSnapshots" - _202410241456_stakerShareSnapshots "github.com/Layr-Labs/go-sidecar/internal/postgres/migrations/202410241456_stakerShareSnapshots" - _202410241539_goldTables "github.com/Layr-Labs/go-sidecar/internal/postgres/migrations/202410241539_goldTables" + _202409061249_bootstrapDb "github.com/Layr-Labs/go-sidecar/pkg/postgres/migrations/202409061249_bootstrapDb" + _202409061250_eigenlayerStateTables "github.com/Layr-Labs/go-sidecar/pkg/postgres/migrations/202409061250_eigenlayerStateTables" + _202409061720_operatorShareChanges "github.com/Layr-Labs/go-sidecar/pkg/postgres/migrations/202409061720_operatorShareChanges" + _202409062151_stakerDelegations "github.com/Layr-Labs/go-sidecar/pkg/postgres/migrations/202409062151_stakerDelegations" + _202409080918_staterootTable "github.com/Layr-Labs/go-sidecar/pkg/postgres/migrations/202409080918_staterootTable" + _202409082234_stakerShare "github.com/Layr-Labs/go-sidecar/pkg/postgres/migrations/202409082234_stakerShare" + _202409101144_submittedDistributionRoot "github.com/Layr-Labs/go-sidecar/pkg/postgres/migrations/202409101144_submittedDistributionRoot" + _202409101540_rewardSubmissions "github.com/Layr-Labs/go-sidecar/pkg/postgres/migrations/202409101540_rewardSubmissions" + _202409161057_avsOperatorDeltas "github.com/Layr-Labs/go-sidecar/pkg/postgres/migrations/202409161057_avsOperatorDeltas" + _202409181340_stakerDelegationDelta "github.com/Layr-Labs/go-sidecar/pkg/postgres/migrations/202409181340_stakerDelegationDelta" + _202410241239_combinedRewards "github.com/Layr-Labs/go-sidecar/pkg/postgres/migrations/202410241239_combinedRewards" + _202410241313_operatorAvsRegistrationSnapshots "github.com/Layr-Labs/go-sidecar/pkg/postgres/migrations/202410241313_operatorAvsRegistrationSnapshots" + _202410241417_operatorAvsStrategySnapshots "github.com/Layr-Labs/go-sidecar/pkg/postgres/migrations/202410241417_operatorAvsStrategySnapshots" + _202410241431_operatorShareSnapshots "github.com/Layr-Labs/go-sidecar/pkg/postgres/migrations/202410241431_operatorShareSnapshots" + _202410241450_stakerDelegationSnapshots "github.com/Layr-Labs/go-sidecar/pkg/postgres/migrations/202410241450_stakerDelegationSnapshots" + _202410241456_stakerShareSnapshots "github.com/Layr-Labs/go-sidecar/pkg/postgres/migrations/202410241456_stakerShareSnapshots" + _202410241539_goldTables "github.com/Layr-Labs/go-sidecar/pkg/postgres/migrations/202410241539_goldTables" "go.uber.org/zap" "gorm.io/gorm" "time" diff --git a/internal/postgres/postgres.go b/pkg/postgres/postgres.go similarity index 98% rename from internal/postgres/postgres.go rename to pkg/postgres/postgres.go index e9e7f998..6c537cf1 100644 --- a/internal/postgres/postgres.go +++ b/pkg/postgres/postgres.go @@ -4,8 +4,8 @@ import ( "database/sql" "fmt" "github.com/Layr-Labs/go-sidecar/internal/config" - "github.com/Layr-Labs/go-sidecar/internal/postgres/migrations" "github.com/Layr-Labs/go-sidecar/internal/tests" + "github.com/Layr-Labs/go-sidecar/pkg/postgres/migrations" _ "github.com/lib/pq" "go.uber.org/zap" "golang.org/x/xerrors" diff --git a/internal/postgres/postgres_test.go b/pkg/postgres/postgres_test.go similarity index 94% rename from internal/postgres/postgres_test.go rename to pkg/postgres/postgres_test.go index b89cecff..fa592233 100644 --- a/internal/postgres/postgres_test.go +++ b/pkg/postgres/postgres_test.go @@ -3,8 +3,8 @@ package postgres import ( "github.com/Layr-Labs/go-sidecar/internal/config" logger2 "github.com/Layr-Labs/go-sidecar/internal/logger" - "github.com/Layr-Labs/go-sidecar/internal/postgres/migrations" "github.com/Layr-Labs/go-sidecar/internal/tests" + "github.com/Layr-Labs/go-sidecar/pkg/postgres/migrations" "testing" ) diff --git a/pkg/rewards/combinedRewards_test.go b/pkg/rewards/combinedRewards_test.go index 492850b7..b338594d 100644 --- a/pkg/rewards/combinedRewards_test.go +++ b/pkg/rewards/combinedRewards_test.go @@ -3,8 +3,8 @@ package rewards import ( "github.com/Layr-Labs/go-sidecar/internal/config" "github.com/Layr-Labs/go-sidecar/internal/logger" - "github.com/Layr-Labs/go-sidecar/internal/postgres" "github.com/Layr-Labs/go-sidecar/internal/tests" + "github.com/Layr-Labs/go-sidecar/pkg/postgres" "github.com/stretchr/testify/assert" "go.uber.org/zap" "gorm.io/gorm" diff --git a/pkg/rewards/operatorAvsRegistrationSnaphots_test.go b/pkg/rewards/operatorAvsRegistrationSnaphots_test.go index cf93d565..7e14adfd 100644 --- a/pkg/rewards/operatorAvsRegistrationSnaphots_test.go +++ b/pkg/rewards/operatorAvsRegistrationSnaphots_test.go @@ -4,8 +4,8 @@ import ( "fmt" "github.com/Layr-Labs/go-sidecar/internal/config" "github.com/Layr-Labs/go-sidecar/internal/logger" - "github.com/Layr-Labs/go-sidecar/internal/postgres" "github.com/Layr-Labs/go-sidecar/internal/tests" + "github.com/Layr-Labs/go-sidecar/pkg/postgres" "github.com/stretchr/testify/assert" "go.uber.org/zap" "gorm.io/gorm" diff --git a/pkg/rewards/operatorAvsStrategySnapshots_test.go b/pkg/rewards/operatorAvsStrategySnapshots_test.go index 2fbe8aec..926e51b5 100644 --- a/pkg/rewards/operatorAvsStrategySnapshots_test.go +++ b/pkg/rewards/operatorAvsStrategySnapshots_test.go @@ -4,8 +4,8 @@ import ( "fmt" "github.com/Layr-Labs/go-sidecar/internal/config" "github.com/Layr-Labs/go-sidecar/internal/logger" - "github.com/Layr-Labs/go-sidecar/internal/postgres" "github.com/Layr-Labs/go-sidecar/internal/tests" + "github.com/Layr-Labs/go-sidecar/pkg/postgres" "github.com/stretchr/testify/assert" "go.uber.org/zap" "gorm.io/gorm" diff --git a/pkg/rewards/operatorShareSnapshots_test.go b/pkg/rewards/operatorShareSnapshots_test.go index e7e8b89d..9b155737 100644 --- a/pkg/rewards/operatorShareSnapshots_test.go +++ b/pkg/rewards/operatorShareSnapshots_test.go @@ -4,8 +4,8 @@ import ( "fmt" "github.com/Layr-Labs/go-sidecar/internal/config" "github.com/Layr-Labs/go-sidecar/internal/logger" - "github.com/Layr-Labs/go-sidecar/internal/postgres" "github.com/Layr-Labs/go-sidecar/internal/tests" + "github.com/Layr-Labs/go-sidecar/pkg/postgres" "github.com/stretchr/testify/assert" "go.uber.org/zap" "gorm.io/gorm" diff --git a/pkg/rewards/rewards.go b/pkg/rewards/rewards.go index 704937f9..c8b2bd08 100644 --- a/pkg/rewards/rewards.go +++ b/pkg/rewards/rewards.go @@ -3,13 +3,13 @@ package rewards import ( "bytes" "fmt" - "github.com/Layr-Labs/go-sidecar/internal/postgres" - "github.com/Layr-Labs/go-sidecar/internal/utils" + "github.com/Layr-Labs/go-sidecar/pkg/postgres" + "github.com/Layr-Labs/go-sidecar/pkg/utils" "text/template" "time" "github.com/Layr-Labs/go-sidecar/internal/config" - "github.com/Layr-Labs/go-sidecar/internal/eigenState/submittedDistributionRoots" + "github.com/Layr-Labs/go-sidecar/pkg/eigenState/submittedDistributionRoots" "go.uber.org/zap" "gorm.io/gorm" ) diff --git a/pkg/rewards/rewards_test.go b/pkg/rewards/rewards_test.go index ecf9c563..18770e27 100644 --- a/pkg/rewards/rewards_test.go +++ b/pkg/rewards/rewards_test.go @@ -4,8 +4,8 @@ import ( "fmt" "github.com/Layr-Labs/go-sidecar/internal/config" "github.com/Layr-Labs/go-sidecar/internal/logger" - "github.com/Layr-Labs/go-sidecar/internal/postgres" "github.com/Layr-Labs/go-sidecar/internal/tests" + "github.com/Layr-Labs/go-sidecar/pkg/postgres" "github.com/stretchr/testify/assert" "go.uber.org/zap" "gorm.io/gorm" diff --git a/pkg/rewards/stakerDelegationSnapshots_test.go b/pkg/rewards/stakerDelegationSnapshots_test.go index d2cae704..a9723447 100644 --- a/pkg/rewards/stakerDelegationSnapshots_test.go +++ b/pkg/rewards/stakerDelegationSnapshots_test.go @@ -4,8 +4,8 @@ import ( "fmt" "github.com/Layr-Labs/go-sidecar/internal/config" "github.com/Layr-Labs/go-sidecar/internal/logger" - "github.com/Layr-Labs/go-sidecar/internal/postgres" "github.com/Layr-Labs/go-sidecar/internal/tests" + "github.com/Layr-Labs/go-sidecar/pkg/postgres" "github.com/stretchr/testify/assert" "go.uber.org/zap" "gorm.io/gorm" diff --git a/pkg/rewards/stakerShareSnapshots_test.go b/pkg/rewards/stakerShareSnapshots_test.go index fcca19f0..e84b8ca2 100644 --- a/pkg/rewards/stakerShareSnapshots_test.go +++ b/pkg/rewards/stakerShareSnapshots_test.go @@ -4,8 +4,8 @@ import ( "fmt" "github.com/Layr-Labs/go-sidecar/internal/config" "github.com/Layr-Labs/go-sidecar/internal/logger" - "github.com/Layr-Labs/go-sidecar/internal/postgres" "github.com/Layr-Labs/go-sidecar/internal/tests" + "github.com/Layr-Labs/go-sidecar/pkg/postgres" "github.com/stretchr/testify/assert" "go.uber.org/zap" "gorm.io/gorm" diff --git a/internal/rpcServer/handlers.go b/pkg/rpcServer/handlers.go similarity index 100% rename from internal/rpcServer/handlers.go rename to pkg/rpcServer/handlers.go diff --git a/internal/rpcServer/server.go b/pkg/rpcServer/server.go similarity index 88% rename from internal/rpcServer/server.go rename to pkg/rpcServer/server.go index c811275b..c4df7dc0 100644 --- a/internal/rpcServer/server.go +++ b/pkg/rpcServer/server.go @@ -2,9 +2,9 @@ package rpcServer import ( "context" + "github.com/Layr-Labs/go-sidecar/pkg/storage" - "github.com/Layr-Labs/go-sidecar/internal/eigenState/stateManager" - "github.com/Layr-Labs/go-sidecar/internal/storage" + "github.com/Layr-Labs/go-sidecar/pkg/eigenState/stateManager" v1 "github.com/Layr-Labs/sidecar-apis/protos/eigenlayer/sidecar/v1" "github.com/grpc-ecosystem/grpc-gateway/v2/runtime" "go.uber.org/zap" diff --git a/internal/shutdown/shutdown.go b/pkg/shutdown/shutdown.go similarity index 100% rename from internal/shutdown/shutdown.go rename to pkg/shutdown/shutdown.go diff --git a/internal/sidecar/blockIndexer.go b/pkg/sidecar/blockIndexer.go similarity index 100% rename from internal/sidecar/blockIndexer.go rename to pkg/sidecar/blockIndexer.go diff --git a/internal/sidecar/sidecar.go b/pkg/sidecar/sidecar.go similarity index 94% rename from internal/sidecar/sidecar.go rename to pkg/sidecar/sidecar.go index cd659a5a..3bb3690a 100644 --- a/internal/sidecar/sidecar.go +++ b/pkg/sidecar/sidecar.go @@ -4,17 +4,17 @@ import ( "context" "errors" "fmt" + "github.com/Layr-Labs/go-sidecar/pkg/clients/ethereum" + "github.com/Layr-Labs/go-sidecar/pkg/pipeline" + "github.com/Layr-Labs/go-sidecar/pkg/rpcServer" + "github.com/Layr-Labs/go-sidecar/pkg/storage" "net" "net/http" "regexp" "time" - "github.com/Layr-Labs/go-sidecar/internal/clients/ethereum" "github.com/Layr-Labs/go-sidecar/internal/config" - "github.com/Layr-Labs/go-sidecar/internal/eigenState/stateManager" - "github.com/Layr-Labs/go-sidecar/internal/pipeline" - "github.com/Layr-Labs/go-sidecar/internal/rpcServer" - "github.com/Layr-Labs/go-sidecar/internal/storage" + "github.com/Layr-Labs/go-sidecar/pkg/eigenState/stateManager" grpc_zap "github.com/grpc-ecosystem/go-grpc-middleware/logging/zap" grpc_ctxtags "github.com/grpc-ecosystem/go-grpc-middleware/tags" "github.com/grpc-ecosystem/grpc-gateway/v2/runtime" diff --git a/internal/storage/postgres/storage.go b/pkg/storage/postgres/storage.go similarity index 98% rename from internal/storage/postgres/storage.go rename to pkg/storage/postgres/storage.go index 82dc0b18..4357682a 100644 --- a/internal/storage/postgres/storage.go +++ b/pkg/storage/postgres/storage.go @@ -5,12 +5,12 @@ import ( "encoding/json" "errors" "fmt" + "github.com/Layr-Labs/go-sidecar/pkg/parser" + "github.com/Layr-Labs/go-sidecar/pkg/storage" "strings" "time" "github.com/Layr-Labs/go-sidecar/internal/config" - "github.com/Layr-Labs/go-sidecar/internal/parser" - "github.com/Layr-Labs/go-sidecar/internal/storage" "go.uber.org/zap" "golang.org/x/xerrors" "gorm.io/gorm" diff --git a/internal/storage/postgres/storage_test.go b/pkg/storage/postgres/storage_test.go similarity index 97% rename from internal/storage/postgres/storage_test.go rename to pkg/storage/postgres/storage_test.go index b39832d5..8c400c82 100644 --- a/internal/storage/postgres/storage_test.go +++ b/pkg/storage/postgres/storage_test.go @@ -1,16 +1,16 @@ package postgres import ( - "github.com/Layr-Labs/go-sidecar/internal/postgres" "github.com/Layr-Labs/go-sidecar/internal/tests" + "github.com/Layr-Labs/go-sidecar/pkg/parser" + "github.com/Layr-Labs/go-sidecar/pkg/postgres" + "github.com/Layr-Labs/go-sidecar/pkg/storage" "strings" "testing" "time" "github.com/Layr-Labs/go-sidecar/internal/config" "github.com/Layr-Labs/go-sidecar/internal/logger" - "github.com/Layr-Labs/go-sidecar/internal/parser" - "github.com/Layr-Labs/go-sidecar/internal/storage" "github.com/stretchr/testify/assert" "go.uber.org/zap" "gorm.io/gorm" diff --git a/internal/storage/storage.go b/pkg/storage/storage.go similarity index 98% rename from internal/storage/storage.go rename to pkg/storage/storage.go index bddc17c0..7685129f 100644 --- a/internal/storage/storage.go +++ b/pkg/storage/storage.go @@ -1,9 +1,8 @@ package storage import ( + "github.com/Layr-Labs/go-sidecar/pkg/parser" "time" - - "github.com/Layr-Labs/go-sidecar/internal/parser" ) type BlockStore interface { diff --git a/internal/types/numbers/numbers.go b/pkg/types/numbers/numbers.go similarity index 100% rename from internal/types/numbers/numbers.go rename to pkg/types/numbers/numbers.go diff --git a/internal/types/numbers/numbers_test.go b/pkg/types/numbers/numbers_test.go similarity index 100% rename from internal/types/numbers/numbers_test.go rename to pkg/types/numbers/numbers_test.go diff --git a/internal/utils/utils.go b/pkg/utils/helpers.go similarity index 80% rename from internal/utils/utils.go rename to pkg/utils/helpers.go index 0156a3a2..c875ff3d 100644 --- a/internal/utils/utils.go +++ b/pkg/utils/helpers.go @@ -20,16 +20,6 @@ func ConvertBytesToString(b []byte) string { return "0x" + hex.EncodeToString(b) } -func StripLeading0x(s string) string { - if len(s) < 2 { - return s - } - if s[0:2] == "0x" { - s = s[2:] - } - return s -} - func SnakeCase(s string) string { notSnake := regexp.MustCompile(`[_-]`) return notSnake.ReplaceAllString(s, "_") diff --git a/scripts/generateMigration.sh b/scripts/generateMigration.sh index 3eb1e1b5..5c971a9a 100755 --- a/scripts/generateMigration.sh +++ b/scripts/generateMigration.sh @@ -11,7 +11,7 @@ timestamp=$(date +"%Y%m%d%H%M") migration_name="${timestamp}_${name}" -migrations_dir="./internal/postgres/migrations/${migration_name}" +migrations_dir="./pkg/postgres/migrations/${migration_name}" migration_file="${migrations_dir}/up.go" mkdir -p $migrations_dir || true