Skip to content

Commit

Permalink
merge
Browse files Browse the repository at this point in the history
  • Loading branch information
notV4l committed Aug 13, 2024
1 parent a6951ae commit 87ffa16
Show file tree
Hide file tree
Showing 11 changed files with 42 additions and 31 deletions.
16 changes: 8 additions & 8 deletions Scarb.lock
Original file line number Diff line number Diff line change
Expand Up @@ -21,44 +21,44 @@ source = "git+https://github.com/dojoengine/dojo?rev=f15def33#f15def330c0d099e79

[[package]]
name = "origami_algebra"
version = "1.0.0-alpha.4"
version = "1.0.0-alpha.5"
dependencies = [
"cubit",
]

[[package]]
name = "origami_defi"
version = "1.0.0-alpha.4"
version = "1.0.0-alpha.5"
dependencies = [
"cubit",
]

[[package]]
name = "origami_governance"
version = "1.0.0-alpha.4"
version = "1.0.0-alpha.5"
dependencies = [
"dojo",
]

[[package]]
name = "origami_map"
version = "1.0.0-alpha.4"
version = "1.0.0-alpha.5"

[[package]]
name = "origami_random"
version = "1.0.0-alpha.4"
version = "1.0.0-alpha.5"

[[package]]
name = "origami_rating"
version = "1.0.0-alpha.4"
version = "1.0.0-alpha.5"

[[package]]
name = "origami_security"
version = "1.0.0-alpha.4"
version = "1.0.0-alpha.5"

[[package]]
name = "origami_token"
version = "1.0.0-alpha.4"
version = "1.0.0-alpha.5"
dependencies = [
"dojo",
]
2 changes: 1 addition & 1 deletion Scarb.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ members = [
]

[workspace.package]
version = "1.0.0-alpha.4"
version = "1.0.0-alpha.5"

[workspace.dependencies]
dojo = { git = "https://github.com/dojoengine/dojo", tag = "v1.0.0-alpha.5" }
Expand Down
16 changes: 8 additions & 8 deletions crates/algebra/src/matrix.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ impl MatrixImpl<
+Mul<T>,
+Div<T>,
+Add<T>,
+AddAssign<T,T>,
+AddAssign<T, T>,
+Sub<T>,
+SubAssign<T,T>,
+SubAssign<T, T>,
+Neg<T>,
+Zeroable<T>,
+Copy<T>,
Expand Down Expand Up @@ -162,9 +162,9 @@ impl MatrixAdd<
+Mul<T>,
+Div<T>,
+Add<T>,
+AddAssign<T,T>,
+AddAssign<T, T>,
+Sub<T>,
+SubAssign<T,T>,
+SubAssign<T, T>,
+Neg<T>,
+Zeroable<T>,
+Copy<T>,
Expand Down Expand Up @@ -194,9 +194,9 @@ impl MatrixSub<
+Mul<T>,
+Div<T>,
+Add<T>,
+AddAssign<T,T>,
+AddAssign<T, T>,
+Sub<T>,
+SubAssign<T,T>,
+SubAssign<T, T>,
+Neg<T>,
+Zeroable<T>,
+Copy<T>,
Expand Down Expand Up @@ -226,9 +226,9 @@ impl MatrixMul<
+Mul<T>,
+Div<T>,
+Add<T>,
+AddAssign<T,T>,
+AddAssign<T, T>,
+Sub<T>,
+SubAssign<T,T>,
+SubAssign<T, T>,
+Neg<T>,
+Zeroable<T>,
+Copy<T>,
Expand Down
6 changes: 3 additions & 3 deletions crates/algebra/src/vector.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ trait VectorTrait<T> {
fn dot(self: Vector<T>, vector: Vector<T>) -> T;
}

