Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: onchain crude matter #331

Open
wants to merge 9 commits into
base: v2-world-contracts
Choose a base branch
from

Conversation

Kooshaba
Copy link

@Kooshaba Kooshaba commented Nov 25, 2024

Goals

  • Crude lives entirely onchain and is auditable by players
  • Locations of Rifts and players mining Crude is shielded

Questions / Todos

  • Should I also create a Lens ERC721 as part of this?
  • Does Crude have an initial total supply of the token? In my mind it does not, the universe continues "minting" new tokens every time a Rift opens. We will have to modify the standard ERC20 contract to account for this.
  • How does a ship own Crude? By default we need an address to be the owner of any token. In the past I have deployed special contracts which can own tokens and can be controlled by the MUD World for this purpose. It is a bit expensive gas wise, but allows us to preserve the base functionality of ERC20.

Tables

	CrudeLift: // Deployable
		smartObjectId: "uint256"
		lensId: "uint256"
		startMiningTime: "uint256"
		miningRiftId: "uint256"
	Lens:
		lensId: "uint256",
		durability: "uint256", // how many remaining blocks it can mine for
		exhausted: "bool",
	Rift: // Created by game server
		riftId: "uint256",
		createdAt: "uint256",
		crudeAmount: "uint256",

High Level Flow

  • Game Server creates onchain rifts with a specific amount of Crude in them
    • This mints a Crude token at the moment of creation, but is owned by the World itself
    • This allows players to check the current total supply and inflation of Crude at any moment
    • No location onchain. Location is shielded by the game server until we can figure out a purely onchain solution.
  • Player mints a Lens
    • Goes into their Ship inventory
    • Mint time is recorded in order to track expiry (TODO)
  • Player create a Crude Lift
    • Object used to initiate the mining of a Rift
  • Player deploys Crude Lift at a Rift
    • Inserts their Lens into Crude Lift inventory
    • Initiates mining
    • At the moment a Lens starts mining, onchain data related to its durability is updated. Lens durability is stored in a separate table.
  • Player waits X blocks then:
    • Rift is depleted OR
    • Lens is broken (runs out of durability) OR
    • Player stops mining early OR
    • Lift is destroyed and mining stops
  • Crude Matter is deposited into the Crude Lift Inventory
  • Player withdraws Crude Matter into their Ship (TODO)

@Kooshaba Kooshaba requested a review from a team as a code owner November 25, 2024 01:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant