Skip to content

Commit

Permalink
⬆️ bump dojo to v0.7.1
Browse files Browse the repository at this point in the history
  • Loading branch information
bal7hazar committed Jun 18, 2024
1 parent b73f06e commit 7e196eb
Show file tree
Hide file tree
Showing 11 changed files with 40 additions and 25 deletions.
4 changes: 2 additions & 2 deletions Scarb.lock
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ source = "git+https://github.com/notV4l/cubit.git?branch=cairo_2.7#cadb27aa62509

[[package]]
name = "dojo"
version = "0.7.0"
source = "git+https://github.com/dojoengine/dojo?tag=v0.7.0#34b13caa785c1149558d28f1a9d9fbd700c4aa2d"
version = "0.7.1"
source = "git+https://github.com/dojoengine/dojo?tag=v0.7.1#c4a1feadf1d5c5ecf9593b50c1a2ca2856ae2313"
dependencies = [
"dojo_plugin",
]
Expand Down
2 changes: 1 addition & 1 deletion Scarb.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@ authors = ["[email protected]"]
[workspace.dependencies]
# cubit = { git = "https://github.com/influenceth/cubit.git" }
cubit = { git = "https://github.com/notV4l/cubit.git", branch = "cairo_2.7" }
dojo = { git = "https://github.com/dojoengine/dojo", tag = "v0.7.0" }
dojo = { git = "https://github.com/dojoengine/dojo", tag = "v0.7.1" }
origami = { path = "crates" }
token = { path = "token" }
4 changes: 2 additions & 2 deletions crates/src/algebra/vec2.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ impl Vec2Impl<T, impl TCopy: Copy<T>, impl TDrop: Drop<T>> of Vec2Trait<T> {

// Masks

/// Creates a vector from the elements in `if_true` and `if_false`,
/// Creates a vector from the elements in `if_true` and `if_false`,
/// selecting which to use for each element of `self`.
///
/// A true element in the mask uses the corresponding element from
Expand All @@ -63,7 +63,7 @@ impl Vec2Impl<T, impl TCopy: Copy<T>, impl TDrop: Drop<T>> of Vec2Trait<T> {

// Math

/// Computes the dot product of `self` and `rhs` .
/// Computes the dot product of `self` and `rhs` .
// #[inline(always)] is not allowed for functions with impl generic parameters.
fn dot<impl TMul: Mul<T>, impl TAdd: Add<T>>(self: Vec2<T>, rhs: Vec2<T>) -> T {
(self.x * rhs.x) + (self.y * rhs.y)
Expand Down
6 changes: 4 additions & 2 deletions crates/src/defi/auction/gda.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,8 @@ mod tests {
use super::{assert_approx_equal, TOLERANCE};
use super::super::{ContinuousGDA, ContinuousGDATrait};

// ipynb with calculations at https://colab.research.google.com/drive/14elIFRXdG3_gyiI43tP47lUC_aClDHfB?usp=sharing
// ipynb with calculations at
// https://colab.research.google.com/drive/14elIFRXdG3_gyiI43tP47lUC_aClDHfB?usp=sharing
#[test]
fn test_price_1() {
let auction = ContinuousGDA {
Expand Down Expand Up @@ -175,7 +176,8 @@ mod tests {
assert_approx_equal(price, auction.initial_price, TOLERANCE)
}

// ipynb with calculations at https://colab.research.google.com/drive/14elIFRXdG3_gyiI43tP47lUC_aClDHfB?usp=sharing
// ipynb with calculations at
// https://colab.research.google.com/drive/14elIFRXdG3_gyiI43tP47lUC_aClDHfB?usp=sharing
#[test]
fn test_price_1() {
let auction = DiscreteGDA {
Expand Down
3 changes: 2 additions & 1 deletion crates/src/defi/auction/vrgda.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ impl TVRGDATrait<T, +VRGDAVarsTrait<T>, +VRGDATargetTimeTrait<T>> of VRGDATrait<
/// # Arguments
///
/// * `time_since_start`: Time since the auction started.
/// * `sold`: Quantity sold. (Not including this unit) eg if this the price for the first unit sold is 0.
/// * `sold`: Quantity sold. (Not including this unit) eg if this the price for the first unit
/// sold is 0.
///
/// # Returns
///
Expand Down
3 changes: 2 additions & 1 deletion crates/src/random/deck.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ trait DeckTrait {
/// # Arguments
/// * `seed` - A seed to initialize the deck.
/// * `number` - The initial number of cards (must be below u128).
/// * `bitmap` - The bitmap, each bit is a card with: 0/1 is in/out (so a null bitmap will create a `new` deck).
/// * `bitmap` - The bitmap, each bit is a card with: 0/1 is in/out (so a null bitmap will
/// create a `new` deck).
/// # Returns
/// * The initialized `Deck`.
fn from_bitmap(seed: felt252, number: u32, bitmap: u128) -> Deck;
Expand Down
3 changes: 2 additions & 1 deletion crates/src/rating/elo.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ impl EloImpl of EloTrait {
/// * `rating_a` - The ELO rating of the player A.
/// * `rating_b` - The ELO rating of the player B.
/// * `score` - The score of the player A, scaled by 100. 100 = win, 50 = draw, 0 = loss.
/// * `k` - The k-factor or development multiplier used to calculate the change in ELO rating. 20 is the typical value.
/// * `k` - The k-factor or development multiplier used to calculate the change in ELO rating.
/// 20 is the typical value.
/// # Returns
/// * `change` - The change in ELO rating of player A.
/// * `negative` - The directional change of player A's ELO. Opposite sign for player B.
Expand Down
5 changes: 3 additions & 2 deletions examples/hex_map/src/noise.cairo
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
//
//
// Unique buisness logic of your world. It imports both the hex from origami and the simplex from cubit
// Unique buisness logic of your world. It imports both the hex from origami and the simplex from
// cubit
//
//

Expand Down Expand Up @@ -59,7 +60,7 @@ mod tests {

#[test]
fn test_gradient() {
// seems inconsistent
// seems inconsistent

let mut i = 5;

Expand Down
11 changes: 7 additions & 4 deletions examples/market/src/models/market.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,8 @@ impl MarketImpl of MarketTrait {
//
// Returns:
//
// (amount, quantity, shares): The amount of cash and quantity of items added to the market and the shares minted
// (amount, quantity, shares): The amount of cash and quantity of items added to the market and
// the shares minted
fn add_liquidity(self: @Market, amount: u128, quantity: u128) -> (u128, u128, Fixed) {
// Compute the amount and quantity to add to the market
let (amount, quantity) = self.add_liquidity_inner(amount, quantity);
Expand Down Expand Up @@ -300,7 +301,7 @@ mod tests {
let (amount, quantity) = (SCALING_FACTOR * 2, 20); // pool 1:10
let (amount_add, quantity_add, liquidity_add) = market.add_liquidity(amount, quantity);

// Assert
// Assert
assert(amount_add == amount, 'wrong cash amount');
assert(quantity_add == quantity, 'wrong item quantity');

Expand Down Expand Up @@ -343,7 +344,8 @@ mod tests {
let _expected_liquidity = FixedTrait::sqrt(expected_amount * expected_quantity);

let _final_liquidity = initial_liquidity + liquidity_add;
// assert_precise(expected_liquidity, final_liquidity.into(), 'wrong liquidity', Option::None(()));
// assert_precise(expected_liquidity, final_liquidity.into(), 'wrong liquidity',
// Option::None(()));
}

#[test]
Expand Down Expand Up @@ -385,7 +387,8 @@ mod tests {
let _expected_liquidity = FixedTrait::sqrt(expected_amount * expected_quantity);

let _final_liquidity = initial_liquidity - liquidity_remove;
// assert_precise(expected_liquidity, final_liquidity.into(), 'wrong liquidity', Option::None(()));
// assert_precise(expected_liquidity, final_liquidity.into(), 'wrong liquidity',
// Option::None(()));
}

#[test]
Expand Down
18 changes: 12 additions & 6 deletions examples/matchmaker/src/helpers/bitmap.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,12 @@ impl Bitmap of BitmapTrait {

/// The index of the most significant bit of the number,
/// where the least significant bit is at index 0 and the most significant bit is at index 255
/// Source: https://github.com/lambdaclass/yet-another-swap/blob/main/crates/yas_core/src/libraries/bit_math.cairo
/// # Arguments
/// * `x` - The value for which to compute the most significant bit, must be greater than 0.
/// Source:
///
///
/// https://github.com/lambdaclass/yet-another-swap/blob/main/crates/yas_core/src/libraries/bit_math.cairo
/// # Arguments * `x` - The value for which to compute the most significant bit, must be greater
/// than 0.
/// # Returns
/// * The index of the most significant bit
#[inline(always)]
Expand Down Expand Up @@ -108,9 +111,12 @@ impl Bitmap of BitmapTrait {

/// The index of the least significant bit of the number,
/// where the least significant bit is at index 0 and the most significant bit is at index 255
/// Source: https://github.com/lambdaclass/yet-another-swap/blob/main/crates/yas_core/src/libraries/bit_math.cairo
/// # Arguments
/// * `x` - The value for which to compute the least significant bit, must be greater than 0.
/// Source:
///
///
/// https://github.com/lambdaclass/yet-another-swap/blob/main/crates/yas_core/src/libraries/bit_math.cairo
/// # Arguments * `x` - The value for which to compute the least significant bit, must be
/// greater than 0.
/// # Returns
/// * The index of the least significant bit
#[inline(always)]
Expand Down
6 changes: 3 additions & 3 deletions examples/projectile/src/lib.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ fn main() -> (usize, Array::<Fixed>, Array::<Fixed>) {
// v_0_mag_felt: felt252, theta_0_deg_felt: felt252, x_0_felt: felt252, y_0_felt: felt252

//
// Projectile parameters
//
// Projectile parameters
//
/// Inputs: to be contract inputs for view function `main`
/// Launch velocity magnitude, 0 <= v_0_felt <= 100
let v_0_mag_felt = 100;
Expand Down Expand Up @@ -43,7 +43,7 @@ fn main() -> (usize, Array::<Fixed>, Array::<Fixed>) {
assert(v_0_mag.mag <= 100 * ONE_u128, 'need v_0_mag_felt <= 100');
assert(v_0_mag.mag > 0 * ONE_u128, 'need v_0_mag_felt > 0');
assert(v_0_mag.sign == false, 'need v_0_mag_felt > 0');
// `theta_0_deg.mag` not exact after conversion, so use 180.0000001
// `theta_0_deg.mag` not exact after conversion, so use 180.0000001
assert(theta_0_deg.mag <= 180000001 * ONE_u128 / 1000000, '-180 <= theta_0_deg_felt <= 180');
assert(x_0 <= x_max, 'need x_0 <= x_max');
assert(x_0 >= x_min, 'need x_0 >= x_min');
Expand Down

0 comments on commit 7e196eb

Please sign in to comment.