-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'release/v1.0.0' into merge/deploy/v1.0.0-mainnet
Signed-off-by: Thai Xuan Dang <59406756+thaixuandang@users.noreply.github.com>
- Loading branch information
Showing
42 changed files
with
6,523 additions
and
4,678 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,4 +18,9 @@ yarn-error.log | |
.yarnrc.yml | ||
|
||
# Soldeer | ||
dependencies/ | ||
dependencies/ | ||
|
||
# Hardhat | ||
artifacts/ | ||
typechain/ | ||
cache_hardhat/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,114 +1,41 @@ | ||
## Template Smart Contract Project | ||
# Katana V3 Smart Contracts | ||
|
||
This repository serves as a template for building robust and efficient smart contracts, providing developers with a structured foundation to accelerate the process of developing, testing and upgrading contracts. | ||
This repository contains the router and governance contracts for the Katana decentralized exchange. | ||
|
||
## Documentation | ||
## Development | ||
|
||
https://book.getfoundry.sh/ | ||
### Prerequisites | ||
|
||
## Usage | ||
For a comprehensive guide on writing migrations, refer to [foundry-deployment-kit example](https://github.com/axieinfinity/foundry-deployment-kit/tree/testnet/script/sample). | ||
To work with this repository, ensure you have the following tools installed: | ||
- Node.js (version 16 or later) | ||
- Yarn or npm | ||
- Hardhat | ||
|
||
## Install | ||
```shell | ||
$ yarn install | ||
$ forge install | ||
After cloning the repository, install the required JavaScript dependencies for testing by running: | ||
``` | ||
|
||
### Build | ||
|
||
```shell | ||
$ forge build | ||
``` | ||
|
||
### Test | ||
|
||
```shell | ||
$ forge test | ||
``` | ||
|
||
### Format | ||
|
||
```shell | ||
$ forge fmt | ||
``` | ||
|
||
### Simulate | ||
|
||
```shell | ||
$ ./run.sh <path/to/file.s.sol> -f <network> | ||
``` | ||
|
||
### Broadcast | ||
|
||
```shell | ||
$ ./run.sh <path/to/file.s.sol> -f <network> --broadcast --log <subcommand> | ||
yarn | ||
``` | ||
|
||
### Verify | ||
|
||
```shell | ||
$ ./verify.sh -c <network> | ||
And Foundry dependencies: | ||
``` | ||
|
||
### Debug | ||
|
||
#### Debug on-chain transaction hash | ||
|
||
```shell | ||
$ cast run -e istanbul -r <network> <tx_hash> | ||
forge install | ||
forge soldeer update | ||
``` | ||
|
||
#### Debug raw call data | ||
### Compiling | ||
|
||
```shell | ||
# Create a debug file | ||
$ touch .debug.env | ||
To compile the contracts, run: | ||
``` | ||
Fill in the necessary variables in the .debug.env file. Refer to the provided .debug.env.example for guidance. Here's an example of how to set the variables: | ||
```shell | ||
BLOCK=21224300 | ||
FROM=0x412d4d69122839fccad0180e9358d157c3876f3c | ||
TO=0x512699b52ac2dc2b2ad505d9f29dcdad078fa799 | ||
VALUE=0x27cdb0997a65b2de99 | ||
CALLDATA=0xcb80fe2f00000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000412d4d69122839fccad0180e9358d157c3876f3c0000000000000000000000000000000000000000000000000000000001e133809923eb94000000032ef4aeab07d3fac5770bd31775496da5b39fa2215aee1494000000000000000000000000803c459dcb8771e5354d1fc567ecc6885a9fd5e600000000000000000000000000000000000000000000000000000000000001200000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000374686900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 | ||
``` | ||
Debug command: | ||
```shell | ||
chmod +x debug.sh | ||
./debug.sh -f <network> | ||
``` | ||
|
||
### Miscellaneous | ||
|
||
#### Inspect Storage layout | ||
|
||
```shell | ||
$ forge inspect <contract> storage-layout --pretty | ||
forge build | ||
``` | ||
This will generate the compiled artifacts in the out directory. | ||
|
||
#### Inspect error selectors | ||
### Testing | ||
|
||
```shell | ||
$ forge inspect <contract> errors --pretty | ||
You can run tests to ensure the contracts work as expected. | ||
``` | ||
|
||
#### Decode errors | ||
```shell | ||
$ cast 4byte <error_codes> | ||
# or | ||
$ cast 4byte-decode <long_bytes_error_codes> | ||
forge test | ||
``` | ||
|
||
#### Decode call data | ||
```shell | ||
$ cast pretty-calldata <calldata> | ||
With Hardhat tests, run: | ||
``` | ||
|
||
### Help | ||
|
||
```shell | ||
$ forge --help | ||
$ anvil --help | ||
$ cast --help | ||
yarn test | ||
``` |
48 changes: 48 additions & 0 deletions
48
broadcast/20241118_DeployFixedRouter.s.sol/2021/run-1731916689.json
Large diffs are not rendered by default.
Oops, something went wrong.
48 changes: 48 additions & 0 deletions
48
broadcast/20241118_DeployFixedRouter.s.sol/2021/run-latest.json
Large diffs are not rendered by default.
Oops, something went wrong.
96 changes: 96 additions & 0 deletions
96
broadcast/DeployKatanaOperationTestnet.s.sol/2021/run-1726654011.json
Large diffs are not rendered by default.
Oops, something went wrong.
96 changes: 96 additions & 0 deletions
96
broadcast/DeployKatanaOperationTestnet.s.sol/2021/run-latest.json
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// SPDX-License-Identifier: UNLICENSED | ||
pragma solidity ^0.8.17; | ||
|
||
import { Script, console } from "forge-std/Script.sol"; | ||
import { RouterParameters } from "@katana/operation-contracts/aggregate-router/base/RouterImmutables.sol"; | ||
import { AggregateRouter } from "@katana/operation-contracts/aggregate-router/AggregateRouter.sol"; | ||
|
||
contract Migration__20241118_DeployFixedRouter is Script { | ||
function run() public { | ||
RouterParameters memory params = RouterParameters({ | ||
permit2: 0xCcf4a457E775f317e0Cf306EFDda14Cc8084F82C, | ||
weth9: 0xA959726154953bAe111746E265E6d754F48570E6, | ||
governance: 0x247F12836A421CDC5e22B93Bf5A9AAa0f521f986, | ||
v2Factory: 0x86587380C4c815Ba0066c90aDB2B45CC9C15E72c, | ||
v3Factory: 0x4E7236ff45d69395DDEFE1445040A8f3C7CD8819, | ||
pairInitCodeHash: 0x1cc97ead4d6949b7a6ecb28652b21159b9fd5608ae51a1960224099caab07dca, | ||
poolInitCodeHash: 0xb381dabeb6037396a764deb39e57a4a3f75b641ce3e9944b1e4b18d036e322e1 | ||
}); | ||
|
||
vm.rememberKey(vm.envUint("TESTNET_PK")); | ||
vm.broadcast(); | ||
|
||
address router = address(new AggregateRouter(params)); | ||
console.log("Aggregate Router deployed:", router); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[[dependencies]] | ||
name = "@openzeppelin-contracts" | ||
version = "4.7.0" | ||
source = "https://github.com/OpenZeppelin/openzeppelin-contracts/archive/refs/tags/v4.7.0.zip" | ||
url = "https://github.com/OpenZeppelin/openzeppelin-contracts/archive/refs/tags/v4.7.0.zip" | ||
checksum = "7a88a52b70872f3e428e595a03aed77c3323b118338d7256ce57dfc99eeab9e9" | ||
integrity = "e47aca6d7bf9d4e13aba827a315bac2ab10708d1a2d219bff645a20e5d78ff85" | ||
integrity = "40bc5e663f19cf42c5ab0ddfc049ca44d58a9f1236cef417c370af79fa8ac3a7" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// SPDX-License-Identifier: GPL-3.0-or-later | ||
pragma solidity ^0.8.17; | ||
|
||
contract ExampleModule { | ||
event ExampleModuleEvent(string message); | ||
|
||
error CauseRevert(); | ||
|
||
function logEvent() public { | ||
emit ExampleModuleEvent("testEvent"); | ||
} | ||
|
||
function causeRevert() public pure { | ||
revert CauseRevert(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
// SPDX-License-Identifier: GPL-3.0-or-later | ||
pragma solidity ^0.8.17; | ||
|
||
import { ERC1155 } from "solmate/tokens/ERC1155.sol"; | ||
import { Permit2 } from "permit2/src/Permit2.sol"; | ||
import { TransparentUpgradeableProxy } from "@openzeppelin-contracts-4.7.0/contracts/proxy/transparent/TransparentUpgradeableProxy.sol"; | ||
|
||
// this contract only exists to pull ERC1155 and Permit2 into the hardhat build pipeline | ||
// so that typechain artifacts are generated for it | ||
abstract contract ImportsForTypechain is ERC1155, Permit2 { } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
// SPDX-License-Identifier: GPL-3.0-or-later | ||
pragma solidity ^0.8.17; | ||
|
||
contract TestCustomErrors { | ||
// adding so that hardhat knows this custom signature selector for external contracts | ||
error InvalidSignature(); | ||
error UnsafeCast(); | ||
} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.