Skip to content

Commit

Permalink
Merge pull request #621 from AegirFinance/icrc2-swap
Browse files Browse the repository at this point in the history
Add Motoko ICRC2-Swap example
  • Loading branch information
sesi200 authored Nov 23, 2023
2 parents 5c6939d + 251651e commit abf2568
Show file tree
Hide file tree
Showing 22 changed files with 9,502 additions and 1 deletion.
30 changes: 30 additions & 0 deletions .github/workflows/motoko-icrc2-swap-example.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: motoko-icrc2-swap
on:
push:
branches:
- master
pull_request:
paths:
- motoko/icrc2-swap/**
- .github/workflows/provision-darwin.sh
- .github/workflows/provision-linux.sh
- .github/workflows/motoko-icrc2-swap-example.yaml
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
motoko-icrc2-swap-linux:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v1
- name: Provision Linux
env:
DFX_VERSION: 0.15.1
run: bash .github/workflows/provision-linux.sh
- name: Motoko ICRC2-Swap Linux
run: |
dfx start --background
pushd motoko/icrc2-swap
npm install
sleep 10
make test
3 changes: 2 additions & 1 deletion motoko/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ These examples show the Motoko language as a backend language for the IC, operat
- [`quicksort`](https://github.com/dfinity/examples/tree/master/motoko/quicksort) -- sorting an array, via Quick Sort, in Motoko.
- [`simple-to-do`](https://github.com/dfinity/examples/tree/master/motoko/simple-to-do) -- CRUD-like demo service, sans a front end; see also: `phone-book` and `superheroes`.
- [`calc`](https://github.com/dfinity/examples/tree/master/motoko/calc) -- more advanced version of `counter` demo.
- [`icrc2-swap`](https://github.com/dfinity/examples/tree/master/motoko/icrc2-swap) -- deposit, swap, and withdraw two ICRC-2 tokens.

## Minimal front end.

Expand All @@ -42,4 +43,4 @@ These examples use a "conventional" front end component (via `React.Component`).

## Security Considerations and Security Best Practices

If you base your application on one of these examples, we recommend you familiarize yourself with and adhere to the [Security Best Practices](https://internetcomputer.org/docs/current/references/security/) for developing on the Internet Computer. The examples provided here may not implement all the best practices.
If you base your application on one of these examples, we recommend you familiarize yourself with and adhere to the [Security Best Practices](https://internetcomputer.org/docs/current/references/security/) for developing on the Internet Computer. The examples provided here may not implement all the best practices.
34 changes: 34 additions & 0 deletions motoko/icrc2-swap/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Various IDEs and Editors
.vscode/
.idea/
**/*~

# Mac OSX temporary files
.DS_Store
**/.DS_Store

# dfx temporary files
.dfx/

# rust
target/

# environment variables
.env

# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# yarn cache
.yarn/cache

# misc
scratch/

# Jest test stuff
coverage/
src/declarations
3 changes: 3 additions & 0 deletions motoko/icrc2-swap/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.dfx/
coverage/
src/declarations/
3 changes: 3 additions & 0 deletions motoko/icrc2-swap/.prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"plugins": ["prettier-plugin-motoko"]
}
6 changes: 6 additions & 0 deletions motoko/icrc2-swap/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.PHONY: test

test:
./test/deploy.sh
dfx generate
npm run test
Loading

0 comments on commit abf2568

Please sign in to comment.