@sendgft/contracts
v1.33.0
Published
gft.xyz smart contracts
Downloads
145
Readme
gft.xyz Smart contracts.
These contracts use the Diamond Standard to allow for infinite size and upgradeability.
Note: IMaster.sol specifies a convenience interface combines all the different diamond facet interfaces into one - we recommend using this.
How to use
Install the package:
npm install @sendgft/contractsThe package exposes the following properties:
contracts- the key contracts JSON artifact contentsaddresses- contents ofdeployedAddresses.jsonevents- ABIs for events to listen for
Example
const ethers = require('ethers')
const { contracts, addresses } = require('@sendgft/contracts')
const contract = new ethers.Contract(
addresses.Gifter.chains[5].address, // goerli
contracts.IMaster.abi
)Development
Requirements:
- Node.js 14.18.0+
- Yarn 1.22.10+ (use
npm i -g yarnonce Node.js is installed)
Copy .env.sample to .env and fill in the values (available in our password vault).
Install dependencies:
yarnInitialize git submodules (for maker-otc trading engine):
git submodule init
git submodule updateFirst, run the dev network in a separate terminal:
yarn devnetCompile the contracts:
yarn compileSetup the deployment config (only need to run this once):
yarn setup-deploy-config:localNow deploy the contracts to it:
yarn deploy:localNow you can run the tests:
yarn testTo run a single test:
yarn test ./test/testName.jsTesting DEX integrations
To test the AvaxDex.sol integration with TraderJoe:
yarn compile
export MNEMONIC="..."
./scripts/testAvaxDex.jsNOTE: MNEMONIC should be set to your account's mnemonic. Ensure it has enough AVAX to deploy and interact with the DEX contract.
Deployments
We use the same wallet on every network to deploy from. Deployment always happens at the same wallet nonce so that our contract addresses are the same on every network.
The deployment script will check to ensure that the wallet nonce is at the expected number prior to deploying. Once the contracts are deployed on a given network, subsequent deployments will simply result in an upgrade call.
Goerli testnet
yarn setup-deploy-config:goerli
yarn deploy:goerliAvalanche mainnet
yarn setup-deploy-config:avalanche
yarn deploy:avalanchePublishing
Ensure you deploy the contracts first (see above) so that deployedAddresses.json is updated.
Commit the code and push the changes.
Then run:
yarn releaseGit Subtree
Note that the cards/** folder contents are populated using git subtree and the following repos:
cards/cells-cat-card= https://github.com/sendgft/cells-cat-card
License
MIT (see LICENSE.md)
