{"id":19096759,"url":"https://github.com/makerdao/endgame-toolkit","last_synced_at":"2025-04-09T14:07:53.619Z","repository":{"id":152393869,"uuid":"621905549","full_name":"makerdao/endgame-toolkit","owner":"makerdao","description":"Smart contract modules to enable MakerDAO Endgame.","archived":false,"fork":false,"pushed_at":"2024-12-13T15:38:13.000Z","size":2054,"stargazers_count":52,"open_issues_count":4,"forks_count":25,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-02T12:08:05.850Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Solidity","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/makerdao.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":"audits/ChainSecurity_MakerDAO_EndGame_Toolkit_scripts_audit.pdf","citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-03-31T16:36:44.000Z","updated_at":"2024-11-05T15:17:34.000Z","dependencies_parsed_at":null,"dependency_job_id":"c1783de2-030f-4c2e-a00a-d5ba2703d6ab","html_url":"https://github.com/makerdao/endgame-toolkit","commit_stats":{"total_commits":56,"total_committers":4,"mean_commits":14.0,"dds":0.125,"last_synced_commit":"e6c3a783614748717b4cb8d671c907a1feb71121"},"previous_names":["makerdao/endgame-toolkit"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/makerdao%2Fendgame-toolkit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/makerdao%2Fendgame-toolkit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/makerdao%2Fendgame-toolkit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/makerdao%2Fendgame-toolkit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/makerdao","download_url":"https://codeload.github.com/makerdao/endgame-toolkit/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248054207,"owners_count":21039952,"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-11-09T03:37:40.143Z","updated_at":"2025-04-09T14:07:53.595Z","avatar_url":"https://github.com/makerdao.png","language":"Solidity","readme":"# Endgame Toolkit\n\nA set of components for the [SubDAO](https://endgame.makerdao.com/subdaos/overview) stack in the context of the\n[MakerDAO Endgame](https://endgame.makerdao.com/).\n\n\u003c!-- vim-markdown-toc GFM --\u003e\n\n- [Components](#components)\n  - [`SubProxy`](#subproxy)\n  - [`SDAO`](#sdao)\n  - [Farms](#farms)\n    - [`VestedRewardsDistribution`](#vestedrewardsdistribution)\n    - [`StakingRewards`](#stakingrewards)\n- [Contributing](#contributing)\n  - [Requirements](#requirements)\n  - [Install dependencies](#install-dependencies)\n  - [Build](#build)\n  - [Run tests](#run-tests)\n\n\u003c!-- vim-markdown-toc --\u003e\n\n## Components\n\n### `SubProxy`\n\nThe `SubProxy` is the SubDAO level counter-party of the MakerDAO level [`MCD_PAUSE_PROXY`][mcd-pause-proxy]\n\nThe reason a Proxy is required is to isolate the context of execution for spells from the main governance contract to\navoid potential exploits messing with the original contract storage.\n\nThis module is heavily inspired by the original [`DSPauseProxy`][ds-pause-proxy] contract, with a few modifications:\n\n- Instead of a single `owner`, it uses the now classic `wards`/`rely`/`deny` pattern from MCD.\n- The `exec` function is `payable`.\n\n### `SDAO`\n\n`SDAO` is a standard ERC-20 token with permissioned `mint`ing capability. It is meant to be the main SubDAO governance\ntoken.\n\nThere is an uncommon feature that allow the owner of the contract to change both `name` and `symbol`. This can be used\nby SubDAOs in the future to rebrand their tokens. For simplicity, there is no limitation on the amount of times this can\nbe done at code level. Future immutability will be enforced off-chain by governance artifacts.\n\n### Farms\n\nFor more details about the farming solution in the scope of the Endgame, please refer to the [technical document](https://hackmd.io/@dewiz/endgame-token-farming).\n\n#### `VestedRewardsDistribution`\n\nRewards are going to be generated through a [`DssVestMintable`][dss-vest] contract and distributed to final users\nthrough a [`StakingRewards`](#stakingrewards) contract.\n\n`VestedRewardsDistribution` is the \"glue\" between these two very distinct contracts. It controls the vesting stream from\n`DssVest` and permissionlessly allows for distributing rewards on a predefined schedule.\n\n#### `StakingRewards`\n\n`StakingRewards` is a port of [Synthetix `StakingRewards`][staking-rewards]. The changes made include:\n\n- Upgrade to the Solidity version from 0.5.x to 0.8.x.\n  - It was required some reorganization of the internal structure because of changes in the inheritance resolution\n    mechanism.\n- Add referral code functionality for `stake()`.\n  - Referral codes are meant to be used by UIs to identify themselves as the preferred solution by users.\n  - The original `stake(uint256 amount)` function still works the same as before.\n  - There is a new overload `stake(uint256 amount, uint16 referral)` which performs the same operation and emits the\n    new `Referral` event.\n- Update `setRewardsDuration()` to support changing the reward duration during an active distribution.\n  - This allows the duration to be changed even when new reward is added immediately after the end of a distribution\n    period, which would be the case when `rewardDistribution` is a smart contract distributing new reward every period.\n- Prevent `rewardsToken` and `stakingToken` from being the same token.\n  - Instead of using the _pull pattern_, this contract expect the address with the `rewardsDistribution` role to\n    transfer the tokens to it and call `notifyRewardAmount` with the correct value.\n  - There is a possible scenario where the amount of tokens transferred to the contract is less than the amount used as\n    a parameter in `notifyRewardAmount`. In such case, if the staking token and rewards token are the same, the staked\n    tokens would be incorporated into the new reward period, causing stakers to lose their capital.\n\n## Contributing\n\n### Requirements\n\n- [Foundry](https://github.com/foundry-rs/foundry)\n- [Node.js](https://nodejs.org/)\n- [Yarn 1.x](https://classic.yarnpkg.com/lang/en/)\n\nWe use Foundry for all Solidity things and Node.js + Yarn to manage devtools, such as linting and formatting.\n\n### Install dependencies\n\nAfter cloning the repo, run:\n\n```bash\n# 1. Install solhint, prettier, husky and other tools\nyarn install\n# 2. Install Foundry dependencies\nforge update\n```\n\n### Build\n\n**⚠️ ATTENTION:** The order of execution is important here.\n\n```bash\n# 1. Build the Solidity 0.6.x contract\nFOUNDRY_PROFILE=0_6_x forge build\n# 2. Build the default Solidity 0.8.x contracts\nforge build\n```\n\nNotice that if you use `forge build --force`, the `out/` directory is going to be erased.\n\n### Run tests\n\n```bash\nforge test -vvv\n```\n\n[mcd-pause-proxy]: https://etherscan.io/address/0xbe8e3e3618f7474f8cb1d074a26affef007e98fb#code\n[dss-vest]: https://github.com/makerdao/dss-vest/blob/19a9d663bb3a2737f1f0c763365f1dfc6788aad2/src/DssVest.sol#L223-L225\n[ds-pause-proxy]: https://github.com/makerdao/ds-pause/blob/5e798dd96bfaac978cd9fe3c0259b486e8afd213/src/pause.sol#L139-L154\n[staking-rewards]: https://github.com/Synthetixio/synthetix/blob/098b7f58a65fab5c2608d1d7e9c8bd56fdcc50d3/contracts/StakingRewards.sol\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmakerdao%2Fendgame-toolkit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmakerdao%2Fendgame-toolkit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmakerdao%2Fendgame-toolkit/lists"}