{"id":20117943,"url":"https://github.com/jjhesk/moodyeth","last_synced_at":"2025-05-06T14:31:16.459Z","repository":{"id":57443085,"uuid":"376233499","full_name":"jjhesk/moodyeth","owner":"jjhesk","description":"The python implemention for truffle or similar products like brownie. ","archived":false,"fork":false,"pushed_at":"2024-04-15T07:52:12.000Z","size":1084,"stargazers_count":6,"open_issues_count":3,"forks_count":3,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-01-03T19:44:07.473Z","etag":null,"topics":["brownie","multicalls","python","pyweb3","transpiler","truffle","upgradables","web3py"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jjhesk.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-06-12T07:54:07.000Z","updated_at":"2024-12-22T06:30:15.000Z","dependencies_parsed_at":"2024-11-13T19:09:01.939Z","dependency_job_id":"154aea99-3246-45f5-bfa8-1b641dac252e","html_url":"https://github.com/jjhesk/moodyeth","commit_stats":{"total_commits":186,"total_committers":2,"mean_commits":93.0,"dds":0.005376344086021501,"last_synced_commit":"cbdae8e4124f9356e242ed757bfd74730213e90b"},"previous_names":["jjhesk/moodyeth","tokenchain/moodyeth"],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jjhesk%2Fmoodyeth","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jjhesk%2Fmoodyeth/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jjhesk%2Fmoodyeth/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jjhesk%2Fmoodyeth/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jjhesk","download_url":"https://codeload.github.com/jjhesk/moodyeth/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252703316,"owners_count":21790866,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["brownie","multicalls","python","pyweb3","transpiler","truffle","upgradables","web3py"],"created_at":"2024-11-13T19:08:58.039Z","updated_at":"2025-05-06T14:31:16.113Z","avatar_url":"https://github.com/jjhesk.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🏗👷🏾 Moodyeth\n### Ether API for Python The only Library\n\n[![moodyeth](https://img.shields.io/pypi/v/moodyeth?style=plastic)](https://pypi.org/project/moodyeth/)\n[![moodyeth](https://img.shields.io/pypi/pyversions/moodyeth.svg)](https://pypi.org/project/moodyeth/)\n[![moodyeth](https://api.travis-ci.com/tokenchain/moodyeth.svg?branch=master)](https://pypi.org/project/moodyeth/)\n[![moodyeth](https://img.shields.io/github/issues/tokenchain/moodyeth.svg)](https://pypi.org/project/moodyeth/)\n\n\nEthereum based all Moody tool chain for smart contract development kit [documentation](https://htmlpreview.github.io/?https://github.com/tokenchain/moodyeth/blob/main/docs/moody/index.html).\n\n### Why do we use python\nUsing it because it is fast and easy. More importantly it runs directly by its own and no more dependencies.\n\nIts much faster to building modules and calling functions on python.\nAlso it can be wrapped into an executable binary on wasm or cpython that runs on natively any platforms.\n\nIf you are using PyCharm or similar IDE, all type are ready to show at your finger tips.\n\n### Get Started\n\n`pip3 install moodyeth`\n\nor upgrade using\n\n`sudo pip3 install moodyeth --upgrade`\n\nor try this without vpn\n\n`sudo pip3 install moodyeth --upgrade -i https://pypi.tuna.tsinghua.edu.cn/simple`\n\n`sudo pip3 install moodyeth --upgrade -i https://pypi.python.org/simple`\n\nThe development of Moody contract deployment tools:\n\nSetup (for the early version, we are going to setup the workspace manually. )\n\nSetup the folders:\n /vault\n /artifact\n /deploy_history\n /deploy_results\n /factoryabi\n\n### Why use moody eth\n\nIt is a all-in-one package with zero setup and configurations that works for multiple architectures. It is lightweight and simple. Build-in ERC20 support and bulk token sending support. Out of the box that comes with solc-compile automation and web3 executions.\n\n### Features\n- support most of the evm compatible chains\n- golang module compile support\n- python module compile support\n- typescript module compile support\n- forge foundry support\n- flashbots support\n- implementation of contract upgradings\n- upgrade contracts for 3 different ways\n- Multicall3 interactions\n\n\n### Examples:\n\n##### Deployment of the new contract:\n\n```python\n# !/usr/bin/env python\n# coding: utf-8\nimport os\n\nfrom moody.libeb import MiliDoS\nfrom moody import conf\n\nprivatekey = \"xxxxxxxx\"\n# now using xDAI\nnetwork = conf.XDaiMainnet()\n\nROOT = os.path.join(os.path.dirname(__file__))\nmeta = MiliDoS(network).withPOA()\nmeta.setWorkspace(ROOT).Auth(privatekey)\nmeta.deploy(\"Ori20\")\n\n```\n\n#### BSend add signer\nAdding signer using bsend\n\n```python\n# !/usr/bin/env python\n# coding: utf-8\nimport os\n\nfrom moody.libeb import MiliDoS\nfrom moody import conf\n\nprivatekey = \"xxxxxxxx\"\n# now using xDAI\nnetwork = conf.XDaiMainnet()\n\n#gas and gas price configurations\nmeta.OverrideGasConfig(6000000, 2000000000)\n\nROOT = os.path.join(os.path.dirname(__file__))\nmeta = MiliDoS(network).withPOA().setWorkspace(ROOT).Auth(privatekey)\n\ncontract_address = \"0x_________________\"\n\nsigning_address =  \"0x________my_wallet\"\n\nexpressContract = BSend(meta, contract_address).CallAutoConf(meta).CallDebug(True)\n\nexpressContract.add_signer(signing_address)\n\n```\n\n#### Mint Coins\nThe example for minting coins with 18 decimal\n\n```python\n# !/usr/bin/env python\n# coding: utf-8\nimport os\n\nfrom moody.libeb import MiliDoS\nfrom moody import conf\nfrom moody.m.tc20 import Tc20\n\nprivatekey = \"xxxxxxxx\"\ncontract_address = \"0x_________________\"\nmy_wallet =  \"0x________my_wallet\"\n\n# now using xDAI\nnetwork = conf.XDaiMainnet()\n\n#gas and gas price configurations\nmeta.OverrideGasConfig(6000000, 2000000000)\n\nROOT = os.path.join(os.path.dirname(__file__))\nmeta = MiliDoS(network).withPOA().setWorkspace(ROOT).Auth(privatekey)\n\n\ntokenContract = Tc20(meta, contract_address).CallAutoConf(meta)\n\n# assume this coin comes with 18 decimal\ntokenContract.EnforceTxReceipt(True).mint(my_wallet, 300*10**18)\n\n```\n\n\n### Example for compiling contracts with solc\n```python\n# !/usr/bin/env python\n# coding: utf-8\n\n\nfrom moody import conf, Evm\nfrom moody.libeb import MiliDoS\n\nROOT = \"my_workspace_path\"\n\n# as the solidity compiler version\nSOLV = \"0.8.6\"\n\nCONTRACT_LIST = [\n    \"vault/folder1/xxx1.sol\",\n    \"vault/folder2/xxx2.sol\",\n    \"vault/folder2/xxx3.sol\",\n]\n\n\n\nnetcompile = conf.RSCMainnet()\nr = MiliDoS(netcompile)\nprint(\"-----\u003e the workspace location\")\nprint(ROOT)\nr.setWorkspace(ROOT).setOptimizationRuns(5000).setEvm(Evm.ISTANBUL).setClassSolNames(CONTRACT_LIST).remoteCompile(SOLV).localTranspile()\n# Optionally you can directly call the execution to run the localtranspile\n# r.setWorkspace(ROOT).setClassSolNames(CONTRACT_LIST).localTranspile()\n# os.system(\"sh localpile\")\n\n```\n\n#### Code compile\n\nThe new build codebase all in the one take. In order to use this feature, the required package will need to be installed to the system. Otherwise the error message will show.\n\n- factoryabi (source transpiler for ts and python)\n- forge (solidity compiler)\n- abigen (golang transpile generator)\n- abi-gen-uni (transpiler consumer)\n\nIf you are all set, then you are ready to run the following code for example:\n\n\n```python\n# !/usr/bin/env python\n# coding: utf-8\nimport os\nfrom moody.libeb import MiliDoS\nfrom moody import Evm, conf\nfrom key import ROOT\n\nSOLV = \"0.8.12\"\nC811 = [\n    \"vault/token/RaceToken.sol\",\n]\nnetwork = conf.EthereumFL()\nr = MiliDoS(network)\n\nROOT = '/.../Documents/b95/devmoody'\nFACTORY = '$HOME/Documents/piplines/factoryabi'\nr.brew(ROOT, FACTORY).setClassSolNames(C811).setEvm(Evm.ISTANBUL)\nr.useForge().localTranspile()\n\n\n```\n\n\n\n### Example for multicall\n\n```python\n\nfrom multicall import Call, Multicall\n\n# assuming you are on kovan\nMKR_TOKEN = '0xaaf64bfcc32d0f15873a02163e7e500671a4ffcd'\nMKR_WHALE = '0xdb33dfd3d61308c33c63209845dad3e6bfb2c674'\nMKR_FISH = '0x2dfcedcb401557354d0cf174876ab17bfd6f4efd'\n\ndef from_wei(value):\n    return value / 1e18\n\nmulti = Multicall([\n    Call(MKR_TOKEN, ['balanceOf(address)(uint256)', MKR_WHALE], [('whale', from_wei)]),\n    Call(MKR_TOKEN, ['balanceOf(address)(uint256)', MKR_FISH], [('fish', from_wei)]),\n    Call(MKR_TOKEN, 'totalSupply()(uint256)', [('supply', from_wei)]),\n])\n\nmulti()  # {'whale': 566437.0921992733, 'fish': 7005.0, 'supply': 1000003.1220798912}\n\n# seth-style calls\nCall(MKR_TOKEN, ['balanceOf(address)(uint256)', MKR_WHALE])()\nCall(MKR_TOKEN, 'balanceOf(address)(uint256)')(MKR_WHALE)\n# return values processing\nCall(MKR_TOKEN, 'totalSupply()(uint256)', [('supply', from_wei)])()\n\n```\nDocumentation is ready [here](https://htmlpreview.github.io/?https://github.com/tokenchain/moodyeth/blob/main/docs/moody/index.html)\n\nAlso there is a brother library for those who works with [Tron](https://github.com/tokenchain/tronpytool) network.\n\n### Donations\n\nWelcome for donation for the good works!","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjjhesk%2Fmoodyeth","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjjhesk%2Fmoodyeth","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjjhesk%2Fmoodyeth/lists"}