Skip to content

Commit

Permalink
add denom to evm db
Browse files Browse the repository at this point in the history
  • Loading branch information
perfogic committed May 8, 2024
1 parent f1833f4 commit c513a06
Show file tree
Hide file tree
Showing 8 changed files with 64 additions and 11 deletions.
2 changes: 1 addition & 1 deletion packages/ibc-routing/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@

export const config = {
ORAIBRIDGE_RPC_URL: "https://bridge-v2.rpc.orai.io",
ORAICHAIN_RPC_URL: "https://rpc.orai.io"
ORAICHAIN_RPC_URL: "https://rpc.orai.io/"
};
2 changes: 1 addition & 1 deletion packages/ibc-routing/src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ export const ChainIdToEvmChainPrefix = {
export const FinalTag = "Final";

// Total time to wait for one state to be transition to another state
export const TimeOut = process.env.NODE_ENV == "development" ? 3000 : 20000;
export const TimeOut = process.env.NODE_ENV == "development" ? 1000 : 20000;

export const IbcWasmContract = "orai195269awwnt5m6c843q6w7hp8rt0k7syfu9de4h0wz384slshuzps8y7ccm";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export const handleSendToCosmosEvm = async (ctx: ContextIntepreter, event: AnyEv
const eventData = event.payload;
const { transactionHash: txHash, blockNumber: height } = eventData[5];
const routeData: OraiBridgeRouteData = unmarshalOraiBridgeRoute(eventData[2]);
const denom = eventData[2];
const denom = eventData[0];
const evmChainPrefix = eventData[6];
const sendToCosmosData = {
txHash,
Expand Down Expand Up @@ -509,6 +509,7 @@ export const handleStoreOnBatchSendToEthClaim = async (
fromAmount: oraiBridgeData[0].amount,
oraiBridgeChannelId: "",
oraiReceiver: "",
denom: decodeDenomToTokenAddress(oraiBridgeData[0].denom),
destinationDenom: decodeDenomToTokenAddress(oraiBridgeData[0].denom),
destinationChannelId: "",
destinationReceiver: `0x${oraiBridgeData[0].memo.split("0x")[1]}`,
Expand Down
2 changes: 1 addition & 1 deletion packages/ibc-routing/test/data/backup.json

Large diffs are not rendered by default.

33 changes: 33 additions & 0 deletions packages/ibc-routing/test/integration-batch-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ describe("test-batch-integration", () => {
fromAmount: "3484735000000000000",
oraiBridgeChannelId: "channel-1",
oraiReceiver: "orai1ehmhqcn8erf3dgavrca69zgp4rtxj5kqgtcnyd",
denom: "0x55d398326f99059fF775485246999027B3197955",
destinationDenom: "",
destinationChannelId: "",
destinationReceiver: "orai1ehmhqcn8erf3dgavrca69zgp4rtxj5kqgtcnyd",
Expand All @@ -217,6 +218,7 @@ describe("test-batch-integration", () => {
fromAmount: "2154324000000000000",
oraiBridgeChannelId: "channel-1",
oraiReceiver: "orai1rqhjqpaqrv26wuq627gav3ka4994u39e84lncy",
denom: "0x55d398326f99059fF775485246999027B3197955",
destinationDenom: "",
destinationChannelId: "",
destinationReceiver: "orai1rqhjqpaqrv26wuq627gav3ka4994u39e84lncy",
Expand Down Expand Up @@ -453,6 +455,7 @@ describe("test-batch-integration", () => {
oraiBridgeChannelId: "channel-1",
oraiReceiver: "orai1rchnkdpsxzhquu63y6r4j4t57pnc9w8ehdhedx",
destinationDenom: "uatom",
denom: "0x55d398326f99059fF775485246999027B3197955",
destinationChannelId: "channel-15",
destinationReceiver: "cosmos1rchnkdpsxzhquu63y6r4j4t57pnc9w8ey7p6v4",
eventNonce: 65539,
Expand All @@ -478,6 +481,7 @@ describe("test-batch-integration", () => {
fromAmount: "3000000000000000000",
oraiBridgeChannelId: "channel-1",
oraiReceiver: "orai1ehmhqcn8erf3dgavrca69zgp4rtxj5kqgtcnyd",
denom: "0x55d398326f99059fF775485246999027B3197955",
destinationDenom: "uatom",
destinationChannelId: "channel-15",
destinationReceiver: "cosmos1ehmhqcn8erf3dgavrca69zgp4rtxj5kqmcws97",
Expand Down Expand Up @@ -788,6 +792,7 @@ describe("test-batch-integration", () => {
fromAmount: "13000000000000000000",
oraiBridgeChannelId: "channel-1",
oraiReceiver: "orai1rchnkdpsxzhquu63y6r4j4t57pnc9w8ehdhedx",
denom: "0x55d398326f99059fF775485246999027B3197955",
destinationDenom: "eth-mainnet0xdAC17F958D2ee523a2206206994597C13D831ec7",
destinationChannelId: "channel-29",
destinationReceiver: "eth-mainnet0xb1ADE84566dB117B4B241fC446ceb1c46616e172",
Expand All @@ -814,6 +819,7 @@ describe("test-batch-integration", () => {
fromAmount: "15000000000000000000",
oraiBridgeChannelId: "channel-1",
oraiReceiver: "orai1ehmhqcn8erf3dgavrca69zgp4rtxj5kqgtcnyd",
denom: "0x55d398326f99059fF775485246999027B3197955",
destinationDenom: "eth-mainnet0xdAC17F958D2ee523a2206206994597C13D831ec7",
destinationChannelId: "channel-29",
destinationReceiver: "eth-mainnet0x0deB52499C2e9F3921c631cb6Ad3522C576d5484",
Expand Down Expand Up @@ -1028,6 +1034,7 @@ describe("test-batch-integration", () => {
fromAmount: "2442556",
oraiBridgeChannelId: "",
oraiReceiver: "",
denom: "0xdAC17F958D2ee523a2206206994597C13D831ec7",
destinationDenom: "0xdAC17F958D2ee523a2206206994597C13D831ec7",
destinationChannelId: "",
destinationReceiver: "0xb1ADE84566dB117B4B241fC446ceb1c46616e172",
Expand All @@ -1054,6 +1061,7 @@ describe("test-batch-integration", () => {
fromAmount: "4438556",
oraiBridgeChannelId: "",
oraiReceiver: "",
denom: "0xdAC17F958D2ee523a2206206994597C13D831ec7",
destinationDenom: "0xdAC17F958D2ee523a2206206994597C13D831ec7",
destinationChannelId: "",
destinationReceiver: "0x0deB52499C2e9F3921c631cb6Ad3522C576d5484",
Expand Down Expand Up @@ -1373,6 +1381,7 @@ describe("test-batch-integration", () => {
fromAmount: "11370620000000000000",
oraiBridgeChannelId: "",
oraiReceiver: "",
denom: "0x55d398326f99059fF775485246999027B3197955",
destinationDenom: "0x55d398326f99059fF775485246999027B3197955",
destinationChannelId: "",
destinationReceiver: "0x0deB52499C2e9F3921c631cb6Ad3522C576d5484",
Expand All @@ -1399,6 +1408,7 @@ describe("test-batch-integration", () => {
fromAmount: "1166126000000000000",
oraiBridgeChannelId: "",
oraiReceiver: "",
denom: "0x55d398326f99059fF775485246999027B3197955",
destinationDenom: "0x55d398326f99059fF775485246999027B3197955",
destinationChannelId: "",
destinationReceiver: "0xb1ADE84566dB117B4B241fC446ceb1c46616e172",
Expand Down Expand Up @@ -1637,6 +1647,7 @@ describe("test-batch-integration", () => {
fromAmount: "570339000000000000",
oraiBridgeChannelId: "",
oraiReceiver: "",
denom: "0x55d398326f99059fF775485246999027B3197955",
destinationDenom: "0x55d398326f99059fF775485246999027B3197955",
destinationChannelId: "",
destinationReceiver: "0x8163B6142d701E671a7c39aD9C14eB2c0A51aa00",
Expand Down Expand Up @@ -1664,6 +1675,7 @@ describe("test-batch-integration", () => {
fromAmount: "124142000000000000",
oraiBridgeChannelId: "",
oraiReceiver: "",
denom: "0x55d398326f99059fF775485246999027B3197955",
destinationDenom: "0x55d398326f99059fF775485246999027B3197955",
destinationChannelId: "",
destinationReceiver: "0x8163B6142d701E671a7c39aD9C14eB2c0A51aa00",
Expand Down Expand Up @@ -1738,6 +1750,7 @@ describe("test-batch-integration-timeout", () => {
fromAmount: "3484735000000000000",
oraiBridgeChannelId: "channel-1",
oraiReceiver: "orai1ehmhqcn8erf3dgavrca69zgp4rtxj5kqgtcnyd",
denom: "0x55d398326f99059fF775485246999027B3197955",
destinationDenom: "",
destinationChannelId: "",
destinationReceiver: "orai1ehmhqcn8erf3dgavrca69zgp4rtxj5kqgtcnyd",
Expand All @@ -1764,6 +1777,7 @@ describe("test-batch-integration-timeout", () => {
fromAmount: "2154324000000000000",
oraiBridgeChannelId: "channel-1",
oraiReceiver: "orai1rqhjqpaqrv26wuq627gav3ka4994u39e84lncy",
denom: "0x55d398326f99059fF775485246999027B3197955",
destinationDenom: "",
destinationChannelId: "",
destinationReceiver: "orai1rqhjqpaqrv26wuq627gav3ka4994u39e84lncy",
Expand Down Expand Up @@ -2054,6 +2068,7 @@ describe("test-batch-integration-timeout", () => {
fromAmount: "124142000000000000",
oraiBridgeChannelId: "",
oraiReceiver: "",
denom: "0x55d398326f99059fF775485246999027B3197955",
destinationDenom: "0x55d398326f99059fF775485246999027B3197955",
destinationChannelId: "",
destinationReceiver: "0x8163B6142d701E671a7c39aD9C14eB2c0A51aa00",
Expand Down Expand Up @@ -2081,6 +2096,8 @@ describe("test-batch-integration-timeout", () => {
fromAmount: "570339000000000000",
oraiBridgeChannelId: "",
oraiReceiver: "",
denom: "0x55d398326f99059fF775485246999027B3197955",

destinationDenom: "0x55d398326f99059fF775485246999027B3197955",
destinationChannelId: "",
destinationReceiver: "0x8163B6142d701E671a7c39aD9C14eB2c0A51aa00",
Expand Down Expand Up @@ -2125,6 +2142,8 @@ describe("test-batch-integration-timeout", () => {
"channel-1/orai1rchnkdpsxzhquu63y6r4j4t57pnc9w8ehdhedx:Ci1jb3Ntb3MxcmNobmtkcHN4emhxdXU2M3k2cjRqNHQ1N3BuYzl3OGV5N3A2djQSCmNoYW5uZWwtMTUaBXVhdG9t",
fromAmount: "3000000000000000000",
oraiBridgeChannelId: "channel-1",
denom: "0x55d398326f99059fF775485246999027B3197955",

oraiReceiver: "orai1rchnkdpsxzhquu63y6r4j4t57pnc9w8ehdhedx",
destinationDenom: "uatom",
destinationChannelId: "channel-15",
Expand All @@ -2151,6 +2170,8 @@ describe("test-batch-integration-timeout", () => {
"channel-1/orai1ehmhqcn8erf3dgavrca69zgp4rtxj5kqgtcnyd:Ci1jb3Ntb3MxZWhtaHFjbjhlcmYzZGdhdnJjYTY5emdwNHJ0eGo1a3FtY3dzOTcSCmNoYW5uZWwtMTUaBXVhdG9t",
fromAmount: "3000000000000000000",
oraiBridgeChannelId: "channel-1",
denom: "0x55d398326f99059fF775485246999027B3197955",

oraiReceiver: "orai1ehmhqcn8erf3dgavrca69zgp4rtxj5kqgtcnyd",
destinationDenom: "uatom",
destinationChannelId: "channel-15",
Expand Down Expand Up @@ -2555,6 +2576,8 @@ describe("test-batch-integration-timeout", () => {
fromAmount: "11370620000000000000",
oraiBridgeChannelId: "",
oraiReceiver: "",
denom: "0x55d398326f99059fF775485246999027B3197955",

destinationDenom: "0x55d398326f99059fF775485246999027B3197955",
destinationChannelId: "",
destinationReceiver: "0x0deB52499C2e9F3921c631cb6Ad3522C576d5484",
Expand All @@ -2581,6 +2604,8 @@ describe("test-batch-integration-timeout", () => {
fromAmount: "1166126000000000000",
oraiBridgeChannelId: "",
oraiReceiver: "",
denom: "0x55d398326f99059fF775485246999027B3197955",

destinationDenom: "0x55d398326f99059fF775485246999027B3197955",
destinationChannelId: "",
destinationReceiver: "0xb1ADE84566dB117B4B241fC446ceb1c46616e172",
Expand Down Expand Up @@ -2627,6 +2652,8 @@ describe("test-batch-integration-timeout", () => {
fromAmount: "13000000000000000000",
oraiBridgeChannelId: "channel-1",
oraiReceiver: "orai1rchnkdpsxzhquu63y6r4j4t57pnc9w8ehdhedx",
denom: "0x55d398326f99059fF775485246999027B3197955",

destinationDenom: "eth-mainnet0xdAC17F958D2ee523a2206206994597C13D831ec7",
destinationChannelId: "channel-29",
destinationReceiver: "eth-mainnet0xb1ADE84566dB117B4B241fC446ceb1c46616e172",
Expand All @@ -2653,6 +2680,8 @@ describe("test-batch-integration-timeout", () => {
fromAmount: "15000000000000000000",
oraiBridgeChannelId: "channel-1",
oraiReceiver: "orai1ehmhqcn8erf3dgavrca69zgp4rtxj5kqgtcnyd",
denom: "0x55d398326f99059fF775485246999027B3197955",

destinationDenom: "eth-mainnet0xdAC17F958D2ee523a2206206994597C13D831ec7",
destinationChannelId: "channel-29",
destinationReceiver: "eth-mainnet0x0deB52499C2e9F3921c631cb6Ad3522C576d5484",
Expand Down Expand Up @@ -2745,6 +2774,7 @@ describe("test-batch-integration-timeout", () => {
localReceiver: "orai1rchnkdpsxzhquu63y6r4j4t57pnc9w8ehdhedx",
nextPacketSequence: 22780,
nextMemo: "eth-mainnet0xb1ADE84566dB117B4B241fC446ceb1c46616e172",

nextAmount: "2442556",
nextReceiver: "oraib1rchnkdpsxzhquu63y6r4j4t57pnc9w8eqvn4u9",
nextDestinationDenom:
Expand Down Expand Up @@ -2866,6 +2896,8 @@ describe("test-batch-integration-timeout", () => {
destination: "",
fromAmount: "2442556",
oraiBridgeChannelId: "",
denom: "0xdAC17F958D2ee523a2206206994597C13D831ec7",

oraiReceiver: "",
destinationDenom: "0xdAC17F958D2ee523a2206206994597C13D831ec7",
destinationChannelId: "",
Expand Down Expand Up @@ -2893,6 +2925,7 @@ describe("test-batch-integration-timeout", () => {
fromAmount: "4438556",
oraiBridgeChannelId: "",
oraiReceiver: "",
denom: "0xdAC17F958D2ee523a2206206994597C13D831ec7",
destinationDenom: "0xdAC17F958D2ee523a2206206994597C13D831ec7",
destinationChannelId: "",
destinationReceiver: "0x0deB52499C2e9F3921c631cb6Ad3522C576d5484",
Expand Down
12 changes: 12 additions & 0 deletions packages/ibc-routing/test/integration-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ describe("test-integration", () => {
destination:
"channel-1/orai1rqhjqpaqrv26wuq627gav3ka4994u39e84lncy:CitvcmFpMXJxaGpxcGFxcnYyNnd1cTYyN2dhdjNrYTQ5OTR1MzllODRsbmN5EgAaK29yYWkxMmh6anhmaDc3d2w1NzJnZHpjdDJmeHYyYXJ4Y3doNmd5a2M3cWg=",
fromAmount: "1783597583898563052",
denom: "0x55d398326f99059fF775485246999027B3197955",
oraiBridgeChannelId: "channel-1",
oraiReceiver: "orai1rqhjqpaqrv26wuq627gav3ka4994u39e84lncy",
destinationDenom: "orai12hzjxfh77wl572gdzct2fxv2arxcwh6gykc7qh",
Expand Down Expand Up @@ -316,6 +317,7 @@ describe("test-integration", () => {
"channel-1/orai1ehmhqcn8erf3dgavrca69zgp4rtxj5kqgtcnyd:Ci1jb3Ntb3MxZWhtaHFjbjhlcmYzZGdhdnJjYTY5emdwNHJ0eGo1a3FtY3dzOTcSCmNoYW5uZWwtMTUaBXVhdG9t",
fromAmount: "3000000000000000000",
oraiBridgeChannelId: "channel-1",
denom: "0x55d398326f99059fF775485246999027B3197955",
oraiReceiver: "orai1ehmhqcn8erf3dgavrca69zgp4rtxj5kqgtcnyd",
destinationDenom: "uatom",
destinationChannelId: "channel-15",
Expand Down Expand Up @@ -486,6 +488,7 @@ describe("test-integration", () => {
destination:
"channel-1/orai1ehmhqcn8erf3dgavrca69zgp4rtxj5kqgtcnyd:CjVldGgtbWFpbm5ldDB4MGRlQjUyNDk5QzJlOUYzOTIxYzYzMWNiNkFkMzUyMkM1NzZkNTQ4NBIKY2hhbm5lbC0yORo1ZXRoLW1haW5uZXQweGRBQzE3Rjk1OEQyZWU1MjNhMjIwNjIwNjk5NDU5N0MxM0Q4MzFlYzc=",
fromAmount: "17000000000000000000",
denom: "0x55d398326f99059fF775485246999027B3197955",
oraiBridgeChannelId: "channel-1",
oraiReceiver: "orai1ehmhqcn8erf3dgavrca69zgp4rtxj5kqgtcnyd",
destinationDenom: "eth-mainnet0xdAC17F958D2ee523a2206206994597C13D831ec7",
Expand Down Expand Up @@ -585,6 +588,7 @@ describe("test-integration", () => {
fromAmount: "1106616",
oraiBridgeChannelId: "",
oraiReceiver: "",
denom: "0xdAC17F958D2ee523a2206206994597C13D831ec7",
destinationDenom: "0xdAC17F958D2ee523a2206206994597C13D831ec7",
destinationChannelId: "",
destinationReceiver: "0x0deB52499C2e9F3921c631cb6Ad3522C576d5484",
Expand Down Expand Up @@ -774,6 +778,7 @@ describe("test-integration", () => {
fromAmount: "1940789000000000000",
oraiBridgeChannelId: "",
oraiReceiver: "",
denom: "0x55d398326f99059fF775485246999027B3197955",
destinationDenom: "0x55d398326f99059fF775485246999027B3197955",
destinationChannelId: "",
destinationReceiver: "0x0deB52499C2e9F3921c631cb6Ad3522C576d5484",
Expand Down Expand Up @@ -921,6 +926,7 @@ describe("test-integration", () => {
fromAmount: "1388829000000000000",
oraiBridgeChannelId: "",
oraiReceiver: "",
denom: "0x55d398326f99059fF775485246999027B3197955",
destinationDenom: "0x55d398326f99059fF775485246999027B3197955",
destinationChannelId: "",
destinationReceiver: "0x0deB52499C2e9F3921c631cb6Ad3522C576d5484",
Expand Down Expand Up @@ -988,6 +994,7 @@ describe("test-integration time-out", () => {
fromAmount: "17000000000000000000",
oraiBridgeChannelId: "channel-1",
oraiReceiver: "orai1ehmhqcn8erf3dgavrca69zgp4rtxj5kqgtcnyd",
denom: "0x55d398326f99059fF775485246999027B3197955",
destinationDenom: "eth-mainnet0xdAC17F958D2ee523a2206206994597C13D831ec7",
destinationChannelId: "channel-29",
destinationReceiver: "eth-mainnet0x0deB52499C2e9F3921c631cb6Ad3522C576d5484",
Expand Down Expand Up @@ -1085,6 +1092,7 @@ describe("test-integration time-out", () => {
fromAmount: "1106616",
oraiBridgeChannelId: "",
oraiReceiver: "",
denom: "0xdAC17F958D2ee523a2206206994597C13D831ec7",
destinationDenom: "0xdAC17F958D2ee523a2206206994597C13D831ec7",
destinationChannelId: "",
destinationReceiver: "0x0deB52499C2e9F3921c631cb6Ad3522C576d5484",
Expand Down Expand Up @@ -1131,6 +1139,7 @@ describe("test-integration time-out", () => {
fromAmount: "1783597583898563052",
oraiBridgeChannelId: "channel-1",
oraiReceiver: "orai1rqhjqpaqrv26wuq627gav3ka4994u39e84lncy",
denom: "0x55d398326f99059fF775485246999027B3197955",
destinationDenom: "orai12hzjxfh77wl572gdzct2fxv2arxcwh6gykc7qh",
destinationChannelId: "",
destinationReceiver: "orai1rqhjqpaqrv26wuq627gav3ka4994u39e84lncy",
Expand Down Expand Up @@ -1236,6 +1245,7 @@ describe("test-integration time-out", () => {
fromAmount: "3000000000000000000",
oraiBridgeChannelId: "channel-1",
oraiReceiver: "orai1ehmhqcn8erf3dgavrca69zgp4rtxj5kqgtcnyd",
denom: "0x55d398326f99059fF775485246999027B3197955",
destinationDenom: "uatom",
destinationChannelId: "channel-15",
destinationReceiver: "cosmos1ehmhqcn8erf3dgavrca69zgp4rtxj5kqmcws97",
Expand Down Expand Up @@ -1447,6 +1457,7 @@ describe("test-integration time-out", () => {
fromAmount: "1940789000000000000",
oraiBridgeChannelId: "",
oraiReceiver: "",
denom: "0x55d398326f99059fF775485246999027B3197955",
destinationDenom: "0x55d398326f99059fF775485246999027B3197955",
destinationChannelId: "",
destinationReceiver: "0x0deB52499C2e9F3921c631cb6Ad3522C576d5484",
Expand Down Expand Up @@ -1547,6 +1558,7 @@ describe("test-integration time-out", () => {
fromAmount: "1388829000000000000",
oraiBridgeChannelId: "",
oraiReceiver: "",
denom: "0x55d398326f99059fF775485246999027B3197955",
destinationDenom: "0x55d398326f99059fF775485246999027B3197955",
destinationChannelId: "",
destinationReceiver: "0x0deB52499C2e9F3921c631cb6Ad3522C576d5484",
Expand Down
Loading

0 comments on commit c513a06

Please sign in to comment.