Skip to content

Commit

Permalink
Merge pull request #82 from dojoengine/1.0.0-alpha.1
Browse files Browse the repository at this point in the history
feat: update for 1.0.0-alpha
  • Loading branch information
glihm authored Jul 25, 2024
2 parents 4bb65b8 + 0b08830 commit 520d77f
Show file tree
Hide file tree
Showing 209 changed files with 986 additions and 7,406 deletions.
64 changes: 40 additions & 24 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
name: Origami CI

on: [push, pull_request]
on:
push:
branches:
- main
pull_request:

env:
DOJO_VERSION: v0.7.2
SCARB_VERSION: nightly-2024-06-08
DOJO_VERSION: v1.0.0-alpha.3
SCARB_VERSION: 2.7.0-rc.4

jobs:
check:
Expand All @@ -22,87 +26,99 @@ jobs:
build:
needs: check
runs-on: ubuntu-latest
name: Build package
name: Build workspace
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup
- name: Build
run: sozo build
shell: bash

origami:
# TODO: uncomment once test fixed.
# algebra:
# needs: [check, build]
# runs-on: ubuntu-latest
# name: Test origami_algebra
# steps:
# - uses: actions/checkout@v4
# - uses: ./.github/actions/setup
# - name: Test
# run: sozo test --package origami_algebra
# shell: bash

defi:
needs: [check, build]
runs-on: ubuntu-latest
name: Test crates
name: Test origami_defi
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup
- name: Test
run: sozo test -f origami
run: sozo test --package origami_defi
shell: bash

token:
map:
needs: [check, build]
runs-on: ubuntu-latest
name: Test token
name: Test origami_map
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup
- name: Test
run: sozo test -f token
run: sozo test --package origami_map
shell: bash

market:
random:
needs: [check, build]
runs-on: ubuntu-latest
name: Test example market
name: Test origami_random
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup
- name: Test
run: sozo test -f market
run: sozo test --package origami_random
shell: bash

matchmaker:
rating:
needs: [check, build]
runs-on: ubuntu-latest
name: Test example matchmaker
name: Test origami_rating
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup
- name: Test
run: sozo test -f matchmaker
run: sozo test --package origami_rating
shell: bash

projectile:
security:
needs: [check, build]
runs-on: ubuntu-latest
name: Test example projectile
name: Test origami_security
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup
- name: Test
run: sozo test -f projectile
run: sozo test --package origami_security
shell: bash

hex-map:
token:
needs: [check, build]
runs-on: ubuntu-latest
name: Test example hex map
name: Test origami_token
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup
- name: Test
run: sozo test -f hex_map
run: sozo test --package origami_token
shell: bash

governance:
needs: [check, build]
runs-on: ubuntu-latest
name: Test example hex map
name: Test origami_governance
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup
- name: Test
run: sozo test -f governance
run: sozo test --package origami_governance
shell: bash
1 change: 1 addition & 0 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
scarb 2.7.0-rc.4
67 changes: 24 additions & 43 deletions Scarb.lock
Original file line number Diff line number Diff line change
@@ -1,83 +1,64 @@
# Code generated by scarb DO NOT EDIT.
version = 1

[[package]]
name = "chess"
version = "0.6.0-alpha.6"
dependencies = [
"dojo",
]

[[package]]
name = "cubit"
version = "1.3.0"
source = "git+https://github.com/notV4l/cubit.git?branch=cairo_2.7#cadb27aa62509ad9059dfac4f075317893f1f614"
source = "git+https://github.com/dojoengine/cubit?branch=cairo_2.7#53020b6320a10f2ab55b661be9b8d895aca945e9"

[[package]]
name = "dojo"
version = "0.7.2"
source = "git+https://github.com/dojoengine/dojo?tag=v0.7.2#3da5cad9fdd39b81551e0668015d88262e6c5fc4"
version = "0.7.3"
source = "git+https://github.com/dojoengine/dojo?tag=v1.0.0-alpha.3#a6a7724380169372336e886fb36f31f56e7d0d8a"
dependencies = [
"dojo_plugin",
]

[[package]]
name = "dojo_plugin"
version = "0.3.11"
source = "git+https://github.com/dojoengine/dojo?tag=v0.3.11#1e651b5d4d3b79b14a7d8aa29a92062fcb9e6659"
version = "0.7.3"
source = "git+https://github.com/dojoengine/dojo?rev=71b1f1a4#71b1f1a467534cbeeb901356f41e612ed4187bd1"

[[package]]
name = "governance"
version = "0.0.0"
name = "origami_algebra"
version = "0.1.0"
dependencies = [
"dojo",
"cubit",
]

[[package]]
name = "hex_map"
version = "0.0.0"
name = "origami_defi"
version = "0.1.0"
dependencies = [
"cubit",
"dojo",
"origami",
]

