Skip to content

Commit

Permalink
fix: wrong first asset on build msg
Browse files Browse the repository at this point in the history
  • Loading branch information
trung2891 committed Oct 3, 2024
1 parent 967e5e0 commit 9d5ed54
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 16 deletions.
21 changes: 9 additions & 12 deletions packages/universal-swap/src/msg/oraichain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import { toUtf8 } from "@cosmjs/encoding";

export class OraichainMsg {
SWAP_VENUE_NAME = "oraidex";
ENTRY_POINT_CONTRACT = "orai1yglsm0u2x3xmct9kq3lxa654cshaxj9j5d9rw5enemkkkdjgzj7sr3gwt0";
ENTRY_POINT_CONTRACT = "orai13mgxn93pjvd7eermj4ghet8assxdqttxugwk25rasuuqq2g5nczq43eesn"; // FIXME: use mainnet

constructor(
protected path: Path,
Expand Down Expand Up @@ -414,8 +414,8 @@ export class OraichainMsg {
),
funds: [
{
amount: bridgeInfo.fromToken,
denom: this.path.tokenInAmount
denom: this.path.tokenIn,
amount: this.path.tokenInAmount
}
]
})
Expand Down Expand Up @@ -454,12 +454,12 @@ export class OraichainMsg {
};

// if asset info is native => send native way, else send cw20 way
if (isCw20Token(bridgeInfo.fromToken)) {
if (isCw20Token(this.path.tokenIn)) {
return {
typeUrl: "/cosmwasm.wasm.v1.MsgExecuteContract",
value: MsgExecuteContract.fromPartial({
sender: this.currentChainAddress,
contract: bridgeInfo.fromToken,
contract: this.path.tokenIn,
msg: toUtf8(
JSON.stringify({
send: {
Expand All @@ -476,20 +476,17 @@ export class OraichainMsg {
};
}
// native token

return {
typeUrl: "/cosmwasm.wasm.v1.MsgExecuteContract",
value: MsgExecuteContract.fromPartial({
sender: this.currentChainAddress,
contract: this.ENTRY_POINT_CONTRACT,
msg: toUtf8(
JSON.stringify({
msg
})
),
msg: toUtf8(JSON.stringify(msg)),
funds: [
{
amount: bridgeInfo.fromToken,
denom: this.path.tokenInAmount
denom: this.path.tokenIn,
amount: this.path.tokenInAmount
}
]
})
Expand Down
8 changes: 4 additions & 4 deletions packages/universal-swap/src/msg/osmosis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -236,12 +236,12 @@ export class OsmosisMsg {
};

// if asset info is native => send native way, else send cw20 way
if (isCw20Token(bridgeInfo.fromToken)) {
if (isCw20Token(this.path.tokenIn)) {
return {
typeUrl: "/cosmwasm.wasm.v1.MsgExecuteContract",
value: MsgExecuteContract.fromPartial({
sender: this.currentChainAddress,
contract: bridgeInfo.fromToken,
contract: this.path.tokenIn,
msg: toUtf8(
JSON.stringify({
send: {
Expand Down Expand Up @@ -270,8 +270,8 @@ export class OsmosisMsg {
),
funds: [
{
amount: bridgeInfo.fromToken,
denom: this.path.tokenInAmount
denom: this.path.tokenIn,
amount: this.path.tokenInAmount
}
]
})
Expand Down

0 comments on commit 9d5ed54

Please sign in to comment.