Skip to content

Commit

Permalink
update_to_v0.6.0.alpha-10
Browse files Browse the repository at this point in the history
  • Loading branch information
notV4l committed Mar 29, 2024
1 parent abee884 commit ca202fe
Show file tree
Hide file tree
Showing 15 changed files with 59 additions and 63 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ name: Origami CI
on: [push, pull_request]

env:
DOJO_VERSION: v0.6.0-alpha.6
SCARB_VERSION: v2.5.4
DOJO_VERSION: v0.6.0-alpha.10
SCARB_VERSION: v2.6.4

jobs:
check:
Expand Down
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
.vscode
target
target
abis
manifests
4 changes: 2 additions & 2 deletions Scarb.lock
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ dependencies = [
[[package]]
name = "cubit"
version = "1.3.0"
source = "git+https://github.com/notV4l/cubit.git?rev=5aa99005#5aa99005475012a04421e85c8fa3dc77f53c8ca3"
source = "git+https://github.com/influenceth/cubit.git#9402f710716b12c21cd1e481c57c54edaf5bb4b1"

[[package]]
name = "dojo"
version = "0.5.1"
source = "git+https://github.com/dojoengine/dojo?tag=v0.6.0-alpha.6#cfdd17029222b8baacc4efc06d9fe945458686f6"
source = "git+https://github.com/dojoengine/dojo?tag=v0.6.0-alpha.10#c0da5b447185c8c191d9b0e337e00e7843a67d94"
dependencies = [
"dojo_plugin",
]
Expand Down
7 changes: 3 additions & 4 deletions Scarb.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,13 @@ members = [
]

[workspace.package]
version = "0.6.0-alpha.6"
version = "0.6.0-alpha.10"
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", rev = "5aa99005" }
dojo = { git = "https://github.com/dojoengine/dojo", tag = "v0.6.0-alpha.6" }
cubit = { git = "https://github.com/influenceth/cubit.git" }
dojo = { git = "https://github.com/dojoengine/dojo", tag = "v0.6.0-alpha.10" }
origami = { path = "crates" }
token = { path = "token" }
14 changes: 6 additions & 8 deletions examples/bridge/sn/src/dojo_bridge.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,9 @@ mod dojo_bridge {
token_dispatcher.mint(recipient, amount);

let event = DepositHandled { recipient, amount };
self.emit_event(event);

self.emit(event.clone());
emit!(self.world(), (Event::DepositHandled(event)));
}

//
Expand Down Expand Up @@ -162,7 +164,9 @@ mod dojo_bridge {
starknet::syscalls::send_message_to_l1_syscall(data.l1_bridge, message.span());

let event = WithdrawalInitiated { sender: caller, recipient: l1_recipient, amount };
self.emit_event(event);

self.emit(event.clone());
emit!(self.world(), (Event::WithdrawalInitiated(event)));
}

fn get_l1_bridge(self: @ContractState) -> felt252 {
Expand All @@ -181,12 +185,6 @@ mod dojo_bridge {
get!(self.world(), get_contract_address(), (DojoBridgeModel))
}

fn emit_event<S, +traits::Into<S, Event>, +Drop<S>, +Clone<S>>(
ref self: ContractState, event: S
) {
self.emit(event.clone());
emit!(self.world(), event);
}
}
}

2 changes: 1 addition & 1 deletion examples/hex_map/src/actions.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ mod actions {
set!(world, (next));

// Emit an event to the world to notify about the player's move.
emit!(world, Moved { player, direction });
emit!(world, (Event::Moved(Moved { player, direction })));
}
}
}
Expand Down
12 changes: 4 additions & 8 deletions token/src/components/token/erc20/erc20_allowance.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,9 @@ mod erc20_allowance_component {
let approval_event = Approval {
owner: allowance.owner, spender: allowance.spender, value: allowance.amount
};
self.emit_event(approval_event);

self.emit(approval_event.clone());
emit!(self.get_contract().world(), (Event::Approval(approval_event)));
}

// use in transfer_from
Expand All @@ -128,12 +130,6 @@ mod erc20_allowance_component {
allowance.amount = allowance.amount - amount;
self.set_allowance(allowance);
}

