Skip to content

Commit

Permalink
Merge pull request #26 from compolabs/asset-type-hotfix
Browse files Browse the repository at this point in the history
Change base to quote type
  • Loading branch information
chlenc authored Apr 9, 2024
2 parents 39944c8 + e2bc0a4 commit 7994c36
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions market-contract/src/main.sw
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ impl Market for Contract {
let user = msg_sender().unwrap();
let (amount, asset_type) = match msg_asset_id() == BASE_ASSET {
true => (msg_amount() * 10.pow(BASE_ASSET_DECIMALS), AssetType::Base),
false => (msg_amount() * 10.pow(QUOTE_ASSET_DECIMALS), AssetType::Base),
false => (msg_amount() * 10.pow(QUOTE_ASSET_DECIMALS), AssetType::Quote),
};

let mut account = match storage.account.get(user).try_read() {
Expand Down Expand Up @@ -106,7 +106,7 @@ impl Market for Contract {
// TODO: Is this division correct?
let (internal_amount, asset_type) = match msg_asset_id() == BASE_ASSET {
true => (amount / 10.pow(BASE_ASSET_DECIMALS), AssetType::Base),
false => (amount / 10.pow(QUOTE_ASSET_DECIMALS), AssetType::Base),
false => (amount / 10.pow(QUOTE_ASSET_DECIMALS), AssetType::Quote),
};

account.liquid.debit(amount, asset_type);
Expand Down

0 comments on commit 7994c36

Please sign in to comment.