Skip to content
Open

V1.1 #91

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
23ddc6b
feat: add vault with delegations & recompose vault structure - wip
1kresh Feb 13, 2025
2d36736
chore: out files
1kresh Feb 13, 2025
0b9c229
feat: allow increase epoch duration
1kresh Feb 13, 2025
955f392
feat: first txn whitelisting
1kresh Feb 13, 2025
6b945af
feat: add flashloan
1kresh Feb 14, 2025
5f7de07
feat: add interfaces & tests
1kresh Feb 17, 2025
53c430d
fix: adjust migrations & encodeWithSelector -> encodeCall & v1.1.0 ->…
1kresh Feb 17, 2025
90677dd
chore: migration tests & votes fix
1kresh Feb 18, 2025
12dc2dc
fix: adjust migrations
1kresh Feb 18, 2025
3c79587
docs: add descriptions
1kresh Feb 18, 2025
d9ba6e7
feat: make epoch's increase auto-commit
1kresh Feb 18, 2025
a7b63b1
docs: add missing description
1kresh Feb 18, 2025
1f1e8ab
test: more coverage
1kresh Feb 23, 2025
4c06bed
refactor: simplify constructors
1kresh Feb 23, 2025
7a00ce5
feat: allow epoch duration set delay change
1kresh Feb 23, 2025
2bcd165
chore: sync out files
1kresh Feb 23, 2025
2c315c5
refactor: name error
1kresh Feb 24, 2025
2c6f46b
chore: sync out
1kresh Feb 24, 2025
22d32c7
fix: add exit window for small current epoch durations
1kresh Feb 24, 2025
608fa54
fix: adjust setEpochDuration
1kresh Feb 24, 2025
762081c
refactor: rename epoch vars
1kresh Feb 24, 2025
cf61075
fix: nullify fee when no receiver
1kresh Feb 24, 2025
9d2999a
Merge pull request #92 from symbioticfi/epochs-inc-auto
1kresh Feb 24, 2025
5c75584
refactor: reduce one delegate call step
1kresh Feb 24, 2025
6231135
feat: enable flashloan flag
1kresh Feb 25, 2025
3827590
refactor: flashloan -> flashLoan
1kresh Feb 25, 2025
7358a93
Merge pull request #93 from symbioticfi/reduce-delegate-calls
1kresh Feb 25, 2025
62d1a66
Merge branch 'v1.1.0' into flashloan-flag
1kresh Feb 25, 2025
16ed27d
Merge pull request #94 from symbioticfi/flashloan-flag
1kresh Feb 25, 2025
0868cc5
chore: add new vault version - wip
1kresh Feb 25, 2025
2b6244b
fix: possible reinitialization
1kresh Feb 25, 2025
6e1841f
chore: fix tests
1kresh Feb 25, 2025
e42a99c
chore: more tests
1kresh Feb 25, 2025
14e9c72
Merge pull request #95 from symbioticfi/new-version
1kresh Feb 25, 2025
9032060
fix: certora - FlashFee is rounding down
1kresh Feb 26, 2025
1b83769
fix: certora - The declaration of _Vault_init() in VaultImplementatio…
1kresh Feb 26, 2025
c1223a0
chore: add v1.1 deploy and migrate scripts
1kresh Feb 27, 2025
1644ecf
refactor: minor changes
1kresh Feb 27, 2025
b1c330f
Merge pull request #98 from symbioticfi/minors
1kresh Feb 27, 2025
e1d5e01
Merge branch 'v1.1.0' into certora-fixes
1kresh Feb 27, 2025
854744c
Merge branch 'certora-fixes' into v1.1-script
1kresh Feb 27, 2025
85fb759
Merge pull request #97 from symbioticfi/v1.1-script
1kresh Feb 27, 2025
8f0b940
chore: adjust script name
1kresh Feb 28, 2025
baa6d9a
docs: chainsecurity - Reliance on Epoch Details
1kresh Mar 3, 2025
84831c2
fix: chainsecurity - Reentrancy Guard Unused for Tokenized Vaults
1kresh Mar 3, 2025
fa91499
fix: chainsecurity - Incomplete Check
1kresh Mar 3, 2025
30c3daa
fix: chainsecurity - Flashloan Enabler Role Not Granted on Initializa…
1kresh Mar 3, 2025
c0089c6
partial fix: chainsecurity - Flashloan Parameter Checks
1kresh Mar 3, 2025
8963efd
fix: allow for donations in flash loans
1kresh Mar 6, 2025
c632876
test: cover fee-on-transfer flash loans
1kresh Mar 6, 2025
8109878
Merge pull request #99 from symbioticfi/certora-fixes3
1kresh Mar 6, 2025
57cd33f
Merge branch 'v1.1.0' into chainsecurity-fixes
1kresh Mar 6, 2025
7157483
partial fix: chainsecurity - EIP-3156 Violations
1kresh Mar 6, 2025
f0131f3
refactor: public -> internal for epoch duration variables
1kresh Mar 18, 2025
85def45
refactor: public -> internal for epoch duration variables
1kresh Mar 18, 2025
215ffee
test: add details
1kresh Mar 18, 2025
ed39ff4
Merge pull request #100 from symbioticfi/chainsecurity-fixes
1kresh Mar 24, 2025
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
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
# Compiler files
cache/
out/**/
!out/VaultImplementation.sol/
!out/VaultTokenizedImplementation.sol/
!out/VaultVotesImplementation.sol/
!out/v1.1/
!out/v1.1/Vault.sol/
!out/v1.1/VaultTokenized.sol/
!out/VaultVotes.sol/
!out/Vault.sol/
!out/VaultTokenized.sol/
!out/NetworkRestakeDelegator.sol/
Expand Down
2 changes: 1 addition & 1 deletion lib/openzeppelin-contracts
2 changes: 1 addition & 1 deletion lib/openzeppelin-contracts-upgradeable
2 changes: 1 addition & 1 deletion out/DelegatorFactory.sol/DelegatorFactory.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion out/DelegatorHints.sol/BaseDelegatorHints.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion out/DelegatorHints.sol/FullRestakeDelegatorHints.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion out/DelegatorHints.sol/NetworkRestakeDelegatorHints.json

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion out/FullRestakeDelegator.sol/FullRestakeDelegator.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion out/MetadataService.sol/MetadataService.json

