Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[submodule "packages/core/lib/forge-std"]
path = packages/core/lib/forge-std
url = https://github.com/foundry-rs/forge-std
[submodule "packages/core/lib/hyper-evm-lib"]
path = packages/core/lib/hyper-evm-lib
url = https://github.com/hyperliquid-dev/hyper-evm-lib
[submodule "packages/core/lib/boring-vault"]
path = packages/core/lib/boring-vault
url = https://github.com/Se7en-Seas/boring-vault
5 changes: 2 additions & 3 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# docs
dist
build
.vercel

# web
.next
packages/core/lib
14 changes: 13 additions & 1 deletion .prettierrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,19 @@ module.exports = {
trailingComma: 'all',
semi: true,

// @trivago/prettier-plugin-sort-imports
plugins: [
'prettier-plugin-solidity',
'@trivago/prettier-plugin-sort-imports',
],

overrides: [
{
files: '*.sol',
options: {
tabWidth: 4,
},
},
],
importOrder: ['<THIRD_PARTY_MODULES>', '@/(.*)$', '^[./](.*)$'],
importOrderSeparation: true,
importOrderSortSpecifiers: true,
Expand Down
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,8 @@
},
"[jsonc]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[solidity]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
}
}
6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,15 @@
"private": true,
"version": "1.0.0",
"repository": "https://github.com/0xinevitable/crest",
"scripts": {
"format": "prettier --write **/*"
},
"workspaces": [
"packages/*"
],
"devDependencies": {
"@trivago/prettier-plugin-sort-imports": "^5.2.2",
"prettier": "^3.6.2"
"prettier": "^3.6.2",
"prettier-plugin-solidity": "^2.1.0"
}
}
14 changes: 14 additions & 0 deletions packages/core/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Compiler files
cache/
out/

# Ignores development broadcast logs
!/broadcast
/broadcast/*/31337/
/broadcast/**/dry-run/

# Docs
docs/

# Dotenv file
.env
1 change: 1 addition & 0 deletions packages/core/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
##
9 changes: 9 additions & 0 deletions packages/core/foundry.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[profile.default]
src = "src"
out = "out"
libs = ["lib"]
solc_version = "0.8.28"
test = "test"
script = "script"

# See more config options https://github.com/foundry-rs/foundry/blob/master/crates/config/README.md#all-options
1 change: 1 addition & 0 deletions packages/core/lib/boring-vault
Submodule boring-vault added at 0e23e7
1 change: 1 addition & 0 deletions packages/core/lib/forge-std
Submodule forge-std added at 8bbcf6
1 change: 1 addition & 0 deletions packages/core/lib/hyper-evm-lib
Submodule hyper-evm-lib added at 518baa
13 changes: 13 additions & 0 deletions packages/core/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"name": "@crest/core",
"version": "1.0.0",
"license": "MIT",
"scripts": {
"start": "tsx typescript/fetch-index.ts"
},
"devDependencies": {
"@types/node": "^24.5.1",
"tsx": "^4.20.5",
"typescript": "^5.9.2"
}
}
6 changes: 6 additions & 0 deletions packages/core/remappings.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
@hyper-evm-lib/=lib/hyper-evm-lib/
@boring-vault/=lib/boring-vault/
@solmate/=lib/boring-vault/lib/solmate/src/
@openzeppelin-v4/=lib/boring-vault/lib/openzeppelin-contracts/
@openzeppelin/=lib/hyper-evm-lib/lib/openzeppelin-contracts/
forge-std/=lib/forge-std/src/
19 changes: 19 additions & 0 deletions packages/core/script/Counter.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.13;

import { Script, console } from 'forge-std/Script.sol';
import { Counter } from '../src/Counter.sol';

contract CounterScript is Script {
Counter public counter;

function setUp() public {}

function run() public {
vm.startBroadcast();

counter = new Counter();

vm.stopBroadcast();
}
}
81 changes: 81 additions & 0 deletions packages/core/script/DeployCrestVault.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.21;

import { Script, console } from 'forge-std/Script.sol';
import { CrestVault } from '../src/CrestVault.sol';
import { CrestTeller } from '../src/CrestTeller.sol';
import { CrestAccountant } from '../src/CrestAccountant.sol';
import { CrestManager } from '../src/CrestManager.sol';

contract DeployCrestVault is Script {
// Hyperliquid USDC address
address constant USDC = 0xd825E39c8F28401f36eBe4DF59A8B92a8A1A0b93;

function run() external {
uint256 deployerPrivateKey = vm.envUint('PRIVATE_KEY');
address deployer = vm.addr(deployerPrivateKey);
address curator = vm.envAddress('CURATOR_ADDRESS');
address feeRecipient = vm.envAddress('FEE_RECIPIENT_ADDRESS');

console.log('Deploying CrestVault with:');
console.log(' Deployer:', deployer);
console.log(' Curator:', curator);
console.log(' Fee Recipient:', feeRecipient);
console.log(' USDC:', USDC);

vm.startBroadcast(deployerPrivateKey);

// Deploy vault
CrestVault vault = new CrestVault(deployer, 'Crest Vault', 'CREST');
console.log('Vault deployed at:', payable(address(vault)));

// Deploy accountant
CrestAccountant accountant = new CrestAccountant(
payable(address(vault)),
deployer,
feeRecipient
);
console.log('Accountant deployed at:', address(accountant));

// Deploy teller
CrestTeller teller = new CrestTeller(
payable(address(vault)),
USDC,
deployer
);
console.log('Teller deployed at:', address(teller));

// Deploy manager
CrestManager manager = new CrestManager(
payable(address(vault)),
USDC,
deployer,
curator
);
console.log('Manager deployed at:', address(manager));

// Configure teller
teller.setAccountant(address(accountant));
console.log('Accountant set in Teller');

// Setup vault permissions
vault.authorize(address(teller));
vault.authorize(address(manager));
vault.authorize(address(accountant));
console.log('Vault permissions configured');

vm.stopBroadcast();

console.log('\nDeployment complete!');
console.log('========================');
console.log('Vault:', payable(address(vault)));
console.log('Teller:', address(teller));
console.log('Accountant:', address(accountant));
console.log('Manager:', address(manager));
console.log('========================');
console.log('\nNext steps:');
console.log('1. Verify contracts on explorer');
console.log('2. Test deposit/withdraw functionality');
console.log('3. Configure initial allocation parameters');
}
}
14 changes: 14 additions & 0 deletions packages/core/src/Counter.sol
Original file line number Diff line number Diff line change
@@ -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++;
}
}
Loading