From 91e2504eb065eca5e04a6e62af11d0febbf496fd Mon Sep 17 00:00:00 2001 From: GonCer Date: Tue, 3 Dec 2024 21:36:54 +0100 Subject: [PATCH 01/14] chore: forge init --- .../modify_response.cpython-312.pyc | Bin 0 -> 497 bytes .../modify_response_redirect.cpython-312.pyc | Bin 0 -> 1162 bytes .../contracts.sol/.github/workflows/test.yml | 34 +++++++++ utils/frontend/contracts.sol/.gitignore | 14 ++++ utils/frontend/contracts.sol/README.md | 66 ++++++++++++++++++ utils/frontend/contracts.sol/USDC.sol | 27 +++++++ utils/frontend/contracts.sol/USDT.sol | 27 +++++++ utils/frontend/contracts.sol/foundry.toml | 6 ++ .../contracts.sol/script/Counter.s.sol | 12 ++++ utils/frontend/contracts.sol/src/Counter.sol | 14 ++++ .../frontend/contracts.sol/test/Counter.t.sol | 24 +++++++ utils/setupsOnTheGo.ts | 1 + 12 files changed, 225 insertions(+) create mode 100644 mitmproxy/__pycache__/modify_response.cpython-312.pyc create mode 100644 mitmproxy/__pycache__/modify_response_redirect.cpython-312.pyc create mode 100644 utils/frontend/contracts.sol/.github/workflows/test.yml create mode 100644 utils/frontend/contracts.sol/.gitignore create mode 100644 utils/frontend/contracts.sol/README.md create mode 100644 utils/frontend/contracts.sol/USDC.sol create mode 100644 utils/frontend/contracts.sol/USDT.sol create mode 100644 utils/frontend/contracts.sol/foundry.toml create mode 100644 utils/frontend/contracts.sol/script/Counter.s.sol create mode 100644 utils/frontend/contracts.sol/src/Counter.sol create mode 100644 utils/frontend/contracts.sol/test/Counter.t.sol diff --git a/mitmproxy/__pycache__/modify_response.cpython-312.pyc b/mitmproxy/__pycache__/modify_response.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..1f2889a9e2c0ee18efb5cc45c0517f3f81718eee GIT binary patch literal 497 zcmX@j%ge<81m~R<(|-c##~=<2us|7~O@NH)3@HpLj5!Rsj8Tk?3@J>hj9D;wn0g?c z!kogA#*)I?!V<+?$)d^j5+tX|c#9>Yq@>^$OIl8T`7O4h)RNMoJilZ{B#j`mn1T3n z9*~&MP{WXgBne|?F~L{}I*S#-hOtr@QXMY ziwpAeic@c~l%!Ua++r_EEyzhsPSs>A0=cjlq)p+MP;P!oW?E%DOtD@;Wf3P(226m} zsRMZp3?JASq~zwy&Xm0_seMsW`?{p@MM>ig&O3xJOWHQLwEH&tUS$#c3{=XX$#RP` zH?t(SpeVnhvIrCqw>UgPLIT`?0R}d8B|{M}P_&2#Nc`fk0Xm>GC)KV<5Xc3&saPIJ jd|+l|WW38D^?{9<(QbmtblZux9~gkl1tDKR6xaX&7VBTD literal 0 HcmV?d00001 diff --git a/mitmproxy/__pycache__/modify_response_redirect.cpython-312.pyc b/mitmproxy/__pycache__/modify_response_redirect.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..7277f62b0aa79910c03c76ede510b36ed3c45bee GIT binary patch literal 1162 zcmbtTO=uHA6rM?DH)(9^PpEZkQ!5r^DQOG!RE;3kA21D4(n}FS>})k*lU-*g+K565 ziVA`a9%8+;SLwy0NAI3OD=CAX^rELgdg{qHYj&g3qTpNhn{RgBoBj5EvmbhTA_(GT z^5m_%L4>}@i5H|zS~q~y5JeQ5sDS4&Ml>)Vpg{xYRWG?SQbLtQLe)oPp8O>z1UX7s z(Zk`^e88XhB;!A$ zc%KZpqZ>TzvHSs#b;iA`^WB{ck8QN|KE(W>_l)~Gyj6_KNDriPuTMY+!XlEsFni@v zIx{z$6d`8ZDH#rjwpbEvivi{xt0)xH%2G!VZY*)3*eqA%dVopCM0dL?L$f^V$oCBo z?;bB$G`CpJFvGE}qGJG|Ic6;IF}uv<_qq@Q;+zGjpdA%yrz+D=lFP|0(zktV(C1&H z{k5s;)GNAXu9}UZ@%qsCW^|&G{6xB*pMIQbK{@)(Dyd2~xAh$WtnzK#r%a`U`pVuz&CZmdO?Q>d(CG(atiL+W_H2QvFn>7 z+cL}!0kS?1sT zuCm?mIXFlq(>TutU`a}L5&+F0#`rTDXsW2UzY=MxAsk&9sl}`DCIY%X-I7D|h=PY! S&eRgsL=ypBPw&XV-TnuIO2>cz literal 0 HcmV?d00001 diff --git a/utils/frontend/contracts.sol/.github/workflows/test.yml b/utils/frontend/contracts.sol/.github/workflows/test.yml new file mode 100644 index 000000000..09880b1d7 --- /dev/null +++ b/utils/frontend/contracts.sol/.github/workflows/test.yml @@ -0,0 +1,34 @@ +name: test + +on: workflow_dispatch + +env: + FOUNDRY_PROFILE: ci + +jobs: + check: + strategy: + fail-fast: true + + name: Foundry project + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + submodules: recursive + + - name: Install Foundry + uses: foundry-rs/foundry-toolchain@v1 + with: + version: nightly + + - name: Run Forge build + run: | + forge --version + forge build --sizes + id: build + + - name: Run Forge tests + run: | + forge test -vvv + id: test diff --git a/utils/frontend/contracts.sol/.gitignore b/utils/frontend/contracts.sol/.gitignore new file mode 100644 index 000000000..85198aaa5 --- /dev/null +++ b/utils/frontend/contracts.sol/.gitignore @@ -0,0 +1,14 @@ +# Compiler files +cache/ +out/ + +# Ignores development broadcast logs +!/broadcast +/broadcast/*/31337/ +/broadcast/**/dry-run/ + +# Docs +docs/ + +# Dotenv file +.env diff --git a/utils/frontend/contracts.sol/README.md b/utils/frontend/contracts.sol/README.md new file mode 100644 index 000000000..9265b4558 --- /dev/null +++ b/utils/frontend/contracts.sol/README.md @@ -0,0 +1,66 @@ +## Foundry + +**Foundry is a blazing fast, portable and modular toolkit for Ethereum application development written in Rust.** + +Foundry consists of: + +- **Forge**: Ethereum testing framework (like Truffle, Hardhat and DappTools). +- **Cast**: Swiss army knife for interacting with EVM smart contracts, sending transactions and getting chain data. +- **Anvil**: Local Ethereum node, akin to Ganache, Hardhat Network. +- **Chisel**: Fast, utilitarian, and verbose solidity REPL. + +## Documentation + +https://book.getfoundry.sh/ + +## Usage + +### Build + +```shell +$ forge build +``` + +### Test + +```shell +$ forge test +``` + +### Format + +```shell +$ forge fmt +``` + +### Gas Snapshots + +```shell +$ forge snapshot +``` + +### Anvil + +```shell +$ anvil +``` + +### Deploy + +```shell +$ forge script script/Counter.s.sol:CounterScript --rpc-url --private-key +``` + +### Cast + +```shell +$ cast +``` + +### Help + +```shell +$ forge --help +$ anvil --help +$ cast --help +``` diff --git a/utils/frontend/contracts.sol/USDC.sol b/utils/frontend/contracts.sol/USDC.sol new file mode 100644 index 000000000..e73dfcd30 --- /dev/null +++ b/utils/frontend/contracts.sol/USDC.sol @@ -0,0 +1,27 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.0; + +import "./FiatTokenV1_1.sol"; +import "./EIP3009.sol"; +import "./EIP2612.sol"; + +contract USDC is FiatTokenV1_1, EIP3009, EIP2612 { + constructor( + string memory name, + string memory symbol, + string memory currency, + uint8 decimals_, + address masterMinter, + address pauser, + address blacklister, + address owner + ) FiatTokenV1_1(name, symbol, currency, decimals_, masterMinter, pauser, blacklister, owner) { + // Mint initial supply of tokens to the deployer for testing + _mint(msg.sender, 1_000_000_000 * 10**decimals_); // 1 billion tokens + } + + // Function to mint more tokens for testing + function mintTestTokens(address to, uint256 amount) external { + _mint(to, amount); + } +} \ No newline at end of file diff --git a/utils/frontend/contracts.sol/USDT.sol b/utils/frontend/contracts.sol/USDT.sol new file mode 100644 index 000000000..2b391b7ed --- /dev/null +++ b/utils/frontend/contracts.sol/USDT.sol @@ -0,0 +1,27 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.0; + +import "./FiatTokenV1_1.sol"; +import "./EIP3009.sol"; +import "./EIP2612.sol"; + +contract USDT is FiatTokenV1_1, EIP3009, EIP2612 { + constructor( + string memory name, + string memory symbol, + string memory currency, + uint8 decimals_, + address masterMinter, + address pauser, + address blacklister, + address owner + ) FiatTokenV1_1(name, symbol, currency, decimals_, masterMinter, pauser, blacklister, owner) { + // Mint initial supply of tokens to the deployer for testing + _mint(msg.sender, 1_000_000_000 * 10**decimals_); // 1 billion tokens + } + + // Function to mint more tokens for testing + function mintTestTokens(address to, uint256 amount) external { + _mint(to, amount); + } +} \ No newline at end of file diff --git a/utils/frontend/contracts.sol/foundry.toml b/utils/frontend/contracts.sol/foundry.toml new file mode 100644 index 000000000..25b918f9c --- /dev/null +++ b/utils/frontend/contracts.sol/foundry.toml @@ -0,0 +1,6 @@ +[profile.default] +src = "src" +out = "out" +libs = ["lib"] + +# See more config options https://github.com/foundry-rs/foundry/blob/master/crates/config/README.md#all-options diff --git a/utils/frontend/contracts.sol/script/Counter.s.sol b/utils/frontend/contracts.sol/script/Counter.s.sol new file mode 100644 index 000000000..1a47b40b8 --- /dev/null +++ b/utils/frontend/contracts.sol/script/Counter.s.sol @@ -0,0 +1,12 @@ +// SPDX-License-Identifier: UNLICENSED +pragma solidity ^0.8.13; + +import {Script, console2} from "forge-std/Script.sol"; + +contract CounterScript is Script { + function setUp() public {} + + function run() public { + vm.broadcast(); + } +} diff --git a/utils/frontend/contracts.sol/src/Counter.sol b/utils/frontend/contracts.sol/src/Counter.sol new file mode 100644 index 000000000..aded7997b --- /dev/null +++ b/utils/frontend/contracts.sol/src/Counter.sol @@ -0,0 +1,14 @@ +// SPDX-License-Identifier: UNLICENSED +pragma solidity ^0.8.13; + +contract Counter { + uint256 public number; + + function setNumber(uint256 newNumber) public { + number = newNumber; + } + + function increment() public { + number++; + } +} diff --git a/utils/frontend/contracts.sol/test/Counter.t.sol b/utils/frontend/contracts.sol/test/Counter.t.sol new file mode 100644 index 000000000..e9b9e6acf --- /dev/null +++ b/utils/frontend/contracts.sol/test/Counter.t.sol @@ -0,0 +1,24 @@ +// SPDX-License-Identifier: UNLICENSED +pragma solidity ^0.8.13; + +import {Test, console2} from "forge-std/Test.sol"; +import {Counter} from "../src/Counter.sol"; + +contract CounterTest is Test { + Counter public counter; + + function setUp() public { + counter = new Counter(); + counter.setNumber(0); + } + + function test_Increment() public { + counter.increment(); + assertEq(counter.number(), 1); + } + + function testFuzz_SetNumber(uint256 x) public { + counter.setNumber(x); + assertEq(counter.number(), x); + } +} diff --git a/utils/setupsOnTheGo.ts b/utils/setupsOnTheGo.ts index 28d994ff4..f06f79121 100644 --- a/utils/setupsOnTheGo.ts +++ b/utils/setupsOnTheGo.ts @@ -360,6 +360,7 @@ export async function setupPoolWithRewardsForDefaultUsers() { amount.divn(10), token2, amount.divn(10), + "StableSwap", ), ), ); From bf6f4a87730f8885cfa3f8f22c61a68ea237930f Mon Sep 17 00:00:00 2001 From: GonCer Date: Tue, 3 Dec 2024 21:36:56 +0100 Subject: [PATCH 02/14] forge install: forge-std v1.9.4 --- .gitmodules | 3 +++ utils/frontend/contracts.sol/lib/forge-std | 1 + 2 files changed, 4 insertions(+) create mode 100644 .gitmodules create mode 160000 utils/frontend/contracts.sol/lib/forge-std diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 000000000..bba08cbd5 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "utils/frontend/contracts.sol/lib/forge-std"] + path = utils/frontend/contracts.sol/lib/forge-std + url = https://github.com/foundry-rs/forge-std diff --git a/utils/frontend/contracts.sol/lib/forge-std b/utils/frontend/contracts.sol/lib/forge-std new file mode 160000 index 000000000..1eea5bae1 --- /dev/null +++ b/utils/frontend/contracts.sol/lib/forge-std @@ -0,0 +1 @@ +Subproject commit 1eea5bae12ae557d589f9f0f0edae2faa47cb262 From e3a7278e771d5466c85f6fb25c1ee4beeda9d824 Mon Sep 17 00:00:00 2001 From: GonCer Date: Tue, 3 Dec 2024 21:40:01 +0100 Subject: [PATCH 03/14] add two examples --- utils/frontend/contracts.sol/{ => src}/USDC.sol | 0 utils/frontend/contracts.sol/{ => src}/USDT.sol | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename utils/frontend/contracts.sol/{ => src}/USDC.sol (100%) rename utils/frontend/contracts.sol/{ => src}/USDT.sol (100%) diff --git a/utils/frontend/contracts.sol/USDC.sol b/utils/frontend/contracts.sol/src/USDC.sol similarity index 100% rename from utils/frontend/contracts.sol/USDC.sol rename to utils/frontend/contracts.sol/src/USDC.sol diff --git a/utils/frontend/contracts.sol/USDT.sol b/utils/frontend/contracts.sol/src/USDT.sol similarity index 100% rename from utils/frontend/contracts.sol/USDT.sol rename to utils/frontend/contracts.sol/src/USDT.sol From 89efe2f4fbf889965c4357b4845f98aa569f13f9 Mon Sep 17 00:00:00 2001 From: GonCer Date: Tue, 3 Dec 2024 21:40:17 +0100 Subject: [PATCH 04/14] forge install: openzeppelin-contracts v5.1.0 --- .gitmodules | 3 +++ utils/frontend/contracts.sol/lib/openzeppelin-contracts | 1 + 2 files changed, 4 insertions(+) create mode 160000 utils/frontend/contracts.sol/lib/openzeppelin-contracts diff --git a/.gitmodules b/.gitmodules index bba08cbd5..b32ecbbf0 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,6 @@ [submodule "utils/frontend/contracts.sol/lib/forge-std"] path = utils/frontend/contracts.sol/lib/forge-std url = https://github.com/foundry-rs/forge-std +[submodule "utils/frontend/contracts.sol/lib/openzeppelin-contracts"] + path = utils/frontend/contracts.sol/lib/openzeppelin-contracts + url = https://github.com/OpenZeppelin/openzeppelin-contracts diff --git a/utils/frontend/contracts.sol/lib/openzeppelin-contracts b/utils/frontend/contracts.sol/lib/openzeppelin-contracts new file mode 160000 index 000000000..69c8def5f --- /dev/null +++ b/utils/frontend/contracts.sol/lib/openzeppelin-contracts @@ -0,0 +1 @@ +Subproject commit 69c8def5f222ff96f2b5beff05dfba996368aa79 From 32062ab2e90663ae8b683b0f6b338cfc7ab0ce88 Mon Sep 17 00:00:00 2001 From: GonCer Date: Tue, 3 Dec 2024 21:49:18 +0100 Subject: [PATCH 05/14] add script --- .../contracts.sol/script/deploycontracts.sol | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 utils/frontend/contracts.sol/script/deploycontracts.sol diff --git a/utils/frontend/contracts.sol/script/deploycontracts.sol b/utils/frontend/contracts.sol/script/deploycontracts.sol new file mode 100644 index 000000000..47fb1c88d --- /dev/null +++ b/utils/frontend/contracts.sol/script/deploycontracts.sol @@ -0,0 +1,25 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.0; +import "forge-std/Script.sol"; +import {USDC} from "../src/USDC.sol"; +import {USDT} from "../src/USDT.sol"; + +contract DeployTokens is Script { + function run() external { + // Fetch the deployer's private key from environment variables + uint256 deployerPrivateKey = vm.envUint("PRIVATE_KEY"); + + // Start broadcast for transactions + vm.startBroadcast(deployerPrivateKey); + + // Deploy TestERC20 + TestERC20 testERC20 = new USDC("Test USDC", "USDC", "cUSDC",10); + console.log("USDC deployed to:", address(testERC20)); + + // Deploy TestCustomToken + TestCustomToken testCustomToken = new USDT("Test USDT", "USDT", "cUSDT",6); + console.log("USDT deployed to:", address(testCustomToken)); + + vm.stopBroadcast(); + } +} \ No newline at end of file From a287c6651da5fc9f023d822b3638ff867cb27083 Mon Sep 17 00:00:00 2001 From: GonCer Date: Tue, 3 Dec 2024 22:15:20 +0100 Subject: [PATCH 06/14] add evth else --- utils/frontend/contracts.sol/src/USDT.sol | 27 ----------------------- 1 file changed, 27 deletions(-) delete mode 100644 utils/frontend/contracts.sol/src/USDT.sol diff --git a/utils/frontend/contracts.sol/src/USDT.sol b/utils/frontend/contracts.sol/src/USDT.sol deleted file mode 100644 index 2b391b7ed..000000000 --- a/utils/frontend/contracts.sol/src/USDT.sol +++ /dev/null @@ -1,27 +0,0 @@ -// SPDX-License-Identifier: MIT -pragma solidity ^0.8.0; - -import "./FiatTokenV1_1.sol"; -import "./EIP3009.sol"; -import "./EIP2612.sol"; - -contract USDT is FiatTokenV1_1, EIP3009, EIP2612 { - constructor( - string memory name, - string memory symbol, - string memory currency, - uint8 decimals_, - address masterMinter, - address pauser, - address blacklister, - address owner - ) FiatTokenV1_1(name, symbol, currency, decimals_, masterMinter, pauser, blacklister, owner) { - // Mint initial supply of tokens to the deployer for testing - _mint(msg.sender, 1_000_000_000 * 10**decimals_); // 1 billion tokens - } - - // Function to mint more tokens for testing - function mintTestTokens(address to, uint256 amount) external { - _mint(to, amount); - } -} \ No newline at end of file From b0338a11a593f6e623b83608aaa5a648636acfa3 Mon Sep 17 00:00:00 2001 From: GonCer Date: Tue, 3 Dec 2024 22:16:11 +0100 Subject: [PATCH 07/14] latest --- utils/frontend/contracts.sol/foundry.toml | 2 ++ .../contracts.sol/script/deploycontracts.sol | 7 +---- utils/frontend/contracts.sol/src/USDC.sol | 27 ++++++++----------- 3 files changed, 14 insertions(+), 22 deletions(-) diff --git a/utils/frontend/contracts.sol/foundry.toml b/utils/frontend/contracts.sol/foundry.toml index 25b918f9c..d958fc307 100644 --- a/utils/frontend/contracts.sol/foundry.toml +++ b/utils/frontend/contracts.sol/foundry.toml @@ -4,3 +4,5 @@ out = "out" libs = ["lib"] # See more config options https://github.com/foundry-rs/foundry/blob/master/crates/config/README.md#all-options +[remappings] +openzeppelin-contracts="lib/openzeppelin-contracts" \ No newline at end of file diff --git a/utils/frontend/contracts.sol/script/deploycontracts.sol b/utils/frontend/contracts.sol/script/deploycontracts.sol index 47fb1c88d..84f7c7d32 100644 --- a/utils/frontend/contracts.sol/script/deploycontracts.sol +++ b/utils/frontend/contracts.sol/script/deploycontracts.sol @@ -2,7 +2,6 @@ pragma solidity ^0.8.0; import "forge-std/Script.sol"; import {USDC} from "../src/USDC.sol"; -import {USDT} from "../src/USDT.sol"; contract DeployTokens is Script { function run() external { @@ -13,13 +12,9 @@ contract DeployTokens is Script { vm.startBroadcast(deployerPrivateKey); // Deploy TestERC20 - TestERC20 testERC20 = new USDC("Test USDC", "USDC", "cUSDC",10); + USDC testERC20 = new USDC("Test USDC", "USDC"); console.log("USDC deployed to:", address(testERC20)); - // Deploy TestCustomToken - TestCustomToken testCustomToken = new USDT("Test USDT", "USDT", "cUSDT",6); - console.log("USDT deployed to:", address(testCustomToken)); - vm.stopBroadcast(); } } \ No newline at end of file diff --git a/utils/frontend/contracts.sol/src/USDC.sol b/utils/frontend/contracts.sol/src/USDC.sol index e73dfcd30..991c1e980 100644 --- a/utils/frontend/contracts.sol/src/USDC.sol +++ b/utils/frontend/contracts.sol/src/USDC.sol @@ -1,27 +1,22 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; -import "./FiatTokenV1_1.sol"; -import "./EIP3009.sol"; -import "./EIP2612.sol"; +import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; -contract USDC is FiatTokenV1_1, EIP3009, EIP2612 { +contract USDC is ERC20 { constructor( string memory name, - string memory symbol, - string memory currency, - uint8 decimals_, - address masterMinter, - address pauser, - address blacklister, - address owner - ) FiatTokenV1_1(name, symbol, currency, decimals_, masterMinter, pauser, blacklister, owner) { - // Mint initial supply of tokens to the deployer for testing - _mint(msg.sender, 1_000_000_000 * 10**decimals_); // 1 billion tokens + string memory symbol + ) ERC20(name, symbol) { + // Mint initial tokens + _mint(msg.sender, 1_000_000_000 * 10**decimals()); + } + + function decimals() public pure override returns (uint8) { + return 6; } - // Function to mint more tokens for testing function mintTestTokens(address to, uint256 amount) external { _mint(to, amount); } -} \ No newline at end of file +} From df8b661096fcd3a7f219270b70bbaa3d5c522fc1 Mon Sep 17 00:00:00 2001 From: GonCer Date: Wed, 4 Dec 2024 11:27:50 +0100 Subject: [PATCH 08/14] improvements --- utils/frontend/contracts.sol/src/USDC.sol | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/utils/frontend/contracts.sol/src/USDC.sol b/utils/frontend/contracts.sol/src/USDC.sol index 991c1e980..75124196c 100644 --- a/utils/frontend/contracts.sol/src/USDC.sol +++ b/utils/frontend/contracts.sol/src/USDC.sol @@ -3,7 +3,7 @@ pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; -contract USDC is ERC20 { +contract USDC18 is ERC20 { constructor( string memory name, string memory symbol @@ -13,7 +13,7 @@ contract USDC is ERC20 { } function decimals() public pure override returns (uint8) { - return 6; + return 18; } function mintTestTokens(address to, uint256 amount) external { From 3f20dd8d0733fde2d3a754e0618f1955b95e5244 Mon Sep 17 00:00:00 2001 From: GonCer Date: Wed, 4 Dec 2024 14:42:47 +0100 Subject: [PATCH 09/14] improvements --- utils/frontend/contracts.sol/README.md | 11 +++++++++++ utils/frontend/contracts.sol/src/USDC.sol | 6 +++--- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/utils/frontend/contracts.sol/README.md b/utils/frontend/contracts.sol/README.md index 9265b4558..9b6bb6d41 100644 --- a/utils/frontend/contracts.sol/README.md +++ b/utils/frontend/contracts.sol/README.md @@ -64,3 +64,14 @@ $ forge --help $ anvil --help $ cast --help ``` + + +# Howto + foundryup + + forge install OpenZeppelin/openzeppelin-contracts + + forge build + + export PRIVATE_KEY=0xdbda1821b80551c9d65939329250298aa3472ba22feea921c0cf5d620ea67b97 ; forge script --rpc-url=https://evm-node-arb-frontend.gasp.xyz script/deploycontracts.sol --broadcast + diff --git a/utils/frontend/contracts.sol/src/USDC.sol b/utils/frontend/contracts.sol/src/USDC.sol index 75124196c..1a3f04916 100644 --- a/utils/frontend/contracts.sol/src/USDC.sol +++ b/utils/frontend/contracts.sol/src/USDC.sol @@ -3,7 +3,7 @@ pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; -contract USDC18 is ERC20 { +contract USDC is ERC20 { constructor( string memory name, string memory symbol @@ -13,10 +13,10 @@ contract USDC18 is ERC20 { } function decimals() public pure override returns (uint8) { - return 18; + return 6; } - function mintTestTokens(address to, uint256 amount) external { + function mint(address to, uint256 amount) external { _mint(to, amount); } } From 7dc44a2563593dda73f66b786ffe0d2e9ad9d0f6 Mon Sep 17 00:00:00 2001 From: GonCer Date: Wed, 4 Dec 2024 14:45:13 +0100 Subject: [PATCH 10/14] remove mtimproxy --- .../__pycache__/modify_response.cpython-312.pyc | Bin 497 -> 0 bytes .../modify_response_redirect.cpython-312.pyc | Bin 1162 -> 0 bytes 2 files changed, 0 insertions(+), 0 deletions(-) delete mode 100644 mitmproxy/__pycache__/modify_response.cpython-312.pyc delete mode 100644 mitmproxy/__pycache__/modify_response_redirect.cpython-312.pyc diff --git a/mitmproxy/__pycache__/modify_response.cpython-312.pyc b/mitmproxy/__pycache__/modify_response.cpython-312.pyc deleted file mode 100644 index 1f2889a9e2c0ee18efb5cc45c0517f3f81718eee..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 497 zcmX@j%ge<81m~R<(|-c##~=<2us|7~O@NH)3@HpLj5!Rsj8Tk?3@J>hj9D;wn0g?c z!kogA#*)I?!V<+?$)d^j5+tX|c#9>Yq@>^$OIl8T`7O4h)RNMoJilZ{B#j`mn1T3n z9*~&MP{WXgBne|?F~L{}I*S#-hOtr@QXMY ziwpAeic@c~l%!Ua++r_EEyzhsPSs>A0=cjlq)p+MP;P!oW?E%DOtD@;Wf3P(226m} zsRMZp3?JASq~zwy&Xm0_seMsW`?{p@MM>ig&O3xJOWHQLwEH&tUS$#c3{=XX$#RP` zH?t(SpeVnhvIrCqw>UgPLIT`?0R}d8B|{M}P_&2#Nc`fk0Xm>GC)KV<5Xc3&saPIJ jd|+l|WW38D^?{9<(QbmtblZux9~gkl1tDKR6xaX&7VBTD diff --git a/mitmproxy/__pycache__/modify_response_redirect.cpython-312.pyc b/mitmproxy/__pycache__/modify_response_redirect.cpython-312.pyc deleted file mode 100644 index 7277f62b0aa79910c03c76ede510b36ed3c45bee..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1162 zcmbtTO=uHA6rM?DH)(9^PpEZkQ!5r^DQOG!RE;3kA21D4(n}FS>})k*lU-*g+K565 ziVA`a9%8+;SLwy0NAI3OD=CAX^rELgdg{qHYj&g3qTpNhn{RgBoBj5EvmbhTA_(GT z^5m_%L4>}@i5H|zS~q~y5JeQ5sDS4&Ml>)Vpg{xYRWG?SQbLtQLe)oPp8O>z1UX7s z(Zk`^e88XhB;!A$ zc%KZpqZ>TzvHSs#b;iA`^WB{ck8QN|KE(W>_l)~Gyj6_KNDriPuTMY+!XlEsFni@v zIx{z$6d`8ZDH#rjwpbEvivi{xt0)xH%2G!VZY*)3*eqA%dVopCM0dL?L$f^V$oCBo z?;bB$G`CpJFvGE}qGJG|Ic6;IF}uv<_qq@Q;+zGjpdA%yrz+D=lFP|0(zktV(C1&H z{k5s;)GNAXu9}UZ@%qsCW^|&G{6xB*pMIQbK{@)(Dyd2~xAh$WtnzK#r%a`U`pVuz&CZmdO?Q>d(CG(atiL+W_H2QvFn>7 z+cL}!0kS?1sT zuCm?mIXFlq(>TutU`a}L5&+F0#`rTDXsW2UzY=MxAsk&9sl}`DCIY%X-I7D|h=PY! S&eRgsL=ypBPw&XV-TnuIO2>cz From ef2c167e9fe3f660aad5715a6369e3e2a9d76b7c Mon Sep 17 00:00:00 2001 From: GonCer Date: Wed, 4 Dec 2024 14:46:51 +0100 Subject: [PATCH 11/14] remove some crap from foundry init --- .../contracts.sol/.github/workflows/test.yml | 34 ------------------- .../contracts.sol/script/Counter.s.sol | 12 ------- utils/frontend/contracts.sol/src/Counter.sol | 14 -------- 3 files changed, 60 deletions(-) delete mode 100644 utils/frontend/contracts.sol/.github/workflows/test.yml delete mode 100644 utils/frontend/contracts.sol/script/Counter.s.sol delete mode 100644 utils/frontend/contracts.sol/src/Counter.sol diff --git a/utils/frontend/contracts.sol/.github/workflows/test.yml b/utils/frontend/contracts.sol/.github/workflows/test.yml deleted file mode 100644 index 09880b1d7..000000000 --- a/utils/frontend/contracts.sol/.github/workflows/test.yml +++ /dev/null @@ -1,34 +0,0 @@ -name: test - -on: workflow_dispatch - -env: - FOUNDRY_PROFILE: ci - -jobs: - check: - strategy: - fail-fast: true - - name: Foundry project - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - with: - submodules: recursive - - - name: Install Foundry - uses: foundry-rs/foundry-toolchain@v1 - with: - version: nightly - - - name: Run Forge build - run: | - forge --version - forge build --sizes - id: build - - - name: Run Forge tests - run: | - forge test -vvv - id: test diff --git a/utils/frontend/contracts.sol/script/Counter.s.sol b/utils/frontend/contracts.sol/script/Counter.s.sol deleted file mode 100644 index 1a47b40b8..000000000 --- a/utils/frontend/contracts.sol/script/Counter.s.sol +++ /dev/null @@ -1,12 +0,0 @@ -// SPDX-License-Identifier: UNLICENSED -pragma solidity ^0.8.13; - -import {Script, console2} from "forge-std/Script.sol"; - -contract CounterScript is Script { - function setUp() public {} - - function run() public { - vm.broadcast(); - } -} diff --git a/utils/frontend/contracts.sol/src/Counter.sol b/utils/frontend/contracts.sol/src/Counter.sol deleted file mode 100644 index aded7997b..000000000 --- a/utils/frontend/contracts.sol/src/Counter.sol +++ /dev/null @@ -1,14 +0,0 @@ -// SPDX-License-Identifier: UNLICENSED -pragma solidity ^0.8.13; - -contract Counter { - uint256 public number; - - function setNumber(uint256 newNumber) public { - number = newNumber; - } - - function increment() public { - number++; - } -} From f2cc564d878a791ef4df90a94fff83d0e91c2841 Mon Sep 17 00:00:00 2001 From: GonCer Date: Wed, 4 Dec 2024 14:49:09 +0100 Subject: [PATCH 12/14] remove test file --- .../frontend/contracts.sol/test/Counter.t.sol | 24 ------------------- 1 file changed, 24 deletions(-) delete mode 100644 utils/frontend/contracts.sol/test/Counter.t.sol diff --git a/utils/frontend/contracts.sol/test/Counter.t.sol b/utils/frontend/contracts.sol/test/Counter.t.sol deleted file mode 100644 index e9b9e6acf..000000000 --- a/utils/frontend/contracts.sol/test/Counter.t.sol +++ /dev/null @@ -1,24 +0,0 @@ -// SPDX-License-Identifier: UNLICENSED -pragma solidity ^0.8.13; - -import {Test, console2} from "forge-std/Test.sol"; -import {Counter} from "../src/Counter.sol"; - -contract CounterTest is Test { - Counter public counter; - - function setUp() public { - counter = new Counter(); - counter.setNumber(0); - } - - function test_Increment() public { - counter.increment(); - assertEq(counter.number(), 1); - } - - function testFuzz_SetNumber(uint256 x) public { - counter.setNumber(x); - assertEq(counter.number(), x); - } -} From 8cb932ead8bf31af31145660c0e74ecd3893617e Mon Sep 17 00:00:00 2001 From: GonCer Date: Thu, 5 Dec 2024 17:48:36 +0100 Subject: [PATCH 13/14] bump sdk --- cliTool/index.ts | 6 +++++- package.json | 4 ++-- utils/setupsOnTheGo.ts | 11 ++++++++++- yarn.lock | 26 +++++++++++++------------- 4 files changed, 30 insertions(+), 17 deletions(-) diff --git a/cliTool/index.ts b/cliTool/index.ts index 776cdef3b..c002feef7 100644 --- a/cliTool/index.ts +++ b/cliTool/index.ts @@ -49,7 +49,7 @@ import { getPolkAddress, create10sequencers, closeL1Item, - sendUpdateToL1, + sendUpdateToL1, calculateBuyPrice } from "../utils/setupsOnTheGo"; import { findErrorMetadata, @@ -135,10 +135,14 @@ async function app(): Promise { "Close All L1 items", "1000 withdrawals", "sync updates", + "calculateBuyPrice", ], }) .then(async (answers: { option: string | string[] }) => { console.log("Answers::: " + JSON.stringify(answers, null, " ")); + if (answers.option.includes("calculateBuyPrice")){ + await calculateBuyPrice(); + } if (answers.option.includes("sync updates")) { await sendUpdateToL1(); } diff --git a/package.json b/package.json index b7430302f..9aa7b2896 100644 --- a/package.json +++ b/package.json @@ -49,8 +49,8 @@ "ethers": "^5.4.7", "exec-sh": "^0.4.0", "express": "^4.18.2", - "gasp-sdk": "0.0.2-feature-rolldown-on-idle-hook.0", - "gasp-types": "0.0.2-feature-rolldown-on-idle-hook.0", + "gasp-sdk": "0.0.2-feature-stable-pool-mgx-1307.18", + "gasp-types": "0.0.2-feature-stable-pool-mgx-1307.24", "get-port-please": "^3.0.1", "guid-typescript": "^1.0.9", "jest-docblock": "^29.7.0", diff --git a/utils/setupsOnTheGo.ts b/utils/setupsOnTheGo.ts index f06f79121..36acabfab 100644 --- a/utils/setupsOnTheGo.ts +++ b/utils/setupsOnTheGo.ts @@ -360,7 +360,7 @@ export async function setupPoolWithRewardsForDefaultUsers() { amount.divn(10), token2, amount.divn(10), - "StableSwap", + "Xyk", ), ), ); @@ -476,6 +476,15 @@ export async function setupTokenWithRewardsForDefaultUsers() { return { users, liqId, sudo, token2 }; } +export async function calculateBuyPrice() { + await setupUsers(); + await setupApi(); + const api = await getApi(); + //@ts-ignore + const value = await api.rpc.market.get_pools(3); + //@ts-ignore + testLog.getLog().info(JSON.stringify(value.toHuman())); +} export async function printAllTxsDoneByUser(userAddress: string) { await setupUsers(); await setupApi(); diff --git a/yarn.lock b/yarn.lock index fca38ada8..0db75bac5 100644 --- a/yarn.lock +++ b/yarn.lock @@ -9559,27 +9559,27 @@ ganache@7.9.1: bufferutil "4.0.5" utf-8-validate "5.0.7" -gasp-sdk@0.0.2-feature-rolldown-on-idle-hook.0: - version "0.0.2-feature-rolldown-on-idle-hook.0" - resolved "https://registry.yarnpkg.com/gasp-sdk/-/gasp-sdk-0.0.2-feature-rolldown-on-idle-hook.0.tgz#17693211576b6a679df72dbedae12abfeb23a2a6" - integrity sha512-h08qiBKXhDgrGWojgepdOAk+Lumaq/EEro1KAlFhf+MfR+fHzH1Mm8UVONUrN2Xp/xmaVUam/0HBoLcNo+Q03A== +gasp-sdk@0.0.2-feature-stable-pool-mgx-1307.18: + version "0.0.2-feature-stable-pool-mgx-1307.18" + resolved "https://registry.yarnpkg.com/gasp-sdk/-/gasp-sdk-0.0.2-feature-stable-pool-mgx-1307.18.tgz#7e576c7ca5255ac53d492ee4a7e8ff5801785285" + integrity sha512-7RHw82pBQ2FR1Cybg2bXDbupRBZz+EV7SYgcGAK8F568rhWX3maiYQH34L4OoGHAtWo/LCrnZtpZObbo/bez8g== dependencies: big.js "6.2.1" - gasp-type-definitions "0.0.2-feature-rolldown-on-idle-hook.0" + gasp-type-definitions "0.0.2-feature-stable-pool-mgx-1307.24" tslib "^2.3.0" tslog "4.8.2" viem "^2.17.4" wagmi "^2.10.10" -gasp-type-definitions@0.0.2-feature-rolldown-on-idle-hook.0: - version "0.0.2-feature-rolldown-on-idle-hook.0" - resolved "https://registry.yarnpkg.com/gasp-type-definitions/-/gasp-type-definitions-0.0.2-feature-rolldown-on-idle-hook.0.tgz#823400703966ac0042c3e2017877810e1fbb4269" - integrity sha512-unRXCS2OUbeSSzYSKWeVpTcyEoZq8/TB+Fb7JaNO+CQ+kVOghEjatHhUtfzxkkBjdpCnB8BprLmgZm9pVLU4Sw== +gasp-type-definitions@0.0.2-feature-stable-pool-mgx-1307.24: + version "0.0.2-feature-stable-pool-mgx-1307.24" + resolved "https://registry.yarnpkg.com/gasp-type-definitions/-/gasp-type-definitions-0.0.2-feature-stable-pool-mgx-1307.24.tgz#9b227cc62ae5625dd11e250db336133f6d86edb4" + integrity sha512-AFgQMA7CsIB2K8zFyVseHKEVXlrWhtMNikLfHF15dfxP23uApnd7mMR72WKv7qYBMuxCGFI05QdatGgGQigxDA== -gasp-types@0.0.2-feature-rolldown-on-idle-hook.0: - version "0.0.2-feature-rolldown-on-idle-hook.0" - resolved "https://registry.yarnpkg.com/gasp-types/-/gasp-types-0.0.2-feature-rolldown-on-idle-hook.0.tgz#6952414f82bb2bece10a8e26f104682cf8d04145" - integrity sha512-P0VFssv/HGfJuRu9biW2DRQv2fHjc0E0L3B6M8dS2741J24ZBPi3MlCkgXQeYVyNjXT7SAdt53qZeES7CUQLug== +gasp-types@0.0.2-feature-stable-pool-mgx-1307.24: + version "0.0.2-feature-stable-pool-mgx-1307.24" + resolved "https://registry.yarnpkg.com/gasp-types/-/gasp-types-0.0.2-feature-stable-pool-mgx-1307.24.tgz#6cbf4ff7dd71460b3525c8632f2c832bfb52f165" + integrity sha512-86iMzX4ZiyxwdNAriljIqQLYmvyO4beczY+QKrqYW6k309EEp9P39VZYzWmKPKhjpF+5n2x2n2iXmXnywjKK3g== gauge@^4.0.3: version "4.0.4" From cf5d84b8f9663b4e26bfa1b5ddacc2efae358645 Mon Sep 17 00:00:00 2001 From: GonCer Date: Thu, 27 Feb 2025 10:34:31 +0100 Subject: [PATCH 14/14] minor changes --- utils/frontend/contracts.sol/script/deploycontracts.sol | 2 +- utils/frontend/contracts.sol/src/USDC.sol | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/utils/frontend/contracts.sol/script/deploycontracts.sol b/utils/frontend/contracts.sol/script/deploycontracts.sol index 84f7c7d32..e8ab5b041 100644 --- a/utils/frontend/contracts.sol/script/deploycontracts.sol +++ b/utils/frontend/contracts.sol/script/deploycontracts.sol @@ -12,7 +12,7 @@ contract DeployTokens is Script { vm.startBroadcast(deployerPrivateKey); // Deploy TestERC20 - USDC testERC20 = new USDC("Test USDC", "USDC"); + USDC testERC20 = new USDC("Test Token10", "Token10"); console.log("USDC deployed to:", address(testERC20)); vm.stopBroadcast(); diff --git a/utils/frontend/contracts.sol/src/USDC.sol b/utils/frontend/contracts.sol/src/USDC.sol index 1a3f04916..c35f4f2d5 100644 --- a/utils/frontend/contracts.sol/src/USDC.sol +++ b/utils/frontend/contracts.sol/src/USDC.sol @@ -13,7 +13,7 @@ contract USDC is ERC20 { } function decimals() public pure override returns (uint8) { - return 6; + return 18; } function mint(address to, uint256 amount) external {