Skip to content

Commit

Permalink
bump forc, progress with tests
Browse files Browse the repository at this point in the history
  • Loading branch information
johnquid committed Dec 26, 2023
1 parent 6fd22ab commit e0b3a14
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 23 deletions.
38 changes: 26 additions & 12 deletions Forc.lock
@@ -1,21 +1,35 @@
[[package]]
name = 'QD'
source = 'member'
name = "QD"
source = "member"
dependencies = [
'libraries',
'std',
"libraries",
"std",
]

[[package]]
name = 'core'
source = 'path+from-root-EB296BD18C0E4CC4'
name = "core"
source = "path+from-root-B77DA2F383183718"

[[package]]
name = 'libraries'
source = 'path+from-root-163A23D64F0174CB'
dependencies = ['std']
name = "fixed_point"
source = "git+https://github.com/fuellabs/sway-libs?branch=master#5d69f665207158517eba14c35c7d28cb1cb93aa9"
dependencies = ["std"]

[[package]]
name = 'std'
source = 'git+https://github.com/fuellabs/sway?tag=v0.44.1#04a597093e7441898933dd412b8e4dc6ac860cd3'
dependencies = ['core']
name = "libraries"
source = "path+from-root-163A23D64F0174CB"
dependencies = [
"fixed_point",
"signed_integers",
"std",
]

[[package]]
name = "signed_integers"
source = "git+https://github.com/fuellabs/sway-libs?branch=master#5d69f665207158517eba14c35c7d28cb1cb93aa9"
dependencies = ["std"]

[[package]]
name = "std"
source = "git+https://github.com/fuellabs/sway?tag=v0.48.1#6886ef050ce62afd3fe3186ed562fd33bd76bffa"
dependencies = ["core"]
2 changes: 1 addition & 1 deletion contracts/QD/Cargo.toml
Expand Up @@ -7,7 +7,7 @@ authors = ["John Quid <john@quid.io>"]
license = "BSL-1.1"

[dev-dependencies]
fuels = { version = "0.48", features = ["fuel-core-lib"] }
fuels = { version = "0.53", features = ["fuel-core-lib"] }
tokio = { version = "1.12", features = ["rt", "macros"] }

[[test]]
Expand Down
10 changes: 6 additions & 4 deletions contracts/QD/src/main.sw
Expand Up @@ -7,6 +7,7 @@ use libraries::{
};

use std::{
hash::Hash,
auth::msg_sender,
block::timestamp,
call_frames::{
Expand Down Expand Up @@ -892,7 +893,7 @@ impl Quid for Contract
let mut qd = 0;

// First take care of attached deposit by appending collat
if msg_asset_id() == contract_id().into() { // QD
if msg_asset_id() == AssetId::from(contract_id().into()) { // QD
if !short && deposit > 0 {
eth = redeem(deposit);
}
Expand Down Expand Up @@ -1014,7 +1015,7 @@ impl Quid for Contract
require(amt > 0, AssetError::BelowMinimum);
let mut pledge = fetch_pledge(sender, true, true);

if msg_asset_id() == contract_id().into() { // QD
if msg_asset_id() == AssetId::from(contract_id().into()) { // QD
require(amt > ONE, AssetError::BelowMinimum);
if live { // adding collat to LP
let mut pool = storage.live.read();
Expand Down Expand Up @@ -1079,7 +1080,8 @@ impl Quid for Contract
}
}
else {
revert(33);
log(54);
//revert(33);
}
//log(pledge.live.long.credit); // THIS LOG SHOWS ZERO
storage.pledges.insert(sender, pledge); // TODO save_pledge
Expand Down Expand Up @@ -1169,7 +1171,7 @@ impl Quid for Contract
pod.credit -= least;
storage.brood.write(pod);
}
transfer(Identity::Address(account), contract_id().into(), least);
transfer(Identity::Address(account), AssetId::from(contract_id().into()), least);
}
storage.pledges.insert(account, pledge);
}
Expand Down
2 changes: 1 addition & 1 deletion contracts/QD/tests/harness.rs
Expand Up @@ -131,7 +131,7 @@ async fn test_deposit_withdraw() {
.await
.unwrap()
.decode_logs_with_type::<u64>().unwrap();
assert_eq!(res, vec![42]); // this should not be happening !
assert_eq!(res, vec![54]); // this should not be happening !

// let result = depositor.contract
// .methods()
Expand Down
6 changes: 3 additions & 3 deletions fuel-toolchain.toml
@@ -1,6 +1,6 @@
[toolchain]
channel = "latest-2023-08-16"
channel = "latest-2023-12-7"

[components]
forc = "0.44.1"
fuel-core = "0.20.4"
forc = "0.48.1"
fuel-core = "0.20.8"
4 changes: 2 additions & 2 deletions libraries/Forc.toml
Expand Up @@ -5,5 +5,5 @@ license = "BSL 1.1"
name = "libraries"

[dependencies]
# signed_integers = { git = "https://github.com/fuellabs/sway-libs", branch = "master" }
# fixed_point = { git = "https://github.com/fuellabs/sway-libs", branch = "master" }
signed_integers = { git = "https://github.com/fuellabs/sway-libs", branch = "master" }
fixed_point = { git = "https://github.com/fuellabs/sway-libs", branch = "master" }

0 comments on commit e0b3a14

Please sign in to comment.