Skip to content

Commit

Permalink
Add candy machine core program (metaplex-foundation#772)
Browse files Browse the repository at this point in the history
* Add candy core program

* Renamed directory to candy-machine-core

* Update doc

* Change program id

* Fix deprecated name

* Remove test folder from build

* Remove extra padding from hidden section

* Bump minor version

* Updated IDL

* Add information about the accout layout

* Tweak formatting

* Add instructions details

* Fix mint instruction account list

* Add features section

* Add note formatting

* Remove note formatting

* Typo

* removes anchor spl for compatability (metaplex-foundation#760)

* Fix typos

* Check if all config lines were added before mint

* Add timestamp as a seed for the index

* Remove unused dependency

* Add CI

* Better way to get items available

* Update yarn.lock

* Add test to yarn build

* Fix imports

* Build JS dependencies

* Add candy machine core dependencies

* Fix identation

* Add build for auction_house and candy_machine

* Building JS dependencies

* Exporting minter module

* Fix import path

* More import path fix

* Refactoring test files

* Use local variable

* Skip test during SDK build

* Remove padding from values

* Updated active project list

* Add note about hidden settings

* Update link to candy guard

* remove rent

* Version bump

* Improve CI script

* Fix JS dependencies

* Change output directory

* Fix files path

* Update spl-token version

* Downgrade spl-token

* Fix dependencies

* Change CI runner

Co-authored-by: Austin Adams <[email protected]>
Co-authored-by: Sammy <[email protected]>
  • Loading branch information
3 people authored Oct 6, 2022
1 parent 13c7b94 commit 03ad5bd
Show file tree
Hide file tree
Showing 76 changed files with 9,443 additions and 46 deletions.
5 changes: 5 additions & 0 deletions .base-ammanrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ const programs = {
programId: 'hyDQ4Nz1eYyegS6JfenyKwKzYxRsCWCriYSAjtzP4Vg',
deployPath: localDeployPath('mpl_hydra'),
},
candy_machine_core: {
label: "Candy Machine Core",
programId: 'CndyV3LdqHUfDLmE5naZjVN8rBZz4tqhdefbAnjHG3JR',
deployPath: localDeployPath('mpl_candy_machine_core'),
},
};

const validator = {
Expand Down
16 changes: 16 additions & 0 deletions .github/actions/build-candy-machine-core/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Implicit dependencies
# - actions/checkout@v2
# - ./.github/actions/install-linux-build-deps
# - ./.github/actions/install-solana
# - ./.github/actions/install-rust

name: Build Candy Machine Core
runs:
using: 'composite'
steps:
- name: build-candy-machine-core
working-directory: ./candy-machine-core/program
run: |
cargo +${{ env.RUST_STABLE }} build-bpf --version
cargo +${{ env.RUST_STABLE }} build-bpf --bpf-out-dir ../../test-programs/
shell: bash
28 changes: 28 additions & 0 deletions .github/actions/yarn-install-and-build/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,14 @@ inputs:
description: If true it will build the token_metadata package
required: false
default: false
build_auction_house:
description: If true it will build the auction_house package before running checks
required: false
default: false
build_candy_machine:
description: If true it will build the candy_machine package before running checks
required: false
default: false

runs:
using: composite
Expand Down Expand Up @@ -53,6 +61,26 @@ runs:
working-directory: ./token-metadata/js
shell: bash

- name: Install and Build auction-house
if: inputs.build_auction_house == 'true'
run: |
echo 'Install and Build auction-house: yarn install'
yarn install
echo 'Install and Build auction-house: yarn build'
yarn build
working-directory: ./auction-house/js
shell: bash

- name: Install and Build candy-machine
if: inputs.build_candy_machine == 'true'
run: |
echo 'Install and Build candy-machine: yarn install'
yarn install
echo 'Install and Build candy-machine: yarn build'
yarn build
working-directory: ./candy-machine/js
shell: bash

##############
# Build Contract
##############
Expand Down
29 changes: 29 additions & 0 deletions .github/actions/yarn-install-and-verify/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,15 @@ inputs:
description: If true it will build the token_metadata package before running checks
required: false
default: false
build_auction_house:
description: If true it will build the auction_house package before running checks
required: false
default: false
build_candy_machine:
description: If true it will build the candy_machine package before running checks
required: false
default: false


runs:
using: composite
Expand Down Expand Up @@ -57,6 +66,26 @@ runs:
working-directory: ./token-metadata/js
shell: bash

- name: Install and Build auction-house
if: inputs.build_auction_house == 'true'
run: |
echo 'Install and Build auction-house: yarn install'
yarn install
echo 'Install and Build auction-house: yarn build'
yarn build
working-directory: ./auction-house/js
shell: bash

- name: Install and Build candy-machine
if: inputs.build_candy_machine == 'true'
run: |
echo 'Install and Build candy-machine: yarn install'
yarn install
echo 'Install and Build candy-machine: yarn build'
yarn build
working-directory: ./candy-machine/js
shell: bash

##############
# Verify Contract
##############
Expand Down
90 changes: 90 additions & 0 deletions .github/workflows/integration-candy-machine-core.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
name: Integration Candy Machine Core

on:
push:
branches: [master]
pull_request:
branches: [master]

env:
CARGO_TERM_COLOR: always
SOLANA_VERSION: 1.10.35
RUST_TOOLCHAIN: stable

jobs:
changes:
runs-on: buildjet-4vcpu-ubuntu-2004
# Set job outputs to values from filter step
outputs:
core: ${{ steps.filter.outputs.core }}
package: ${{ steps.filter.outputs.package }}
workflow: ${{ steps.filter.outputs.workflow }}
steps:
- uses: actions/checkout@v2
# For pull requests it's not necessary to checkout the code
- uses: dorny/paths-filter@v2
id: filter
with:
filters: |
core:
- 'core/**'
package:
- 'candy-machine-core/**'
workflow:
- '.github/workflows/integration-candy-machine-core.yml'
build-and-integration-test-candy-machine-core:
runs-on: buildjet-4vcpu-ubuntu-2004
env:
cache_id: program-candy-machine-core
needs: changes
if: ${{ needs.changes.outputs.core == 'true' || needs.changes.outputs.package == 'true' || needs.changes.outputs.workflow == 'true' }}
steps:
# Setup Deps
- uses: actions/checkout@v2
- uses: ./.github/actions/install-linux-build-deps
- uses: ./.github/actions/install-solana
with:
solana_version: ${{ env.SOLANA_VERSION }}
- uses: ./.github/actions/install-rust
with:
toolchain: ${{ env.RUST_TOOLCHAIN }}

# Restore Cache from previous build/test
- uses: actions/cache@v2
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
./rust/target
key: ${{ env.cache_id }}-${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}-${{ env.RUSTC_HASH }}

# Build Rust Program
- uses: ./.github/actions/build-candy-machine-core
- uses: ./.github/actions/build-token-metadata

# Install JS SDK deps
- uses: ./.github/actions/yarn-install-and-build
with:
cache_id: sdk-candy-machine-core
working_dir: ./candy-machine-core/js
build_token_metadata: true
build_auction_house: true
build_candy_machine: true

# Start local validator
- name: start-local-test-validator
working-directory: ./candy-machine-core/js
run: DEBUG=amman* yarn amman:start

# Run integration test
- name: run-integration-test
id: run_integration_test
working-directory: ./candy-machine-core/js
run: DEBUG=mpl* yarn test

# Stop local validator
- name: stop-local-test-validator
working-directory: ./candy-machine-core/js
run: yarn amman:stop
42 changes: 42 additions & 0 deletions .github/workflows/sdk-candy-machine-core.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: SDK Candy Machine Core

on:
push:
branches: [master]
pull_request:
branches: [master]

jobs:
changes:
runs-on: ubuntu-latest
# Set job outputs to values from filter step
outputs:
core: ${{ steps.filter.outputs.core }}
package: ${{ steps.filter.outputs.package }}
steps:
- uses: actions/checkout@v2
# For pull requests it's not necessary to checkout the code
- uses: dorny/paths-filter@v2
id: filter
with:
filters: |
core:
- 'core/js/**'
package:
- 'candy-machine-core/js/**'
build-lint-and-test-candy-machine-core:
needs: changes
if: ${{ needs.changes.outputs.core == 'true' || needs.changes.outputs.package == 'true' }}
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v1
- uses: ./.github/actions/yarn-install-and-verify
with:
cache_id: sdk-candy-machine-core
working_dir: ./candy-machine-core/js
skip_test: true
build_token_metadata: true
build_auction_house: true
build_candy_machine: true
2 changes: 1 addition & 1 deletion .prettierrc.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module.exports = {
bracketSpacing: true,
jsxBracketSameLine: false,
bracketSameLine: false,
jsxSingleQuote: true,
printWidth: 100,
proseWrap: "always",
Expand Down
1 change: 1 addition & 0 deletions auction-house/js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
},
"devDependencies": {
"@metaplex-foundation/solita": "^0.15.2",
"@solana/spl-token": "0.3.5",
"@types/tape": "^4.13.2",
"eslint": "^8.3.0",
"prettier": "^2.5.1",
Expand Down
2 changes: 1 addition & 1 deletion bubblegum/js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,4 @@
"typedoc": "^0.23.10",
"typescript": "^4.3.5"
}
}
}
8 changes: 8 additions & 0 deletions candy-machine-core/js/.ammanrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
'use strict';
// @ts-check
const base = require('../../.base-ammanrc.js');
const validator = {
...base.validator,
programs: [base.programs.candy_machine_core, base.programs.metadata],
};
module.exports = {validator};
1 change: 1 addition & 0 deletions candy-machine-core/js/.prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = require('../../.prettierrc');
16 changes: 16 additions & 0 deletions candy-machine-core/js/.solitarc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// @ts-check
const path = require('path');
const programDir = path.join(__dirname, '..', 'program');
const idlDir = path.join(__dirname, 'idl');
const sdkDir = path.join(__dirname, 'src', 'generated');
const binaryInstallDir = path.join(__dirname, '.crates');

module.exports = {
idlGenerator: 'anchor',
programName: 'candy_machine_core',
programId: 'CndyV3LdqHUfDLmE5naZjVN8rBZz4tqhdefbAnjHG3JR',
idlDir,
sdkDir,
binaryInstallDir,
programDir,
};
Loading

0 comments on commit 03ad5bd

Please sign in to comment.