bibliothecadao / realms-contracts Goto Github PK
View Code? Open in Web Editor NEWRealms Monorepo for Ethereum contracts and Starknet contracts.
Home Page: https://bibliothecadao.xyz/
License: MIT License
Realms Monorepo for Ethereum contracts and Starknet contracts.
Home Page: https://bibliothecadao.xyz/
License: MIT License
Baseline happiness is 100 up to 150 down to 50
industry starts at 25
food and culture start at 10
10 pop is supported by 1 food/culture
industry 23 hour cooldown from use
reduce starting population from 1000 to 100
reduce the population supported by 1 culture or food from 100 to 10
replace "Farms" with "Farm"
change to: let population = 1000 + (RealmBuildings.Housing * 75) + (RealmBuildings.Hamlet * 35) + (RealmBuildings.Farm* 10)
load_troop_costs
The function is throwing an error when more than 1 troop is built. Suspect it is due to the loop of the struct.
I'd like to propose a pattern:
State contracts shouldn't have any externally callable (@external
) state modifying functions; state modification should happen only through functions in Logic modules. The Logic modules should import
internal state modifying function and call them directly and not invoke State functions via interfaces (like in this example).
TBH I just came up with the idea while doing a code review, so I haven't fully though it through but I'd like to hear the opinions of others. Does it make sense? Is it limiting? Is it ๐ฉ ?
I started a Discussion #49 about a contract header template:
# Contract title
# Contract Description Line 1
# Contract Description Line 2
#
# License
Here are the files I didn't feel confident in writing the title/description for. It's 3 lines total so should be pretty straightforward:
database/Storage.cairo
interfaces/IStorage.cairo
interfaces/ixoroshiro.cairo
utils/library.cairo
L03_Buildings.cairo
S03_Buildings.cairo
L05_Wonders.cairo
S05_Wonders.cairo
Currently, upgrade_resource function will allow the upgrading of any resource.
It should revert if the attempted resource does not exist in the realm
For reasons that do not need much explanation, this repository will need a robust security policy.
Let's discuss and potentially bounty this out.
Change contract names to have no number as the beginning character
Docker container needs to be updated to include:
Once this is done we can set GitHub actions to run the protostar tests
Working on frontend integration of L2 contracts for testing Realms bridging and settling processes (and in future C&C and Loot distilling)- and the rest of the ecosystem (indexer, subgraphs etc) would require a shared Goerli (L1) deployment of the following (ideally with contracts verified on etherscan and referenced in the repo somewhere):
721 contracts
Bridging/staking contracts
Docker container needs to be updated to include:
Once this is done we can set GitHub actions to run the protostar tests
For technical users a CLI is the faster way to interact with the contracts, so we should embrace this and build a beautiful CLI tool for interacting with the game. This doubles as a quick interface to prototype changes as the game evolves.
Ability to stake and unstake multiple realms in one transaction
bin/compile needs to be updated to account for account contracts
As the project has developed we have narrowed down the most elegant way to manage the game modules.
The new structure is:
Core:
settling_game/modules/module_name/module_name.cairo
Library:
settling_game/modules/module_name/library.cairo
Currently, all new modules are following this pattern, however, the original modules have not been reformatted to this.
This task involves migrating/renaming the old modules into this new structure.
You will need to:
Resources must be claimed before upgrading, otherwise, an unfair boost is activated.
Upgrade Resource
Realm_id: 3
Resource_id: 1
Level: 1
https://goerli.voyager.online/event/184426_5_1
Build Building
Realm_id: 3
Building_id: 16
https://goerli.voyager.online/event/184202_9_2
Was a discussion about this.
Do we think this is the best path forward? IMO, I think it is for now as we will try to reuse as much of the OZ implementations as possible.
Perhaps we have a:
openzepplin submodule -> base OZ repo
realms_openzepplin -> imports OZ utils into custom implementations
Thoughts?
We have these magic constants flying around (example) representing module IDs. It's better to use an enum for them, something like:
namespace Modules:
const Settling = 1
const Resources = 2
end
I've noticed that the contracts in the settling game use Uint256
as a type for Realm token ID instead of the Cairo native felt
type. Do you think it would be possible to change the ID to a felt
?
The main benefit of adopting the use of felt
s is TX cost. I don't think we'll ever be doing any math operations on the token IDs, there's no need to use this type. A Uint256
uses 2 felts internally so the calldata size for a single ID doubles. I know this might still be a tiny saving in a single TX, but the token ID will be used in tons of places and if there's going to be tens of thousands (millions?) of players, in aggregate, through all the TXs, it's going to account for something, right?
For reference, this is how Starkware currently thinks about implementing TX fees.
I deployed a wallet and am trying to play the Realms settling game (mint realms) following the README.
The steps include commands like nile mint_realm
but the only realms-related commands I see are:
check_lords Check balance
check_realms Check realms balance
check_resources Check claimable resources
claim_resources Claim available resources
Let's leverage the power of StarkNets compute.
The current design requires the passing of currency and token reserves into the get_ functions. This is redundant since those values exist in the state and it is extra client calls. Proposing to:
Update to current functions
get_sell_price_with_royalty
get_buy_price_with_royalty
New functions
get_batch_buy_price_with_royalty
get_batch_sell_price_with_royalty
Needs a clearer explanation of how to launch the container.
Currently, it is nested in the settling game, but the container is relevant to the whole repo so it should be on the index readme.
Update event:
Combat_step.emit(attacking_id, defending_id, a, d, attack_type, hit_points)
Background
To continue community ownership over the protocol single-sided mechanisms will be put in place where stakers of Lords can earn interest on their deposits. This interest is calculated by the tribute generated from the protocol.
Tribute captured by the protocol
Half of this tribute should be allocated to the single-sided stakers, who should be rewarded per block according to their % of the total staked amount.
WIP branch: https://github.com/BibliothecaForAdventurers/realms-contracts/tree/fix/formatting
Here are some notes I jotted down. Please discuss if you have any ideas or know what to do.
constructor
receive function (if exists)
fallback function (if exists)
external
public
internal
private
IL01_Settling
get_happiness
with_attr error_message("COMBAT_LIBRARY: troop_id cannot be zero"):
assert_not_zero(troop_id)
end
with_attr error_message("COMBAT_LIBRARY: Invalid troop_id"):
assert_lt(troop_id, TroopId.SIZE)
end
time_left
impliescrypts:
Crypts_ERC721_Mintable.cairo
-> crypts_erc721_mintable.cairo
get_crypt_info
-> returns the raw felt, fetch_crypt_data
-> returns parsed data, naming could be betterrealms:
foo(realm_id, resource_id)
resources:
check_can_action
: again the owner+caller checkupgrade()
proposal to change s_realms to staked_realms
TroopId: const Watchman = 1
-> Watchman
since it's a const, should we put it in allcaps?I think it makes sense to keep the underscore and then combine it with CamelCase. e.g. L01_CamelCase. right now we are doing more akin to L01_Camel_Case.
Arbiter:
L01_Settling:
L06_Combat:
Crypts:
It has come to the point where we should spin out the AMM into its own specific repository to allow easy contribution from outside collaborators.
This would involve the following:
New blank repo made here - https://github.com/BibliothecaForAdventurers/ResourceSwap
Expected behavior of 'build_squad_from_troops_in_realm'
Actual behavior
View function is needed to see all troops on the Realm
To complete the marketplace the following is required:
Currently Crypts and Realms share 95% of code to stake/unstake.
Investigate how to abstract this for any future erc721s that will need to mint/stake and read packed data.
There are a few hundred minor automatic issues that need resolving.
For sanity checks, we need to clean these up so all new commits can be passed easily.
This is a good first issue for someone looking to jump into the codebase.
This will cap their production or increase their production
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.