{"id":13453523,"url":"https://github.com/eoseoul/eos-ramcost","last_synced_at":"2025-03-24T01:31:35.185Z","repository":{"id":81548408,"uuid":"136478804","full_name":"eoseoul/eos-ramcost","owner":"eoseoul","description":"Adjusting supply of a token and connector balance of bancor during final phase of boot.","archived":false,"fork":false,"pushed_at":"2022-03-13T20:18:32.000Z","size":77,"stargazers_count":6,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-01-25T04:52:51.390Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/eoseoul.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2018-06-07T13:07:36.000Z","updated_at":"2018-11-23T14:34:14.000Z","dependencies_parsed_at":null,"dependency_job_id":"b48f5c41-148b-4623-a01d-147c4b89019a","html_url":"https://github.com/eoseoul/eos-ramcost","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eoseoul%2Feos-ramcost","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eoseoul%2Feos-ramcost/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eoseoul%2Feos-ramcost/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eoseoul%2Feos-ramcost/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eoseoul","download_url":"https://codeload.github.com/eoseoul/eos-ramcost/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245194246,"owners_count":20575728,"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":[],"created_at":"2024-07-31T08:00:42.102Z","updated_at":"2025-03-24T01:31:34.753Z","avatar_url":"https://github.com/eoseoul.png","language":"C++","funding_links":[],"categories":["Tools","Developers"],"sub_categories":["Node Tools","Block Producer tools"],"readme":"# Backgrounds\n\nIt is necessary to buy ram for creating new accounts in EOSIO. To buy, it costs some EOS. To boot up the mainnet based on EOSIO, some of block producer candidates proposed method to create user accounts in `genesis.json`.\n\nTwo methods emerged. 1) Print some EOS more and gift ram costs to genesis users. 2) Transfer (or Workout) and make supply to 1B exactly.\n\nBut there are hot debates about results of methods proposed. Before **resignation of system accounts**, states below are ideal and desirable because this is a blockchain. See three conditions below.\n\n## Three conditions\n\n1. **supply of EOS token** : 1,000,000,000.0000 EOS exactly.\n   * Initial EOS distribution is 1B.\n   * If larger than 1B, inflation is slightly **more**.\n2. **connector balance of EOS in Bancor system** : (1,000,000,000.0000 / 1000) exactly.\n    * If larger than value above, RAM price starts slightly **higher** and grows slightly **steeper**. In consequence, users pay **more**.\n3. **Initial token balance of system accounts** : 0.0000 EOS exactly.\n   * sum of all accounts including user accounts and system accounts should be same with supply of EOS token above.\n   * system accounts such as `eosio`, `eosio.ram`, `eosio.ramfee`, `eosio.stake`\n\nIt is quite easy to check whether three conditions are met before resignation of system accounts using commands below:\n```\ncleos get currency stats eosio.token EOS\ncleos get currency balance eosio.token eosio EOS\n# .... and many other system accounts\ncleos get table eosio eosio rammarket\n```\n\nIn either way, in order to be in desirable states, three conditions above should be satisfied. But there were no viable options to do that although hot debates.\n\nTo fill the gap between proposed methods and to make adjustments easy, `eos-ramcost` is implemented, tested and presented to community before mainnet launch for review and inclusion.\n\n# `eos-ramcost` contracts\n\nTwo contracts, `eosio.token.ramcost` and `eosio.system.ramcost` for adjusting during boot. **And only three simple actions are just added to be audited easily.** It is tested on master branch of eos-mainnet repo only. And **`wasm` included.**\n\n# Codes\n\nOriginal `eosio.token` and `eosio.system` is from master branch of eos-mainnet repo.\n* commit id : `464b687e684290beee6a37c3521f3181216700e8`\n\n## `eosio.token.ramcost` contract\n\nTwo actions are added to original `eosio.token` contract.\n\n* `zerobalance` for zeroing balance of target account.\n```\ncleos push action eosio.token zerobalance '[\"eosio.ram\", \"0.0000 EOS\"]' -p eosio\n```\n\n* `unissue` for adjusting(subtracting) excess supply of a token.\n```\ncleos push action eosio.token unissue '[\"101019.2000 EOS\", \"Adjust supply to correct initial supply and inflation\"]' -p eosio\n```\n\n## `eosio.system.ramcost` contract\n\nOne action is added to original `eosio.system` contract.\n\n* `biosramcost` for adjusting(subtracting) excess balance of EOS inside Bancor.\n```\ncleos push action eosio biosramcost '[\"eosio\", \"249.0751 EOS\"]' -p eosio\n```\n\n# Build\n\nIt is tested on master branch of eos-mainnet repo only.\n\n* Clone this repo and copy two directorys into under `contracts/`.\n* Make some changes into `contracts/CMakeLists.txt`\n```\nadd_subdirectory(eosio.token.ramcost)\nadd_subdirectory(eosio.system.ramcost)\n```\n* Then, launch `./eosio_build.sh`\n\nSorry for not being neat.\n\nOr you can use `wasm` files included.\n\n# Usage\n\n* You can use `eos-ramcost` contracts from the beginning or when necessary.\n```\ncleos set contract eosio.token /path/to/eosio.token.ramcost\ncleos set contract eosio /path/to/eosio.system.ramcost\n```\n\nIt's time to adjust for the common good. **Calculate the amount to adjust before.**\n\n* Check the initial state of 1) token supply, 2) balance of system accounts, and 3) bancor state.\n```\ncleos get currency stats eosio.token EOS\ncleos get currency balance eosio.token eosio EOS\n# .... and many other system accounts\ncleos get table eosio eosio rammarket\n```\n* **Adjust token supply of EOS.** Say subtrating 101019.2000 EOS for example.\n```\ncleos push action eosio.token unissue '[\"101019.2000 EOS\", \"Adjust supply to correct initial supply and inflation\"]' -p eosio\n```\n* Check result.\n```\ncleos get currency stats eosio.token EOS\n```\n\n* **Zero** balances of system accounts of interest.\n```\ncleos push action eosio.token zerobalance '[\"eosio.ram\", \"0.0000 EOS\"]' -p eosio\n# .... and many other system accounts\n```\n\n* Check results.\n```\ncleos get currency balance eosio.token eosio EOS\n# .... and many other system accounts\n```\n\n* **Adjust balance of EOS in bancor state.** Say subtracting 249.0751 EOS for example.\n```\ncleos push action eosio biosramcost '[\"eosio\", \"249.0751 EOS\"]' -p eosio\n```\n\n* Check again 1) token supply, 2) balance of system accounts, and 3) bancor state to satisfy three conditions.\n```\ncleos get currency stats eosio.token EOS\ncleos get currency balance \n# .... and many other system accounts\ncleos get table eosio eosio rammarket\n```\n\n* When finished, setcode again to original contracts.\n```\ncleos set contract eosio.token /path/to/eosio.token\ncleos set contract eosio /path/to/eosio.system\n```\n\nGood. We're done. Proceed to the next step.\n\n# Reference\n\n* https://gist.github.com/redjade/bdbcb10708e165b29d0301c5defa1d83\n* [EOSeoul Testnet Builder](https://github.com/eoseoul/testnetbuilder)\n\n**EOSeoul**\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feoseoul%2Feos-ramcost","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feoseoul%2Feos-ramcost","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feoseoul%2Feos-ramcost/lists"}