fn emit_event<S, +traits::Into<S, Event>, +Drop<S>, +Clone<S>>(
ref self: ComponentState<TContractState>, event: S
) {
self.emit(event.clone());
emit!(self.get_contract().world(), event);
}

}
}
10 changes: 3 additions & 7 deletions token/src/components/token/erc20/erc20_balance.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -170,14 +170,10 @@ mod erc20_balance_component {
self.update_balance(recipient, 0, amount);

let transfer_event = Transfer { from: sender, to: recipient, value: amount };
self.emit_event(transfer_event);

self.emit(transfer_event.clone());
emit!(self.get_contract().world(), (Event::Transfer(transfer_event)));
}

fn emit_event<S, +traits::Into<S, Event>, +Drop<S>, +Clone<S>>(
ref self: ComponentState<TContractState>, event: S
) {
self.emit(event.clone());
emit!(self.get_contract().world(), event);
}
}
}
5 changes: 4 additions & 1 deletion token/src/components/token/erc20/erc20_burnable.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ mod erc20_burnable_component {
use erc20_balance_comp::InternalImpl as ERC20BalanceInternal;
use erc20_metadata_comp::InternalImpl as ERC20MetadataInternal;


#[storage]
struct Storage {}

Expand Down Expand Up @@ -43,7 +44,9 @@ mod erc20_burnable_component {
let transfer_event = erc20_balance_comp::Transfer {
from: account, to: Zeroable::zero(), value: amount
};
erc20_balance.emit_event(transfer_event);

erc20_balance.emit(transfer_event.clone());
emit!(self.get_contract().world(), (erc20_balance_comp::Event::Transfer(transfer_event)));
}
}
}
5 changes: 4 additions & 1 deletion token/src/components/token/erc20/erc20_mintable.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,10 @@ mod erc20_mintable_component {
let transfer_event = erc20_balance_comp::Transfer {
from: Zeroable::zero(), to: recipient, value: amount
};
erc20_balance.emit_event(transfer_event);

erc20_balance.emit(transfer_event.clone());
emit!(self.get_contract().world(), (erc20_balance_comp::Event::Transfer(transfer_event)));

}
}
}
2 changes: 1 addition & 1 deletion token/src/erc1155/erc1155.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ mod ERC1155 {
ref self: ContractState, event: S
) {
self.emit(event.clone());
emit!(self.world(), event);
emit!(self.world(), (event));
}
}

Expand Down
2 changes: 1 addition & 1 deletion token/src/erc20/erc20.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ mod ERC20 {
ref self: ContractState, event: S
) {
self.emit(event);
emit!(self.world(), event);
emit!(self.world(), (event));
}
}

Expand Down
2 changes: 1 addition & 1 deletion token/src/erc721/erc721.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ mod ERC721 {
ref self: ContractState, event: S
) {
self.emit(event);
emit!(self.world(), event);
emit!(self.world(), (event));
}
}

Expand Down
48 changes: 24 additions & 24 deletions token/src/lib.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -23,32 +23,32 @@ mod components {
mod tests;
}

mod erc20 {
mod interface;
mod models;
mod erc20;
use erc20::ERC20;
#[cfg(test)]
mod tests;
}
// mod erc20 {
// mod interface;
// mod models;
// mod erc20;
// use erc20::ERC20;
// #[cfg(test)]
// mod tests;
// }

mod erc721 {
mod interface;
mod models;
mod erc721;
use erc721::ERC721;
#[cfg(test)]
mod tests;
}
// mod erc721 {
// mod interface;
// mod models;
// mod erc721;
// use erc721::ERC721;
// #[cfg(test)]
// mod tests;
// }

mod erc1155 {
mod interface;
mod models;
mod erc1155;
use erc1155::ERC1155;
#[cfg(test)]
mod tests;
}
// mod erc1155 {
// mod interface;
// mod models;
// mod erc1155;
// use erc1155::ERC1155;
// #[cfg(test)]
// mod tests;
// }

mod presets {
mod erc20 {
Expand Down
1 change: 0 additions & 1 deletion token/src/presets/erc20/bridgeable.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ trait IERC20BridgeableInitializer<TState> {

#[dojo::contract]
mod ERC20Bridgeable {
use token::erc20::interface;
use integer::BoundedInt;
use starknet::ContractAddress;
use starknet::{get_caller_address, get_contract_address};
Expand Down

0 comments on commit ca202fe

Please sign in to comment.