Large diffs are not rendered by default.

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion out/NetworkRegistry.sol/NetworkRegistry.json

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion out/OperatorRegistry.sol/OperatorRegistry.json

Large diffs are not rendered by default.

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion out/OptInService.sol/OptInService.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion out/OptInServiceHints.sol/OptInServiceHints.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion out/Slasher.sol/Slasher.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion out/SlasherFactory.sol/SlasherFactory.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion out/SlasherHints.sol/BaseSlasherHints.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion out/SlasherHints.sol/SlasherHints.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion out/SlasherHints.sol/VetoSlasherHints.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion out/Vault.sol/Vault.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion out/VaultConfigurator.sol/VaultConfigurator.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion out/VaultFactory.sol/VaultFactory.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion out/VaultHints.sol/VaultHints.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions out/VaultImplementation.sol/VaultImplementation.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion out/VaultTokenized.sol/VaultTokenized.json

Large diffs are not rendered by default.

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions out/VaultVotes.sol/VaultVotes.json

Large diffs are not rendered by default.

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion out/VetoSlasher.sol/VetoSlasher.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions out/v1.1/Vault.sol/Vault.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions out/v1.1/VaultTokenized.sol/VaultTokenized.json

Large diffs are not rendered by default.

20 changes: 11 additions & 9 deletions script/deploy/Vault.s.sol
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.25;

import {Script, console2} from "forge-std/Script.sol";
import {console2} from "forge-std/Script.sol";

import {SymbioticCoreInit} from "../integration/SymbioticCoreInit.sol";

import {Vault} from "../../src/contracts/vault/Vault.sol";

import {IMigratablesFactory} from "../../src/interfaces/common/IMigratablesFactory.sol";
import {IVault} from "../../src/interfaces/vault/IVault.sol";
import {IVaultConfigurator} from "../../src/interfaces/IVaultConfigurator.sol";
import {IBaseDelegator} from "../../src/interfaces/delegator/IBaseDelegator.sol";
Expand All @@ -17,14 +18,13 @@ import {IBaseSlasher} from "../../src/interfaces/slasher/IBaseSlasher.sol";
import {ISlasher} from "../../src/interfaces/slasher/ISlasher.sol";
import {IVetoSlasher} from "../../src/interfaces/slasher/IVetoSlasher.sol";

