Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

With flextesa #49

Open
wants to merge 22 commits into
base: master
Choose a base branch
from
Open
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: 1 addition & 1 deletion .env
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
EXCHANGE_TOKEN_STANDARD=FA12
LIGO_VERSION=0.9.0
LIGO_VERSION=0.24.0
4 changes: 2 additions & 2 deletions .github/workflows/master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ jobs:
run: sudo apt install git -y
- name: Install modules
run: yarn
- name: Run the ganache-cli in background
- name: Run the sandbox in background
run: ./ci/flextesa.sh
- name: Remove existing .env
run: rm .env
- name: Compile and test the contracts
run: yarn compile && yarn test
env:
EXCHANGE_TOKEN_STANDARD: ${{ matrix.standard }}
LIGO_VERSION: "0.9.0"
LIGO_VERSION: "0.24.0"
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ The solution consists of 6 types of contracts:

1. `Factory` - singleton used to deploy new TokenX-XTZ exchange pair;
2. `Dex` - contract for TokenX-XTZ pair exchanges;
3. `TTDex` - contract for TokenX-TokenY pair exchanges;
3. `Dex` - contract for TokenX-TokenY pair exchanges;
4. `Token` - FA token implementation.
5. `BakerRegistry` - bakery registrar.
6. `MetadataStorage` - contract to store and upgrade the shares token metadata.
Expand All @@ -26,7 +26,7 @@ The solution consists of 6 types of contracts:
|──────── main/ # the contracts to be compiled
|──────── partial/ # the code parts imported by main contracts
├── test/ # test cases
├── storage/ # initial storage for contract originations
├── storage_type/ # initial storage_type for contract originations
├── scripts/ # cli for dex/factory actions
├── test.md # cases covered by tests
├── README.md # current file
Expand All @@ -40,7 +40,7 @@ The solution consists of 6 types of contracts:

- Installed NodeJS (tested with NodeJS v12+)

- Installed Yarn (NPM isn't working properly with `[email protected]`)
- Installed Yarn

- Installed Ligo:

Expand Down
2 changes: 1 addition & 1 deletion ci/flextesa.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/bin/sh
yarn start-sandbox &
sleep 10
sleep 20
8 changes: 0 additions & 8 deletions contracts/main/BakerRegistry.ligo

This file was deleted.

38 changes: 38 additions & 0 deletions contracts/main/Dex.ligo
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#include "../partials/IDex.ligo"
#include "../partials/Utils.ligo"
#include "../partials/MethodFA2.ligo"
#include "../partials/MethodDex.ligo"
#include "../partials/Dex.ligo"

(* DexFA2 - Contract for exchanges for XTZ - FA2 token pair *)
function main(
const p : full_action_type;
const s : full_storage_type)
: full_return_type is
case p of
Use(params) -> call_dex(params, s)
| Transfer(params) -> call_token(ITransfer(params), 0n, s)
| Balance_of(params) -> call_token(IBalance_of(params), 2n, s)
| Update_operators(params) -> call_token(IUpdate_operators(params), 1n, s)
| BalanceAFA12(params) -> call_balance(IBalanceAFA12(params), 0n, s)
| BalanceBFA12(params) -> call_balance(IBalanceBFA12(params), 1n, s)
| BalanceAFA2(params) -> call_balance(IBalanceAFA2(params), 2n, s)
| BalanceBFA2(params) -> call_balance(IBalanceBFA2(params), 3n, s)
| Get_reserves(params) -> get_reserves(params, s)
| Close -> ((nil:list(operation)), close(s))
| SetBalanceFunction(params) ->
((nil:list(operation)),
if params.index > bal_func_count
then (failwith("Dex/wrong-index") : full_storage_type)
else set_balance_function(params.index, params.func, s))
| SetDexFunction(params) ->
((nil:list(operation)),
if params.index > dex_func_count
then (failwith("Dex/wrong-index") : full_storage_type)
else set_dex_function(params.index, params.func, s))
| SetTokenFunction(params) ->
((nil:list(operation)),
if params.index > token_func_count
then (failwith("Dex/wrong-index") : full_storage_type)
else set_token_function(params.index, params.func, s))
end
16 changes: 0 additions & 16 deletions contracts/main/DexFA12.ligo

This file was deleted.

Loading