Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
rust 1.81.0
golang 1.22.0
2 changes: 2 additions & 0 deletions chains/solana/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
contracts/target
contracts/docker-target
87 changes: 87 additions & 0 deletions chains/solana/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
BIN_DIR = bin
export GOPATH ?= $(shell go env GOPATH)
export GO111MODULE ?= on
export ANCHOR_VERSION ?=v0.29.0
export ANCHOR_IMAGE ?= backpackapp/build:$(ANCHOR_VERSION)
export ANCHOR_BUILD_ARGS ?=
# Allow overriding the output directory for docker builds
TARGET_DIR ?= $(PWD)/contracts/target

.PHONY: projectserum_version
anchor_version:
@echo "${ANCHOR_VERSION}"

.PHONY: clippy
clippy:
cd ./contracts && cargo clippy -- -D warnings

.PHONY: gomods
gomods: ## Install gomods
go install github.com/jmank88/gomods@v0.1.3

.PHONY: gomodtidy
gomodtidy: gomods
gomods tidy

.PHONY: format-contracts
format-contracts:
cd ./contracts && cargo fmt && go fmt ./...

.PHONY: rust-tests
rust-tests:
cd ./contracts && cargo test

.PHONY: lint-go
lint-go:
golangci-lint --max-issues-per-linter 0 --max-same-issues 0 --color=always --exclude=dot-imports --timeout 15m --out-format checkstyle:golangci-lint-report.xml run

.PHONY: lint-go-fix
lint-go-fix:
golangci-lint --max-issues-per-linter 0 --max-same-issues 0 --color=always --exclude=dot-imports --timeout 15m run --verbose --fix

.PHONY: anchor-go-gen
anchor-go-gen:
rm -rf ./gobindings && cd ./contracts && anchor build && cd .. && ./scripts/anchor-go-gen.sh

.PHONY: rematch-ids
rematch-ids:
./scripts/rematch-ids.sh

.PHONY: reclaim-sol
reclaim-sol:
./scripts/reclaim-sol.sh

.PHONY: format
format:
go fmt ./... && cd ./contracts && cargo fmt

.PHONY: go-tests
go-tests:
go test -v ./... -json -covermode=atomic -coverpkg=./... -coverprofile=integration_coverage.txt 2>&1 | tee /tmp/gotest.log | gotestloghelper -ci=true -singlepackage=true -hidepassingtests=false -hidepassinglogs=false

.PHONY: build-contracts
build-contracts:
cd ./contracts && anchor build

# Note on CARGO_REGISTRIES_CRATES_IO_PROTOCOL=sparse
# Sparse index significantly speeds up dependency fetching, supposedly default in 1.70 but anchor build was still using a slow git download
.PHONY: docker-build-contracts
docker-build-contracts:
docker run --rm \
-v $(shell pwd)/contracts:/workdir \
-v ${TARGET_DIR}:/workdir/target \
-e CARGO_TARGET_DIR=/workdir/target \
-e CARGO_REGISTRIES_CRATES_IO_PROTOCOL=sparse \
${ANCHOR_IMAGE} anchor build ${ANCHOR_BUILD_ARGS}

.PHONY: docker-update-contracts
docker-update-contracts:
docker run --rm \
-v $(shell pwd)/contracts:/workdir \
-v ${TARGET_DIR}:/workdir/target \
-e CARGO_TARGET_DIR=/workdir/target \
-e CARGO_REGISTRIES_CRATES_IO_PROTOCOL=sparse \
${ANCHOR_IMAGE} anchor keys sync

.PHONY: solana-checks
solana-checks: clippy anchor-go-gen format gomodtidy lint-go rust-tests go-tests build-contracts
24 changes: 24 additions & 0 deletions chains/solana/contracts/Anchor.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
[toolchain]
anchor_version = "0.29.0"

[features]
seeds = false
skip-lint = false

[programs.devnet]
failing_receiver = "Dri11EwVRViqqkjs7SWV3d3ejcanBGMNrcGhD6HVn756"
firedrill_compound = "Dri11NnBPbx85w8a47ZXBZa3Hi7E2xvHAA9Xpyk7UivQ"
firedrill_entrypoint = "Dri11c6TXJXELaZUgQtyw3doxbn7bGXQ6z5LRZ8bMPbc"
firedrill_feequoter = "3d1KhA6K2L6pbzpuhYGHTcsj1B4f3r86wJRE81brYTQW"
firedrill_offramp = "Dri11kiWR5f1oTn5NLm3wmfaDq3cYauR92wrsTxNaudt"
firedrill_token = "Dri11r4S1hY8iMpxNh6UoYZ9hsGgmGUUyZ3zxUb2rpc2"

[registry]
url = "https://api.apr.dev"

[provider]
cluster = "Devnet"
wallet = "/Users/bukata/.config/solana/id.json"

[scripts]
test = "yarn run ts-mocha -p ./tsconfig.json -t 1000000 tests/**/*.ts"
Loading