impl VectorImpl<T, +Mul<T>, +AddAssign<T,T>, +Zeroable<T>, +Copy<T>, +Drop<T>,> of VectorTrait<T> {
impl VectorImpl<T, +Mul<T>, +AddAssign<T, T>, +Zeroable<T>, +Copy<T>, +Drop<T>,> of VectorTrait<T> {
fn new(data: Span<T>) -> Vector<T> {
Vector { data }
}
Expand Down Expand Up @@ -51,7 +51,7 @@ impl VectorImpl<T, +Mul<T>, +AddAssign<T,T>, +Zeroable<T>, +Copy<T>, +Drop<T>,>
}

impl VectorAdd<
T, +Mul<T>, +AddAssign<T,T>, +Add<T>, +Zeroable<T>, +Copy<T>, +Drop<T>,
T, +Mul<T>, +AddAssign<T, T>, +Add<T>, +Zeroable<T>, +Copy<T>, +Drop<T>,
> of Add<Vector<T>> {
fn add(mut lhs: Vector<T>, mut rhs: Vector<T>) -> Vector<T> {
// [Check] Dimesions are compatible
Expand All @@ -71,7 +71,7 @@ impl VectorAdd<
}

impl VectorSub<
T, +Mul<T>, +AddAssign<T,T>, +Sub<T>, +Zeroable<T>, +Copy<T>, +Drop<T>,
T, +Mul<T>, +AddAssign<T, T>, +Sub<T>, +Zeroable<T>, +Copy<T>, +Drop<T>,
> of Sub<Vector<T>> {
fn sub(mut lhs: Vector<T>, mut rhs: Vector<T>) -> Vector<T> {
// [Check] Dimesions are compatible
Expand Down
4 changes: 3 additions & 1 deletion crates/governance/src/systems/governor/contract.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,9 @@ mod governor {
let queued_tx = get!(world, (target_selector, class_hash), QueuedTransactions).queued;
assert!(!queued_tx, "Governor::queue_or_revert: proposal action already queued at eta");

let (_, timelock_addr) = world_utils::get_contract_infos(world, get!(world, self.selector(), GovernorParams).timelock);
let (_, timelock_addr) = world_utils::get_contract_infos(
world, get!(world, self.selector(), GovernorParams).timelock
);
let timelock = ITimelockDispatcher { contract_address: timelock_addr };
timelock.que_transaction(target_selector, class_hash, eta);
}
Expand Down
4 changes: 1 addition & 3 deletions crates/governance/src/systems/governor/tests.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,6 @@ fn test_queue_proposal() {
let proposal = get!(world, 1, Proposals).proposal;
assert!(proposal.eta == 'ts1' + DELAY * 2 + PERIOD + 1, "eta is not correct");
}



// TODO: update later
// #[test]
// fn test_execute_proposal() {
Expand Down Expand Up @@ -167,3 +164,4 @@ fn test_queue_proposal() {
// IHelloStarknetUgradedDispatcher { contract_address: systems.mock.contract_address }
// .decrease_balance(1000);
// }

8 changes: 5 additions & 3 deletions crates/governance/src/utils/testing.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,6 @@ fn setup() -> (Systems, IWorldDispatcher) {
let token_selector = IContractDispatcher { contract_address: token.contract_address }
.selector();



// let selectors = array![
// selector_from_tag!("origami_governance-GovernorParams"),
// selector_from_tag!("origami_governance-ProposalParams"),
Expand Down Expand Up @@ -139,7 +137,11 @@ fn setup() -> (Systems, IWorldDispatcher) {
mock.contract_address,
];

world_utils::grant_writer(world, array![dojo::utils::bytearray_hash(@"origami_governance")].span(), contract_addresses.span());
world_utils::grant_writer(
world,
array![dojo::utils::bytearray_hash(@"origami_governance")].span(),
contract_addresses.span()
);

// should use constructor now
systems.governor.initialize(timelock_selector, token_selector, GOVERNOR());
Expand Down
2 changes: 1 addition & 1 deletion crates/governance/src/utils/world_utils.cairo
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use starknet::{ClassHash, ContractAddress};
use dojo::world::{IWorldDispatcher, IWorldDispatcherTrait};
use starknet::{ClassHash, ContractAddress};

pub fn get_contract_infos(
world: IWorldDispatcher, resource: felt252
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ fn test_transfer_from() {
assert(erc20_balance_mock.balance_of(RECIPIENT()) == VALUE, 'Should eq amount');
assert(erc20_balance_mock.balance_of(OWNER()) == SUPPLY - VALUE, 'Should eq suppy - amount');
assert(erc20_balance_mock.allowance(OWNER(), SPENDER()) == 0, 'Should eq 0');
// assert(erc20_balance_mock.total_supply() == SUPPLY, 'Total supply should not change');
// assert(erc20_balance_mock.total_supply() == SUPPLY, 'Total supply should not change');
}

#[test]
Expand Down Expand Up @@ -291,5 +291,5 @@ fn test_transferFrom() {
assert(erc20_balance_mock.balance_of(RECIPIENT()) == VALUE, 'Should eq amount');
assert(erc20_balance_mock.balance_of(OWNER()) == SUPPLY - VALUE, 'Should eq suppy - amount');
assert(erc20_balance_mock.allowance(OWNER(), SPENDER()) == 0, 'Should eq 0');
// assert(erc20_balance_mock.total_supply() == SUPPLY, 'Total supply should not change');
// assert(erc20_balance_mock.total_supply() == SUPPLY, 'Total supply should not change');
}
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,11 @@ fn setup_uninitialized() -> (IWorldDispatcher, IERC721EnumMintBurnPresetDispatch
.deploy_contract('salt', ERC721EnumMintBurn::TEST_CLASS_HASH.try_into().unwrap())
};

world.grant_owner(dojo::utils::bytearray_hash(@"origami_token"), erc721_enum_mint_burn_dispatcher.contract_address);
world
.grant_owner(
dojo::utils::bytearray_hash(@"origami_token"),
erc721_enum_mint_burn_dispatcher.contract_address
);
world.grant_owner(dojo::utils::bytearray_hash(@"origami_token"), OWNER());

(world, erc721_enum_mint_burn_dispatcher)
Expand Down
5 changes: 5 additions & 0 deletions crates/token/src/presets/erc721/tests_mintable_burnable.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,11 @@ fn setup_uninitialized() -> (IWorldDispatcher, IERC721MintableBurnablePresetDisp
.deploy_contract('salt', ERC721MintableBurnable::TEST_CLASS_HASH.try_into().unwrap())
};

world
.grant_owner(
dojo::utils::bytearray_hash(@"origami_token"),
erc721_mintable_burnable_dispatcher.contract_address
);

(world, erc721_mintable_burnable_dispatcher)
}
Expand Down

0 comments on commit 87ffa16

Please sign in to comment.