@ErmiteSauvage@boletellus@AvaLabs@avax Félicitations et encore une preuve que travail, le partage et la persévérance paye.
Belle aventure a toi et merci pour ton travail
Je rejoins officiellement @AvaLabs en tant que Community Manager France pour @avax !
C'est avec beaucoup d'humilité et d'excitation que je démarre cette nouvelle aventure.
Si vous me connaissez, vous savez que je me donne à fond dans tout ce que j'entreprends depuis trois ans sur Avalanche.
C'est une opportunité en or pour redonner du piment à la commu FR, n'hésitez pas à me DM vos idées, vos questions, vos avis sur les events à venir.
C'est avec tous vos retours qu'on sera capable de construire un environnement qui vous plaît vraiment !
Restez branchés, on va bien s'amuser ! 🐑x🐐
Dimanche 7 Juillet, 21 h, commentaires à chaud sur les résultats de l’élection.
C’est dans des moments comme celui-ci qu’il faut savoir garder son calme pour pouvoir tirer des conclusions raisonnables dans mes domaines de compétence, l’économie et la finance
C’est ce que je vais essayer de faire dans les lignes qui suivent.
L’incertitude légale sur la taxation des profits futurs et le coût du travail sont de loin ce qui terrorise le plus les chefs d’entreprise. Cette incertitude vient de faire un bond gigantesque. Je ne connais donc pas un seul chef d’entreprise en France qui va accroître ses investissements ou ses embauches dans les mois qui viennent, et j’en connais beaucoup qui vont les réduire substantiellement.
En ce qui concerne les entreprises étrangères qui auraient eu l’idée saugrenue d’investir en France, je prends le pari que tous ces investissements vont être annulés dès lundi matin
Ce qui veut dire que la probabilité d’une récession vient de passer à 100 %, et avec cette récession nous allons avoir un creusement profond de notre déficit budgétaire qui va passer à 10 % du PIB en très peu de temps.
Or, tout le monde sait que notre pays souffre d’un double déficit et du commerce extérieur et du budget.
Tout le monde sait aussi que nous avons une dette colossale dont le financement est assuré à moitié par l’étranger.
En aucun cas, le résultat de ces élections ne peut amener un investisseur étranger à augmenter ses positions en revenu fixe dans notre pays. Et la tentation de les réduire va être gigantesque, et beaucoup ne vont pas résister à cette tentation.
Ce qui veut dire que la crise de la dette française qui me semblait probable est maintenant devenue certaine, et à brève échéance.
Ce qui nous amène à l'Europe et à la BCE.
Notre pays est le seul en Europe à avoir une situation financière aussi dégradée.
Le gouvernement, quel qu’il soit, va devoir demander à la BCE de monétiser nos déficits.
Et la, il n’y aura plus d’en même temps.
Tout le monde semble changer d'avis sur les memecoin/shitcoin, perso, c'est tjr des tokens inutiles, avec des schéma de ponzi horrible. Oui il y a des l'argent à le trade, mais non, sa reste de la merde ^^
Tutorial: Querying a #MultiversX smart contract using mxpy ⚒️
Even if you're not a developer, knowing how to query a smart contract enables you to retrieve crucial information without relying on any dApp 🔥
Let me show you step by step how to do this 🧵
Here's the plan for this thread:
1️⃣ - Prerequisites and introduction to mxpy
2️⃣ - How to know which information you can retrieve from a contract
3️⃣ - Querying a smart contract: general basics
4️⃣ - Concrete example with xExchange: a token sniping bot
This thread is the first one of a new series: interacting with the #MultiversX blockchain 👀
For easier reading I also published this thread as a Medium article, the link will be in the comments!
1️⃣ - Prerequisites and introduction to mxpy
mxpy is a CLI, Command Line Interface, that allows you to do several things on the MultiversX blockchain. Since it is a CLI, you will have to use it through your computer’s terminal, here are the prerequisites:
- Having an Ubuntu/macOS terminal: if you're on Windows, don't worry—you can install WSL with just one click, which provides you with an Ubuntu terminal. I’ll provide you a link to install it in the comments. From this point you’ll have to do all the operations in this article inside WSL
- Knowing how to launch a command in the terminal: no worries you don’t need to know more
- If you’re on macOS you should have homebrew installed. To do so you can run the following command: /bin/bash -c "$(curl -fsSL https://t.co/I3OuA72Ks0)"
It’s time to install mxpy! The first step is to install pipx, a tool that makes installing Python CLIs easy
💻 For macOS
macOS users have to run the following commands:
brew install pipx pipx ensurepath sudo pipx ensurepath --global
🖥️ For Ubuntu or WSL users
Ubuntu or WSL users have to run the following commands:
sudo apt update sudo apt install pipx pipx ensurepath sudo pipx ensurepath --global
You may need to restart your terminal. Once you have installed pipx, you can install mxpy with a single command:
pipx install multiversx-sdk-cli --force
Restart your terminal and run the following command to check if mxpy has been correctly installed:
mxpy --version
If you get a response like this: MultiversX Python CLI (mxpy) <version number> then you have installed mxpy successfully and you can go to the next steps!
2️⃣ - How to know which information you can retrieve from a contract
Before querying a smart contract, you need to know its address, which you can determine in one of five ways:
- Delving into the explorer to see useful transactions that lead to the contracts you aim for
- Knowing the admin of the contracts, then you can check on the explorer the contracts it has deployed
- Going to the dApp and inspecting the developer console, especially the “Network” tab, to try to retrieve a list of interesting addresses
- Retrieving a transaction you did through the dApp, the receiver have great chances to be a useful contract
- Asking someone who knows: the project that owns the contract, a project that uses the contracts, @xFoudres because he knows everything happening on the blockchain, etc…
Example with xExchange
You want to get information about the xExchange liquidity pair USDC/WEGLD. This pool is frequently used, making it a good idea to initially delve into the explorer. Once you’re on the explorer you can go to the “Tokens” page to click on the USDC token, you’ll see all the transactions involving USDC. You just have to find a transaction that performs a swap and you’ll see the liquidity pool contract address: erd1qqqqqqqqqqqqqpgqeel2kumf0r8ffyhth7pqdujjat9nx0862jpsg2pqaq
You have the address, it’s time to know the information you can retrieve from it! A smart contract is a set of functions one can call. We’re looking for a specific type of functions called “views”, the sole purpose of a view is to retrieve a specific information about the contract. In our example, any xExchange liquidity pool contract contains a lot of view such as:
- “getFirstTokenId”, which gives you… the first token of the pair
- "getAmountOut”, which estimates the amount of a swap without the need to perform it
- "getTotalFeePercent”, which gives you the % of the fees for each swap
- etc…
Your goal is to find the views that provide the information you need. Depending on the context, you will choose one of the following methods:
- You have access to the ABI. This is the ideal scenario because the ABI is a JSON file referencing all the views! - A project can give you the ABI of its contract
- The contract’s code is open source. You can either directly read the code and search for “#[view(” to see the views or if you’re a developer you can compile yourself the ABI
- Reading directly from the raw WASM of the contract. If you’re totally desperate you can download the wasm code of the contract from the explorer, convert it to wat through an online tool such as wasm2wat so you can read it, and find for “export” functions. This is hard and you probably don’t want to do this
- You have the contract address and the views that interests you, let’s use mxpy to query them!
3️⃣ - Querying a smart contract: general basics
Let’s see the general way to perform a query using mxpy. It will be a bit abstract and you probably won’t understand everything at first, but once I’ll show you some concrete examples everything will become super clear!
mxpy has a command dedicated to query a contract’s views: mxpy contract query. Let’s see how to use it
The general form of the command is as follows:
mxpy contract build <contract’s address> --proxy <proxy url> --function <view name> --arguments <parameters of the view if any, separated by a space>
Here are more details about each parameter:
- contract’s address: the erd… address of the contract such as erd1qqqqqqqqqqqqqpgqeel2kumf0r8ffyhth7pqdujjat9nx0862jpsg2pqaq
- proxy: the proxy used to communicate with the blockchain, if you don’t know what it is you can provide the mainnet official one: https://t.co/HgxTRlrj3d
- arguments: some views can ask arguments, you have to provide them here. For example the “getAmountOut” view of a xExchange pair, which simulates the result of a swap, asks for 2 arguments: the input token and the input amount of the swap. For views that doesn’t require any argument, you should not pass the --arguments in the mxpy command
About the argument format, it depends of what the view asks for, but here’s the general method:
- For a number : “<the number>”, for example “1600”. Be careful because 1 EGLD is 10^18, so “1000000000000000000”
- For a text or a token identifier: “str:<the text>”, for examples “str:Hello World” or “str:USDC-c76f1”
- For an address: “<the address>”, for example “erd1qqqqqqqqqqqqqpgqeel2kumf0r8ffyhth7pqdujjat9nx0862jpsg2pqaq”
- For arbitrary hexadecimal data: “0x<the hex bytes>”, for example “0x1af76d”. However you probably won’t use this because it’s not human readable
The arguments should always be enclosed in quotes and separated by spaces. The following is valid for a view asking for a token identifier, an address, and an amount: --arguments “str:USDC-c76f1” “erd1qqqqqqqqqqqqqpgqeel2kumf0r8ffyhth7pqdujjat9nx0862jpsg2pqaq” “1000000000000000000”
When you run the command in the terminal, you will get the output in different encoding: base64, hex, decimal. If the expected result of the view is a number, look at the decimal value. If you expect a text or an erd address, such as the name of a token, you have to take the hex value and and decode it using the following tool: https://t.co/7zz3zt7C7Z
If you expect a complex output, then you should use a more elaborate tool than mxpy. This is the topic of another article
I know it sounds a bit abstract, that’s why I’ll show you concrete examples with the xExchange!
4️⃣ - Concrete example with xExchange: a token sniping bot
Suppose you want to create a bot that snipes a specific token once the swap are enabled. You’ll need to automatically query the following information:
- The token xExchange pair contract address
- The state of the pair, to know whether the swaps are enabled
- The liquidity, so you don’t snipe a token which has almost no liquidity. It would result in a huge price impact
- The estimated amount out, so you can apply a slippage
Let’s take a concrete token live on the mainnet: BOBER-9eb764. The first thing we want to do is to retrieve the WEGLD-bd4d79/BOBER-9eb764 pair contract address
To do so, the xExchange’s router contract is our best ally, this contract has a view called "getPair” that gives us the contract address of a pair, if it exists. The router address is erd1qqqqqqqqqqqqqpgqq66xk9gfr4esuhem3jru86wg5hvp33a62jps2fy57p and the view asks for two arguments: first_token_id and second_token_id, both are token identifiers
Here’s the command to query the getPair view on the xExchange router contract:
mxpy contract query erd1qqqqqqqqqqqqqpgqq66xk9gfr4esuhem3jru86wg5hvp33a62jps2fy57p --proxy https://t.co/HgxTRlrj3d --function "getPair" --arguments "str:WEGLD-bd4d79" "str:BOBER-9eb764"
The hexadecimal output: 00000000000000000500490c9a6ff1c993e899c9d9df08eecca3f748bd295483
Let’s use the tool I mentioned above to convert it to an address: erd1qqqqqqqqqqqqqpgqfyxf5ml3exf73xwfm80s3mkv50m530ff2jpsznpumc
Note: If the pair doesn’t exist, the view will output the zero address: 0000000000000000000000000000000000000000000000000000000000000000 (in hex) = erd1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq6gq4hu
Once you have identified the pair, you need to check whether the swaps are enabled. You can call the 'getState' view on the pair, this view don’t have any argument and returns the hex value 00, 01 or 02 for respectively “Inactive”, “Active” and “PartiallyActive”. What interest us is the “Active” state, let’s query it:
mxpy contract query erd1qqqqqqqqqqqqqpgqfyxf5ml3exf73xwfm80s3mkv50m530ff2jpsznpumc --proxy https://t.co/HgxTRlrj3d --function "getState"
The hexadecimal output is: 01, bingo swaps are enabled!
At this point, we already can send a transaction to swap our WEGLD to get some BOBER, but let’s be precautious, maybe there is 10$ worth of liquidity in the pair, resulting in a huge loss due to the price impact. To counter this, we have to query the liquidity of the pair
For simplicity we’ll only query the liquidity of the WEGLD token. The pair contract has a view called 'getReserve,' which requires a single token identifier as an argument and returns the liquidity for that token. Let’s do the query:
mxpy contract query erd1qqqqqqqqqqqqqpgqfyxf5ml3exf73xwfm80s3mkv50m530ff2jpsznpumc --proxy https://t.co/HgxTRlrj3d --function "getReserve" --arguments "str:WEGLD-bd4d79"
Since the view returns a number, we can directly read the decimal result: 5096579809102999849080. Please remember that 1 WEGLD = 10^18, therefore 5096579809102999849080 = 5096.579809102999849080 EGLD
If you find the liquidity sufficient, you can go to the last step: simulating the output of the swap. In order to compute the result of a swap, one has to query the 'getAmountOut' view present on the pair contract. This view takes two arguments: token_in which is a token identifier and amount_in which is a number
token_in is the input token: WEGLD-bd4d79. Let’s suppose you want to swap 10 WEGLD, the amount you have to input as argument is “10000000000000000000”
Here is the query:
mxpy contract query erd1qqqqqqqqqqqqqpgqfyxf5ml3exf73xwfm80s3mkv50m530ff2jpsznpumc --proxy https://t.co/HgxTRlrj3d --function "getAmountOut" --arguments "str:WEGLD-bd4d79" "10000000000000000000"
This view also returns a number; we can directly interpret the decimal result: 737369342289264796533510 = 737369.342289264796533510 BOBER
You have everything needed to take your decision and apply a slippage if you want to! The very next step is to send a real transaction to perform the swap! 🔥 It can also be done through mxpy but this the subject of another thread
I hope you enjoyed this technical thread! If so, please share it and give me a follow ❤️
1 actif financier =
> Soit il baisse soit il monte.
> Soit tu achètes soit tu vends.
> Soit tu réussis soit tu te plantes.
Si tu en es à utiliser 250 indicateurs ou autres Schmilblicks pour représenter graphiquement un PRIX =
Il est fort probable qu'il y ait un souci !
🚨 Si vous avez des wallets sur Mac M1/M1Pro/M2/M2Pro récupérer vos clés en format papier et formater votre pc, ouvrez un coldwallet sur Airgap ou Ledger et ne connecter plus de hotwallet sur votre mac. 🚨
Larry Fink (CEO Black Rock) explique que la tokenisation l'émoustille au plus haut point et qu'il compte bien tokéniser "toutes les actions et toutes les obligations" du monde.
Mais pourquoi faire ? En quoi est-ce intéressant ?
Principe de base : Tokeniser = titriser (découper en petits bouts) un asset sur une blockchain comme nous le faisons avec CleanSat Mining. Il y a plusieurs intérêts majeurs :
1/ Réduire les coûts de transaction.
Lorsque l'on veut vendre/acheter un asset il y a des coûts administratifs, liés à la signature des documents, chaque organisation doit mettre en place pour elle même tous les process de contrôle et de conformité pour chaque service, et j'en passe ...
Avec la tokenisation, comme le registre est unique pour tous les nœuds et que les signatures sont cryptographiques (très haute sécurité), les coûts de transferts s'effondrent avec des tokens. Tous les besoins en conformité et autres process de contrôle peuvent être mutualisés une bonne fois pour toute pour tout le monde.
2/ Effondrer les coûts permet d'augmenter la liquidité de ces marchés. Typiquement, sur Data Factory, où l'on a pas tokénisé, il fallait mettre $10k minimum pour participer à notre levée de fonds. Avec CleanSat Mining, où l'on tokénise, la somme de départ est de $50. Forcément, on voit bien que l'on touche potentiellement plus de monde. Si l'on touche plus de monde, alors il y a plus de liquidité.
3/ À quoi ça sert la liquidité ?
C'est une question dont les personnes qui se demandent à quoi servent "les bourses" à part "spéculer" n'ont pas compris la réponse. Pour la faire simple, plus vous avez la capacité d'acheter/vendre facilement sur un marché secondaire, plus votre actif est bien évalué et peut circuler facilement. Or, mieux un actif est "pricé", et plus il se déplace sans "frottements", plus votre croissance économique augmente sur cette partie.
Pour le dire autrement, c'est comme le rendement d'un chauffage centrale. Plus il est élevé, plus vous avez de chaleur utile dans la maison pour une même unité de combustible. C'est donc très très cool la liquidité. Aussi cool que de passer d'un feu de camp par terre au milieu du salon pour chauffer toute la maison à une chaudière à bois à condensation dernier cri dernier crac qui distribue la chaleur dans toute la maison. Ça change la vie.
4/ La programmabilité sur la blockchain.
Là, c'est un concept clef.
Typiquement, manipuler des tokens qui représentent des actions ou des obligations avec du code informatique permettrai de généraliser ce que l'on appelle "les produits dérivés" à tout le monde alors qu'aujourd'hui ils ne sont réservés qu'aux plus riches à cause des coûts induits par 1/2/3. Donc, avec la programmabilité, TOUT le monde pourra avoir les mêmes produits financiers que les plus riches clients de Goldman Sachs.
Est-ce réellement une avancé car tout le monde sait que les produits dérivés "c'est pô bien".
Oui, cela est une énorme avancée car les produits dérivés c'est juste la brique essentiel qui nous permet de bénéficier d'une économie et d'un système financier aussi complexe et efficient que celui dont on dispose.
Dit autrement, tout le monde pourrait couvrir son taux de change avant de partir en vacances, avoir accès à des assurances bien moins chères ou encore faire des prêts pour acheter sa maison sans passer par une banque mais plutôt par des protocoles sur Internet qui vous permettent de collatéraliser votre maison indépendamment de vos revenus et j'en passe ...
Tout cela apporterait des gains de croissance assez conséquents et aussi ... plus d'inégalités de revenu et de patrimoine entre les gens.
5/ Bonus : Les inégalités
Tout processus qui vise à augmenter l'efficience économique et financier de groupe comprenant de plus en plus d'individu augmente la richesse globale mais augmente aussi le coefficient de pareto dans le groupe.
Autrement dit, on est tous plus riche mais les plus riche le seront beaucoup plus que les plus pauvre par rapport à maintenant. Pourquoi cette "injustice sociale" ? Car dans la nature, les inégalités se mettent en place pour augmenter l'efficience d'un système. Un arbre c'est bien plus inégalitaire que du gazon (20% du volume, le tronc assure 80% de la structure, 20% de la masse, les feuilles, assures 80% de l'alimentation en énergie, etc ...).
6/ Bonus 2 : Augmentation des risques systémiques.
Une fois que vous avez tout bien optimisé et synchronisé à l'échelle mondiale, lorsqu'il y a un problème dans la machine, tout le monde prend très cher. Mais bon, on a rien sans rien n'est ce pas🤗
Blague à part, notre monde est bien plus risqué en terme systémique qu'au moyen âge où l'activité économique à Paris était peu impacté par les crises à Pékin mais je préfère quand même vivre à notre époque car le confort n'est pas le même qu'en l'an 500 ^^
Conclusion : Inévitablement nous allons vers plus d'efficience car c'est le sens du capitalisme mais surtout c'est le sens de la vie. La tokenisation aura donc lieu et cela permet de comprendre pourquoi Larry en est tout excité ^^
Les inégalités vont mécaniquement augmenter car ces changements se feront à l'échelle mondiale.
Mais la bonne nouvelle c'est qu'en tant qu'individu, c'est bien la connaissance qui vous permettra d'en profiter le plus et non simplement l'argent que vous avez.
Il est donc plus important que jamais de bosser ces sujets et dites vous bien qu'à notre époque, ce que vous avez dans la tête a bien plus de valeur que ce que vous avez dans votre portefeuille.