Skip to content

Commit

Permalink
Merge branch 'main' into test
Browse files Browse the repository at this point in the history
  • Loading branch information
D4mph1r authored Dec 16, 2024
2 parents c56ca0c + a68bad0 commit 1c25f82
Show file tree
Hide file tree
Showing 7 changed files with 62 additions and 10 deletions.
4 changes: 3 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,6 @@ HEDERA_RPC=
TON_RPC=
TEZOS_RPC=
FANTOM_RPC=
AVALANCHE_RPC=
AVALANCHE_RPC=
MOONBEAM_RPC=
ETH_RPC=
48 changes: 48 additions & 0 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,54 @@ export const prodBridgeConfig: IBridgeConfig = {
decimals: 18,
blockChunks: 1000,
},
{
chain: "MOONBEAM",
rpcURL: process.env.MOONBEAM_RPC || "https://1rpc.io/glmr",
nativeCoinSymbol: "GLMR",
intialFund: "6000000000000000000",
contractAddress: "0x2Aa8Dbb7543754d70B5A40D52cB81c2a0bB08B83",
chainType: "evm",
lastBlock: 8335997,
decimals: 18,
blockChunks: 1000,
},
{
chain: "ETHEREUM",
rpcURL: process.env.ETH_RPC || "https://eth.llamarpc.com",
nativeCoinSymbol: "ETH",
intialFund: "3000000000000000",
contractAddress: "0x4B2A837613bA45C734439155CC7030c79095a2ed",
chainType: "evm",
lastBlock: 21257516,
decimals: 18,
blockChunks: 1000,
},
// {
// chainType: "casper",
// chain: "CASPER",
// network: "casper",
// contractAddress:
// "284d7eeee5d0ece8b0d56cc7162a3cf72e6fabc62946e3a9abae219c646d56c3",
// decimals: 9,
// intialFund: "100000000000",
// lastBlock: 3983916,
// nativeCoinSymbol: "CSPR",
// rpcURL: "https://rpc.mainnet.casperlabs.io/rpc",
// },
{
chain: "NEAR",
chainType: "near",
contractAddress: "xp-bridge-main.near",
decimals: 24,
intialFund: "100000000000000000000000",
lastBlock: 0,
nativeCoinSymbol: "NEAR",
nearBlocksUrl: "https://api.nearblocks.io/v1/",
networkId: "mainnet",
rpcURL: "https://rpc.mainnet.near.org",
theGraphApiUrl:
"https://api.studio.thegraph.com/query/97240/d-live/version/latest",
},
],
storageConfig: {
chain: "OP",
Expand Down
6 changes: 3 additions & 3 deletions src/deps/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import type { LogInstance, THandler } from "../handler/types";
import MikroOrmConfig from "../mikro-orm.config";
import type { IBridgeConfig, IGeneratedWallets } from "../types";
import { initializeEvmProviderAndWallet } from "./init-evm-provider-wallet";
import { runMigrationsIfAny } from "./run-migrations-if-any";
// import { runMigrationsIfAny } from "./run-migrations-if-any";

export async function configDeps(
config: IBridgeConfig,
Expand Down Expand Up @@ -66,8 +66,8 @@ export async function configDeps(
new NonceManager(stakingSigner),
);
const orm = await MikroORM.init(MikroOrmConfig);
await orm.schema.updateSchema();
await runMigrationsIfAny(orm.getMigrator(), logger);
// await orm.schema.updateSchema();
// await runMigrationsIfAny(orm.getMigrator(), logger);
const em = orm.em;
const serverLinkHandler = process.env.SERVER_LINK
? axios.create({
Expand Down
2 changes: 2 additions & 0 deletions src/environment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ export const Env = z.object({
TEZOS_RPC: z.string().optional(),
FANTOM_RPC: z.string().optional(),
AVALANCHE_RPC: z.string().optional(),
MOONBEAM_RPC: z.string().optional(),
ETH_RPC: z.string().optional(),
});
export type Env = z.infer<typeof Env>;

Expand Down
9 changes: 4 additions & 5 deletions src/handler/chains/secrets/utils/listenForLockEvents.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ import { Block } from "../../../../persistence/entities/block";
import type { EventBuilder } from "../../../event-builder";
import { tryRerunningFailed } from "../../../poller/utils";
import type { LockEventIter, LogInstance } from "../../../types";
import { useMutexAndRelease } from "../../../utils";
import { convertStringToHexToNumb } from "../../../utils/token-id-conversion";
import { convertStringToHexToNumb, useMutexAndRelease } from "../../../utils";
import type { SecretProviderFetch } from "../types";

const CHAIN_IDENT = "SECRET";
Expand Down Expand Up @@ -45,12 +44,12 @@ export default async function listenForLockEvents(
async (c) => await c.query.txsQuery(query),
);
const startBlock = lastBlock;
lastBlock = latestBlockNumber;
lastBlock = latestBlockNumber + 1;
if (!logs.length) {
logger.info(
`${startBlock} -> ${latestBlockNumber}: 0 TXs. Awaiting 10s`,
);
lastBlock = latestBlockNumber;
lastBlock = latestBlockNumber + 1;
await em.upsert(Block, {
chain: CHAIN_IDENT,
contractAddress: bridge,
Expand Down Expand Up @@ -98,7 +97,7 @@ export default async function listenForLockEvents(
),
);
}
lastBlock = latestBlockNumber;
lastBlock = latestBlockNumber + 1;
await em.upsert(Block, {
chain: CHAIN_IDENT,
contractAddress: bridge,
Expand Down
2 changes: 1 addition & 1 deletion src/handler/chains/secrets/utils/signClaimData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { sha256 } from "@noble/hashes/sha256";
import * as secp256k1 from "@noble/secp256k1";

import type { TNftTransferDetailsObject } from "../../../types";
import { convertNumbToHexToString } from "../../../utils/token-id-conversion";
import { convertNumbToHexToString } from "../../../utils";

export default async function signClaimData(
data: TNftTransferDetailsObject,
Expand Down
1 change: 1 addition & 0 deletions src/handler/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ export * from "./retry";
export * from "./check-or-add-self-as-validator";
export * from "./useMutex";
export * from "./wait";
export * from "./token-id-conversion";

0 comments on commit 1c25f82

Please sign in to comment.