/SkyWeaver-contracts

SkyWeaver Ethereum contracts

Primary LanguageTypeScriptMIT LicenseMIT

This repository includes smart contracts that are specific to Skyweaver. These contracts depend on the ERC-1155 token implementation that can be found here.

Instructions

For testing

  1. yarn install
  2. yarn build
  3. yarn ganache
  4. (Different terminal) yarn test

SkyWeaver's Smart Contracts Environment

This is a overview of all the smart contracts in this repository.

1 Asset Contracts

SkyWeaverAssets.sol: Implementation of ERC-1155 that keeps track of all the users' Skyweaver asset balance and contains all the token functions. Assets can include cards, cosmetics, etc.

SkyweaverCurrencies.sol: Implementation of ERC-1155 that keeps track of all the users' Skyweaver currencies. Currencies could be Weave for example.

2 Asset Supply Manager

SWSupplyManager.sol: This contract controls the tokens minting permissions and supply parameters. The supply manager keeps track of which factory contract can which which token id and what if the maximum supply of a given token id, if any. Factories can be added or removed and they can be granted permissions to mint some token ids.

3. Factories

Factories are contracts that will submit minting request to the Asset Supply Manager. Factories contain the minting logic for different token ids.

SilverCardsFactory.sol: Allows players to purchase any silver card for a fixed price.

EternalHeroesFactory.sol: Allows players to purchase Eternal Heroes for a given price depending on its current price tier. The price of an Eternal Hero will increase every N copies sold, until the maximum supply is reached for that Eternal Hero.

WeaveFactory.sol: Allows owner of the factory to mint a given number of weave as a function of time. Curent target is to allow for 1m Weave to be mintable per week.

GoldCardsFactory.sol: Allows players to convert weave into a random gold card. Players first have to commit their weave (deposit) and have to mint the gold card in a subsequent transaction, after N blocks have passed. Anyone can execute the second transaction on behalf of a user.

SilverConquestFactory.sol: Allows players to burn silver cards or send ARC to Horizon in exchange for off-chain conquest entries. Horizon can only mint silver cards up to the amount of silver cards burnt and ARC recived. Since the value of these assets is low, the RNG is handled off-chain.

FreemintFactory.sol: Allows owner to mint any tokens within a given range. This factory will be used to mint communiy related assets, special even assets that are meant to be given away.