Skip to content

Commit

Permalink
v0.7.0-alpha.0
Browse files Browse the repository at this point in the history
  • Loading branch information
notV4l committed May 2, 2024
1 parent 474060d commit 8357db0
Show file tree
Hide file tree
Showing 11 changed files with 7,455 additions and 80 deletions.
4 changes: 2 additions & 2 deletions Scarb.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ version = 1
[[package]]
name = "dojo"
version = "0.6.0"
source = "git+https://github.com/dojoengine/dojo?tag=v0.6.1-alpha.1#9a814ad59b3855bf8f3bbdeefe13c407cf4edf87"
source = "git+https://github.com/dojoengine/dojo?tag=v0.7.0-alpha.0#2b2dc1bf35e4568bda7341f17267a931b49148b0"
dependencies = [
"dojo_plugin",
]
Expand All @@ -25,7 +25,7 @@ dependencies = [
[[package]]
name = "token"
version = "0.0.0"
source = "git+https://github.com/notV4l/origami?branch=erc_without_events#87f4b046791616d40cca168b821682bf14df29bb"
source = "git+https://github.com/dojoengine/origami?tag=v0.7.0-alpha.0#53c06b6a32d0d715a265b2a5d290f333b8c000f9"
dependencies = [
"dojo",
]
35 changes: 17 additions & 18 deletions Scarb.toml
Original file line number Diff line number Diff line change
@@ -1,23 +1,18 @@
[package]
cairo-version = "2.4.0"
cairo-version = "2.5.4"
name = "rollyourown"
version = "0.1.0"

[cairo]
sierra-replace-ids = true

[dependencies]
dojo = {git = "https://github.com/dojoengine/dojo", tag = "v0.6.1-alpha.1"}
# dojo = {git = "https://github.com/dojoengine/dojo", tag = "v0.6.1-alpha.1-alpha.13"}
# token = { git = "https://github.com/dojoengine/origami", tag = "v0.6.1-alpha.1-alpha.10" }
token = { git = "https://github.com/notV4l/origami", branch = "erc_without_events" }
dojo = {git = "https://github.com/dojoengine/dojo", tag = "v0.7.0-alpha.0"}
token = { git = "https://github.com/dojoengine/origami", tag = "v0.7.0-alpha.0"}


[scripts]

aaa="./scripts/test.sh"
bbb="AAA=aaaValue && scarb run aaa $AAA"

#
katana = "katana --disable-fee --invoke-max-steps 2000000"
build = "sozo build && scarb run gendojo"
Expand All @@ -32,20 +27,23 @@ auth = "./scripts/default_auth.sh"
migrate = "PROFILE=dev && sozo -P $PROFILE build && sozo -P $PROFILE migrate apply && scarb run copy_manifest $PROFILE && scarb run gendojo $PROFILE && scarb run auth $PROFILE"
migrate_ryo420 = "PROFILE=ryo420 && sozo -P $PROFILE build && sozo -P $PROFILE migrate apply && scarb run copy_manifest $PROFILE && scarb run gendojo $PROFILE && scarb run auth $PROFILE"
# migrate_ryo421 = "PROFILE=ryo421 && sozo -P $PROFILE build && sozo -P $PROFILE migrate apply && scarb run copy_manifest $PROFILE && scarb run gendojo $PROFILE && scarb run auth $PROFILE"
migrate_sepolia = "PROFILE=ryosepolia && sozo -P $PROFILE build && sozo -P $PROFILE migrate apply && scarb run copy_manifest $PROFILE && scarb run gendojo $PROFILE && scarb run auth $PROFILE"

migrateplan_sepolia = "PROFILE=ryosepolia && sozo -P $PROFILE build && sozo -P $PROFILE migrate plan --name ryo000"
migrate_sepolia = "PROFILE=ryosepolia && sozo -P $PROFILE build && sozo -P $PROFILE migrate apply --name ryo000 --fee-estimate-multiplier 5 && scarb run copy_manifest $PROFILE"
auth_sepolia = "PROFILE=ryosepolia && scarb run auth $PROFILE"

# slot ryo420
slot_ryo420_katana="slot d create ryo420 katana --seed 420 --version v0.6.1-alpha.1 --chain-id KATANA_SLOT_420 --disable-fee true --invoke-max-steps 2000000"
slot_ryo420_torii="slot d create ryo420 torii --rpc https://api.cartridge.gg/x/ryo420/katana -s 0 --version v0.6.1-alpha.1 --world 0x3bf84ccc82282acd4c8afbb843c9e864bf1e0770fba607595104202b938b7a4"
slot_ryo420_katana="slot d create ryo420 katana --seed 420 --version v0.7.0-alpha.0 --chain-id KATANA_SLOT_420 --disable-fee true --invoke-max-steps 2000000"
slot_ryo420_torii="slot d create ryo420 torii --rpc https://api.cartridge.gg/x/ryo420/katana -s 0 --version v0.7.0-alpha.0 --world 0x3bf84ccc82282acd4c8afbb843c9e864bf1e0770fba607595104202b938b7a4"

# # slot ryo421
# slot_ryo421_katana="slot d create ryo421 katana --seed 421 --version v0.6.1-alpha.1 --chain-id KATANA_SLOT_421 --disable-fee true --invoke-max-steps 2000000"
# slot_ryo421_torii="slot d create ryo421 torii --rpc https://api.cartridge.gg/x/ryo421/katana -s 0 --version v0.6.1-alpha.1 --world 0x3bf84ccc82282acd4c8afbb843c9e864bf1e0770fba607595104202b938b7a4"
# slot_ryo421_katana="slot d create ryo421 katana --seed 421 --version v0.7.0-alpha.0 --chain-id KATANA_SLOT_421 --disable-fee true --invoke-max-steps 2000000"
# slot_ryo421_torii="slot d create ryo421 torii --rpc https://api.cartridge.gg/x/ryo421/katana -s 0 --version v0.7.0-alpha.0 --world 0x3bf84ccc82282acd4c8afbb843c9e864bf1e0770fba607595104202b938b7a4"

# slot ryo_sepolia
slot_ryosepolia_torii="slot d create ryosepolia torii --rpc https://api.cartridge.gg/x/ryo421/katana -s 0 --version v0.6.1-alpha.1 --world 0x3bf84ccc82282acd4c8afbb843c9e864bf1e0770fba607595104202b938b7a4"

slot_ryosepolia_torii="slot d create ryosepolia torii --rpc https://api.cartridge.gg/rpc/starknet-sepolia -s 63200 --version v0.7.0-alpha.0 --world 0x45d3b72e3c6c85c38d43798b9751817f14fac4b14c3645480683f8fae1c6464"
# slot_ryosepolia_torii="slot d create ryosepolia torii --rpc https://free-rpc.nethermind.io/sepolia-juno -s 63260 --version v0.7.0-alpha.0 --world 0x45d3b72e3c6c85c38d43798b9751817f14fac4b14c3645480683f8fae1c6464"


[profile.dev.tool.dojo.env]
rpc_url = "http://localhost:5050"
Expand All @@ -63,10 +61,11 @@ private_key = "0x2f9a2435c3195dfa3c2f8290de5347e0da48193fd6d6d80320f0201a0964b8c
# private_key = "0x784b1dd14d761c414c6394fccca3ca1d1b0cac187e88122e4b06378f9e8c515"

[profile.ryosepolia.tool.dojo.env]
# world_address= "0x45d3b72e3c6c85c38d43798b9751817f14fac4b14c3645480683f8fae1c6464"
rpc_url = "https://api.cartridge.gg/rpc/starknet-sepolia"
# account_address = "0x7d806fc9478c73c60fac37c27888771bdb3092c21eb93452277e7673954d034"
# private_key = "0x784b1dd14d761c414c6394fccca3ca1d1b0cac187e88122e4b06378f9e8c515"

account_address = "0x3677d8443f74dcc6cd23c4b3f217256c70f084ee7edc4ddc431af2ce91eb936"
keystore_path = "/Users/boo/sozo_acc"
# password = "sozo_acc"

# [profile.prod.tool.dojo.env]
# rpc_url = "https://api.cartridge.gg/x/ryo420/katana"
Expand Down
1 change: 0 additions & 1 deletion scripts/copy_manifest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ else
export PROFILE="dev"
fi

# TODO use ./target/[profile]
mkdir -p ./web/src/manifests/$PROFILE
cp ./manifests/$PROFILE/manifest.json ./web/src/manifests/$PROFILE/manifest.json

Expand Down
23 changes: 13 additions & 10 deletions scripts/default_auth.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,21 @@ else
export PROFILE="dev"
fi

TX_SLEEP=0.5
TX_SLEEP=1

export WORLD_ADDRESS=$(cat ./manifests/dev/manifest.json | jq -r '.world.address')
export WORLD_ADDRESS=$(cat ./manifests/$PROFILE/manifest.json | jq -r '.world.address')

export RYO_ADDRESS=$(cat ./manifests/dev/manifest.json | jq -r '.contracts[] | select(.name == "rollyourown::systems::ryo::ryo" ).address')
export CONFIG_ADDRESS=$(cat ./manifests/dev/manifest.json | jq -r '.contracts[] | select(.name == "rollyourown::config::config::config" ).address')
export GAME_ADDRESS=$(cat ./manifests/dev/manifest.json | jq -r '.contracts[] | select(.name == "rollyourown::systems::game::game" ).address')
export RYO_ADDRESS=$(cat ./manifests/$PROFILE/manifest.json | jq -r '.contracts[] | select(.name == "rollyourown::systems::ryo::ryo" ).address')
export CONFIG_ADDRESS=$(cat ./manifests/$PROFILE/manifest.json | jq -r '.contracts[] | select(.name == "rollyourown::config::config::config" ).address')
export GAME_ADDRESS=$(cat ./manifests/$PROFILE/manifest.json | jq -r '.contracts[] | select(.name == "rollyourown::systems::game::game" ).address')

export PAPER_MOCK_ADDRESS=$(cat ./manifests/dev/manifest.json | jq -r '.contracts[] | select(.name == "rollyourown::_mocks::paper_mock::paper_mock" ).address')
export PAPER_MOCK_ADDRESS=$(cat ./manifests/$PROFILE/manifest.json | jq -r '.contracts[] | select(.name == "rollyourown::_mocks::paper_mock::paper_mock" ).address')

export TREASURY_ADDRESS="0xe29882a1fcba1e7e10cad46212257fea5c752a4f9b1b1ec683c503a2cf5c8a";
# dev/katana
# export TREASURY_ADDRESS="0xe29882a1fcba1e7e10cad46212257fea5c752a4f9b1b1ec683c503a2cf5c8a";

# sepolia deployer
export TREASURY_ADDRESS="0x3677d8443f74dcc6cd23c4b3f217256c70f084ee7edc4ddc431af2ce91eb936";

echo "---------------------------------------------------------------------------"
echo profile : $PROFILE
Expand All @@ -31,8 +35,9 @@ echo game : $GAME_ADDRESS
echo paper : $PAPER_MOCK_ADDRESS
echo "---------------------------------------------------------------------------"


# enable system -> models authorizations
sozo -P $PROFILE auth grant --world $WORLD_ADDRESS --wait writer\
sozo -P $PROFILE auth grant --world $WORLD_ADDRESS --fee-estimate-multiplier 5 --wait writer\
RyoConfig,$RYO_ADDRESS \
RyoAddress,$RYO_ADDRESS \
Leaderboard,$RYO_ADDRESS \
Expand All @@ -48,7 +53,6 @@ sozo -P $PROFILE auth grant --world $WORLD_ADDRESS --wait writer\
Leaderboard,$GAME_ADDRESS \



# remove later
sozo -P $PROFILE auth grant --world $WORLD_ADDRESS --wait writer\
ERC20MetadataModel,$PAPER_MOCK_ADDRESS \
Expand All @@ -57,7 +61,6 @@ sozo -P $PROFILE auth grant --world $WORLD_ADDRESS --wait writer\
InitializableModel,$PAPER_MOCK_ADDRESS \



echo "Default authorizations have been successfully set."

echo "Initializing..."
Expand Down
12 changes: 0 additions & 12 deletions scripts/test.sh

This file was deleted.

30 changes: 14 additions & 16 deletions src/_mocks/paper_mock.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ trait IPaperMock<TState> {
fn world(self: @TState,) -> IWorldDispatcher;

// IUpgradeable
fn upgrade(self: @TState, new_class_hash: ClassHash);
fn upgrade(ref self: TState, new_class_hash: ClassHash);

// IERC20Metadata
fn decimals(self: @TState,) -> u8;
Expand All @@ -22,23 +22,23 @@ trait IPaperMock<TState> {

// IERC20Balance
fn balance_of(self: @TState, account: ContractAddress) -> u256;
fn transfer(self: @TState, recipient: ContractAddress, amount: u256) -> bool;
fn transfer(ref self: TState, recipient: ContractAddress, amount: u256) -> bool;
fn transfer_from(
self: @TState, sender: ContractAddress, recipient: ContractAddress, amount: u256
ref self: TState, sender: ContractAddress, recipient: ContractAddress, amount: u256
) -> bool;

// IERC20BalanceCamel
fn balanceOf(self: @TState, account: ContractAddress) -> u256;
fn transferFrom(
self: @TState, sender: ContractAddress, recipient: ContractAddress, amount: u256
ref self: TState, sender: ContractAddress, recipient: ContractAddress, amount: u256
) -> bool;

// IERC20Allowance
fn allowance(self: @TState, owner: ContractAddress, spender: ContractAddress) -> u256;
fn approve(self: @TState, spender: ContractAddress, amount: u256) -> bool;
fn approve(ref self: TState, spender: ContractAddress, amount: u256) -> bool;

// WITHOUT INTERFACE !!!
fn initializer(self: @TState);
fn initializer(ref self: TState);
fn dojo_resource(self: @TState,) -> felt252;
}

Expand All @@ -49,17 +49,17 @@ trait IPaperMock<TState> {
///
#[starknet::interface]
trait IPaperMockInitializer<TState> {
fn initializer(self: @TState);
fn initializer(ref self: TState);
}

#[starknet::interface]
trait IPaperMockFaucet<TState> {
fn faucet(self: @TState);
fn faucetTo(self: @TState,recipient: ContractAddress);
fn faucet(ref self: TState,);
fn faucetTo(ref self: TState, recipient: ContractAddress);
}


#[dojo::contract]
#[dojo::contract(allow_ref_self)]
mod paper_mock {
use integer::BoundedInt;
use starknet::ContractAddress;
Expand Down Expand Up @@ -160,7 +160,7 @@ mod paper_mock {

#[abi(embed_v0)]
impl PaperMockInitializerImpl of super::IPaperMockInitializer<ContractState> {
fn initializer(self: @ContractState) {
fn initializer(ref self: ContractState) {
assert(
self.world().is_owner(get_caller_address(), get_contract_address().into()),
Errors::CALLER_IS_NOT_OWNER
Expand All @@ -169,7 +169,7 @@ mod paper_mock {
self.erc20_metadata.initialize('fPAPER', 'fPAPER', 18);
self.erc20_mintable.mint(get_caller_address(), 10_000);

// self.initializable.initialize(); // <-- error
self.initializable.initialize();
}
}

Expand All @@ -179,14 +179,12 @@ mod paper_mock {

const ETHER: u256 = 1_000_000_000_000_000_000;

use debug::PrintTrait;

#[abi(embed_v0)]
impl PaperMockFaucetImpl of super::IPaperMockFaucet<ContractState> {
fn faucet(self: @ContractState) {
fn faucet(ref self: ContractState) {
self.erc20_mintable.mint(get_caller_address(), 10_000 * ETHER);
}
fn faucetTo(self: @ContractState, recipient: ContractAddress) {
fn faucetTo(ref self: ContractState, recipient: ContractAddress) {
self.erc20_mintable.mint(recipient, 10_000 * ETHER);
}
}
Expand Down
7 changes: 3 additions & 4 deletions web/src/components/layout/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,13 @@ export const Header = observer(({ back }: HeaderProps) => {
fontSize={["14px", "16px"]}
>
<HStack gap={3} flex="1" /*justify={["left", "right"]}*/>
{/* {isAdmin && ( )} */}
{!isMobile && (
<>
<Burners />
<Predeployed />
<ChainSelector canChange={!gameId} />
</>

)}

{/* {!gameId && account && (
<Card h="48px" p={2} display="flex" justifyContent="center">
Expand All @@ -64,10 +64,9 @@ export const Header = observer(({ back }: HeaderProps) => {

{!gameId && <ClaimReward />}
{!gameId && <OnGoingGames />}

</HStack>

{game && /*!game.gameOver ||*/ (true || router.asPath.includes("logs")) && (
{game && router.asPath.includes("logs") && (
<HStack flex={["auto", 1]} justify="center" width={["100%", "auto"]}>
<HStack
h="48px"
Expand Down
14 changes: 7 additions & 7 deletions web/src/dojo/abis/paperAbi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export const ABI = [
"name": "initializer",
"inputs": [],
"outputs": [],
"state_mutability": "view"
"state_mutability": "external"
}
]
},
Expand All @@ -85,7 +85,7 @@ export const ABI = [
"name": "faucet",
"inputs": [],
"outputs": [],
"state_mutability": "view"
"state_mutability": "external"
},
{
"type": "function",
Expand All @@ -97,7 +97,7 @@ export const ABI = [
}
],
"outputs": [],
"state_mutability": "view"
"state_mutability": "external"
}
]
},
Expand Down Expand Up @@ -283,7 +283,7 @@ export const ABI = [
"type": "core::bool"
}
],
"state_mutability": "view"
"state_mutability": "external"
},
{
"type": "function",
Expand All @@ -307,7 +307,7 @@ export const ABI = [
"type": "core::bool"
}
],
"state_mutability": "view"
"state_mutability": "external"
}
]
},
Expand Down Expand Up @@ -358,7 +358,7 @@ export const ABI = [
"type": "core::bool"
}
],
"state_mutability": "view"
"state_mutability": "external"
}
]
},
Expand Down Expand Up @@ -409,7 +409,7 @@ export const ABI = [
"type": "core::bool"
}
],
"state_mutability": "view"
"state_mutability": "external"
}
]
},
Expand Down
Loading

0 comments on commit 8357db0

Please sign in to comment.