Skip to content

Commit

Permalink
fix packing
Browse files Browse the repository at this point in the history
  • Loading branch information
Larkooo committed Sep 4, 2024
1 parent dd05c4b commit 1789153
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
Binary file modified indexer.db
Binary file not shown.
4 changes: 2 additions & 2 deletions manifests/dev/base/contracts/flippyflop-actions-4407e5f5.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
kind = "DojoContract"
class_hash = "0x28bb42a86e4a38914ce1642c6566b6a102de8549d1c66216ebedcbcd6c8e107"
original_class_hash = "0x28bb42a86e4a38914ce1642c6566b6a102de8549d1c66216ebedcbcd6c8e107"
class_hash = "0x3ea068c930a55765223e357778a6265b56b93e654d27a2849d8efe895244cf2"
original_class_hash = "0x3ea068c930a55765223e357778a6265b56b93e654d27a2849d8efe895244cf2"
base_class_hash = "0x0"
abi = "manifests/dev/base/abis/contracts/flippyflop-actions-4407e5f5.json"
reads = []
Expand Down
4 changes: 2 additions & 2 deletions manifests/dev/deployment/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -1311,8 +1311,8 @@
{
"kind": "DojoContract",
"address": "0x2728baa5c7de0dc4b2fd20d71b76edcfb201924f45e11a52906e1fd22293dbd",
"class_hash": "0x1de3df6c300423e55bf5a88f48c84198e2966ea9e95f7f470998ac7c59dfa51",
"original_class_hash": "0x1de3df6c300423e55bf5a88f48c84198e2966ea9e95f7f470998ac7c59dfa51",
"class_hash": "0x28bb42a86e4a38914ce1642c6566b6a102de8549d1c66216ebedcbcd6c8e107",
"original_class_hash": "0x28bb42a86e4a38914ce1642c6566b6a102de8549d1c66216ebedcbcd6c8e107",
"base_class_hash": "0x2427dd10a58850ac9a5ca6ce04b7771b05330fd18f2e481831ad903b969e6b2",
"abi": [
{
Expand Down
4 changes: 2 additions & 2 deletions manifests/dev/deployment/manifest.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ manifest_name = "dojo-base"
[[contracts]]
kind = "DojoContract"
address = "0x2728baa5c7de0dc4b2fd20d71b76edcfb201924f45e11a52906e1fd22293dbd"
class_hash = "0x1de3df6c300423e55bf5a88f48c84198e2966ea9e95f7f470998ac7c59dfa51"
original_class_hash = "0x1de3df6c300423e55bf5a88f48c84198e2966ea9e95f7f470998ac7c59dfa51"
class_hash = "0x28bb42a86e4a38914ce1642c6566b6a102de8549d1c66216ebedcbcd6c8e107"
original_class_hash = "0x28bb42a86e4a38914ce1642c6566b6a102de8549d1c66216ebedcbcd6c8e107"
base_class_hash = "0x2427dd10a58850ac9a5ca6ce04b7771b05330fd18f2e481831ad903b969e6b2"
abi = "manifests/dev/deployment/abis/contracts/flippyflop-actions-4407e5f5.json"
reads = []
Expand Down
8 changes: 4 additions & 4 deletions src/systems/actions.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -54,17 +54,17 @@ mod actions {

let mut packed: u256 = 0_u256;
packed = packed | (address_bits & ADDRESS_BITMAP);
packed = packed | ((powerup_type * 16_u256) & 0xF0_u256);
packed = packed | (powerup_data & 0x0F_u256);
packed = packed | ((powerup_type * 256_u256) & 0xFF00_u256);
packed = packed | (powerup_data & 0x00FF_u256);

packed.try_into().unwrap()
}

fn unpack_flipped_data(flipped: felt252) -> (ContractAddress, PowerUp) {
let flipped_u256: u256 = flipped.into();
let address: felt252 = (flipped_u256 & ADDRESS_BITMAP).try_into().unwrap();
let powerup_type: felt252 = ((flipped_u256 & 0xF0_u256) / 16_u256).try_into().unwrap();
let powerup_data = flipped_u256 & 0x0F_u256;
let powerup_type: felt252 = ((flipped_u256 & 0xFF00_u256) / 256_u256).try_into().unwrap();
let powerup_data = flipped_u256 & 0x00FF_u256;

let powerup = match powerup_type {
0 => PowerUp::None,
Expand Down

0 comments on commit 1789153

Please sign in to comment.