Skip to content

Gallion-labs/gallion-guild-contracts

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Welcome to the Gallion Contracts!

⚠️ This project is currently in stand-by. ⚠️

Gallion brings together a set of tools for the management and animation of Discord guilds in the world of web3 games.

This repository contains all contracts used by guilds. These contracts are powered by the ERC20, ERC721 and ERC1155 standards. The contracts also implement the EIP-2535 Diamonds standard, which allows for modular upgradeability.

Deployed Contract Addresses

Gallion is not yet born, but it will appear on the Polygon sidechain.

  • Polygon Diamond Address: Coming soon!

Resources

Devs section

Note: The loupe functions in DiamondLoupeFacet.sol MUST be added to a diamond and are required by the EIP-2535 Diamonds standard.

Note: In this implementation the loupe functions are NOT gas optimized. The facets, facetFunctionSelectors, facetAddresses loupe functions are not meant to be called on-chain and may use too much gas or run out of gas when called in on-chain transactions. In this implementation these functions should be called by off-chain software like websites and Javascript libraries etc., where gas costs do not matter.

Installation

  1. Clone this repo:
git clone git@github.com:gallion-labs/gallion-contracts.git
  1. Install NPM packages:
cd diamond-1-hardhat
yarn

Deployment

npx hardhat run scripts/deploy.js

Run tests:

npx hardhat test

Calling Diamond Functions

In order to call a function that exists in a diamond you need to use the ABI information of the facet that has the function.

Here is an example that uses web3.js:

let myUsefulFacet = new web3.eth.Contract(MyUsefulFacet.abi, diamondAddress);

In the code above we create a contract variable so we can call contract functions with it.

In this example we know we will use a diamond because we pass a diamond's address as the second argument. But we are using an ABI from the MyUsefulFacet facet so we can call functions that are defined in that facet. MyUsefulFacet's functions must have been added to the diamond (using diamondCut) in order for the diamond to use the function information provided by the ABI of course.

Similarly you need to use the ABI of a facet in Solidity code in order to call functions from a diamond. Here's an example of Solidity code that calls a function from a diamond:

string result = MyUsefulFacet(address(diamondContract)).getResult()

About

Gallion guild smart contracts

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published