Skip to content

Commit abf2568

Browse files
authored
Merge pull request #621 from AegirFinance/icrc2-swap
Add Motoko ICRC2-Swap example
2 parents 5c6939d + 251651e commit abf2568

22 files changed

+9502
-1
lines changed
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: motoko-icrc2-swap
2+
on:
3+
push:
4+
branches:
5+
- master
6+
pull_request:
7+
paths:
8+
- motoko/icrc2-swap/**
9+
- .github/workflows/provision-darwin.sh
10+
- .github/workflows/provision-linux.sh
11+
- .github/workflows/motoko-icrc2-swap-example.yaml
12+
concurrency:
13+
group: ${{ github.workflow }}-${{ github.ref }}
14+
cancel-in-progress: true
15+
jobs:
16+
motoko-icrc2-swap-linux:
17+
runs-on: ubuntu-20.04
18+
steps:
19+
- uses: actions/checkout@v1
20+
- name: Provision Linux
21+
env:
22+
DFX_VERSION: 0.15.1
23+
run: bash .github/workflows/provision-linux.sh
24+
- name: Motoko ICRC2-Swap Linux
25+
run: |
26+
dfx start --background
27+
pushd motoko/icrc2-swap
28+
npm install
29+
sleep 10
30+
make test

motoko/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ These examples show the Motoko language as a backend language for the IC, operat
2222
- [`quicksort`](https://github.com/dfinity/examples/tree/master/motoko/quicksort) -- sorting an array, via Quick Sort, in Motoko.
2323
- [`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`.
2424
- [`calc`](https://github.com/dfinity/examples/tree/master/motoko/calc) -- more advanced version of `counter` demo.
25+
- [`icrc2-swap`](https://github.com/dfinity/examples/tree/master/motoko/icrc2-swap) -- deposit, swap, and withdraw two ICRC-2 tokens.
2526

2627
## Minimal front end.
2728

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

4344
## Security Considerations and Security Best Practices
4445

45-
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.
46+
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.

motoko/icrc2-swap/.gitignore

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Various IDEs and Editors
2+
.vscode/
3+
.idea/
4+
**/*~
5+
6+
# Mac OSX temporary files
7+
.DS_Store
8+
**/.DS_Store
9+
10+
# dfx temporary files
11+
.dfx/
12+
13+
# rust
14+
target/
15+
16+
# environment variables
17+
.env
18+
19+
# Logs
20+
logs
21+
*.log
22+
npm-debug.log*
23+
yarn-debug.log*
24+
yarn-error.log*
25+
26+
# yarn cache
27+
.yarn/cache
28+
29+
# misc
30+
scratch/
31+
32+
# Jest test stuff
33+
coverage/
34+
src/declarations

motoko/icrc2-swap/.prettierignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.dfx/
2+
coverage/
3+
src/declarations/

motoko/icrc2-swap/.prettierrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"plugins": ["prettier-plugin-motoko"]
3+
}

motoko/icrc2-swap/Makefile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
.PHONY: test
2+
3+
test:
4+
./test/deploy.sh
5+
dfx generate
6+
npm run test

0 commit comments

Comments
 (0)