contract VaultScript is Script {
contract VaultScript is SymbioticCoreInit {
function run(
address vaultConfigurator,
address owner,
address collateral,
address burner,
uint48 epochDuration,
address[] calldata whitelistedDepositors,
address[] calldata depositorsWhitelisted,
uint256 depositLimit,
uint64 delegatorIndex,
address hook,
Expand All @@ -33,10 +33,12 @@ contract VaultScript is Script {
uint64 slasherIndex,
uint48 vetoDuration
) public {
SymbioticCoreInit.run(0);

vm.startBroadcast();
(,, address deployer) = vm.readCallers();

bool depositWhitelist = whitelistedDepositors.length != 0;
bool depositWhitelist = depositorsWhitelisted.length != 0;

bytes memory vaultParams = abi.encode(
IVault.InitParams({
Expand Down Expand Up @@ -136,7 +138,7 @@ contract VaultScript is Script {
);
}

(address vault_, address delegator_, address slasher_) = IVaultConfigurator(vaultConfigurator).create(
(address vault_, address delegator_, address slasher_) = symbioticCore.vaultConfigurator.create(
IVaultConfigurator.InitParams({
version: 1,
owner: owner,
Expand All @@ -153,8 +155,8 @@ contract VaultScript is Script {
Vault(vault_).grantRole(Vault(vault_).DEFAULT_ADMIN_ROLE(), owner);
Vault(vault_).grantRole(Vault(vault_).DEPOSITOR_WHITELIST_ROLE(), deployer);

for (uint256 i; i < whitelistedDepositors.length; ++i) {
Vault(vault_).setDepositorWhitelistStatus(whitelistedDepositors[i], true);
for (uint256 i; i < depositorsWhitelisted.length; ++i) {
Vault(vault_).setDepositorWhitelistStatus(depositorsWhitelisted[i], true);
}

Vault(vault_).renounceRole(Vault(vault_).DEPOSITOR_WHITELIST_ROLE(), deployer);
Expand Down
20 changes: 11 additions & 9 deletions script/deploy/VaultTokenized.s.sol
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.25;

import {Script, console2} from "forge-std/Script.sol";
import {console2} from "forge-std/Script.sol";

import {SymbioticCoreInit} from "../integration/SymbioticCoreInit.sol";

import {Vault} from "../../src/contracts/vault/Vault.sol";

import {IMigratablesFactory} from "../../src/interfaces/common/IMigratablesFactory.sol";
import {IVault} from "../../src/interfaces/vault/IVault.sol";
import {IVaultTokenized} from "../../src/interfaces/vault/IVaultTokenized.sol";
import {IVaultConfigurator} from "../../src/interfaces/IVaultConfigurator.sol";
Expand All @@ -18,14 +19,13 @@ import {IBaseSlasher} from "../../src/interfaces/slasher/IBaseSlasher.sol";
import {ISlasher} from "../../src/interfaces/slasher/ISlasher.sol";
import {IVetoSlasher} from "../../src/interfaces/slasher/IVetoSlasher.sol";

contract VaultTokenizedScript is Script {
contract VaultTokenizedScript is SymbioticCoreInit {
function run(
address vaultConfigurator,
address owner,
address collateral,
address burner,
uint48 epochDuration,
address[] calldata whitelistedDepositors,
address[] calldata depositorsWhitelisted,
uint256 depositLimit,
string calldata name,
string calldata symbol,
Expand All @@ -36,10 +36,12 @@ contract VaultTokenizedScript is Script {
uint64 slasherIndex,
uint48 vetoDuration
) public {
SymbioticCoreInit.run(0);

vm.startBroadcast();
(,, address deployer) = vm.readCallers();

bool depositWhitelist = whitelistedDepositors.length != 0;
bool depositWhitelist = depositorsWhitelisted.length != 0;

bytes memory vaultParams = abi.encode(
IVaultTokenized.InitParamsTokenized({
Expand Down Expand Up @@ -143,7 +145,7 @@ contract VaultTokenizedScript is Script {
);
}

(address vault_, address delegator_, address slasher_) = IVaultConfigurator(vaultConfigurator).create(
(address vault_, address delegator_, address slasher_) = symbioticCore.vaultConfigurator.create(
IVaultConfigurator.InitParams({
version: 2,
owner: owner,
Expand All @@ -160,8 +162,8 @@ contract VaultTokenizedScript is Script {
Vault(vault_).grantRole(Vault(vault_).DEFAULT_ADMIN_ROLE(), owner);
Vault(vault_).grantRole(Vault(vault_).DEPOSITOR_WHITELIST_ROLE(), deployer);

for (uint256 i; i < whitelistedDepositors.length; ++i) {
Vault(vault_).setDepositorWhitelistStatus(whitelistedDepositors[i], true);
for (uint256 i; i < depositorsWhitelisted.length; ++i) {
Vault(vault_).setDepositorWhitelistStatus(depositorsWhitelisted[i], true);
}

Vault(vault_).renounceRole(Vault(vault_).DEPOSITOR_WHITELIST_ROLE(), deployer);
Expand Down
38 changes: 19 additions & 19 deletions script/deploy/Core.s.sol → script/deploy/genesis/Core.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,25 @@ pragma solidity 0.8.25;

import {Script, console2} from "forge-std/Script.sol";

import {VaultFactory} from "../../src/contracts/VaultFactory.sol";
import {DelegatorFactory} from "../../src/contracts/DelegatorFactory.sol";
import {SlasherFactory} from "../../src/contracts/SlasherFactory.sol";
import {NetworkRegistry} from "../../src/contracts/NetworkRegistry.sol";
import {OperatorRegistry} from "../../src/contracts/OperatorRegistry.sol";
import {MetadataService} from "../../src/contracts/service/MetadataService.sol";
import {NetworkMiddlewareService} from "../../src/contracts/service/NetworkMiddlewareService.sol";
import {OptInService} from "../../src/contracts/service/OptInService.sol";

import {Vault} from "../../src/contracts/vault/Vault.sol";
import {VaultTokenized} from "../../src/contracts/vault/VaultTokenized.sol";
import {NetworkRestakeDelegator} from "../../src/contracts/delegator/NetworkRestakeDelegator.sol";
import {FullRestakeDelegator} from "../../src/contracts/delegator/FullRestakeDelegator.sol";
import {OperatorSpecificDelegator} from "../../src/contracts/delegator/OperatorSpecificDelegator.sol";
import {OperatorNetworkSpecificDelegator} from "../../src/contracts/delegator/OperatorNetworkSpecificDelegator.sol";
import {Slasher} from "../../src/contracts/slasher/Slasher.sol";
import {VetoSlasher} from "../../src/contracts/slasher/VetoSlasher.sol";

import {VaultConfigurator} from "../../src/contracts/VaultConfigurator.sol";
import {VaultFactory} from "../../../src/contracts/VaultFactory.sol";
import {DelegatorFactory} from "../../../src/contracts/DelegatorFactory.sol";
import {SlasherFactory} from "../../../src/contracts/SlasherFactory.sol";
import {NetworkRegistry} from "../../../src/contracts/NetworkRegistry.sol";
import {OperatorRegistry} from "../../../src/contracts/OperatorRegistry.sol";
import {MetadataService} from "../../../src/contracts/service/MetadataService.sol";
import {NetworkMiddlewareService} from "../../../src/contracts/service/NetworkMiddlewareService.sol";
import {OptInService} from "../../../src/contracts/service/OptInService.sol";

import {Vault} from "../../../src/contracts/vault/Vault.sol";
import {VaultTokenized} from "../../../src/contracts/vault/VaultTokenized.sol";
import {NetworkRestakeDelegator} from "../../../src/contracts/delegator/NetworkRestakeDelegator.sol";
import {FullRestakeDelegator} from "../../../src/contracts/delegator/FullRestakeDelegator.sol";
import {OperatorSpecificDelegator} from "../../../src/contracts/delegator/OperatorSpecificDelegator.sol";
import {OperatorNetworkSpecificDelegator} from "../../../src/contracts/delegator/OperatorNetworkSpecificDelegator.sol";
import {Slasher} from "../../../src/contracts/slasher/Slasher.sol";
import {VetoSlasher} from "../../../src/contracts/slasher/VetoSlasher.sol";

import {VaultConfigurator} from "../../../src/contracts/VaultConfigurator.sol";

contract CoreScript is Script {
function run(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ pragma solidity 0.8.25;

import "forge-std/Script.sol";

import {MetadataService} from "../../src/contracts/service/MetadataService.sol";
import {MetadataService} from "../../../src/contracts/service/MetadataService.sol";

contract MetadataServiceScript is Script {
function run(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ pragma solidity 0.8.25;

import "forge-std/Script.sol";

import {NetworkMiddlewareService} from "../../src/contracts/service/NetworkMiddlewareService.sol";
import {NetworkMiddlewareService} from "../../../src/contracts/service/NetworkMiddlewareService.sol";

contract NetworkMiddlewareServiceScript is Script {
function run(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ pragma solidity 0.8.25;

import "forge-std/Script.sol";

import {NetworkRegistry} from "../../src/contracts/NetworkRegistry.sol";
import {NetworkRegistry} from "../../../src/contracts/NetworkRegistry.sol";

contract NetworkRegistryScript is Script {
function run() public {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ pragma solidity 0.8.25;

import "forge-std/Script.sol";

import {OperatorRegistry} from "../../src/contracts/OperatorRegistry.sol";
import {OperatorRegistry} from "../../../src/contracts/OperatorRegistry.sol";

contract OperatorRegistryScript is Script {
function run() public {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ pragma solidity 0.8.25;

import "forge-std/Script.sol";

import {OptInService} from "../../src/contracts/service/OptInService.sol";
import {OptInService} from "../../../src/contracts/service/OptInService.sol";

contract OptInServiceScript is Script {
function run(address whoRegistry, address whereRegistry, string calldata name) public {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ pragma solidity 0.8.25;

import "forge-std/Script.sol";

import {VaultFactory} from "../../src/contracts/VaultFactory.sol";
import {VaultFactory} from "../../../src/contracts/VaultFactory.sol";

contract VaultFactoryScript is Script {
function run(
Expand Down
43 changes: 43 additions & 0 deletions script/deploy/genesis/v1.1/Vaults.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.25;

import {Script, console2} from "forge-std/Script.sol";

import {SymbioticCoreInit} from "../../../integration/SymbioticCoreInit.sol";

import {Vault} from "../../../../src/contracts/vault/v1.1/Vault.sol";
import {VaultTokenized} from "../../../../src/contracts/vault/v1.1/VaultTokenized.sol";
import {VaultVotes} from "../../../../src/contracts/vault/v1.1/VaultVotes.sol";
import {VaultImplementation} from "../../../../src/contracts/vault/v1.1/VaultImplementation.sol";
import {VaultTokenizedImplementation} from "../../../../src/contracts/vault/v1.1/VaultTokenizedImplementation.sol";
import {VaultVotesImplementation} from "../../../../src/contracts/vault/v1.1/VaultVotesImplementation.sol";

contract VaultsScript is SymbioticCoreInit {
function run() public {
SymbioticCoreInit.run(0);

vm.startBroadcast();

address vaultImplementation = address(
new VaultImplementation(address(symbioticCore.delegatorFactory), address(symbioticCore.slasherFactory))
);
address vaultImpl = address(new Vault(address(symbioticCore.vaultFactory), vaultImplementation));

address vaultTokenizedImplementation = address(new VaultTokenizedImplementation(vaultImplementation));
address vaultTokenizedImpl =
address(new VaultTokenized(address(symbioticCore.vaultFactory), vaultTokenizedImplementation));

address vaultVotesImplementation = address(new VaultVotesImplementation(vaultImplementation));
address vaultVotesImpl = address(new VaultVotes(address(symbioticCore.vaultFactory), vaultVotesImplementation));

console2.log("Vault: ", address(vaultImpl));
console2.log("VaultTokenized: ", address(vaultTokenizedImpl));
console2.log("VaultVotes: ", address(vaultVotesImpl));
console2.log();
console2.log("VaultImplementation: ", address(vaultImplementation));
console2.log("VaultTokenizedImplementation: ", address(vaultTokenizedImplementation));
console2.log("VaultVotesImplementation: ", address(vaultVotesImplementation));

vm.stopBroadcast();
}
}
Loading
Loading