1.33.0 • Published 2 years ago

@sendgft/contracts v1.33.0

Weekly downloads
-
License
MIT
Repository
-
Last release
2 years ago

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/contracts

The package exposes the following properties:

  • contracts - the key contracts JSON artifact contents
  • addresses - contents of deployedAddresses.json
  • events - 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 yarn once Node.js is installed)

Copy .env.sample to .env and fill in the values (available in our password vault).

Install dependencies:

yarn

Initialize git submodules (for maker-otc trading engine):

git submodule init
git submodule update

First, run the dev network in a separate terminal:

yarn devnet

Compile the contracts:

yarn compile

Setup the deployment config (only need to run this once):

yarn setup-deploy-config:local

Now deploy the contracts to it:

yarn deploy:local

Now you can run the tests:

yarn test

To run a single test:

yarn test ./test/testName.js

Testing DEX integrations

To test the AvaxDex.sol integration with TraderJoe:

yarn compile
export MNEMONIC="..." 
./scripts/testAvaxDex.js

NOTE: 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:goerli

Avalanche mainnet

yarn setup-deploy-config:avalanche
yarn deploy:avalanche

Publishing

Ensure you deploy the contracts first (see above) so that deployedAddresses.json is updated.

Commit the code and push the changes.

Then run:

yarn release

Git Subtree

Note that the cards/** folder contents are populated using git subtree and the following repos:

License

MIT (see LICENSE.md)

1.29.0

2 years ago

1.27.0

2 years ago

1.32.0

2 years ago

1.30.0

2 years ago

1.30.1

2 years ago

1.26.0

2 years ago

1.28.0

2 years ago

1.33.0

2 years ago

1.31.0

2 years ago

1.19.0

2 years ago

1.17.2

2 years ago

1.18.0

2 years ago

1.21.0

2 years ago

1.22.0

2 years ago

1.21.1

2 years ago

1.20.0

2 years ago

1.25.0

2 years ago

1.22.3

2 years ago

1.25.1

2 years ago

1.23.0

2 years ago

1.22.1

2 years ago

1.24.0

2 years ago

1.22.2

2 years ago

1.17.1

2 years ago

1.17.0

2 years ago

1.16.0

2 years ago

1.15.0

2 years ago

1.14.1

2 years ago

1.13.2

2 years ago

1.14.0

2 years ago

1.13.1

2 years ago

1.13.0

2 years ago

1.12.0

2 years ago

1.14.2

2 years ago

1.9.1

2 years ago

1.9.0

2 years ago

1.8.1

2 years ago

1.11.0

2 years ago

1.10.1

2 years ago

1.10.0

2 years ago

1.8.0

2 years ago

1.7.0

2 years ago

1.6.0

2 years ago

1.5.0

2 years ago

1.4.0

2 years ago

1.3.0

2 years ago

1.2.0

2 years ago

1.1.0

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago