diff --git a/.readthedocs.yaml b/.readthedocs.yaml new file mode 100644 index 0000000..c1d136e --- /dev/null +++ b/.readthedocs.yaml @@ -0,0 +1,16 @@ +# .readthedocs.yaml +# Read the Docs configuration file +# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details +version: 2 + +build: + os: ubuntu-22.04 + tools: + python: "3.8" + +sphinx: + configuration: docs/source/conf.py + +python: + install: + - requirements: requirements-dev.txt diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 6c1c919..3d3f0d8 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -26,11 +26,12 @@ Please follow this steps: Banches names should reflect the type of change they bring. The examples below should fit most needs. -| **Change type** | Description | Name | -|-----------------|--------------------------------------------------------|----------------------------| -| **Feature** | For any feature that will be added to the project | `feature_` | -| **Fix** | For any bug fix on the project | `fix_` | -| **Refactor** | For any change that do not impact the functionnalities | `refactor_` | -| **Test** | For any test(s) that will be added to the project | `test_` | +| **Change type** | Description | Name | +|-------------------|--------------------------------------------------------|----------------------------| +| **Feature** | For any feature that will be added to the project | `feature_` | +| **Fix** | For any bug fix on the project | `fix_` | +| **Refactor** | For any change that do not impact the functionnalities | `refactor_` | +| **Test** | For any test(s) that will be added to the project | `test_` | +| **Documentation** | For any change in the documentation | `docs_` | Many thanks! :heart: :heart: :heart: diff --git a/README.md b/README.md index d71a92d..91ba0c3 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # MxOps -MxOps is a python package created to automate MultiversX smart contracts deployments, calls and querys. +MxOps is a python package created to automate MultiversX smart contracts deployments, calls and queries. Inspired from DevOps tools, it aims to ease and make reproductible any set of these interactions with smart-contracts. MxOps aims to be useful in these situations: diff --git a/docs/source/conf.py b/docs/source/conf.py index df4a1eb..caa29e0 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -29,16 +29,17 @@ # -- General configuration --------------------------------------------------- # https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration -extensions = ["myst_parser"] +extensions = [ + 'myst_parser', + 'sphinxcontrib.images', +] templates_path = ['_templates'] exclude_patterns = [] - # -- Options for HTML output ------------------------------------------------- # https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output html_theme = 'sphinx_rtd_theme' html_static_path = ['_static'] - diff --git a/docs/source/dev_documentation/changelog.md b/docs/source/dev_documentation/changelog.md index cda8279..c001849 100644 --- a/docs/source/dev_documentation/changelog.md +++ b/docs/source/dev_documentation/changelog.md @@ -14,6 +14,21 @@ - None +## 0.1.1 - 2023-01-24 + +### Added + +- Readthedocs yaml configuration file to fix compilation +- Full user tutorial in the sphinx documentation + +### Changed + +- None + +### Removed + +- None + ## 0.1.0 - 2023-01-23 First version of MxOps. diff --git a/docs/source/images/integration_test_contracts_map.svg b/docs/source/images/integration_test_contracts_map.svg new file mode 100644 index 0000000..de90065 --- /dev/null +++ b/docs/source/images/integration_test_contracts_map.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/docs/source/index.rst b/docs/source/index.rst index 175f48c..57bbff3 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -7,12 +7,14 @@ Welcome to MxOps |version| ! ========================================= You are in the MxOps documentation. Use the left-side pannel or the menu below to navigate where you want to go. -If you are new here, we recommand going first to the :doc:`user_documentation/overview` section and then to the :doc:`user_documentation/getting_started`. - +If you are new here, we recommand going first to the :doc:`user_documentation/overview` section and +then to the :doc:`user_documentation/getting_started`. +Otherwise, if you prefer to learn by example, the :doc:`user_documentation/tutorial` section is here for you! .. toctree:: :maxdepth: 2 :caption: User Documentation + :numbered: user_documentation/overview user_documentation/getting_started @@ -21,6 +23,7 @@ If you are new here, we recommand going first to the :doc:`user_documentation/ov user_documentation/steps user_documentation/values user_documentation/execution + user_documentation/tutorial .. toctree:: :maxdepth: 2 diff --git a/docs/source/user_documentation/overview.md b/docs/source/user_documentation/overview.md index de816d7..1fc4776 100644 --- a/docs/source/user_documentation/overview.md +++ b/docs/source/user_documentation/overview.md @@ -1,6 +1,6 @@ # Overview -MxOps is a python package created to automate MultiversX smart contracts deployments, calls and querys. +MxOps is a python package created to automate MultiversX smart contracts deployments, calls and queries. Inspired from DevOps tools, it aims to ease and make reproductible any set of these interactions with smart-contracts. MxOps aims to be useful in these situations: diff --git a/docs/source/user_documentation/scenario.md b/docs/source/user_documentation/scenario.md index 317a5de..1beb6b5 100644 --- a/docs/source/user_documentation/scenario.md +++ b/docs/source/user_documentation/scenario.md @@ -30,9 +30,13 @@ Where: - Network will be the name of chain used (MAIN, DEV, TEST or LOCAL) for the scenario - .json is the file where all the contract data of the executed scenario are stored -One important note: the files are kept after each executions. This means that you can reuse a `Scenario` and execute new `Scenes` in it. This is very usefull for incremental executions (deploy, upgrade...) or reccurent tasks (complexe claim/compound cycles for example) +```{note} +The files are kept after each executions. This means that you can reuse a `Scenario` and execute new `Scenes` in it. This is very usefull for incremental executions (deploy, upgrade...) or reccurent tasks (complexe claim/compound cycles for example) +``` -This also means that their name should be unique for all your projects. Otherwise you may encounter data collision. +```{warning} +This also means that `Scenario` names should be unique for all your projects. Otherwise you may encounter data collision. +``` ## Commands diff --git a/docs/source/user_documentation/steps.md b/docs/source/user_documentation/steps.md index 20d0afb..b299db3 100644 --- a/docs/source/user_documentation/steps.md +++ b/docs/source/user_documentation/steps.md @@ -42,8 +42,11 @@ esdt_transfers: # optional, ESDTs to send - token_identifier: LKMEX-e45d41 amount: 848491898 nonce: 721 +check_for_errors: True # optional, True by default ``` +`check_for_errors` is the parameter that tells`MxOps` to verify that the transaction went without errors. If an error is found, the execution will be stopped. In some use-cases, for example if you want to launch 100s of txs, you can deactivate this parameter for faster execution. + ## Contract Query Step This `Step` is used to fetch some data from a contract and save it locally for later use in the `Scenario` (specified at execution time). diff --git a/docs/source/user_documentation/tutorial.md b/docs/source/user_documentation/tutorial.md new file mode 100644 index 0000000..8bbdb4d --- /dev/null +++ b/docs/source/user_documentation/tutorial.md @@ -0,0 +1,562 @@ +# Tutorial + +This tutorial uses the smart-contracts and `Scenes` from `MxOps` [integration tests](https://github.com/Catenscia/MxOps/tree/main/integration_tests). + +This will guide you through every steps required to run a complete example with MxOps. After this tutorial, you will have learn to: + +- Automate deploiments +- Automate smart-contract setups +- Simulate user scenario + +In future version of `MxOps`, you will also be able to test queries and calls results. + +## Smart-Contracts + +To use `MxOps`, we first need some smart-contracts. We will create two of them: a simple contract that is in charge of minting a fungible ESDT and a contract that will act as a piggy bank that gives amazing interest returns. + +The image below is a map with the main interactions betweens these contracts and agents. (click on it for full view). +You will also find some explanation in the next two sections. + +```{thumbnail} ../images/integration_test_contracts_map.svg +``` + +```{warning} +DISCLAIMER: This should be obvious but these contracts are not meant to be use on real usecases as their designs are flawed for the tutorial purposes. +``` + +### EsdtMinter Contract + +This contract has three roles: + +- Issue a new token +- Allow airdrops to specific users +- Mint new tokens to pay the interests of the piggy-bank + +Don't hesitate to check the [source code](https://github.com/Catenscia/MxOps/tree/main/integration_tests/contracts/esdt-minter/src) for more details. + +### PiggyBank Contract + +A user can deposit a specific token in the bank. The only other action he can make is to withdraw them. At withdrawal, he will get back his principal and receive some interests in addition. + +Don't hesitate to check the [source code](https://github.com/Catenscia/MxOps/tree/main/integration_tests/contracts/piggy-bank/src) for more details. + +## Scenes + +Now that we home some smart-contracts, we can contructs some `Scenes`. +We will create a scenes folder at the root level of our smart-contract projet. Here is what our structure looks like: + +```bash +. +├── contracts/ +│ ├── esdt-minter +│ ├── piggy-bank +│ ├── tests +│ └── Cargo.toml +├── scenes +├── scripts +├── wallets/ +│ ├── alice.pem +│ ├── bob.pem +│ ├── devnet_owner.pem +│ └── devnet_user.pem +└── Cargo.toml +``` + +### Accounts + +We would like to execute our contracts on two chains: On the devnet to ensure everything will work flawlessly but also on a localnet to make our first tests without spamming the devnet. + +We will copy two wallets, alice and bob, that already have some egld on their account when we start a localnet. + +For the devnet we will create two wallets, one for the owner of the contracts and one for a user. We will provide some egld to these accounts using the [devnet wallet](https://devnet-wallet.multiversx.com/). + +To access these wallets from several scenes, we will create specific `Scenes̀for them. + +#### LocalNet Accounts + +We will use bob as the contract owner and alice as a user. + +```yaml +allowed_networks: + - LOCAL + +allowed_scenario: + - "integration_tests*" + +accounts: + - account_name: owner + pem_path: ./integration_tests/wallets/bob.pem + - account_name: user + pem_path: ./integration_tests/wallets/alice.pem +``` + +#### Devnet Accounts + +Same as above, but we replace the wallets by the ones on the devnet and we change the allowed network. + +```yaml +allowed_networks: + - LOCAL + +allowed_scenario: + - "integration_tests*" + +accounts: + - account_name: owner + pem_path: ./integration_tests/wallets/bob.pem + - account_name: user + pem_path: ./integration_tests/wallets/alice.pem +``` + +#### Result Structure + +Our project should now be like this: + +```bash +. +├── contract/ +│ ├── esdt-minter +│ ├── piggy-bank +│ ├── tests +│ └── Cargo.toml +├── scenes/ +│ └── accounts/ +│ ├── local_accounts.yaml +│ └── devent_account.yaml +├── scripts +├── wallets/ +│ ├── alice.pem +│ ├── bob.pem +│ ├── devnet_owner.pem +│ └── devnet_user.pem +└── Cargo.toml +``` + +### Smart Contract Interactions + +We will create the following situation: + +- The owner deploys and setup both smart-contracts +- The owner add some airdrop amount to a user +- The user claim the airdrop +- The user deposit and withdraw to/from the piggy-bank several times to exploit the contracts + +#### EsdtMinter Initialisation + +Let's create out first scene to deploy the `esdt-minter` contract: `scenes/01_esdt_minter_init.yaml`. + +We will allow this scene (and all the next scenes) to be run on all networks except the mainnet. The scenario we will use should also start with 'integration_test': + +```yaml +allowed_networks: + - LOCAL + - TEST + - DEV + +allowed_scenario: + - "integration_test*" +``` + +##### Deployment + +Our first step will be to deploy the `esdt-minter` contract. +The only argument we need to supply is the interest percentage. Let's set it to 100%. +We will give the deployed contract the id "abc-esdt-minter". (ABC will be the name of the token that will be issued). + +```yaml +type: ContractDeploy +sender: owner +wasm_path: "./integration_tests/contracts/esdt-minter/output/esdt-minter.wasm" +contract_id: "abc-esdt-minter" +gas_limit: 50000000 +arguments: + - 100 +upgradeable: True +readable: False +payable: False +payable_by_sc: True +``` + +##### Token Issuance + +We will now ask the contract to issue a new fungible ESDT named "ABC". This token should have 3 decimals. +To issue a new token, we also need to pay some egld. The amount change depending on the network but this value is present in the [MxOps' config](https://github.com/Catenscia/MxOps/blob/main/mxops/resources/default_config.ini) under the name `BASE_ISSUING_COST`. + +```yaml +type: ContractCall +sender: owner +contract_id: "abc-esdt-minter" +endpoint: issueToken +gas_limit: 100000000 +value: "&BASE_ISSUING_COST" +arguments: + - ABC + - ABC + - 3 +``` + +##### Token Identifier + +We want to retrieve the token identifier that has been assigned to the newly issued token. For that we can use a query to access the view on the esdt mapper from the contract. +We will save this identifier as a string under the name "EsdtIdentifier". + +```yaml +type: ContractQuery +contract_id: "abc-esdt-minter" +endpoint: getEsdtIdentifier +arguments: [] +expected_results: + - save_key: EsdtIdentifier + result_type: str +print_results: True +``` + +##### Results + +Our file `scenes/01_esdt_minter_init.yaml` should now look like this: + +```yaml +allowed_networks: + - LOCAL + - TEST + - DEV + +allowed_scenario: + - "integration_test*" + +steps: + - type: ContractDeploy + sender: owner + wasm_path: "./integration_tests/contracts/esdt-minter/output/esdt-minter.wasm" + contract_id: "abc-esdt-minter" + gas_limit: 50000000 + arguments: + - 100 + upgradeable: True + readable: False + payable: False + payable_by_sc: True + + - type: ContractCall + sender: owner + contract_id: "abc-esdt-minter" + endpoint: issueToken + gas_limit: 100000000 + value: "&BASE_ISSUING_COST" + arguments: + - ABC + - ABC + - 3 + + - type: ContractQuery + contract_id: "abc-esdt-minter" + endpoint: getEsdtIdentifier + arguments: [] + expected_results: + - save_key: EsdtIdentifier + result_type: str + print_results: True +``` + +#### PiggyBank Intitialisation + +We create a new scene to deploy and initialize the `piggy-bank` contract: `scenes/02_piggy_bank_init.yaml`. + +##### Deployment + +When we deploy the `piggy-bank` contract, we need to supply two arguments: the token identifier of the token that will be accepted by the contract and the address of the token issuer. + +We could supply theses values by hand but that would be a huge waste of time and very prone to errors. Instead we can use the {doc}`values` system of `MxOps`: + +We can access the address of the `esdt-minter` contract we just deployed by using its id: "%abc-esdt-minter%address". +As we also save the token identifier, we can access it too: "%abc-esdt-minter%EsdtIdentifier". + +```yaml +type: ContractDeploy +sender: owner +wasm_path: "./integration_tests/contracts/piggy-bank/output/piggy-bank.wasm" +contract_id: "abc-piggy-bank" +gas_limit: 80000000 +arguments: + - "%abc-esdt-minter%EsdtIdentifier" + - "%abc-esdt-minter%address" +upgradeable: True +readable: False +payable: False +payable_by_sc: True +``` + +##### Interest Whitelist + +The `esdt-contract` only allows whitelisted addresses to claim interests. We need to add our `piggy-bank` contract to this withelist using the endpoint `addInterestAddress`. + +```yaml +type: ContractCall +sender: owner +contract_id: "abc-esdt-minter" +endpoint: addInterestAddress +gas_limit: 5000000 +arguments: + - "%abc-piggy-bank%address" +``` + +##### Results + +The file `scenes/02_piggy_bank_init.yaml` should look like this: + +```yaml +allowed_networks: + - LOCAL + - TEST + - DEV + +allowed_scenario: + - "integration_test*" + +steps: + - type: ContractDeploy + sender: owner + wasm_path: "./integration_tests/contracts/piggy-bank/output/piggy-bank.wasm" + contract_id: "abc-piggy-bank" + gas_limit: 80000000 + arguments: + - "%abc-esdt-minter%EsdtIdentifier" + - "%abc-esdt-minter%address" + upgradeable: True + readable: False + payable: False + payable_by_sc: True + + - type: ContractCall + sender: owner + contract_id: "abc-esdt-minter" + endpoint: addInterestAddress + gas_limit: 5000000 + arguments: + - "%abc-piggy-bank%address" +``` + +#### Airdrop + +In the scene `scenes/03_airdrop.yaml`, the owner will add an airdrop of 100.000 ABC for the user and the user will claim this airdrop: + +```yaml +allowed_networks: + - LOCAL + - TEST + - DEV + +allowed_scenario: + - "integration_test*" + +steps: + - type: ContractCall + sender: owner + contract_id: "abc-esdt-minter" + endpoint: addAirdropAmount + gas_limit: 5000000 + arguments: + - "[user]" + - 100000 + + - type: ContractCall + sender: user + contract_id: "abc-esdt-minter" + endpoint: claimAirdrop + gas_limit: 5000000 +``` + +#### Money Printing + +Once he claimed the airdrop, the user discover that he can earn tons of ABC tokens by depositing and withdrawing his tokens to/from the `piggy-bank`. To test his hypothesis, he will execute three cycles of deposit and withdraws. As the interest is 100%, the user should double his tokens amount each cycle. + +We will execute this scenario using a `LoopStep`. The loop variable will be the amount that the user deposit at each cycle: 100.000 then 200.000 and finally 400.000 (We assume he deposits each time all the tokens he has). + +```yaml +allowed_networks: + - LOCAL + - TEST + - DEV + +allowed_scenario: + - "integration_test*" + +steps: + - type: Loop + var_name: CAPITAL_AMOUNT + var_list: [100000, 200000, 400000] + steps: + - type: ContractCall + sender: user + contract_id: "abc-piggy-bank" + endpoint: deposit + esdt_transfers: + - token_identifier: "%abc-esdt-minter%EsdtIdentifier" + amount: "$CAPITAL_AMOUNT:int" + nonce: 0 + gas_limit: 8000000 + + - type: ContractCall + sender: user + contract_id: "abc-piggy-bank" + endpoint: withdraw + gas_limit: 8000000 +``` + +#### Result Structure + +Our project should now be like this: + +```bash +. +├── contract/ +│ ├── esdt-minter +│ ├── piggy-bank +│ ├── tests +│ └── Cargo.toml +├── scenes/ +│ ├── accounts/ +│ │ ├── local_accounts.yaml +│ │ └── devent_account.yaml +│ ├── 01_esdt_minter_init.yaml +│ ├── 02_piggy_bank_init.yaml +│ ├── 03_airdrop.yaml +│ └── 04_money_print.yaml +├── scripts +├── wallets/ +│ ├── alice.pem +│ ├── bob.pem +│ ├── devnet_owner.pem +│ └── devnet_user.pem +└── Cargo.toml +``` + +### Execution + +We can now execute our scenes in a `Scenario`. We will execute this on the devnet for example and call our scenario "integration_tests_tutorial". + +#### Data Cleaning + +As we are making some tests, we want to delete the data from any previous execution. + +```bash +mxops \ + data \ + delete \ + -n DEV \ + -s integration_tests_tutorial +``` + +Enter `y` when prompted. + +#### Scenes Execution + +The first `Scene` we need to execute is the `Scene` with the devnet accounts to allow the other `Scenes` to use them. +After that we can execute all the `Scenes`in the order we wrote them. + +```bash +mxops \ + execute \ + -n DEV \ + -s integration_tests_tutorial \ + scenes/accounts/devnet_accounts.yaml \ + scenes +``` + +This sould give you on output similar to this: + +```bash +MxOps Copyright (C) 2023 Catenscia +This program comes with ABSOLUTELY NO WARRANTY +[2023-01-24 21:26:45,650 data INFO] Scenario integration_tests_tutorial created for network DEV [data:259 in create_scenario] +[2023-01-24 21:26:45,650 scene INFO] Executing scene integration_tests/scenes/accounts/devnet_accounts.yaml [scene:68 in execute_scene] +[2023-01-24 21:26:46,099 scene INFO] Executing scene integration_tests/scenes/01_esdt_minter_init.yaml [scene:68 in execute_scene] +[2023-01-24 21:26:46,121 steps INFO] Deploying contract abc-esdt-minter [steps:106 in execute] +[2023-01-24 21:26:51,645 steps INFO] Deploy successful on erd1qqqqqqqqqqqqqpgqam5fmdvqqta307y4xe6elhqj4z58leduhzdq8jytfw +tx hash: https://devnet-explorer.multiversx.com/transactions/2bf47375abc692ecc284fd1a273ca4ad7dbec677da548466aa85eedf7bd5140e [steps:126 in execute] +[2023-01-24 21:26:51,647 steps INFO] Calling issueToken for abc-esdt-minter [steps:175 in execute] +[2023-01-24 21:27:23,416 steps INFO] Call successful: https://devnet-explorer.multiversx.com/transactions/0f80e6e44eb1c742d1837c8871edffe1f6f329230634674588e406c09636e0fd [steps:192 in execute] +[2023-01-24 21:27:23,416 steps INFO] Query on getEsdtIdentifier for abc-esdt-minter [steps:214 in execute] +[{'base64': 'QUJDLTE0YWYwZA==', 'hex': '4142432d313461663064', 'number': 308176147074667304595556}] +[2023-01-24 21:27:23,631 steps INFO] Saving Query results as contract data [steps:228 in execute] +[2023-01-24 21:27:23,631 steps INFO] Query successful [steps:236 in execute] +[2023-01-24 21:27:23,636 scene INFO] Executing scene integration_tests/scenes/02_piggy_bank_init.yaml [scene:68 in execute_scene] +[2023-01-24 21:27:23,653 steps INFO] Deploying contract abc-piggy-bank [steps:106 in execute] +[2023-01-24 21:27:34,681 steps INFO] Deploy successful on erd1qqqqqqqqqqqqqpgqn7jctdfnem2n2zk8atus7ep9r64jy80whzdqp3wmyu +tx hash: https://devnet-explorer.multiversx.com/transactions/9f2f45f2ea9d33dc4700bef2724ec4a42e8a21737a60c02004cef05609d04493 [steps:126 in execute] +[2023-01-24 21:27:34,682 steps INFO] Calling addInterestAddress for abc-esdt-minter [steps:175 in execute] +[2023-01-24 21:27:40,258 steps INFO] Call successful: https://devnet-explorer.multiversx.com/transactions/c3022dab7a49a5eefe2a4c17ccc66838eb41e3280a6c14f0c81d9169773a9810 [steps:192 in execute] +[2023-01-24 21:27:40,259 scene INFO] Executing scene integration_tests/scenes/03_airdrop.yaml [scene:68 in execute_scene] +[2023-01-24 21:27:40,261 steps INFO] Calling addAirdropAmount for abc-esdt-minter [steps:175 in execute] +[2023-01-24 21:27:45,579 steps INFO] Call successful: https://devnet-explorer.multiversx.com/transactions/88beda7d9b4858f32010137fd4e7c5ca573cfae18dccbe0a163001de4474b5a5 [steps:192 in execute] +[2023-01-24 21:27:45,580 steps INFO] Calling claimAirdrop for abc-esdt-minter [steps:175 in execute] +[2023-01-24 21:28:37,922 steps INFO] Call successful: https://devnet-explorer.multiversx.com/transactions/d8451a30fedcd92d67b8e783cb3989e1613143d09cd3cd9303a011bcb29caa2d [steps:192 in execute] +[2023-01-24 21:28:37,923 scene INFO] Executing scene integration_tests/scenes/04_money_print.yaml [scene:68 in execute_scene] +[2023-01-24 21:28:37,926 steps INFO] Calling deposit for abc-piggy-bank [steps:175 in execute] +[2023-01-24 21:29:30,292 steps INFO] Call successful: https://devnet-explorer.multiversx.com/transactions/95fc37a627fcfbea102fb4f317880b39b7b76effd4399bdb15075e6926481c1e [steps:192 in execute] +[2023-01-24 21:29:30,292 steps INFO] Calling withdraw for abc-piggy-bank [steps:175 in execute] +[2023-01-24 21:30:28,589 steps INFO] Call successful: https://devnet-explorer.multiversx.com/transactions/33d52b9ed973757d09782998bd096ff19ba3ad0e42fb4810fc7430941d7b50be [steps:192 in execute] +[2023-01-24 21:30:28,590 steps INFO] Calling deposit for abc-piggy-bank [steps:175 in execute] +[2023-01-24 21:31:21,530 steps INFO] Call successful: https://devnet-explorer.multiversx.com/transactions/2d3da6f3251b3d8194d5bf2ad7e42215bf496c0440b364f901d661a7899e160e [steps:192 in execute] +[2023-01-24 21:31:21,530 steps INFO] Calling withdraw for abc-piggy-bank [steps:175 in execute] +[2023-01-24 21:32:13,874 steps INFO] Call successful: https://devnet-explorer.multiversx.com/transactions/97a5b1699b287561f5bf8f5cbadf90fb42f8abf08a398f0f55b74bca5b643891 [steps:192 in execute] +[2023-01-24 21:32:13,874 steps INFO] Calling deposit for abc-piggy-bank [steps:175 in execute] +[2023-01-24 21:33:06,208 steps INFO] Call successful: https://devnet-explorer.multiversx.com/transactions/da79b69f16c20768a85d48c29225af5c99699b4ffe57c459a46160a66aca36c5 [steps:192 in execute] +[2023-01-24 21:33:06,208 steps INFO] Calling withdraw for abc-piggy-bank [steps:175 in execute] +[2023-01-24 21:34:03,874 steps INFO] Call successful: https://devnet-explorer.multiversx.com/transactions/086d02d7341727aaa89ac09e45bd438aae16ea36b8d46a0723913b4e64968183 [steps:192 in execute] +``` + +And that's it! You just created a repetable way of executing interactions with your smart-contracts! 🥳 + +Using the links in the previous outputs, you can navigate the different transactions with the explorer. + +## Data + +After executing, the `Scenario` data is persitent (until you delete or overwrite it). +You can access this data using command lines. + +For example, to see all the data saved under our integration_tests_tutorial `Scenario`: + +```bash +mxops data get -n DEV -s integration_tests_tutorial +``` + +This should give you a result similar to this: + +```bash +MxOps Copyright (C) 2023 Catenscia +This program comes with ABSOLUTELY NO WARRANTY +[2023-01-24 21:36:14,175 data INFO] Scenario integration_tests_tutorial loaded for network DEV [data:234 in load_scenario] +{ + "name": "integration_tests_tutorial", + "network": "DEV", + "creation_time": 1674592005, + "last_update_time": 1674592054, + "contracts_data": { + "abc-esdt-minter": { + "contract_id": "abc-esdt-minter", + "address": "erd1qqqqqqqqqqqqqpgqam5fmdvqqta307y4xe6elhqj4z58leduhzdq8jytfw", + "wasm_hash": "c8280fa4f2f173940f3ba9e0b294867e3fad910ae0744628a90a0b73452c12cd", + "deploy_time": 1674592008, + "last_upgrade_time": 1674592008, + "saved_values": { + "EsdtIdentifier": "ABC-14af0d" + } + }, + "abc-piggy-bank": { + "contract_id": "abc-piggy-bank", + "address": "erd1qqqqqqqqqqqqqpgqn7jctdfnem2n2zk8atus7ep9r64jy80whzdqp3wmyu", + "wasm_hash": "ea2a4cf5e924d01b3e43541edce4180e5972e46d50c10fa4db62b3b11c0d8699", + "deploy_time": 1674592050, + "last_upgrade_time": 1674592050, + "saved_values": {} + } + } +} +``` + +## Conclusion + +You are now ready to write your own `Scenes` 👏👏👏 + +Please don't hesitate to give us your feedback on [github](https://github.com/Catenscia/MxOps/discussions) or [twitter](https://twitter.com/catenscia), we would really appreciate it 🤗 diff --git a/integration_tests/README.md b/integration_tests/README.md new file mode 100644 index 0000000..81dda2f --- /dev/null +++ b/integration_tests/README.md @@ -0,0 +1,5 @@ +# Integration tests + +This folder contains a dummy smart-contrast project to test MxOps in full use. + +For a detailed description of the contract and the scenes used by MxOps, please heads to the [tutorial section](https://mxops.readthedocs.io/en/latest/user_documentation/tutorial.html) of the documentation. diff --git a/pyproject.toml b/pyproject.toml index 4ec902d..91ba3c0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -5,7 +5,7 @@ build-backend = "setuptools.build_meta" [project] name = "mxops" -version = "0.1.0" +version = "0.1.1" authors = [ { name="Etienne Wallet", email="etienne.wallet@catenscia.com" }, ] diff --git a/requirements-dev.txt b/requirements-dev.txt index 30f38b0..e9dde68 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -7,4 +7,5 @@ pylint~=2.15.6 pytest~=7.2.0 pytest-mock~=3.10.0 sphinx~=5.3.0 -sphinx_rtd_theme~=1.1.1 \ No newline at end of file +sphinx_rtd_theme~=1.1.1 +sphinxcontrib-images~=0.9.4 \ No newline at end of file