feat: complete cancun hardhat compile setup for wtf-contract
This commit is contained in:
@@ -0,0 +1,5 @@
|
|||||||
|
# Robinhood Chain Testnet Deployment Env
|
||||||
|
PRIVATE_KEY=your_testnet_private_key_here
|
||||||
|
ROBINHOOD_TESTNET_RPC=https://rpc.testnet.chain.robinhood.com
|
||||||
|
TREASURY_ADDRESS=
|
||||||
|
COLLATERAL_ADDRESS=
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
node_modules
|
||||||
|
cache
|
||||||
|
artifacts
|
||||||
|
deployments
|
||||||
|
.env
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
import os
|
||||||
|
import shutil
|
||||||
|
import json
|
||||||
|
|
||||||
|
base = r"C:\Users\splea\Desktop\WTFX\wtf-contract"
|
||||||
|
|
||||||
|
# 1. 链接 @solady/utils
|
||||||
|
solady_pkg = os.path.join(base, "node_modules", "@solady", "utils")
|
||||||
|
os.makedirs(solady_pkg, exist_ok=True)
|
||||||
|
with open(os.path.join(solady_pkg, "package.json"), "w") as f:
|
||||||
|
json.dump({"name": "@solady/utils", "version": "1.0.0"}, f)
|
||||||
|
|
||||||
|
src_utils = os.path.join(base, "node_modules", "solady", "src", "utils")
|
||||||
|
if os.path.exists(src_utils):
|
||||||
|
for item in os.listdir(src_utils):
|
||||||
|
s = os.path.join(src_utils, item)
|
||||||
|
d = os.path.join(solady_pkg, item)
|
||||||
|
if os.path.isfile(s):
|
||||||
|
shutil.copy2(s, d)
|
||||||
|
|
||||||
|
# 2. 保证 curve/src 下的合约也可以被扫描到 main/src
|
||||||
|
curve_src = os.path.join(base, "curve", "src")
|
||||||
|
main_curves = os.path.join(base, "main", "src", "curves")
|
||||||
|
if os.path.exists(curve_src):
|
||||||
|
shutil.rmtree(main_curves, ignore_errors=True)
|
||||||
|
shutil.copytree(curve_src, main_curves)
|
||||||
|
|
||||||
|
# 3. 复制 mock
|
||||||
|
mock_src = os.path.join(base, "mock")
|
||||||
|
main_mock = os.path.join(base, "main", "src", "mock")
|
||||||
|
if os.path.exists(mock_src):
|
||||||
|
shutil.rmtree(main_mock, ignore_errors=True)
|
||||||
|
shutil.copytree(mock_src, main_mock)
|
||||||
|
|
||||||
|
print("Pre-compile sync complete!")
|
||||||
+23
-6
@@ -4,21 +4,38 @@ require("dotenv").config();
|
|||||||
const PRIVATE_KEY = process.env.PRIVATE_KEY || "0x0000000000000000000000000000000000000000000000000000000000000001";
|
const PRIVATE_KEY = process.env.PRIVATE_KEY || "0x0000000000000000000000000000000000000000000000000000000000000001";
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
|
paths: {
|
||||||
|
sources: "./main/src",
|
||||||
|
tests: "./test",
|
||||||
|
cache: "./cache",
|
||||||
|
artifacts: "./artifacts"
|
||||||
|
},
|
||||||
solidity: {
|
solidity: {
|
||||||
|
compilers: [
|
||||||
|
{
|
||||||
version: "0.8.29",
|
version: "0.8.29",
|
||||||
settings: {
|
settings: {
|
||||||
evmVersion: "cancun",
|
evmVersion: "cancun",
|
||||||
optimizer: {
|
optimizer: {
|
||||||
enabled: true,
|
enabled: true,
|
||||||
runs: 200
|
runs: 200
|
||||||
}
|
},
|
||||||
|
viaIR: true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
paths: {
|
{
|
||||||
sources: "./main/src",
|
version: "0.8.20",
|
||||||
tests: "./test",
|
settings: {
|
||||||
cache: "./cache",
|
optimizer: {
|
||||||
artifacts: "./artifacts"
|
enabled: true,
|
||||||
|
runs: 200
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
preprocess: {
|
||||||
|
// 处理 @wtf/ 别名映射
|
||||||
},
|
},
|
||||||
networks: {
|
networks: {
|
||||||
localhost: {
|
localhost: {
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ library Errors {
|
|||||||
error CurveInvalidCost(uint256 quantity);
|
error CurveInvalidCost(uint256 quantity);
|
||||||
error CurveOtDeltaNotOnTick(uint256 otDelta, uint256 tick);
|
error CurveOtDeltaNotOnTick(uint256 otDelta, uint256 tick);
|
||||||
error CurveInvalidStartEnd();
|
error CurveInvalidStartEnd();
|
||||||
|
error CurveInvalidParams();
|
||||||
|
|
||||||
error RegistryInsufficientOutcomesGiven();
|
error RegistryInsufficientOutcomesGiven();
|
||||||
error RegistryExceedMaxNames();
|
error RegistryExceedMaxNames();
|
||||||
|
|||||||
+10
-4
@@ -3,15 +3,21 @@
|
|||||||
"version": "2.0.0",
|
"version": "2.0.0",
|
||||||
"description": "WTFX Core Smart Contracts & Deployment Scripts",
|
"description": "WTFX Core Smart Contracts & Deployment Scripts",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"compile": "hardhat compile",
|
"prepare": "python _prepare_compile.py",
|
||||||
|
"compile": "python _prepare_compile.py && hardhat compile",
|
||||||
"test": "hardhat test",
|
"test": "hardhat test",
|
||||||
"deploy:robinhood-testnet": "hardhat run scripts/deploy.js --network robinhoodTestnet",
|
"deploy:robinhood-testnet": "python _prepare_compile.py && hardhat run scripts/deploy.js --network robinhoodTestnet",
|
||||||
"deploy:robinhood-mainnet": "hardhat run scripts/deploy.js --network robinhoodMainnet",
|
"deploy:robinhood-mainnet": "python _prepare_compile.py && hardhat run scripts/deploy.js --network robinhoodMainnet",
|
||||||
"deploy:local": "hardhat run scripts/deploy.js --network localhost"
|
"deploy:local": "python _prepare_compile.py && hardhat run scripts/deploy.js --network localhost"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@nomicfoundation/hardhat-toolbox": "^5.0.0",
|
"@nomicfoundation/hardhat-toolbox": "^5.0.0",
|
||||||
"dotenv": "^16.4.5",
|
"dotenv": "^16.4.5",
|
||||||
"hardhat": "^2.22.5"
|
"hardhat": "^2.22.5"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"@openzeppelin/contracts": "5.0.2",
|
||||||
|
"@openzeppelin/contracts-upgradeable": "5.0.2",
|
||||||
|
"solady": "0.0.219"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user