[[package]]
name = "market"
version = "0.0.0"
name = "origami_governance"
version = "1.0.0-alpha.0"
dependencies = [
"cubit",
"dojo",
]

[[package]]
name = "matchmaker"
version = "0.0.0"
dependencies = [
"dojo",
"origami",
]
name = "origami_map"
version = "0.1.0"

[[package]]
name = "origami"
version = "0.7.2"
dependencies = [
"cubit",
"dojo",
]
name = "origami_random"
version = "0.1.0"

[[package]]
name = "projectile"
version = "0.0.0"
dependencies = [
"cubit",
"dojo",
"origami",
]
name = "origami_rating"
version = "0.1.0"

[[package]]
name = "origami_security"
version = "0.1.0"

[[package]]
name = "token"
version = "0.0.0"
name = "origami_token"
version = "1.0.0-alpha.0"
dependencies = [
"dojo",
]
32 changes: 13 additions & 19 deletions Scarb.toml
Original file line number Diff line number Diff line change
@@ -1,24 +1,18 @@
[workspace]
members = [
"crates",
"examples/chess",
"examples/hex_map",
"examples/market",
"examples/matchmaker",
"examples/projectile",
"token",
"governance"
"crates/algebra",
"crates/defi",
"crates/map",
"crates/random",
"crates/rating",
"crates/security",
"crates/token",
"crates/governance"
]

[workspace.package]
version = "0.7.2"
description = "Community-maintained libraries for Cairo"
homepage = "https://github.com/dojoengine/origami"
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.2" }
origami = { path = "crates" }
token = { path = "token" }
cubit = { git = "https://github.com/dojoengine/cubit", branch = "cairo_2.7" }
dojo = { git = "https://github.com/dojoengine/dojo", tag = "v1.0.0-alpha.3" }
starknet = "2.7.0-rc.3"

# Scripts are not supported for virtual workspaces.
11 changes: 11 additions & 0 deletions crates/algebra/Scarb.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[package]
name = "origami_algebra"
version = "0.1.0"
description = "Algebra library for Dojo based games."
homepage = "https://github.com/dojoengine/origami/tree/main/crates/algebra"

# TODO: update to edition 2024_07, some traits are deprecated and others no longer accessible.
# Mostly related to `AddEq` -> `AddAssign` and so on.

[dependencies]
cubit.workspace = true
3 changes: 3 additions & 0 deletions crates/algebra/src/lib.cairo
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
mod vec2;
mod vector;
mod matrix;
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
10 changes: 10 additions & 0 deletions crates/defi/Scarb.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[package]
name = "origami_defi"
version = "0.1.0"
description = "DeFi library for Dojo based games."
homepage = "https://github.com/dojoengine/origami/tree/main/crates/defi"
edition = "2024_07"

[dependencies]
cubit.workspace = true
starknet.workspace = true
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@ use cubit::f128::types::fixed::{Fixed, FixedTrait};
/// The purchase price for a given quantity is calculated based on
/// the initial price, scale factor, decay constant, and the time since
/// the auction has started.
#[derive(Copy, Drop, Serde, starknet::Storage)]
struct DiscreteGDA {
#[derive(Copy, Drop, Serde, starknet::Store)]
pub struct DiscreteGDA {
sold: Fixed,
initial_price: Fixed,
scale_factor: Fixed,
decay_constant: Fixed,
}

#[generate_trait]
impl DiscreteGDAImpl of DiscreteGDATrait {
pub impl DiscreteGDAImpl of DiscreteGDATrait {
/// Calculates the purchase price for a given quantity of the item at a specific time.
///
/// # Arguments
Expand All @@ -39,15 +39,15 @@ impl DiscreteGDAImpl of DiscreteGDATrait {
/// A Gradual Dutch Auction represented using continuous time steps.
/// The purchase price is calculated based on the initial price,
/// emission rate, decay constant, and the time since the last purchase in days.
#[derive(Copy, Drop, Serde, starknet::Storage)]
struct ContinuousGDA {
#[derive(Copy, Drop, Serde, starknet::Store)]
pub struct ContinuousGDA {
initial_price: Fixed,
emission_rate: Fixed,
decay_constant: Fixed,
}

#[generate_trait]
impl ContinuousGDAImpl of ContinuousGDATrait {
pub impl ContinuousGDAImpl of ContinuousGDATrait {
/// Calculates the purchase price for a given quantity of the item at a specific time.
///
/// # Arguments
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

use cubit::f128::types::fixed::{Fixed, FixedTrait};

fn to_days_fp(x: Fixed) -> Fixed {
pub fn to_days_fp(x: Fixed) -> Fixed {
x / FixedTrait::new(86400, false)
}

fn from_days_fp(x: Fixed) -> Fixed {
pub fn from_days_fp(x: Fixed) -> Fixed {
x * FixedTrait::new(86400, false)
}

Expand Down
Loading

0 comments on commit 520d77f

Please sign in to comment.