From 58c106c44a24bc9214360a16e362ca310bb97a19 Mon Sep 17 00:00:00 2001 From: AK <827452+ak-paca@users.noreply.github.com> Date: Wed, 25 Jan 2023 15:00:25 +0200 Subject: [PATCH 1/3] chore: add info to README --- README.md | 43 ++++--------------------------------------- 1 file changed, 4 insertions(+), 39 deletions(-) diff --git a/README.md b/README.md index d6eeea3..cbae768 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,9 @@ # Aldex Contracts +## Old repo (contains issues/releases that were not migrated) + +[Previous repo](https://github.com/alpaca-finance/aldex-contracts) + ## Get Started [Environment setup](https://alpacafinance.atlassian.net/wiki/spaces/ALDEX/pages/9109505/Environment+setup) @@ -28,42 +32,3 @@ - x - Major (protocol api significant change, for example when a roadmap milestone acomplished) - y - Minor (may have some minor api changes and deployment script changes) - z - Patch (bugfix/optimization that doesn't affect deployment script/api) - -NOTE: In an agile development we will do at least one Patch-level release each sprint. - -### How to Deploy Aldex Contracts on FORK - -important -``` -use .mainnet.empty.json as initial file to update contracts information while deploy - -define env value - -FORK_RPC_URL= -IMPERSONATE_ACCOUNT= -``` - -note -``` -if found `failed ProviderError: resource not found` try remove `.mainnet.json` in `.openzeppelin` -``` - -1. run `yarn compile` if contracts is already compiled with stabled code, you can skip this step -2. run `yarn deploy:aldex-core`\ - deploy Libraries, AldexDeployer, AldexBank, Ausd, AldexBankConfig, ConcentratedLiquidityPoolFactory, etc.. -3. run `yarn deploy:oracle`\ - deploy ChainlinkPriceOracle, OracleChecker, setChainlinkPriceOracle on AldexBankConfig, setOracleChecker on AldexBank -4. run `yarn deploy:strategy-outside-swap`\ - deploy UniswapV3StrategyOutsideSwap and whitelist on AldexBank -5. run `yarn deploy:concentrated-pool`\ - deploy cl pools with custom inputs variable inside `concentrated-liquidity-pool.ts` -6. run `yarn deploy:concentrated-pool-helper` - -### How to set config on contract - -7. run `yarn config:set-oracle-checker-config`\ - set expired time and tolerance bps per token -8. run `yarn config:set-oracle-prices`\ - set price via chainlink address per token -9. run `yarn config:update-ausd-max-debt-limit` - set max debt per token on AldexBank From 5dad52652f2929137caf1e597d7fdc72386429eb Mon Sep 17 00:00:00 2001 From: AK <827452+ak-paca@users.noreply.github.com> Date: Thu, 16 Mar 2023 03:04:13 +0200 Subject: [PATCH 2/3] add FakeERC20 token --- contracts/v0.8.17/extras/ERC20FakeToken.sol | 14 ++++++++++++++ hardhat.config.ts | 1 + 2 files changed, 15 insertions(+) create mode 100644 contracts/v0.8.17/extras/ERC20FakeToken.sol diff --git a/contracts/v0.8.17/extras/ERC20FakeToken.sol b/contracts/v0.8.17/extras/ERC20FakeToken.sol new file mode 100644 index 0000000..2a966ee --- /dev/null +++ b/contracts/v0.8.17/extras/ERC20FakeToken.sol @@ -0,0 +1,14 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.0; + +import { ERC20 } from "../../../lib/openzeppelin-contracts/contracts/token/ERC20/ERC20.sol"; + +contract FakeERC20 is ERC20 { + constructor( + uint256 initialSupply, + string memory name, + string memory symbol + ) ERC20(name, symbol) { + _mint(msg.sender, initialSupply); + } +} diff --git a/hardhat.config.ts b/hardhat.config.ts index f2bfa0c..969111b 100644 --- a/hardhat.config.ts +++ b/hardhat.config.ts @@ -46,6 +46,7 @@ const config: HardhatUserConfig = { "tests", "pool", "strategies", + "extras", ], }, solidity: { From 937a8f5340d546d56604e4caca47beb4c0290816 Mon Sep 17 00:00:00 2001 From: AK <827452+ak-paca@users.noreply.github.com> Date: Wed, 22 Mar 2023 17:29:24 +0200 Subject: [PATCH 3/3] upd: add mint / burn to fake token --- contracts/v0.8.17/extras/ERC20FakeToken.sol | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/contracts/v0.8.17/extras/ERC20FakeToken.sol b/contracts/v0.8.17/extras/ERC20FakeToken.sol index 2a966ee..0a04b94 100644 --- a/contracts/v0.8.17/extras/ERC20FakeToken.sol +++ b/contracts/v0.8.17/extras/ERC20FakeToken.sol @@ -4,11 +4,19 @@ pragma solidity ^0.8.0; import { ERC20 } from "../../../lib/openzeppelin-contracts/contracts/token/ERC20/ERC20.sol"; contract FakeERC20 is ERC20 { - constructor( - uint256 initialSupply, - string memory name, - string memory symbol - ) ERC20(name, symbol) { - _mint(msg.sender, initialSupply); + address private owner; + + constructor(string memory name, string memory symbol) ERC20(name, symbol) { + owner = _msgSender(); + } + + function mint(address _to, uint256 _amount) external { + require(_msgSender() == owner, "Security violation"); + _mint(_to, _amount); + } + + function burn(address _account, uint256 _amount) external { + require(_msgSender() == owner, "Security violation"); + _burn(_account, _amount); } }